github.com/nicocha30/gvisor-ligolo@v0.0.0-20250509122847-3be646365354/pkg/abi/linux/linux_abi_autogen_unsafe.go (about) 1 // Automatically generated marshal implementation. See tools/go_marshal. 2 3 package linux 4 5 import ( 6 "github.com/nicocha30/gvisor-ligolo/pkg/gohacks" 7 "github.com/nicocha30/gvisor-ligolo/pkg/hostarch" 8 "github.com/nicocha30/gvisor-ligolo/pkg/marshal" 9 "io" 10 "reflect" 11 "runtime" 12 "unsafe" 13 ) 14 15 // Marshallable types used by this file. 16 var _ marshal.Marshallable = (*BPFInstruction)(nil) 17 var _ marshal.Marshallable = (*CString)(nil) 18 var _ marshal.Marshallable = (*CapUserData)(nil) 19 var _ marshal.Marshallable = (*CapUserHeader)(nil) 20 var _ marshal.Marshallable = (*ClockT)(nil) 21 var _ marshal.Marshallable = (*ControlMessageCredentials)(nil) 22 var _ marshal.Marshallable = (*ControlMessageHeader)(nil) 23 var _ marshal.Marshallable = (*ControlMessageIPPacketInfo)(nil) 24 var _ marshal.Marshallable = (*ControlMessageIPv6PacketInfo)(nil) 25 var _ marshal.Marshallable = (*ElfHeader64)(nil) 26 var _ marshal.Marshallable = (*ElfProg64)(nil) 27 var _ marshal.Marshallable = (*ElfSection64)(nil) 28 var _ marshal.Marshallable = (*ErrorName)(nil) 29 var _ marshal.Marshallable = (*EthtoolCmd)(nil) 30 var _ marshal.Marshallable = (*EthtoolGFeatures)(nil) 31 var _ marshal.Marshallable = (*EthtoolGetFeaturesBlock)(nil) 32 var _ marshal.Marshallable = (*ExtensionName)(nil) 33 var _ marshal.Marshallable = (*FOwnerEx)(nil) 34 var _ marshal.Marshallable = (*FUSEAccessIn)(nil) 35 var _ marshal.Marshallable = (*FUSEAttr)(nil) 36 var _ marshal.Marshallable = (*FUSEAttrOut)(nil) 37 var _ marshal.Marshallable = (*FUSECreateIn)(nil) 38 var _ marshal.Marshallable = (*FUSECreateMeta)(nil) 39 var _ marshal.Marshallable = (*FUSECreateOut)(nil) 40 var _ marshal.Marshallable = (*FUSEDirent)(nil) 41 var _ marshal.Marshallable = (*FUSEDirentMeta)(nil) 42 var _ marshal.Marshallable = (*FUSEDirents)(nil) 43 var _ marshal.Marshallable = (*FUSEEmptyIn)(nil) 44 var _ marshal.Marshallable = (*FUSEEntryOut)(nil) 45 var _ marshal.Marshallable = (*FUSEFallocateIn)(nil) 46 var _ marshal.Marshallable = (*FUSEFsyncIn)(nil) 47 var _ marshal.Marshallable = (*FUSEGetAttrIn)(nil) 48 var _ marshal.Marshallable = (*FUSEHeaderIn)(nil) 49 var _ marshal.Marshallable = (*FUSEHeaderOut)(nil) 50 var _ marshal.Marshallable = (*FUSEInitIn)(nil) 51 var _ marshal.Marshallable = (*FUSEInitOut)(nil) 52 var _ marshal.Marshallable = (*FUSELinkIn)(nil) 53 var _ marshal.Marshallable = (*FUSELookupIn)(nil) 54 var _ marshal.Marshallable = (*FUSEMkdirIn)(nil) 55 var _ marshal.Marshallable = (*FUSEMkdirMeta)(nil) 56 var _ marshal.Marshallable = (*FUSEMknodIn)(nil) 57 var _ marshal.Marshallable = (*FUSEMknodMeta)(nil) 58 var _ marshal.Marshallable = (*FUSEOpID)(nil) 59 var _ marshal.Marshallable = (*FUSEOpcode)(nil) 60 var _ marshal.Marshallable = (*FUSEOpenIn)(nil) 61 var _ marshal.Marshallable = (*FUSEOpenOut)(nil) 62 var _ marshal.Marshallable = (*FUSEReadIn)(nil) 63 var _ marshal.Marshallable = (*FUSEReleaseIn)(nil) 64 var _ marshal.Marshallable = (*FUSERenameIn)(nil) 65 var _ marshal.Marshallable = (*FUSERmDirIn)(nil) 66 var _ marshal.Marshallable = (*FUSESetAttrIn)(nil) 67 var _ marshal.Marshallable = (*FUSEStatfsOut)(nil) 68 var _ marshal.Marshallable = (*FUSESymlinkIn)(nil) 69 var _ marshal.Marshallable = (*FUSEUnlinkIn)(nil) 70 var _ marshal.Marshallable = (*FUSEWriteIn)(nil) 71 var _ marshal.Marshallable = (*FUSEWriteOut)(nil) 72 var _ marshal.Marshallable = (*FUSEWritePayloadIn)(nil) 73 var _ marshal.Marshallable = (*FileMode)(nil) 74 var _ marshal.Marshallable = (*Flock)(nil) 75 var _ marshal.Marshallable = (*ICMP6Filter)(nil) 76 var _ marshal.Marshallable = (*IFConf)(nil) 77 var _ marshal.Marshallable = (*IFReq)(nil) 78 var _ marshal.Marshallable = (*IOCallback)(nil) 79 var _ marshal.Marshallable = (*IOCqRingOffsets)(nil) 80 var _ marshal.Marshallable = (*IOEvent)(nil) 81 var _ marshal.Marshallable = (*IORingIndex)(nil) 82 var _ marshal.Marshallable = (*IORings)(nil) 83 var _ marshal.Marshallable = (*IOSqRingOffsets)(nil) 84 var _ marshal.Marshallable = (*IOUring)(nil) 85 var _ marshal.Marshallable = (*IOUringCqe)(nil) 86 var _ marshal.Marshallable = (*IOUringParams)(nil) 87 var _ marshal.Marshallable = (*IOUringSqe)(nil) 88 var _ marshal.Marshallable = (*IP6TEntry)(nil) 89 var _ marshal.Marshallable = (*IP6TIP)(nil) 90 var _ marshal.Marshallable = (*IP6TReplace)(nil) 91 var _ marshal.Marshallable = (*IPCPerm)(nil) 92 var _ marshal.Marshallable = (*IPTEntry)(nil) 93 var _ marshal.Marshallable = (*IPTGetEntries)(nil) 94 var _ marshal.Marshallable = (*IPTGetinfo)(nil) 95 var _ marshal.Marshallable = (*IPTIP)(nil) 96 var _ marshal.Marshallable = (*IPTOwnerInfo)(nil) 97 var _ marshal.Marshallable = (*IPTReplace)(nil) 98 var _ marshal.Marshallable = (*Inet6Addr)(nil) 99 var _ marshal.Marshallable = (*Inet6MulticastRequest)(nil) 100 var _ marshal.Marshallable = (*InetAddr)(nil) 101 var _ marshal.Marshallable = (*InetMulticastRequest)(nil) 102 var _ marshal.Marshallable = (*InetMulticastRequestWithNIC)(nil) 103 var _ marshal.Marshallable = (*InterfaceAddrMessage)(nil) 104 var _ marshal.Marshallable = (*InterfaceInfoMessage)(nil) 105 var _ marshal.Marshallable = (*ItimerVal)(nil) 106 var _ marshal.Marshallable = (*Itimerspec)(nil) 107 var _ marshal.Marshallable = (*KernelIP6TEntry)(nil) 108 var _ marshal.Marshallable = (*KernelIP6TGetEntries)(nil) 109 var _ marshal.Marshallable = (*KernelIPTEntry)(nil) 110 var _ marshal.Marshallable = (*KernelIPTGetEntries)(nil) 111 var _ marshal.Marshallable = (*Linger)(nil) 112 var _ marshal.Marshallable = (*MqAttr)(nil) 113 var _ marshal.Marshallable = (*MsgBuf)(nil) 114 var _ marshal.Marshallable = (*MsgInfo)(nil) 115 var _ marshal.Marshallable = (*MsqidDS)(nil) 116 var _ marshal.Marshallable = (*NFNATRange)(nil) 117 var _ marshal.Marshallable = (*NetlinkAttrHeader)(nil) 118 var _ marshal.Marshallable = (*NetlinkErrorMessage)(nil) 119 var _ marshal.Marshallable = (*NetlinkMessageHeader)(nil) 120 var _ marshal.Marshallable = (*NfNATIPV4MultiRangeCompat)(nil) 121 var _ marshal.Marshallable = (*NfNATIPV4Range)(nil) 122 var _ marshal.Marshallable = (*NumaPolicy)(nil) 123 var _ marshal.Marshallable = (*PollFD)(nil) 124 var _ marshal.Marshallable = (*RSeqCriticalSection)(nil) 125 var _ marshal.Marshallable = (*RobustListHead)(nil) 126 var _ marshal.Marshallable = (*RouteMessage)(nil) 127 var _ marshal.Marshallable = (*RtAttr)(nil) 128 var _ marshal.Marshallable = (*Rusage)(nil) 129 var _ marshal.Marshallable = (*SeccompData)(nil) 130 var _ marshal.Marshallable = (*SemInfo)(nil) 131 var _ marshal.Marshallable = (*Sembuf)(nil) 132 var _ marshal.Marshallable = (*ShmInfo)(nil) 133 var _ marshal.Marshallable = (*ShmParams)(nil) 134 var _ marshal.Marshallable = (*ShmidDS)(nil) 135 var _ marshal.Marshallable = (*SigAction)(nil) 136 var _ marshal.Marshallable = (*Sigevent)(nil) 137 var _ marshal.Marshallable = (*SignalInfo)(nil) 138 var _ marshal.Marshallable = (*SignalSet)(nil) 139 var _ marshal.Marshallable = (*SignalStack)(nil) 140 var _ marshal.Marshallable = (*SignalfdSiginfo)(nil) 141 var _ marshal.Marshallable = (*SockAddrInet)(nil) 142 var _ marshal.Marshallable = (*SockAddrInet6)(nil) 143 var _ marshal.Marshallable = (*SockAddrLink)(nil) 144 var _ marshal.Marshallable = (*SockAddrNetlink)(nil) 145 var _ marshal.Marshallable = (*SockAddrUnix)(nil) 146 var _ marshal.Marshallable = (*SockErrCMsgIPv4)(nil) 147 var _ marshal.Marshallable = (*SockErrCMsgIPv6)(nil) 148 var _ marshal.Marshallable = (*SockExtendedErr)(nil) 149 var _ marshal.Marshallable = (*Statfs)(nil) 150 var _ marshal.Marshallable = (*Statx)(nil) 151 var _ marshal.Marshallable = (*StatxTimestamp)(nil) 152 var _ marshal.Marshallable = (*Sysinfo)(nil) 153 var _ marshal.Marshallable = (*TCPInfo)(nil) 154 var _ marshal.Marshallable = (*TableName)(nil) 155 var _ marshal.Marshallable = (*Termios)(nil) 156 var _ marshal.Marshallable = (*TimeT)(nil) 157 var _ marshal.Marshallable = (*TimerID)(nil) 158 var _ marshal.Marshallable = (*Timespec)(nil) 159 var _ marshal.Marshallable = (*Timeval)(nil) 160 var _ marshal.Marshallable = (*Tms)(nil) 161 var _ marshal.Marshallable = (*Utime)(nil) 162 var _ marshal.Marshallable = (*UtsName)(nil) 163 var _ marshal.Marshallable = (*WindowSize)(nil) 164 var _ marshal.Marshallable = (*Winsize)(nil) 165 var _ marshal.Marshallable = (*XTCounters)(nil) 166 var _ marshal.Marshallable = (*XTEntryMatch)(nil) 167 var _ marshal.Marshallable = (*XTEntryTarget)(nil) 168 var _ marshal.Marshallable = (*XTErrorTarget)(nil) 169 var _ marshal.Marshallable = (*XTGetRevision)(nil) 170 var _ marshal.Marshallable = (*XTRedirectTarget)(nil) 171 var _ marshal.Marshallable = (*XTSNATTarget)(nil) 172 var _ marshal.Marshallable = (*XTStandardTarget)(nil) 173 var _ marshal.Marshallable = (*XTTCP)(nil) 174 var _ marshal.Marshallable = (*XTUDP)(nil) 175 176 // SizeBytes implements marshal.Marshallable.SizeBytes. 177 func (i *IOCallback) SizeBytes() int { 178 return 64 179 } 180 181 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 182 func (i *IOCallback) MarshalBytes(dst []byte) []byte { 183 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 184 dst = dst[8:] 185 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 186 dst = dst[4:] 187 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 188 dst = dst[4:] 189 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.OpCode)) 190 dst = dst[2:] 191 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.ReqPrio)) 192 dst = dst[2:] 193 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.FD)) 194 dst = dst[4:] 195 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Buf)) 196 dst = dst[8:] 197 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Bytes)) 198 dst = dst[8:] 199 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Offset)) 200 dst = dst[8:] 201 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Reserved2)) 202 dst = dst[8:] 203 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 204 dst = dst[4:] 205 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ResFD)) 206 dst = dst[4:] 207 return dst 208 } 209 210 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 211 func (i *IOCallback) UnmarshalBytes(src []byte) []byte { 212 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 213 src = src[8:] 214 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 215 src = src[4:] 216 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 217 src = src[4:] 218 i.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 219 src = src[2:] 220 i.ReqPrio = int16(hostarch.ByteOrder.Uint16(src[:2])) 221 src = src[2:] 222 i.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 223 src = src[4:] 224 i.Buf = uint64(hostarch.ByteOrder.Uint64(src[:8])) 225 src = src[8:] 226 i.Bytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 227 src = src[8:] 228 i.Offset = int64(hostarch.ByteOrder.Uint64(src[:8])) 229 src = src[8:] 230 i.Reserved2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 231 src = src[8:] 232 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 233 src = src[4:] 234 i.ResFD = int32(hostarch.ByteOrder.Uint32(src[:4])) 235 src = src[4:] 236 return src 237 } 238 239 // Packed implements marshal.Marshallable.Packed. 240 //go:nosplit 241 func (i *IOCallback) Packed() bool { 242 return true 243 } 244 245 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 246 func (i *IOCallback) MarshalUnsafe(dst []byte) []byte { 247 size := i.SizeBytes() 248 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 249 return dst[size:] 250 } 251 252 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 253 func (i *IOCallback) UnmarshalUnsafe(src []byte) []byte { 254 size := i.SizeBytes() 255 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 256 return src[size:] 257 } 258 259 // CopyOutN implements marshal.Marshallable.CopyOutN. 260 func (i *IOCallback) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 261 // Construct a slice backed by dst's underlying memory. 262 var buf []byte 263 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 264 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 265 hdr.Len = i.SizeBytes() 266 hdr.Cap = i.SizeBytes() 267 268 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 269 // Since we bypassed the compiler's escape analysis, indicate that i 270 // must live until the use above. 271 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 272 return length, err 273 } 274 275 // CopyOut implements marshal.Marshallable.CopyOut. 276 func (i *IOCallback) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 277 return i.CopyOutN(cc, addr, i.SizeBytes()) 278 } 279 280 // CopyIn implements marshal.Marshallable.CopyIn. 281 func (i *IOCallback) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 282 // Construct a slice backed by dst's underlying memory. 283 var buf []byte 284 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 285 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 286 hdr.Len = i.SizeBytes() 287 hdr.Cap = i.SizeBytes() 288 289 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 290 // Since we bypassed the compiler's escape analysis, indicate that i 291 // must live until the use above. 292 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 293 return length, err 294 } 295 296 // WriteTo implements io.WriterTo.WriteTo. 297 func (i *IOCallback) WriteTo(writer io.Writer) (int64, error) { 298 // Construct a slice backed by dst's underlying memory. 299 var buf []byte 300 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 301 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 302 hdr.Len = i.SizeBytes() 303 hdr.Cap = i.SizeBytes() 304 305 length, err := writer.Write(buf) 306 // Since we bypassed the compiler's escape analysis, indicate that i 307 // must live until the use above. 308 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 309 return int64(length), err 310 } 311 312 // SizeBytes implements marshal.Marshallable.SizeBytes. 313 func (i *IOEvent) SizeBytes() int { 314 return 32 315 } 316 317 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 318 func (i *IOEvent) MarshalBytes(dst []byte) []byte { 319 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 320 dst = dst[8:] 321 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Obj)) 322 dst = dst[8:] 323 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result)) 324 dst = dst[8:] 325 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result2)) 326 dst = dst[8:] 327 return dst 328 } 329 330 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 331 func (i *IOEvent) UnmarshalBytes(src []byte) []byte { 332 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 333 src = src[8:] 334 i.Obj = uint64(hostarch.ByteOrder.Uint64(src[:8])) 335 src = src[8:] 336 i.Result = int64(hostarch.ByteOrder.Uint64(src[:8])) 337 src = src[8:] 338 i.Result2 = int64(hostarch.ByteOrder.Uint64(src[:8])) 339 src = src[8:] 340 return src 341 } 342 343 // Packed implements marshal.Marshallable.Packed. 344 //go:nosplit 345 func (i *IOEvent) Packed() bool { 346 return true 347 } 348 349 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 350 func (i *IOEvent) MarshalUnsafe(dst []byte) []byte { 351 size := i.SizeBytes() 352 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 353 return dst[size:] 354 } 355 356 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 357 func (i *IOEvent) UnmarshalUnsafe(src []byte) []byte { 358 size := i.SizeBytes() 359 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 360 return src[size:] 361 } 362 363 // CopyOutN implements marshal.Marshallable.CopyOutN. 364 func (i *IOEvent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 365 // Construct a slice backed by dst's underlying memory. 366 var buf []byte 367 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 368 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 369 hdr.Len = i.SizeBytes() 370 hdr.Cap = i.SizeBytes() 371 372 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 373 // Since we bypassed the compiler's escape analysis, indicate that i 374 // must live until the use above. 375 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 376 return length, err 377 } 378 379 // CopyOut implements marshal.Marshallable.CopyOut. 380 func (i *IOEvent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 381 return i.CopyOutN(cc, addr, i.SizeBytes()) 382 } 383 384 // CopyIn implements marshal.Marshallable.CopyIn. 385 func (i *IOEvent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 386 // Construct a slice backed by dst's underlying memory. 387 var buf []byte 388 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 389 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 390 hdr.Len = i.SizeBytes() 391 hdr.Cap = i.SizeBytes() 392 393 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 394 // Since we bypassed the compiler's escape analysis, indicate that i 395 // must live until the use above. 396 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 397 return length, err 398 } 399 400 // WriteTo implements io.WriterTo.WriteTo. 401 func (i *IOEvent) WriteTo(writer io.Writer) (int64, error) { 402 // Construct a slice backed by dst's underlying memory. 403 var buf []byte 404 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 405 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 406 hdr.Len = i.SizeBytes() 407 hdr.Cap = i.SizeBytes() 408 409 length, err := writer.Write(buf) 410 // Since we bypassed the compiler's escape analysis, indicate that i 411 // must live until the use above. 412 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 413 return int64(length), err 414 } 415 416 // SizeBytes implements marshal.Marshallable.SizeBytes. 417 func (b *BPFInstruction) SizeBytes() int { 418 return 8 419 } 420 421 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 422 func (b *BPFInstruction) MarshalBytes(dst []byte) []byte { 423 hostarch.ByteOrder.PutUint16(dst[:2], uint16(b.OpCode)) 424 dst = dst[2:] 425 dst[0] = byte(b.JumpIfTrue) 426 dst = dst[1:] 427 dst[0] = byte(b.JumpIfFalse) 428 dst = dst[1:] 429 hostarch.ByteOrder.PutUint32(dst[:4], uint32(b.K)) 430 dst = dst[4:] 431 return dst 432 } 433 434 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 435 func (b *BPFInstruction) UnmarshalBytes(src []byte) []byte { 436 b.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 437 src = src[2:] 438 b.JumpIfTrue = uint8(src[0]) 439 src = src[1:] 440 b.JumpIfFalse = uint8(src[0]) 441 src = src[1:] 442 b.K = uint32(hostarch.ByteOrder.Uint32(src[:4])) 443 src = src[4:] 444 return src 445 } 446 447 // Packed implements marshal.Marshallable.Packed. 448 //go:nosplit 449 func (b *BPFInstruction) Packed() bool { 450 return true 451 } 452 453 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 454 func (b *BPFInstruction) MarshalUnsafe(dst []byte) []byte { 455 size := b.SizeBytes() 456 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size)) 457 return dst[size:] 458 } 459 460 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 461 func (b *BPFInstruction) UnmarshalUnsafe(src []byte) []byte { 462 size := b.SizeBytes() 463 gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size)) 464 return src[size:] 465 } 466 467 // CopyOutN implements marshal.Marshallable.CopyOutN. 468 func (b *BPFInstruction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 469 // Construct a slice backed by dst's underlying memory. 470 var buf []byte 471 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 472 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 473 hdr.Len = b.SizeBytes() 474 hdr.Cap = b.SizeBytes() 475 476 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 477 // Since we bypassed the compiler's escape analysis, indicate that b 478 // must live until the use above. 479 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 480 return length, err 481 } 482 483 // CopyOut implements marshal.Marshallable.CopyOut. 484 func (b *BPFInstruction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 485 return b.CopyOutN(cc, addr, b.SizeBytes()) 486 } 487 488 // CopyIn implements marshal.Marshallable.CopyIn. 489 func (b *BPFInstruction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 490 // Construct a slice backed by dst's underlying memory. 491 var buf []byte 492 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 493 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 494 hdr.Len = b.SizeBytes() 495 hdr.Cap = b.SizeBytes() 496 497 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 498 // Since we bypassed the compiler's escape analysis, indicate that b 499 // must live until the use above. 500 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 501 return length, err 502 } 503 504 // WriteTo implements io.WriterTo.WriteTo. 505 func (b *BPFInstruction) WriteTo(writer io.Writer) (int64, error) { 506 // Construct a slice backed by dst's underlying memory. 507 var buf []byte 508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 510 hdr.Len = b.SizeBytes() 511 hdr.Cap = b.SizeBytes() 512 513 length, err := writer.Write(buf) 514 // Since we bypassed the compiler's escape analysis, indicate that b 515 // must live until the use above. 516 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 517 return int64(length), err 518 } 519 520 // CopyBPFInstructionSliceIn copies in a slice of BPFInstruction objects from the task's memory. 521 func CopyBPFInstructionSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []BPFInstruction) (int, error) { 522 count := len(dst) 523 if count == 0 { 524 return 0, nil 525 } 526 size := (*BPFInstruction)(nil).SizeBytes() 527 528 ptr := unsafe.Pointer(&dst) 529 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 530 531 // Construct a slice backed by dst's underlying memory. 532 var buf []byte 533 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 534 hdr.Data = uintptr(val) 535 hdr.Len = size * count 536 hdr.Cap = size * count 537 538 length, err := cc.CopyInBytes(addr, buf) 539 // Since we bypassed the compiler's escape analysis, indicate that dst 540 // must live until the use above. 541 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 542 return length, err 543 } 544 545 // CopyBPFInstructionSliceOut copies a slice of BPFInstruction objects to the task's memory. 546 func CopyBPFInstructionSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []BPFInstruction) (int, error) { 547 count := len(src) 548 if count == 0 { 549 return 0, nil 550 } 551 size := (*BPFInstruction)(nil).SizeBytes() 552 553 ptr := unsafe.Pointer(&src) 554 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 555 556 // Construct a slice backed by dst's underlying memory. 557 var buf []byte 558 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 559 hdr.Data = uintptr(val) 560 hdr.Len = size * count 561 hdr.Cap = size * count 562 563 length, err := cc.CopyOutBytes(addr, buf) 564 // Since we bypassed the compiler's escape analysis, indicate that src 565 // must live until the use above. 566 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 567 return length, err 568 } 569 570 // MarshalUnsafeBPFInstructionSlice is like BPFInstruction.MarshalUnsafe, but for a []BPFInstruction. 571 func MarshalUnsafeBPFInstructionSlice(src []BPFInstruction, dst []byte) []byte { 572 count := len(src) 573 if count == 0 { 574 return dst 575 } 576 577 size := (*BPFInstruction)(nil).SizeBytes() 578 buf := dst[:size*count] 579 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 580 return dst[size*count:] 581 } 582 583 // UnmarshalUnsafeBPFInstructionSlice is like BPFInstruction.UnmarshalUnsafe, but for a []BPFInstruction. 584 func UnmarshalUnsafeBPFInstructionSlice(dst []BPFInstruction, src []byte) []byte { 585 count := len(dst) 586 if count == 0 { 587 return src 588 } 589 590 size := (*BPFInstruction)(nil).SizeBytes() 591 buf := src[:size*count] 592 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 593 return src[size*count:] 594 } 595 596 // SizeBytes implements marshal.Marshallable.SizeBytes. 597 func (c *CapUserData) SizeBytes() int { 598 return 12 599 } 600 601 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 602 func (c *CapUserData) MarshalBytes(dst []byte) []byte { 603 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Effective)) 604 dst = dst[4:] 605 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Permitted)) 606 dst = dst[4:] 607 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Inheritable)) 608 dst = dst[4:] 609 return dst 610 } 611 612 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 613 func (c *CapUserData) UnmarshalBytes(src []byte) []byte { 614 c.Effective = uint32(hostarch.ByteOrder.Uint32(src[:4])) 615 src = src[4:] 616 c.Permitted = uint32(hostarch.ByteOrder.Uint32(src[:4])) 617 src = src[4:] 618 c.Inheritable = uint32(hostarch.ByteOrder.Uint32(src[:4])) 619 src = src[4:] 620 return src 621 } 622 623 // Packed implements marshal.Marshallable.Packed. 624 //go:nosplit 625 func (c *CapUserData) Packed() bool { 626 return true 627 } 628 629 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 630 func (c *CapUserData) MarshalUnsafe(dst []byte) []byte { 631 size := c.SizeBytes() 632 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 633 return dst[size:] 634 } 635 636 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 637 func (c *CapUserData) UnmarshalUnsafe(src []byte) []byte { 638 size := c.SizeBytes() 639 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 640 return src[size:] 641 } 642 643 // CopyOutN implements marshal.Marshallable.CopyOutN. 644 func (c *CapUserData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 645 // Construct a slice backed by dst's underlying memory. 646 var buf []byte 647 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 648 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 649 hdr.Len = c.SizeBytes() 650 hdr.Cap = c.SizeBytes() 651 652 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 653 // Since we bypassed the compiler's escape analysis, indicate that c 654 // must live until the use above. 655 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 656 return length, err 657 } 658 659 // CopyOut implements marshal.Marshallable.CopyOut. 660 func (c *CapUserData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 661 return c.CopyOutN(cc, addr, c.SizeBytes()) 662 } 663 664 // CopyIn implements marshal.Marshallable.CopyIn. 665 func (c *CapUserData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 666 // Construct a slice backed by dst's underlying memory. 667 var buf []byte 668 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 669 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 670 hdr.Len = c.SizeBytes() 671 hdr.Cap = c.SizeBytes() 672 673 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 674 // Since we bypassed the compiler's escape analysis, indicate that c 675 // must live until the use above. 676 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 677 return length, err 678 } 679 680 // WriteTo implements io.WriterTo.WriteTo. 681 func (c *CapUserData) WriteTo(writer io.Writer) (int64, error) { 682 // Construct a slice backed by dst's underlying memory. 683 var buf []byte 684 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 685 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 686 hdr.Len = c.SizeBytes() 687 hdr.Cap = c.SizeBytes() 688 689 length, err := writer.Write(buf) 690 // Since we bypassed the compiler's escape analysis, indicate that c 691 // must live until the use above. 692 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 693 return int64(length), err 694 } 695 696 // CopyCapUserDataSliceIn copies in a slice of CapUserData objects from the task's memory. 697 func CopyCapUserDataSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []CapUserData) (int, error) { 698 count := len(dst) 699 if count == 0 { 700 return 0, nil 701 } 702 size := (*CapUserData)(nil).SizeBytes() 703 704 ptr := unsafe.Pointer(&dst) 705 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 706 707 // Construct a slice backed by dst's underlying memory. 708 var buf []byte 709 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 710 hdr.Data = uintptr(val) 711 hdr.Len = size * count 712 hdr.Cap = size * count 713 714 length, err := cc.CopyInBytes(addr, buf) 715 // Since we bypassed the compiler's escape analysis, indicate that dst 716 // must live until the use above. 717 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 718 return length, err 719 } 720 721 // CopyCapUserDataSliceOut copies a slice of CapUserData objects to the task's memory. 722 func CopyCapUserDataSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []CapUserData) (int, error) { 723 count := len(src) 724 if count == 0 { 725 return 0, nil 726 } 727 size := (*CapUserData)(nil).SizeBytes() 728 729 ptr := unsafe.Pointer(&src) 730 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 731 732 // Construct a slice backed by dst's underlying memory. 733 var buf []byte 734 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 735 hdr.Data = uintptr(val) 736 hdr.Len = size * count 737 hdr.Cap = size * count 738 739 length, err := cc.CopyOutBytes(addr, buf) 740 // Since we bypassed the compiler's escape analysis, indicate that src 741 // must live until the use above. 742 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 743 return length, err 744 } 745 746 // MarshalUnsafeCapUserDataSlice is like CapUserData.MarshalUnsafe, but for a []CapUserData. 747 func MarshalUnsafeCapUserDataSlice(src []CapUserData, dst []byte) []byte { 748 count := len(src) 749 if count == 0 { 750 return dst 751 } 752 753 size := (*CapUserData)(nil).SizeBytes() 754 buf := dst[:size*count] 755 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 756 return dst[size*count:] 757 } 758 759 // UnmarshalUnsafeCapUserDataSlice is like CapUserData.UnmarshalUnsafe, but for a []CapUserData. 760 func UnmarshalUnsafeCapUserDataSlice(dst []CapUserData, src []byte) []byte { 761 count := len(dst) 762 if count == 0 { 763 return src 764 } 765 766 size := (*CapUserData)(nil).SizeBytes() 767 buf := src[:size*count] 768 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 769 return src[size*count:] 770 } 771 772 // SizeBytes implements marshal.Marshallable.SizeBytes. 773 func (c *CapUserHeader) SizeBytes() int { 774 return 8 775 } 776 777 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 778 func (c *CapUserHeader) MarshalBytes(dst []byte) []byte { 779 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Version)) 780 dst = dst[4:] 781 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Pid)) 782 dst = dst[4:] 783 return dst 784 } 785 786 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 787 func (c *CapUserHeader) UnmarshalBytes(src []byte) []byte { 788 c.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 789 src = src[4:] 790 c.Pid = int32(hostarch.ByteOrder.Uint32(src[:4])) 791 src = src[4:] 792 return src 793 } 794 795 // Packed implements marshal.Marshallable.Packed. 796 //go:nosplit 797 func (c *CapUserHeader) Packed() bool { 798 return true 799 } 800 801 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 802 func (c *CapUserHeader) MarshalUnsafe(dst []byte) []byte { 803 size := c.SizeBytes() 804 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 805 return dst[size:] 806 } 807 808 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 809 func (c *CapUserHeader) UnmarshalUnsafe(src []byte) []byte { 810 size := c.SizeBytes() 811 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 812 return src[size:] 813 } 814 815 // CopyOutN implements marshal.Marshallable.CopyOutN. 816 func (c *CapUserHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 817 // Construct a slice backed by dst's underlying memory. 818 var buf []byte 819 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 820 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 821 hdr.Len = c.SizeBytes() 822 hdr.Cap = c.SizeBytes() 823 824 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 825 // Since we bypassed the compiler's escape analysis, indicate that c 826 // must live until the use above. 827 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 828 return length, err 829 } 830 831 // CopyOut implements marshal.Marshallable.CopyOut. 832 func (c *CapUserHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 833 return c.CopyOutN(cc, addr, c.SizeBytes()) 834 } 835 836 // CopyIn implements marshal.Marshallable.CopyIn. 837 func (c *CapUserHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 838 // Construct a slice backed by dst's underlying memory. 839 var buf []byte 840 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 841 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 842 hdr.Len = c.SizeBytes() 843 hdr.Cap = c.SizeBytes() 844 845 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 846 // Since we bypassed the compiler's escape analysis, indicate that c 847 // must live until the use above. 848 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 849 return length, err 850 } 851 852 // WriteTo implements io.WriterTo.WriteTo. 853 func (c *CapUserHeader) WriteTo(writer io.Writer) (int64, error) { 854 // Construct a slice backed by dst's underlying memory. 855 var buf []byte 856 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 857 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 858 hdr.Len = c.SizeBytes() 859 hdr.Cap = c.SizeBytes() 860 861 length, err := writer.Write(buf) 862 // Since we bypassed the compiler's escape analysis, indicate that c 863 // must live until the use above. 864 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 865 return int64(length), err 866 } 867 868 // SizeBytes implements marshal.Marshallable.SizeBytes. 869 func (e *ElfHeader64) SizeBytes() int { 870 return 48 + 871 1*16 872 } 873 874 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 875 func (e *ElfHeader64) MarshalBytes(dst []byte) []byte { 876 for idx := 0; idx < 16; idx++ { 877 dst[0] = byte(e.Ident[idx]) 878 dst = dst[1:] 879 } 880 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Type)) 881 dst = dst[2:] 882 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Machine)) 883 dst = dst[2:] 884 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Version)) 885 dst = dst[4:] 886 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entry)) 887 dst = dst[8:] 888 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Phoff)) 889 dst = dst[8:] 890 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Shoff)) 891 dst = dst[8:] 892 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 893 dst = dst[4:] 894 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Ehsize)) 895 dst = dst[2:] 896 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phentsize)) 897 dst = dst[2:] 898 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phnum)) 899 dst = dst[2:] 900 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shentsize)) 901 dst = dst[2:] 902 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shnum)) 903 dst = dst[2:] 904 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shstrndx)) 905 dst = dst[2:] 906 return dst 907 } 908 909 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 910 func (e *ElfHeader64) UnmarshalBytes(src []byte) []byte { 911 for idx := 0; idx < 16; idx++ { 912 e.Ident[idx] = src[0] 913 src = src[1:] 914 } 915 e.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 916 src = src[2:] 917 e.Machine = uint16(hostarch.ByteOrder.Uint16(src[:2])) 918 src = src[2:] 919 e.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 920 src = src[4:] 921 e.Entry = uint64(hostarch.ByteOrder.Uint64(src[:8])) 922 src = src[8:] 923 e.Phoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 924 src = src[8:] 925 e.Shoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 926 src = src[8:] 927 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 928 src = src[4:] 929 e.Ehsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 930 src = src[2:] 931 e.Phentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 932 src = src[2:] 933 e.Phnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 934 src = src[2:] 935 e.Shentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 936 src = src[2:] 937 e.Shnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 938 src = src[2:] 939 e.Shstrndx = uint16(hostarch.ByteOrder.Uint16(src[:2])) 940 src = src[2:] 941 return src 942 } 943 944 // Packed implements marshal.Marshallable.Packed. 945 //go:nosplit 946 func (e *ElfHeader64) Packed() bool { 947 return true 948 } 949 950 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 951 func (e *ElfHeader64) MarshalUnsafe(dst []byte) []byte { 952 size := e.SizeBytes() 953 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 954 return dst[size:] 955 } 956 957 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 958 func (e *ElfHeader64) UnmarshalUnsafe(src []byte) []byte { 959 size := e.SizeBytes() 960 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 961 return src[size:] 962 } 963 964 // CopyOutN implements marshal.Marshallable.CopyOutN. 965 func (e *ElfHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 966 // Construct a slice backed by dst's underlying memory. 967 var buf []byte 968 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 969 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 970 hdr.Len = e.SizeBytes() 971 hdr.Cap = e.SizeBytes() 972 973 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 974 // Since we bypassed the compiler's escape analysis, indicate that e 975 // must live until the use above. 976 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 977 return length, err 978 } 979 980 // CopyOut implements marshal.Marshallable.CopyOut. 981 func (e *ElfHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 982 return e.CopyOutN(cc, addr, e.SizeBytes()) 983 } 984 985 // CopyIn implements marshal.Marshallable.CopyIn. 986 func (e *ElfHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 987 // Construct a slice backed by dst's underlying memory. 988 var buf []byte 989 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 990 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 991 hdr.Len = e.SizeBytes() 992 hdr.Cap = e.SizeBytes() 993 994 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 995 // Since we bypassed the compiler's escape analysis, indicate that e 996 // must live until the use above. 997 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 998 return length, err 999 } 1000 1001 // WriteTo implements io.WriterTo.WriteTo. 1002 func (e *ElfHeader64) WriteTo(writer io.Writer) (int64, error) { 1003 // Construct a slice backed by dst's underlying memory. 1004 var buf []byte 1005 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1006 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1007 hdr.Len = e.SizeBytes() 1008 hdr.Cap = e.SizeBytes() 1009 1010 length, err := writer.Write(buf) 1011 // Since we bypassed the compiler's escape analysis, indicate that e 1012 // must live until the use above. 1013 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1014 return int64(length), err 1015 } 1016 1017 // SizeBytes implements marshal.Marshallable.SizeBytes. 1018 func (e *ElfProg64) SizeBytes() int { 1019 return 56 1020 } 1021 1022 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1023 func (e *ElfProg64) MarshalBytes(dst []byte) []byte { 1024 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1025 dst = dst[4:] 1026 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1027 dst = dst[4:] 1028 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1029 dst = dst[8:] 1030 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Vaddr)) 1031 dst = dst[8:] 1032 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Paddr)) 1033 dst = dst[8:] 1034 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Filesz)) 1035 dst = dst[8:] 1036 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Memsz)) 1037 dst = dst[8:] 1038 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Align)) 1039 dst = dst[8:] 1040 return dst 1041 } 1042 1043 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1044 func (e *ElfProg64) UnmarshalBytes(src []byte) []byte { 1045 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1046 src = src[4:] 1047 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1048 src = src[4:] 1049 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1050 src = src[8:] 1051 e.Vaddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1052 src = src[8:] 1053 e.Paddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1054 src = src[8:] 1055 e.Filesz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1056 src = src[8:] 1057 e.Memsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1058 src = src[8:] 1059 e.Align = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1060 src = src[8:] 1061 return src 1062 } 1063 1064 // Packed implements marshal.Marshallable.Packed. 1065 //go:nosplit 1066 func (e *ElfProg64) Packed() bool { 1067 return true 1068 } 1069 1070 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1071 func (e *ElfProg64) MarshalUnsafe(dst []byte) []byte { 1072 size := e.SizeBytes() 1073 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1074 return dst[size:] 1075 } 1076 1077 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1078 func (e *ElfProg64) UnmarshalUnsafe(src []byte) []byte { 1079 size := e.SizeBytes() 1080 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1081 return src[size:] 1082 } 1083 1084 // CopyOutN implements marshal.Marshallable.CopyOutN. 1085 func (e *ElfProg64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1086 // Construct a slice backed by dst's underlying memory. 1087 var buf []byte 1088 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1089 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1090 hdr.Len = e.SizeBytes() 1091 hdr.Cap = e.SizeBytes() 1092 1093 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1094 // Since we bypassed the compiler's escape analysis, indicate that e 1095 // must live until the use above. 1096 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1097 return length, err 1098 } 1099 1100 // CopyOut implements marshal.Marshallable.CopyOut. 1101 func (e *ElfProg64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1102 return e.CopyOutN(cc, addr, e.SizeBytes()) 1103 } 1104 1105 // CopyIn implements marshal.Marshallable.CopyIn. 1106 func (e *ElfProg64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1107 // Construct a slice backed by dst's underlying memory. 1108 var buf []byte 1109 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1110 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1111 hdr.Len = e.SizeBytes() 1112 hdr.Cap = e.SizeBytes() 1113 1114 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1115 // Since we bypassed the compiler's escape analysis, indicate that e 1116 // must live until the use above. 1117 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1118 return length, err 1119 } 1120 1121 // WriteTo implements io.WriterTo.WriteTo. 1122 func (e *ElfProg64) WriteTo(writer io.Writer) (int64, error) { 1123 // Construct a slice backed by dst's underlying memory. 1124 var buf []byte 1125 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1126 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1127 hdr.Len = e.SizeBytes() 1128 hdr.Cap = e.SizeBytes() 1129 1130 length, err := writer.Write(buf) 1131 // Since we bypassed the compiler's escape analysis, indicate that e 1132 // must live until the use above. 1133 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1134 return int64(length), err 1135 } 1136 1137 // SizeBytes implements marshal.Marshallable.SizeBytes. 1138 func (e *ElfSection64) SizeBytes() int { 1139 return 64 1140 } 1141 1142 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1143 func (e *ElfSection64) MarshalBytes(dst []byte) []byte { 1144 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Name)) 1145 dst = dst[4:] 1146 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1147 dst = dst[4:] 1148 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Flags)) 1149 dst = dst[8:] 1150 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addr)) 1151 dst = dst[8:] 1152 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1153 dst = dst[8:] 1154 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Size)) 1155 dst = dst[8:] 1156 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Link)) 1157 dst = dst[4:] 1158 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Info)) 1159 dst = dst[4:] 1160 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addralign)) 1161 dst = dst[8:] 1162 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entsize)) 1163 dst = dst[8:] 1164 return dst 1165 } 1166 1167 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1168 func (e *ElfSection64) UnmarshalBytes(src []byte) []byte { 1169 e.Name = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1170 src = src[4:] 1171 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1172 src = src[4:] 1173 e.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1174 src = src[8:] 1175 e.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1176 src = src[8:] 1177 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1178 src = src[8:] 1179 e.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1180 src = src[8:] 1181 e.Link = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1182 src = src[4:] 1183 e.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1184 src = src[4:] 1185 e.Addralign = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1186 src = src[8:] 1187 e.Entsize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1188 src = src[8:] 1189 return src 1190 } 1191 1192 // Packed implements marshal.Marshallable.Packed. 1193 //go:nosplit 1194 func (e *ElfSection64) Packed() bool { 1195 return true 1196 } 1197 1198 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1199 func (e *ElfSection64) MarshalUnsafe(dst []byte) []byte { 1200 size := e.SizeBytes() 1201 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1202 return dst[size:] 1203 } 1204 1205 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1206 func (e *ElfSection64) UnmarshalUnsafe(src []byte) []byte { 1207 size := e.SizeBytes() 1208 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1209 return src[size:] 1210 } 1211 1212 // CopyOutN implements marshal.Marshallable.CopyOutN. 1213 func (e *ElfSection64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1214 // Construct a slice backed by dst's underlying memory. 1215 var buf []byte 1216 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1217 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1218 hdr.Len = e.SizeBytes() 1219 hdr.Cap = e.SizeBytes() 1220 1221 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1222 // Since we bypassed the compiler's escape analysis, indicate that e 1223 // must live until the use above. 1224 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1225 return length, err 1226 } 1227 1228 // CopyOut implements marshal.Marshallable.CopyOut. 1229 func (e *ElfSection64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1230 return e.CopyOutN(cc, addr, e.SizeBytes()) 1231 } 1232 1233 // CopyIn implements marshal.Marshallable.CopyIn. 1234 func (e *ElfSection64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1235 // Construct a slice backed by dst's underlying memory. 1236 var buf []byte 1237 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1238 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1239 hdr.Len = e.SizeBytes() 1240 hdr.Cap = e.SizeBytes() 1241 1242 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1243 // Since we bypassed the compiler's escape analysis, indicate that e 1244 // must live until the use above. 1245 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1246 return length, err 1247 } 1248 1249 // WriteTo implements io.WriterTo.WriteTo. 1250 func (e *ElfSection64) WriteTo(writer io.Writer) (int64, error) { 1251 // Construct a slice backed by dst's underlying memory. 1252 var buf []byte 1253 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1254 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1255 hdr.Len = e.SizeBytes() 1256 hdr.Cap = e.SizeBytes() 1257 1258 length, err := writer.Write(buf) 1259 // Since we bypassed the compiler's escape analysis, indicate that e 1260 // must live until the use above. 1261 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1262 return int64(length), err 1263 } 1264 1265 // SizeBytes implements marshal.Marshallable.SizeBytes. 1266 func (s *SockErrCMsgIPv4) SizeBytes() int { 1267 return 0 + 1268 (*SockExtendedErr)(nil).SizeBytes() + 1269 (*SockAddrInet)(nil).SizeBytes() 1270 } 1271 1272 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1273 func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) []byte { 1274 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1275 dst = s.Offender.MarshalUnsafe(dst) 1276 return dst 1277 } 1278 1279 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1280 func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) []byte { 1281 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1282 src = s.Offender.UnmarshalUnsafe(src) 1283 return src 1284 } 1285 1286 // Packed implements marshal.Marshallable.Packed. 1287 //go:nosplit 1288 func (s *SockErrCMsgIPv4) Packed() bool { 1289 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1290 } 1291 1292 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1293 func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) []byte { 1294 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1295 size := s.SizeBytes() 1296 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1297 return dst[size:] 1298 } 1299 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes. 1300 return s.MarshalBytes(dst) 1301 } 1302 1303 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1304 func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) []byte { 1305 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1306 size := s.SizeBytes() 1307 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1308 return src[size:] 1309 } 1310 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1311 return s.UnmarshalBytes(src) 1312 } 1313 1314 // CopyOutN implements marshal.Marshallable.CopyOutN. 1315 func (s *SockErrCMsgIPv4) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1316 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1317 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1318 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1319 s.MarshalBytes(buf) // escapes: fallback. 1320 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1321 } 1322 1323 // Construct a slice backed by dst's underlying memory. 1324 var buf []byte 1325 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1326 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1327 hdr.Len = s.SizeBytes() 1328 hdr.Cap = s.SizeBytes() 1329 1330 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1331 // Since we bypassed the compiler's escape analysis, indicate that s 1332 // must live until the use above. 1333 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1334 return length, err 1335 } 1336 1337 // CopyOut implements marshal.Marshallable.CopyOut. 1338 func (s *SockErrCMsgIPv4) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1339 return s.CopyOutN(cc, addr, s.SizeBytes()) 1340 } 1341 1342 // CopyIn implements marshal.Marshallable.CopyIn. 1343 func (s *SockErrCMsgIPv4) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1344 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1345 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1346 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1347 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1348 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1349 // partially unmarshalled struct. 1350 s.UnmarshalBytes(buf) // escapes: fallback. 1351 return length, err 1352 } 1353 1354 // Construct a slice backed by dst's underlying memory. 1355 var buf []byte 1356 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1357 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1358 hdr.Len = s.SizeBytes() 1359 hdr.Cap = s.SizeBytes() 1360 1361 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1362 // Since we bypassed the compiler's escape analysis, indicate that s 1363 // must live until the use above. 1364 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1365 return length, err 1366 } 1367 1368 // WriteTo implements io.WriterTo.WriteTo. 1369 func (s *SockErrCMsgIPv4) WriteTo(writer io.Writer) (int64, error) { 1370 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1371 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1372 buf := make([]byte, s.SizeBytes()) 1373 s.MarshalBytes(buf) 1374 length, err := writer.Write(buf) 1375 return int64(length), err 1376 } 1377 1378 // Construct a slice backed by dst's underlying memory. 1379 var buf []byte 1380 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1381 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1382 hdr.Len = s.SizeBytes() 1383 hdr.Cap = s.SizeBytes() 1384 1385 length, err := writer.Write(buf) 1386 // Since we bypassed the compiler's escape analysis, indicate that s 1387 // must live until the use above. 1388 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1389 return int64(length), err 1390 } 1391 1392 // SizeBytes implements marshal.Marshallable.SizeBytes. 1393 func (s *SockErrCMsgIPv6) SizeBytes() int { 1394 return 0 + 1395 (*SockExtendedErr)(nil).SizeBytes() + 1396 (*SockAddrInet6)(nil).SizeBytes() 1397 } 1398 1399 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1400 func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) []byte { 1401 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1402 dst = s.Offender.MarshalUnsafe(dst) 1403 return dst 1404 } 1405 1406 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1407 func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) []byte { 1408 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1409 src = s.Offender.UnmarshalUnsafe(src) 1410 return src 1411 } 1412 1413 // Packed implements marshal.Marshallable.Packed. 1414 //go:nosplit 1415 func (s *SockErrCMsgIPv6) Packed() bool { 1416 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1417 } 1418 1419 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1420 func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) []byte { 1421 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1422 size := s.SizeBytes() 1423 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1424 return dst[size:] 1425 } 1426 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes. 1427 return s.MarshalBytes(dst) 1428 } 1429 1430 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1431 func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) []byte { 1432 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1433 size := s.SizeBytes() 1434 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1435 return src[size:] 1436 } 1437 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1438 return s.UnmarshalBytes(src) 1439 } 1440 1441 // CopyOutN implements marshal.Marshallable.CopyOutN. 1442 func (s *SockErrCMsgIPv6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1443 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1444 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1445 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1446 s.MarshalBytes(buf) // escapes: fallback. 1447 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1448 } 1449 1450 // Construct a slice backed by dst's underlying memory. 1451 var buf []byte 1452 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1453 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1454 hdr.Len = s.SizeBytes() 1455 hdr.Cap = s.SizeBytes() 1456 1457 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1458 // Since we bypassed the compiler's escape analysis, indicate that s 1459 // must live until the use above. 1460 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1461 return length, err 1462 } 1463 1464 // CopyOut implements marshal.Marshallable.CopyOut. 1465 func (s *SockErrCMsgIPv6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1466 return s.CopyOutN(cc, addr, s.SizeBytes()) 1467 } 1468 1469 // CopyIn implements marshal.Marshallable.CopyIn. 1470 func (s *SockErrCMsgIPv6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1471 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1472 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1473 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1474 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1475 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1476 // partially unmarshalled struct. 1477 s.UnmarshalBytes(buf) // escapes: fallback. 1478 return length, err 1479 } 1480 1481 // Construct a slice backed by dst's underlying memory. 1482 var buf []byte 1483 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1484 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1485 hdr.Len = s.SizeBytes() 1486 hdr.Cap = s.SizeBytes() 1487 1488 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1489 // Since we bypassed the compiler's escape analysis, indicate that s 1490 // must live until the use above. 1491 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1492 return length, err 1493 } 1494 1495 // WriteTo implements io.WriterTo.WriteTo. 1496 func (s *SockErrCMsgIPv6) WriteTo(writer io.Writer) (int64, error) { 1497 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1498 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1499 buf := make([]byte, s.SizeBytes()) 1500 s.MarshalBytes(buf) 1501 length, err := writer.Write(buf) 1502 return int64(length), err 1503 } 1504 1505 // Construct a slice backed by dst's underlying memory. 1506 var buf []byte 1507 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1508 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1509 hdr.Len = s.SizeBytes() 1510 hdr.Cap = s.SizeBytes() 1511 1512 length, err := writer.Write(buf) 1513 // Since we bypassed the compiler's escape analysis, indicate that s 1514 // must live until the use above. 1515 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1516 return int64(length), err 1517 } 1518 1519 // SizeBytes implements marshal.Marshallable.SizeBytes. 1520 func (s *SockExtendedErr) SizeBytes() int { 1521 return 16 1522 } 1523 1524 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1525 func (s *SockExtendedErr) MarshalBytes(dst []byte) []byte { 1526 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 1527 dst = dst[4:] 1528 dst[0] = byte(s.Origin) 1529 dst = dst[1:] 1530 dst[0] = byte(s.Type) 1531 dst = dst[1:] 1532 dst[0] = byte(s.Code) 1533 dst = dst[1:] 1534 dst[0] = byte(s.Pad) 1535 dst = dst[1:] 1536 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Info)) 1537 dst = dst[4:] 1538 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Data)) 1539 dst = dst[4:] 1540 return dst 1541 } 1542 1543 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1544 func (s *SockExtendedErr) UnmarshalBytes(src []byte) []byte { 1545 s.Errno = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1546 src = src[4:] 1547 s.Origin = uint8(src[0]) 1548 src = src[1:] 1549 s.Type = uint8(src[0]) 1550 src = src[1:] 1551 s.Code = uint8(src[0]) 1552 src = src[1:] 1553 s.Pad = uint8(src[0]) 1554 src = src[1:] 1555 s.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1556 src = src[4:] 1557 s.Data = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1558 src = src[4:] 1559 return src 1560 } 1561 1562 // Packed implements marshal.Marshallable.Packed. 1563 //go:nosplit 1564 func (s *SockExtendedErr) Packed() bool { 1565 return true 1566 } 1567 1568 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1569 func (s *SockExtendedErr) MarshalUnsafe(dst []byte) []byte { 1570 size := s.SizeBytes() 1571 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1572 return dst[size:] 1573 } 1574 1575 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1576 func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) []byte { 1577 size := s.SizeBytes() 1578 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1579 return src[size:] 1580 } 1581 1582 // CopyOutN implements marshal.Marshallable.CopyOutN. 1583 func (s *SockExtendedErr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1584 // Construct a slice backed by dst's underlying memory. 1585 var buf []byte 1586 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1587 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1588 hdr.Len = s.SizeBytes() 1589 hdr.Cap = s.SizeBytes() 1590 1591 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1592 // Since we bypassed the compiler's escape analysis, indicate that s 1593 // must live until the use above. 1594 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1595 return length, err 1596 } 1597 1598 // CopyOut implements marshal.Marshallable.CopyOut. 1599 func (s *SockExtendedErr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1600 return s.CopyOutN(cc, addr, s.SizeBytes()) 1601 } 1602 1603 // CopyIn implements marshal.Marshallable.CopyIn. 1604 func (s *SockExtendedErr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1605 // Construct a slice backed by dst's underlying memory. 1606 var buf []byte 1607 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1608 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1609 hdr.Len = s.SizeBytes() 1610 hdr.Cap = s.SizeBytes() 1611 1612 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1613 // Since we bypassed the compiler's escape analysis, indicate that s 1614 // must live until the use above. 1615 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1616 return length, err 1617 } 1618 1619 // WriteTo implements io.WriterTo.WriteTo. 1620 func (s *SockExtendedErr) WriteTo(writer io.Writer) (int64, error) { 1621 // Construct a slice backed by dst's underlying memory. 1622 var buf []byte 1623 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1624 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1625 hdr.Len = s.SizeBytes() 1626 hdr.Cap = s.SizeBytes() 1627 1628 length, err := writer.Write(buf) 1629 // Since we bypassed the compiler's escape analysis, indicate that s 1630 // must live until the use above. 1631 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1632 return int64(length), err 1633 } 1634 1635 // SizeBytes implements marshal.Marshallable.SizeBytes. 1636 func (f *FOwnerEx) SizeBytes() int { 1637 return 8 1638 } 1639 1640 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1641 func (f *FOwnerEx) MarshalBytes(dst []byte) []byte { 1642 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 1643 dst = dst[4:] 1644 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1645 dst = dst[4:] 1646 return dst 1647 } 1648 1649 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1650 func (f *FOwnerEx) UnmarshalBytes(src []byte) []byte { 1651 f.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 1652 src = src[4:] 1653 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1654 src = src[4:] 1655 return src 1656 } 1657 1658 // Packed implements marshal.Marshallable.Packed. 1659 //go:nosplit 1660 func (f *FOwnerEx) Packed() bool { 1661 return true 1662 } 1663 1664 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1665 func (f *FOwnerEx) MarshalUnsafe(dst []byte) []byte { 1666 size := f.SizeBytes() 1667 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1668 return dst[size:] 1669 } 1670 1671 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1672 func (f *FOwnerEx) UnmarshalUnsafe(src []byte) []byte { 1673 size := f.SizeBytes() 1674 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1675 return src[size:] 1676 } 1677 1678 // CopyOutN implements marshal.Marshallable.CopyOutN. 1679 func (f *FOwnerEx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1680 // Construct a slice backed by dst's underlying memory. 1681 var buf []byte 1682 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1683 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1684 hdr.Len = f.SizeBytes() 1685 hdr.Cap = f.SizeBytes() 1686 1687 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1688 // Since we bypassed the compiler's escape analysis, indicate that f 1689 // must live until the use above. 1690 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1691 return length, err 1692 } 1693 1694 // CopyOut implements marshal.Marshallable.CopyOut. 1695 func (f *FOwnerEx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1696 return f.CopyOutN(cc, addr, f.SizeBytes()) 1697 } 1698 1699 // CopyIn implements marshal.Marshallable.CopyIn. 1700 func (f *FOwnerEx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1701 // Construct a slice backed by dst's underlying memory. 1702 var buf []byte 1703 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1704 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1705 hdr.Len = f.SizeBytes() 1706 hdr.Cap = f.SizeBytes() 1707 1708 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1709 // Since we bypassed the compiler's escape analysis, indicate that f 1710 // must live until the use above. 1711 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1712 return length, err 1713 } 1714 1715 // WriteTo implements io.WriterTo.WriteTo. 1716 func (f *FOwnerEx) WriteTo(writer io.Writer) (int64, error) { 1717 // Construct a slice backed by dst's underlying memory. 1718 var buf []byte 1719 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1720 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1721 hdr.Len = f.SizeBytes() 1722 hdr.Cap = f.SizeBytes() 1723 1724 length, err := writer.Write(buf) 1725 // Since we bypassed the compiler's escape analysis, indicate that f 1726 // must live until the use above. 1727 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1728 return int64(length), err 1729 } 1730 1731 // SizeBytes implements marshal.Marshallable.SizeBytes. 1732 func (f *Flock) SizeBytes() int { 1733 return 24 + 1734 1*4 + 1735 1*4 1736 } 1737 1738 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1739 func (f *Flock) MarshalBytes(dst []byte) []byte { 1740 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Type)) 1741 dst = dst[2:] 1742 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Whence)) 1743 dst = dst[2:] 1744 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1745 dst = dst[1*(4):] 1746 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Start)) 1747 dst = dst[8:] 1748 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Len)) 1749 dst = dst[8:] 1750 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1751 dst = dst[4:] 1752 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1753 dst = dst[1*(4):] 1754 return dst 1755 } 1756 1757 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1758 func (f *Flock) UnmarshalBytes(src []byte) []byte { 1759 f.Type = int16(hostarch.ByteOrder.Uint16(src[:2])) 1760 src = src[2:] 1761 f.Whence = int16(hostarch.ByteOrder.Uint16(src[:2])) 1762 src = src[2:] 1763 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1764 src = src[1*(4):] 1765 f.Start = int64(hostarch.ByteOrder.Uint64(src[:8])) 1766 src = src[8:] 1767 f.Len = int64(hostarch.ByteOrder.Uint64(src[:8])) 1768 src = src[8:] 1769 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1770 src = src[4:] 1771 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1772 src = src[1*(4):] 1773 return src 1774 } 1775 1776 // Packed implements marshal.Marshallable.Packed. 1777 //go:nosplit 1778 func (f *Flock) Packed() bool { 1779 return true 1780 } 1781 1782 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1783 func (f *Flock) MarshalUnsafe(dst []byte) []byte { 1784 size := f.SizeBytes() 1785 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1786 return dst[size:] 1787 } 1788 1789 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1790 func (f *Flock) UnmarshalUnsafe(src []byte) []byte { 1791 size := f.SizeBytes() 1792 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1793 return src[size:] 1794 } 1795 1796 // CopyOutN implements marshal.Marshallable.CopyOutN. 1797 func (f *Flock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1798 // Construct a slice backed by dst's underlying memory. 1799 var buf []byte 1800 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1801 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1802 hdr.Len = f.SizeBytes() 1803 hdr.Cap = f.SizeBytes() 1804 1805 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1806 // Since we bypassed the compiler's escape analysis, indicate that f 1807 // must live until the use above. 1808 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1809 return length, err 1810 } 1811 1812 // CopyOut implements marshal.Marshallable.CopyOut. 1813 func (f *Flock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1814 return f.CopyOutN(cc, addr, f.SizeBytes()) 1815 } 1816 1817 // CopyIn implements marshal.Marshallable.CopyIn. 1818 func (f *Flock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1819 // Construct a slice backed by dst's underlying memory. 1820 var buf []byte 1821 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1822 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1823 hdr.Len = f.SizeBytes() 1824 hdr.Cap = f.SizeBytes() 1825 1826 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1827 // Since we bypassed the compiler's escape analysis, indicate that f 1828 // must live until the use above. 1829 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1830 return length, err 1831 } 1832 1833 // WriteTo implements io.WriterTo.WriteTo. 1834 func (f *Flock) WriteTo(writer io.Writer) (int64, error) { 1835 // Construct a slice backed by dst's underlying memory. 1836 var buf []byte 1837 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1838 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1839 hdr.Len = f.SizeBytes() 1840 hdr.Cap = f.SizeBytes() 1841 1842 length, err := writer.Write(buf) 1843 // Since we bypassed the compiler's escape analysis, indicate that f 1844 // must live until the use above. 1845 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1846 return int64(length), err 1847 } 1848 1849 // SizeBytes implements marshal.Marshallable.SizeBytes. 1850 //go:nosplit 1851 func (m *FileMode) SizeBytes() int { 1852 return 2 1853 } 1854 1855 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1856 func (m *FileMode) MarshalBytes(dst []byte) []byte { 1857 hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m)) 1858 return dst[2:] 1859 } 1860 1861 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1862 func (m *FileMode) UnmarshalBytes(src []byte) []byte { 1863 *m = FileMode(uint16(hostarch.ByteOrder.Uint16(src[:2]))) 1864 return src[2:] 1865 } 1866 1867 // Packed implements marshal.Marshallable.Packed. 1868 //go:nosplit 1869 func (m *FileMode) Packed() bool { 1870 // Scalar newtypes are always packed. 1871 return true 1872 } 1873 1874 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1875 func (m *FileMode) MarshalUnsafe(dst []byte) []byte { 1876 size := m.SizeBytes() 1877 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 1878 return dst[size:] 1879 } 1880 1881 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1882 func (m *FileMode) UnmarshalUnsafe(src []byte) []byte { 1883 size := m.SizeBytes() 1884 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 1885 return src[size:] 1886 } 1887 1888 // CopyOutN implements marshal.Marshallable.CopyOutN. 1889 func (m *FileMode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1890 // Construct a slice backed by dst's underlying memory. 1891 var buf []byte 1892 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1893 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1894 hdr.Len = m.SizeBytes() 1895 hdr.Cap = m.SizeBytes() 1896 1897 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1898 // Since we bypassed the compiler's escape analysis, indicate that m 1899 // must live until the use above. 1900 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1901 return length, err 1902 } 1903 1904 // CopyOut implements marshal.Marshallable.CopyOut. 1905 func (m *FileMode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1906 return m.CopyOutN(cc, addr, m.SizeBytes()) 1907 } 1908 1909 // CopyIn implements marshal.Marshallable.CopyIn. 1910 func (m *FileMode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1911 // Construct a slice backed by dst's underlying memory. 1912 var buf []byte 1913 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1914 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1915 hdr.Len = m.SizeBytes() 1916 hdr.Cap = m.SizeBytes() 1917 1918 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1919 // Since we bypassed the compiler's escape analysis, indicate that m 1920 // must live until the use above. 1921 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1922 return length, err 1923 } 1924 1925 // WriteTo implements io.WriterTo.WriteTo. 1926 func (m *FileMode) WriteTo(writer io.Writer) (int64, error) { 1927 // Construct a slice backed by dst's underlying memory. 1928 var buf []byte 1929 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1930 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1931 hdr.Len = m.SizeBytes() 1932 hdr.Cap = m.SizeBytes() 1933 1934 length, err := writer.Write(buf) 1935 // Since we bypassed the compiler's escape analysis, indicate that m 1936 // must live until the use above. 1937 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1938 return int64(length), err 1939 } 1940 1941 // SizeBytes implements marshal.Marshallable.SizeBytes. 1942 func (s *Statx) SizeBytes() int { 1943 return 80 + 1944 (*StatxTimestamp)(nil).SizeBytes() + 1945 (*StatxTimestamp)(nil).SizeBytes() + 1946 (*StatxTimestamp)(nil).SizeBytes() + 1947 (*StatxTimestamp)(nil).SizeBytes() 1948 } 1949 1950 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1951 func (s *Statx) MarshalBytes(dst []byte) []byte { 1952 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask)) 1953 dst = dst[4:] 1954 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Blksize)) 1955 dst = dst[4:] 1956 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Attributes)) 1957 dst = dst[8:] 1958 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nlink)) 1959 dst = dst[4:] 1960 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 1961 dst = dst[4:] 1962 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.GID)) 1963 dst = dst[4:] 1964 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Mode)) 1965 dst = dst[2:] 1966 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 1967 dst = dst[2:] 1968 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino)) 1969 dst = dst[8:] 1970 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 1971 dst = dst[8:] 1972 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 1973 dst = dst[8:] 1974 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.AttributesMask)) 1975 dst = dst[8:] 1976 dst = s.Atime.MarshalUnsafe(dst) 1977 dst = s.Btime.MarshalUnsafe(dst) 1978 dst = s.Ctime.MarshalUnsafe(dst) 1979 dst = s.Mtime.MarshalUnsafe(dst) 1980 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMajor)) 1981 dst = dst[4:] 1982 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMinor)) 1983 dst = dst[4:] 1984 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMajor)) 1985 dst = dst[4:] 1986 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMinor)) 1987 dst = dst[4:] 1988 return dst 1989 } 1990 1991 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1992 func (s *Statx) UnmarshalBytes(src []byte) []byte { 1993 s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1994 src = src[4:] 1995 s.Blksize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1996 src = src[4:] 1997 s.Attributes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1998 src = src[8:] 1999 s.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2000 src = src[4:] 2001 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2002 src = src[4:] 2003 s.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2004 src = src[4:] 2005 s.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 2006 src = src[2:] 2007 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 2008 src = src[2:] 2009 s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2010 src = src[8:] 2011 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2012 src = src[8:] 2013 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2014 src = src[8:] 2015 s.AttributesMask = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2016 src = src[8:] 2017 src = s.Atime.UnmarshalUnsafe(src) 2018 src = s.Btime.UnmarshalUnsafe(src) 2019 src = s.Ctime.UnmarshalUnsafe(src) 2020 src = s.Mtime.UnmarshalUnsafe(src) 2021 s.RdevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2022 src = src[4:] 2023 s.RdevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2024 src = src[4:] 2025 s.DevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2026 src = src[4:] 2027 s.DevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2028 src = src[4:] 2029 return src 2030 } 2031 2032 // Packed implements marshal.Marshallable.Packed. 2033 //go:nosplit 2034 func (s *Statx) Packed() bool { 2035 return s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() 2036 } 2037 2038 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2039 func (s *Statx) MarshalUnsafe(dst []byte) []byte { 2040 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2041 size := s.SizeBytes() 2042 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2043 return dst[size:] 2044 } 2045 // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes. 2046 return s.MarshalBytes(dst) 2047 } 2048 2049 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2050 func (s *Statx) UnmarshalUnsafe(src []byte) []byte { 2051 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2052 size := s.SizeBytes() 2053 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2054 return src[size:] 2055 } 2056 // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2057 return s.UnmarshalBytes(src) 2058 } 2059 2060 // CopyOutN implements marshal.Marshallable.CopyOutN. 2061 func (s *Statx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2062 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2063 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2064 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2065 s.MarshalBytes(buf) // escapes: fallback. 2066 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2067 } 2068 2069 // Construct a slice backed by dst's underlying memory. 2070 var buf []byte 2071 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2072 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2073 hdr.Len = s.SizeBytes() 2074 hdr.Cap = s.SizeBytes() 2075 2076 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2077 // Since we bypassed the compiler's escape analysis, indicate that s 2078 // must live until the use above. 2079 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2080 return length, err 2081 } 2082 2083 // CopyOut implements marshal.Marshallable.CopyOut. 2084 func (s *Statx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2085 return s.CopyOutN(cc, addr, s.SizeBytes()) 2086 } 2087 2088 // CopyIn implements marshal.Marshallable.CopyIn. 2089 func (s *Statx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2090 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2091 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2092 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2093 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2094 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2095 // partially unmarshalled struct. 2096 s.UnmarshalBytes(buf) // escapes: fallback. 2097 return length, err 2098 } 2099 2100 // Construct a slice backed by dst's underlying memory. 2101 var buf []byte 2102 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2103 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2104 hdr.Len = s.SizeBytes() 2105 hdr.Cap = s.SizeBytes() 2106 2107 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2108 // Since we bypassed the compiler's escape analysis, indicate that s 2109 // must live until the use above. 2110 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2111 return length, err 2112 } 2113 2114 // WriteTo implements io.WriterTo.WriteTo. 2115 func (s *Statx) WriteTo(writer io.Writer) (int64, error) { 2116 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2117 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2118 buf := make([]byte, s.SizeBytes()) 2119 s.MarshalBytes(buf) 2120 length, err := writer.Write(buf) 2121 return int64(length), err 2122 } 2123 2124 // Construct a slice backed by dst's underlying memory. 2125 var buf []byte 2126 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2127 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2128 hdr.Len = s.SizeBytes() 2129 hdr.Cap = s.SizeBytes() 2130 2131 length, err := writer.Write(buf) 2132 // Since we bypassed the compiler's escape analysis, indicate that s 2133 // must live until the use above. 2134 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2135 return int64(length), err 2136 } 2137 2138 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2139 func (s *Statx) CheckedMarshal(dst []byte) ([]byte, bool) { 2140 if s.SizeBytes() > len(dst) { 2141 return dst, false 2142 } 2143 return s.MarshalUnsafe(dst), true 2144 } 2145 2146 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2147 func (s *Statx) CheckedUnmarshal(src []byte) ([]byte, bool) { 2148 if s.SizeBytes() > len(src) { 2149 return src, false 2150 } 2151 return s.UnmarshalUnsafe(src), true 2152 } 2153 2154 // CopyStatxSliceIn copies in a slice of Statx objects from the task's memory. 2155 func CopyStatxSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Statx) (int, error) { 2156 count := len(dst) 2157 if count == 0 { 2158 return 0, nil 2159 } 2160 size := (*Statx)(nil).SizeBytes() 2161 2162 if !dst[0].Packed() { 2163 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2164 buf := cc.CopyScratchBuffer(size * count) 2165 length, err := cc.CopyInBytes(addr, buf) 2166 2167 // Unmarshal as much as possible, even on error. First handle full objects. 2168 limit := length/size 2169 for idx := 0; idx < limit; idx++ { 2170 buf = dst[idx].UnmarshalBytes(buf) 2171 } 2172 2173 // Handle any final partial object. buf is guaranteed to be long enough for the 2174 // final element, but may not contain valid data for the entire range. This may 2175 // result in unmarshalling zero values for some parts of the object. 2176 if length%size != 0 { 2177 dst[limit].UnmarshalBytes(buf) 2178 } 2179 2180 return length, err 2181 } 2182 2183 ptr := unsafe.Pointer(&dst) 2184 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2185 2186 // Construct a slice backed by dst's underlying memory. 2187 var buf []byte 2188 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2189 hdr.Data = uintptr(val) 2190 hdr.Len = size * count 2191 hdr.Cap = size * count 2192 2193 length, err := cc.CopyInBytes(addr, buf) 2194 // Since we bypassed the compiler's escape analysis, indicate that dst 2195 // must live until the use above. 2196 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 2197 return length, err 2198 } 2199 2200 // CopyStatxSliceOut copies a slice of Statx objects to the task's memory. 2201 func CopyStatxSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Statx) (int, error) { 2202 count := len(src) 2203 if count == 0 { 2204 return 0, nil 2205 } 2206 size := (*Statx)(nil).SizeBytes() 2207 2208 if !src[0].Packed() { 2209 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2210 buf := cc.CopyScratchBuffer(size * count) 2211 curBuf := buf 2212 for idx := 0; idx < count; idx++ { 2213 curBuf = src[idx].MarshalBytes(curBuf) 2214 } 2215 return cc.CopyOutBytes(addr, buf) 2216 } 2217 2218 ptr := unsafe.Pointer(&src) 2219 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2220 2221 // Construct a slice backed by dst's underlying memory. 2222 var buf []byte 2223 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2224 hdr.Data = uintptr(val) 2225 hdr.Len = size * count 2226 hdr.Cap = size * count 2227 2228 length, err := cc.CopyOutBytes(addr, buf) 2229 // Since we bypassed the compiler's escape analysis, indicate that src 2230 // must live until the use above. 2231 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2232 return length, err 2233 } 2234 2235 // MarshalUnsafeStatxSlice is like Statx.MarshalUnsafe, but for a []Statx. 2236 func MarshalUnsafeStatxSlice(src []Statx, dst []byte) []byte { 2237 count := len(src) 2238 if count == 0 { 2239 return dst 2240 } 2241 2242 if !src[0].Packed() { 2243 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2244 for idx := 0; idx < count; idx++ { 2245 dst = src[idx].MarshalBytes(dst) 2246 } 2247 return dst 2248 } 2249 2250 size := (*Statx)(nil).SizeBytes() 2251 buf := dst[:size*count] 2252 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2253 return dst[size*count:] 2254 } 2255 2256 // UnmarshalUnsafeStatxSlice is like Statx.UnmarshalUnsafe, but for a []Statx. 2257 func UnmarshalUnsafeStatxSlice(dst []Statx, src []byte) []byte { 2258 count := len(dst) 2259 if count == 0 { 2260 return src 2261 } 2262 2263 if !dst[0].Packed() { 2264 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2265 for idx := 0; idx < count; idx++ { 2266 src = dst[idx].UnmarshalBytes(src) 2267 } 2268 return src 2269 } 2270 2271 size := (*Statx)(nil).SizeBytes() 2272 buf := src[:size*count] 2273 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2274 return src[size*count:] 2275 } 2276 2277 // SizeBytes implements marshal.Marshallable.SizeBytes. 2278 func (s *Statfs) SizeBytes() int { 2279 return 80 + 2280 4*2 + 2281 8*4 2282 } 2283 2284 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2285 func (s *Statfs) MarshalBytes(dst []byte) []byte { 2286 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type)) 2287 dst = dst[8:] 2288 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize)) 2289 dst = dst[8:] 2290 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2291 dst = dst[8:] 2292 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksFree)) 2293 dst = dst[8:] 2294 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksAvailable)) 2295 dst = dst[8:] 2296 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Files)) 2297 dst = dst[8:] 2298 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FilesFree)) 2299 dst = dst[8:] 2300 for idx := 0; idx < 2; idx++ { 2301 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FSID[idx])) 2302 dst = dst[4:] 2303 } 2304 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength)) 2305 dst = dst[8:] 2306 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FragmentSize)) 2307 dst = dst[8:] 2308 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 2309 dst = dst[8:] 2310 for idx := 0; idx < 4; idx++ { 2311 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Spare[idx])) 2312 dst = dst[8:] 2313 } 2314 return dst 2315 } 2316 2317 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2318 func (s *Statfs) UnmarshalBytes(src []byte) []byte { 2319 s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2320 src = src[8:] 2321 s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2322 src = src[8:] 2323 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2324 src = src[8:] 2325 s.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2326 src = src[8:] 2327 s.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2328 src = src[8:] 2329 s.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2330 src = src[8:] 2331 s.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2332 src = src[8:] 2333 for idx := 0; idx < 2; idx++ { 2334 s.FSID[idx] = int32(hostarch.ByteOrder.Uint32(src[:4])) 2335 src = src[4:] 2336 } 2337 s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2338 src = src[8:] 2339 s.FragmentSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2340 src = src[8:] 2341 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2342 src = src[8:] 2343 for idx := 0; idx < 4; idx++ { 2344 s.Spare[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2345 src = src[8:] 2346 } 2347 return src 2348 } 2349 2350 // Packed implements marshal.Marshallable.Packed. 2351 //go:nosplit 2352 func (s *Statfs) Packed() bool { 2353 return true 2354 } 2355 2356 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2357 func (s *Statfs) MarshalUnsafe(dst []byte) []byte { 2358 size := s.SizeBytes() 2359 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2360 return dst[size:] 2361 } 2362 2363 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2364 func (s *Statfs) UnmarshalUnsafe(src []byte) []byte { 2365 size := s.SizeBytes() 2366 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2367 return src[size:] 2368 } 2369 2370 // CopyOutN implements marshal.Marshallable.CopyOutN. 2371 func (s *Statfs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2372 // Construct a slice backed by dst's underlying memory. 2373 var buf []byte 2374 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2375 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2376 hdr.Len = s.SizeBytes() 2377 hdr.Cap = s.SizeBytes() 2378 2379 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2380 // Since we bypassed the compiler's escape analysis, indicate that s 2381 // must live until the use above. 2382 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2383 return length, err 2384 } 2385 2386 // CopyOut implements marshal.Marshallable.CopyOut. 2387 func (s *Statfs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2388 return s.CopyOutN(cc, addr, s.SizeBytes()) 2389 } 2390 2391 // CopyIn implements marshal.Marshallable.CopyIn. 2392 func (s *Statfs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2393 // Construct a slice backed by dst's underlying memory. 2394 var buf []byte 2395 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2396 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2397 hdr.Len = s.SizeBytes() 2398 hdr.Cap = s.SizeBytes() 2399 2400 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2401 // Since we bypassed the compiler's escape analysis, indicate that s 2402 // must live until the use above. 2403 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2404 return length, err 2405 } 2406 2407 // WriteTo implements io.WriterTo.WriteTo. 2408 func (s *Statfs) WriteTo(writer io.Writer) (int64, error) { 2409 // Construct a slice backed by dst's underlying memory. 2410 var buf []byte 2411 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2412 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2413 hdr.Len = s.SizeBytes() 2414 hdr.Cap = s.SizeBytes() 2415 2416 length, err := writer.Write(buf) 2417 // Since we bypassed the compiler's escape analysis, indicate that s 2418 // must live until the use above. 2419 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2420 return int64(length), err 2421 } 2422 2423 // Packed implements marshal.Marshallable.Packed. 2424 //go:nosplit 2425 func (s *CString) Packed() bool { 2426 // Type CString is dynamic so it might have slice/string headers. Hence, it is not packed. 2427 return false 2428 } 2429 2430 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2431 func (s *CString) MarshalUnsafe(dst []byte) []byte { 2432 // Type CString doesn't have a packed layout in memory, fallback to MarshalBytes. 2433 return s.MarshalBytes(dst) 2434 } 2435 2436 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2437 func (s *CString) UnmarshalUnsafe(src []byte) []byte { 2438 // Type CString doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2439 return s.UnmarshalBytes(src) 2440 } 2441 2442 // CopyOutN implements marshal.Marshallable.CopyOutN. 2443 //go:nosplit 2444 func (s *CString) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2445 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2446 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2447 s.MarshalBytes(buf) // escapes: fallback. 2448 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2449 } 2450 2451 // CopyOut implements marshal.Marshallable.CopyOut. 2452 func (s *CString) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2453 return s.CopyOutN(cc, addr, s.SizeBytes()) 2454 } 2455 2456 // CopyIn implements marshal.Marshallable.CopyIn. 2457 func (s *CString) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2458 // Type CString doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2459 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2460 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2461 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2462 // partially unmarshalled struct. 2463 s.UnmarshalBytes(buf) // escapes: fallback. 2464 return length, err 2465 } 2466 2467 // WriteTo implements io.WriterTo.WriteTo. 2468 func (s *CString) WriteTo(writer io.Writer) (int64, error) { 2469 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2470 buf := make([]byte, s.SizeBytes()) 2471 s.MarshalBytes(buf) 2472 length, err := writer.Write(buf) 2473 return int64(length), err 2474 } 2475 2476 // SizeBytes implements marshal.Marshallable.SizeBytes. 2477 func (f *FUSEAccessIn) SizeBytes() int { 2478 return 8 2479 } 2480 2481 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2482 func (f *FUSEAccessIn) MarshalBytes(dst []byte) []byte { 2483 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mask)) 2484 dst = dst[4:] 2485 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2486 dst = dst[4:] 2487 return dst 2488 } 2489 2490 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2491 func (f *FUSEAccessIn) UnmarshalBytes(src []byte) []byte { 2492 f.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2493 src = src[4:] 2494 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2495 src = src[4:] 2496 return src 2497 } 2498 2499 // Packed implements marshal.Marshallable.Packed. 2500 //go:nosplit 2501 func (f *FUSEAccessIn) Packed() bool { 2502 return true 2503 } 2504 2505 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2506 func (f *FUSEAccessIn) MarshalUnsafe(dst []byte) []byte { 2507 size := f.SizeBytes() 2508 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2509 return dst[size:] 2510 } 2511 2512 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2513 func (f *FUSEAccessIn) UnmarshalUnsafe(src []byte) []byte { 2514 size := f.SizeBytes() 2515 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2516 return src[size:] 2517 } 2518 2519 // CopyOutN implements marshal.Marshallable.CopyOutN. 2520 func (f *FUSEAccessIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2521 // Construct a slice backed by dst's underlying memory. 2522 var buf []byte 2523 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2524 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2525 hdr.Len = f.SizeBytes() 2526 hdr.Cap = f.SizeBytes() 2527 2528 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2529 // Since we bypassed the compiler's escape analysis, indicate that f 2530 // must live until the use above. 2531 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2532 return length, err 2533 } 2534 2535 // CopyOut implements marshal.Marshallable.CopyOut. 2536 func (f *FUSEAccessIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2537 return f.CopyOutN(cc, addr, f.SizeBytes()) 2538 } 2539 2540 // CopyIn implements marshal.Marshallable.CopyIn. 2541 func (f *FUSEAccessIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2542 // Construct a slice backed by dst's underlying memory. 2543 var buf []byte 2544 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2545 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2546 hdr.Len = f.SizeBytes() 2547 hdr.Cap = f.SizeBytes() 2548 2549 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2550 // Since we bypassed the compiler's escape analysis, indicate that f 2551 // must live until the use above. 2552 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2553 return length, err 2554 } 2555 2556 // WriteTo implements io.WriterTo.WriteTo. 2557 func (f *FUSEAccessIn) WriteTo(writer io.Writer) (int64, error) { 2558 // Construct a slice backed by dst's underlying memory. 2559 var buf []byte 2560 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2561 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2562 hdr.Len = f.SizeBytes() 2563 hdr.Cap = f.SizeBytes() 2564 2565 length, err := writer.Write(buf) 2566 // Since we bypassed the compiler's escape analysis, indicate that f 2567 // must live until the use above. 2568 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2569 return int64(length), err 2570 } 2571 2572 // SizeBytes implements marshal.Marshallable.SizeBytes. 2573 func (a *FUSEAttr) SizeBytes() int { 2574 return 88 2575 } 2576 2577 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2578 func (a *FUSEAttr) MarshalBytes(dst []byte) []byte { 2579 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ino)) 2580 dst = dst[8:] 2581 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Size)) 2582 dst = dst[8:] 2583 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Blocks)) 2584 dst = dst[8:] 2585 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Atime)) 2586 dst = dst[8:] 2587 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Mtime)) 2588 dst = dst[8:] 2589 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ctime)) 2590 dst = dst[8:] 2591 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.AtimeNsec)) 2592 dst = dst[4:] 2593 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.MtimeNsec)) 2594 dst = dst[4:] 2595 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.CtimeNsec)) 2596 dst = dst[4:] 2597 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Mode)) 2598 dst = dst[4:] 2599 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Nlink)) 2600 dst = dst[4:] 2601 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.UID)) 2602 dst = dst[4:] 2603 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.GID)) 2604 dst = dst[4:] 2605 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Rdev)) 2606 dst = dst[4:] 2607 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.BlkSize)) 2608 dst = dst[4:] 2609 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2610 dst = dst[4:] 2611 return dst 2612 } 2613 2614 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2615 func (a *FUSEAttr) UnmarshalBytes(src []byte) []byte { 2616 a.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2617 src = src[8:] 2618 a.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2619 src = src[8:] 2620 a.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2621 src = src[8:] 2622 a.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2623 src = src[8:] 2624 a.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2625 src = src[8:] 2626 a.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2627 src = src[8:] 2628 a.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2629 src = src[4:] 2630 a.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2631 src = src[4:] 2632 a.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2633 src = src[4:] 2634 a.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2635 src = src[4:] 2636 a.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2637 src = src[4:] 2638 a.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2639 src = src[4:] 2640 a.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2641 src = src[4:] 2642 a.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2643 src = src[4:] 2644 a.BlkSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2645 src = src[4:] 2646 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2647 src = src[4:] 2648 return src 2649 } 2650 2651 // Packed implements marshal.Marshallable.Packed. 2652 //go:nosplit 2653 func (a *FUSEAttr) Packed() bool { 2654 return true 2655 } 2656 2657 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2658 func (a *FUSEAttr) MarshalUnsafe(dst []byte) []byte { 2659 size := a.SizeBytes() 2660 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size)) 2661 return dst[size:] 2662 } 2663 2664 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2665 func (a *FUSEAttr) UnmarshalUnsafe(src []byte) []byte { 2666 size := a.SizeBytes() 2667 gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size)) 2668 return src[size:] 2669 } 2670 2671 // CopyOutN implements marshal.Marshallable.CopyOutN. 2672 func (a *FUSEAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2673 // Construct a slice backed by dst's underlying memory. 2674 var buf []byte 2675 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2676 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2677 hdr.Len = a.SizeBytes() 2678 hdr.Cap = a.SizeBytes() 2679 2680 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2681 // Since we bypassed the compiler's escape analysis, indicate that a 2682 // must live until the use above. 2683 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2684 return length, err 2685 } 2686 2687 // CopyOut implements marshal.Marshallable.CopyOut. 2688 func (a *FUSEAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2689 return a.CopyOutN(cc, addr, a.SizeBytes()) 2690 } 2691 2692 // CopyIn implements marshal.Marshallable.CopyIn. 2693 func (a *FUSEAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2694 // Construct a slice backed by dst's underlying memory. 2695 var buf []byte 2696 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2697 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2698 hdr.Len = a.SizeBytes() 2699 hdr.Cap = a.SizeBytes() 2700 2701 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2702 // Since we bypassed the compiler's escape analysis, indicate that a 2703 // must live until the use above. 2704 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2705 return length, err 2706 } 2707 2708 // WriteTo implements io.WriterTo.WriteTo. 2709 func (a *FUSEAttr) WriteTo(writer io.Writer) (int64, error) { 2710 // Construct a slice backed by dst's underlying memory. 2711 var buf []byte 2712 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2713 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2714 hdr.Len = a.SizeBytes() 2715 hdr.Cap = a.SizeBytes() 2716 2717 length, err := writer.Write(buf) 2718 // Since we bypassed the compiler's escape analysis, indicate that a 2719 // must live until the use above. 2720 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2721 return int64(length), err 2722 } 2723 2724 // SizeBytes implements marshal.Marshallable.SizeBytes. 2725 func (f *FUSEAttrOut) SizeBytes() int { 2726 return 16 + 2727 (*FUSEAttr)(nil).SizeBytes() 2728 } 2729 2730 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2731 func (f *FUSEAttrOut) MarshalBytes(dst []byte) []byte { 2732 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 2733 dst = dst[8:] 2734 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNsec)) 2735 dst = dst[4:] 2736 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2737 dst = dst[4:] 2738 dst = f.Attr.MarshalUnsafe(dst) 2739 return dst 2740 } 2741 2742 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2743 func (f *FUSEAttrOut) UnmarshalBytes(src []byte) []byte { 2744 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2745 src = src[8:] 2746 f.AttrValidNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2747 src = src[4:] 2748 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2749 src = src[4:] 2750 src = f.Attr.UnmarshalUnsafe(src) 2751 return src 2752 } 2753 2754 // Packed implements marshal.Marshallable.Packed. 2755 //go:nosplit 2756 func (f *FUSEAttrOut) Packed() bool { 2757 return f.Attr.Packed() 2758 } 2759 2760 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2761 func (f *FUSEAttrOut) MarshalUnsafe(dst []byte) []byte { 2762 if f.Attr.Packed() { 2763 size := f.SizeBytes() 2764 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2765 return dst[size:] 2766 } 2767 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes. 2768 return f.MarshalBytes(dst) 2769 } 2770 2771 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2772 func (f *FUSEAttrOut) UnmarshalUnsafe(src []byte) []byte { 2773 if f.Attr.Packed() { 2774 size := f.SizeBytes() 2775 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2776 return src[size:] 2777 } 2778 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2779 return f.UnmarshalBytes(src) 2780 } 2781 2782 // CopyOutN implements marshal.Marshallable.CopyOutN. 2783 func (f *FUSEAttrOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2784 if !f.Attr.Packed() { 2785 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 2786 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 2787 f.MarshalBytes(buf) // escapes: fallback. 2788 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2789 } 2790 2791 // Construct a slice backed by dst's underlying memory. 2792 var buf []byte 2793 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2794 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2795 hdr.Len = f.SizeBytes() 2796 hdr.Cap = f.SizeBytes() 2797 2798 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2799 // Since we bypassed the compiler's escape analysis, indicate that f 2800 // must live until the use above. 2801 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2802 return length, err 2803 } 2804 2805 // CopyOut implements marshal.Marshallable.CopyOut. 2806 func (f *FUSEAttrOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2807 return f.CopyOutN(cc, addr, f.SizeBytes()) 2808 } 2809 2810 // CopyIn implements marshal.Marshallable.CopyIn. 2811 func (f *FUSEAttrOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2812 if !f.Attr.Packed() { 2813 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2814 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 2815 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2816 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2817 // partially unmarshalled struct. 2818 f.UnmarshalBytes(buf) // escapes: fallback. 2819 return length, err 2820 } 2821 2822 // Construct a slice backed by dst's underlying memory. 2823 var buf []byte 2824 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2825 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2826 hdr.Len = f.SizeBytes() 2827 hdr.Cap = f.SizeBytes() 2828 2829 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2830 // Since we bypassed the compiler's escape analysis, indicate that f 2831 // must live until the use above. 2832 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2833 return length, err 2834 } 2835 2836 // WriteTo implements io.WriterTo.WriteTo. 2837 func (f *FUSEAttrOut) WriteTo(writer io.Writer) (int64, error) { 2838 if !f.Attr.Packed() { 2839 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 2840 buf := make([]byte, f.SizeBytes()) 2841 f.MarshalBytes(buf) 2842 length, err := writer.Write(buf) 2843 return int64(length), err 2844 } 2845 2846 // Construct a slice backed by dst's underlying memory. 2847 var buf []byte 2848 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2849 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2850 hdr.Len = f.SizeBytes() 2851 hdr.Cap = f.SizeBytes() 2852 2853 length, err := writer.Write(buf) 2854 // Since we bypassed the compiler's escape analysis, indicate that f 2855 // must live until the use above. 2856 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2857 return int64(length), err 2858 } 2859 2860 // Packed implements marshal.Marshallable.Packed. 2861 //go:nosplit 2862 func (r *FUSECreateIn) Packed() bool { 2863 // Type FUSECreateIn is dynamic so it might have slice/string headers. Hence, it is not packed. 2864 return false 2865 } 2866 2867 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2868 func (r *FUSECreateIn) MarshalUnsafe(dst []byte) []byte { 2869 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to MarshalBytes. 2870 return r.MarshalBytes(dst) 2871 } 2872 2873 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2874 func (r *FUSECreateIn) UnmarshalUnsafe(src []byte) []byte { 2875 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2876 return r.UnmarshalBytes(src) 2877 } 2878 2879 // CopyOutN implements marshal.Marshallable.CopyOutN. 2880 //go:nosplit 2881 func (r *FUSECreateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2882 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 2883 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2884 r.MarshalBytes(buf) // escapes: fallback. 2885 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2886 } 2887 2888 // CopyOut implements marshal.Marshallable.CopyOut. 2889 func (r *FUSECreateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2890 return r.CopyOutN(cc, addr, r.SizeBytes()) 2891 } 2892 2893 // CopyIn implements marshal.Marshallable.CopyIn. 2894 func (r *FUSECreateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2895 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2896 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2897 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2898 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2899 // partially unmarshalled struct. 2900 r.UnmarshalBytes(buf) // escapes: fallback. 2901 return length, err 2902 } 2903 2904 // WriteTo implements io.WriterTo.WriteTo. 2905 func (r *FUSECreateIn) WriteTo(writer io.Writer) (int64, error) { 2906 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 2907 buf := make([]byte, r.SizeBytes()) 2908 r.MarshalBytes(buf) 2909 length, err := writer.Write(buf) 2910 return int64(length), err 2911 } 2912 2913 // SizeBytes implements marshal.Marshallable.SizeBytes. 2914 func (f *FUSECreateMeta) SizeBytes() int { 2915 return 16 2916 } 2917 2918 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2919 func (f *FUSECreateMeta) MarshalBytes(dst []byte) []byte { 2920 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 2921 dst = dst[4:] 2922 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 2923 dst = dst[4:] 2924 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 2925 dst = dst[4:] 2926 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2927 dst = dst[4:] 2928 return dst 2929 } 2930 2931 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2932 func (f *FUSECreateMeta) UnmarshalBytes(src []byte) []byte { 2933 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2934 src = src[4:] 2935 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2936 src = src[4:] 2937 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2938 src = src[4:] 2939 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2940 src = src[4:] 2941 return src 2942 } 2943 2944 // Packed implements marshal.Marshallable.Packed. 2945 //go:nosplit 2946 func (f *FUSECreateMeta) Packed() bool { 2947 return true 2948 } 2949 2950 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2951 func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) []byte { 2952 size := f.SizeBytes() 2953 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2954 return dst[size:] 2955 } 2956 2957 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2958 func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) []byte { 2959 size := f.SizeBytes() 2960 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2961 return src[size:] 2962 } 2963 2964 // CopyOutN implements marshal.Marshallable.CopyOutN. 2965 func (f *FUSECreateMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2966 // Construct a slice backed by dst's underlying memory. 2967 var buf []byte 2968 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2969 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2970 hdr.Len = f.SizeBytes() 2971 hdr.Cap = f.SizeBytes() 2972 2973 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2974 // Since we bypassed the compiler's escape analysis, indicate that f 2975 // must live until the use above. 2976 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2977 return length, err 2978 } 2979 2980 // CopyOut implements marshal.Marshallable.CopyOut. 2981 func (f *FUSECreateMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2982 return f.CopyOutN(cc, addr, f.SizeBytes()) 2983 } 2984 2985 // CopyIn implements marshal.Marshallable.CopyIn. 2986 func (f *FUSECreateMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2987 // Construct a slice backed by dst's underlying memory. 2988 var buf []byte 2989 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2990 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2991 hdr.Len = f.SizeBytes() 2992 hdr.Cap = f.SizeBytes() 2993 2994 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2995 // Since we bypassed the compiler's escape analysis, indicate that f 2996 // must live until the use above. 2997 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2998 return length, err 2999 } 3000 3001 // WriteTo implements io.WriterTo.WriteTo. 3002 func (f *FUSECreateMeta) WriteTo(writer io.Writer) (int64, error) { 3003 // Construct a slice backed by dst's underlying memory. 3004 var buf []byte 3005 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3006 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3007 hdr.Len = f.SizeBytes() 3008 hdr.Cap = f.SizeBytes() 3009 3010 length, err := writer.Write(buf) 3011 // Since we bypassed the compiler's escape analysis, indicate that f 3012 // must live until the use above. 3013 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3014 return int64(length), err 3015 } 3016 3017 // SizeBytes implements marshal.Marshallable.SizeBytes. 3018 func (f *FUSECreateOut) SizeBytes() int { 3019 return 0 + 3020 (*FUSEEntryOut)(nil).SizeBytes() + 3021 (*FUSEOpenOut)(nil).SizeBytes() 3022 } 3023 3024 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3025 func (f *FUSECreateOut) MarshalBytes(dst []byte) []byte { 3026 dst = f.FUSEEntryOut.MarshalUnsafe(dst) 3027 dst = f.FUSEOpenOut.MarshalUnsafe(dst) 3028 return dst 3029 } 3030 3031 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3032 func (f *FUSECreateOut) UnmarshalBytes(src []byte) []byte { 3033 src = f.FUSEEntryOut.UnmarshalUnsafe(src) 3034 src = f.FUSEOpenOut.UnmarshalUnsafe(src) 3035 return src 3036 } 3037 3038 // Packed implements marshal.Marshallable.Packed. 3039 //go:nosplit 3040 func (f *FUSECreateOut) Packed() bool { 3041 return f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() 3042 } 3043 3044 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3045 func (f *FUSECreateOut) MarshalUnsafe(dst []byte) []byte { 3046 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3047 size := f.SizeBytes() 3048 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3049 return dst[size:] 3050 } 3051 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3052 return f.MarshalBytes(dst) 3053 } 3054 3055 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3056 func (f *FUSECreateOut) UnmarshalUnsafe(src []byte) []byte { 3057 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3058 size := f.SizeBytes() 3059 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3060 return src[size:] 3061 } 3062 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3063 return f.UnmarshalBytes(src) 3064 } 3065 3066 // CopyOutN implements marshal.Marshallable.CopyOutN. 3067 func (f *FUSECreateOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3068 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3069 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3070 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3071 f.MarshalBytes(buf) // escapes: fallback. 3072 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3073 } 3074 3075 // Construct a slice backed by dst's underlying memory. 3076 var buf []byte 3077 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3078 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3079 hdr.Len = f.SizeBytes() 3080 hdr.Cap = f.SizeBytes() 3081 3082 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3083 // Since we bypassed the compiler's escape analysis, indicate that f 3084 // must live until the use above. 3085 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3086 return length, err 3087 } 3088 3089 // CopyOut implements marshal.Marshallable.CopyOut. 3090 func (f *FUSECreateOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3091 return f.CopyOutN(cc, addr, f.SizeBytes()) 3092 } 3093 3094 // CopyIn implements marshal.Marshallable.CopyIn. 3095 func (f *FUSECreateOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3096 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3097 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3098 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3099 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3100 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3101 // partially unmarshalled struct. 3102 f.UnmarshalBytes(buf) // escapes: fallback. 3103 return length, err 3104 } 3105 3106 // Construct a slice backed by dst's underlying memory. 3107 var buf []byte 3108 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3109 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3110 hdr.Len = f.SizeBytes() 3111 hdr.Cap = f.SizeBytes() 3112 3113 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3114 // Since we bypassed the compiler's escape analysis, indicate that f 3115 // must live until the use above. 3116 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3117 return length, err 3118 } 3119 3120 // WriteTo implements io.WriterTo.WriteTo. 3121 func (f *FUSECreateOut) WriteTo(writer io.Writer) (int64, error) { 3122 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3123 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3124 buf := make([]byte, f.SizeBytes()) 3125 f.MarshalBytes(buf) 3126 length, err := writer.Write(buf) 3127 return int64(length), err 3128 } 3129 3130 // Construct a slice backed by dst's underlying memory. 3131 var buf []byte 3132 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3133 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3134 hdr.Len = f.SizeBytes() 3135 hdr.Cap = f.SizeBytes() 3136 3137 length, err := writer.Write(buf) 3138 // Since we bypassed the compiler's escape analysis, indicate that f 3139 // must live until the use above. 3140 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3141 return int64(length), err 3142 } 3143 3144 // Packed implements marshal.Marshallable.Packed. 3145 //go:nosplit 3146 func (r *FUSEDirent) Packed() bool { 3147 // Type FUSEDirent is dynamic so it might have slice/string headers. Hence, it is not packed. 3148 return false 3149 } 3150 3151 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3152 func (r *FUSEDirent) MarshalUnsafe(dst []byte) []byte { 3153 // Type FUSEDirent doesn't have a packed layout in memory, fallback to MarshalBytes. 3154 return r.MarshalBytes(dst) 3155 } 3156 3157 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3158 func (r *FUSEDirent) UnmarshalUnsafe(src []byte) []byte { 3159 // Type FUSEDirent doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3160 return r.UnmarshalBytes(src) 3161 } 3162 3163 // CopyOutN implements marshal.Marshallable.CopyOutN. 3164 //go:nosplit 3165 func (r *FUSEDirent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3166 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3167 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3168 r.MarshalBytes(buf) // escapes: fallback. 3169 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3170 } 3171 3172 // CopyOut implements marshal.Marshallable.CopyOut. 3173 func (r *FUSEDirent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3174 return r.CopyOutN(cc, addr, r.SizeBytes()) 3175 } 3176 3177 // CopyIn implements marshal.Marshallable.CopyIn. 3178 func (r *FUSEDirent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3179 // Type FUSEDirent doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3180 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3181 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3182 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3183 // partially unmarshalled struct. 3184 r.UnmarshalBytes(buf) // escapes: fallback. 3185 return length, err 3186 } 3187 3188 // WriteTo implements io.WriterTo.WriteTo. 3189 func (r *FUSEDirent) WriteTo(writer io.Writer) (int64, error) { 3190 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3191 buf := make([]byte, r.SizeBytes()) 3192 r.MarshalBytes(buf) 3193 length, err := writer.Write(buf) 3194 return int64(length), err 3195 } 3196 3197 // SizeBytes implements marshal.Marshallable.SizeBytes. 3198 func (f *FUSEDirentMeta) SizeBytes() int { 3199 return 24 3200 } 3201 3202 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3203 func (f *FUSEDirentMeta) MarshalBytes(dst []byte) []byte { 3204 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino)) 3205 dst = dst[8:] 3206 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Off)) 3207 dst = dst[8:] 3208 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLen)) 3209 dst = dst[4:] 3210 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 3211 dst = dst[4:] 3212 return dst 3213 } 3214 3215 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3216 func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) []byte { 3217 f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3218 src = src[8:] 3219 f.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3220 src = src[8:] 3221 f.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3222 src = src[4:] 3223 f.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3224 src = src[4:] 3225 return src 3226 } 3227 3228 // Packed implements marshal.Marshallable.Packed. 3229 //go:nosplit 3230 func (f *FUSEDirentMeta) Packed() bool { 3231 return true 3232 } 3233 3234 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3235 func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) []byte { 3236 size := f.SizeBytes() 3237 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3238 return dst[size:] 3239 } 3240 3241 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3242 func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) []byte { 3243 size := f.SizeBytes() 3244 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3245 return src[size:] 3246 } 3247 3248 // CopyOutN implements marshal.Marshallable.CopyOutN. 3249 func (f *FUSEDirentMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3250 // Construct a slice backed by dst's underlying memory. 3251 var buf []byte 3252 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3253 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3254 hdr.Len = f.SizeBytes() 3255 hdr.Cap = f.SizeBytes() 3256 3257 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3258 // Since we bypassed the compiler's escape analysis, indicate that f 3259 // must live until the use above. 3260 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3261 return length, err 3262 } 3263 3264 // CopyOut implements marshal.Marshallable.CopyOut. 3265 func (f *FUSEDirentMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3266 return f.CopyOutN(cc, addr, f.SizeBytes()) 3267 } 3268 3269 // CopyIn implements marshal.Marshallable.CopyIn. 3270 func (f *FUSEDirentMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3271 // Construct a slice backed by dst's underlying memory. 3272 var buf []byte 3273 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3274 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3275 hdr.Len = f.SizeBytes() 3276 hdr.Cap = f.SizeBytes() 3277 3278 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3279 // Since we bypassed the compiler's escape analysis, indicate that f 3280 // must live until the use above. 3281 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3282 return length, err 3283 } 3284 3285 // WriteTo implements io.WriterTo.WriteTo. 3286 func (f *FUSEDirentMeta) WriteTo(writer io.Writer) (int64, error) { 3287 // Construct a slice backed by dst's underlying memory. 3288 var buf []byte 3289 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3290 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3291 hdr.Len = f.SizeBytes() 3292 hdr.Cap = f.SizeBytes() 3293 3294 length, err := writer.Write(buf) 3295 // Since we bypassed the compiler's escape analysis, indicate that f 3296 // must live until the use above. 3297 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3298 return int64(length), err 3299 } 3300 3301 // Packed implements marshal.Marshallable.Packed. 3302 //go:nosplit 3303 func (r *FUSEDirents) Packed() bool { 3304 // Type FUSEDirents is dynamic so it might have slice/string headers. Hence, it is not packed. 3305 return false 3306 } 3307 3308 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3309 func (r *FUSEDirents) MarshalUnsafe(dst []byte) []byte { 3310 // Type FUSEDirents doesn't have a packed layout in memory, fallback to MarshalBytes. 3311 return r.MarshalBytes(dst) 3312 } 3313 3314 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3315 func (r *FUSEDirents) UnmarshalUnsafe(src []byte) []byte { 3316 // Type FUSEDirents doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3317 return r.UnmarshalBytes(src) 3318 } 3319 3320 // CopyOutN implements marshal.Marshallable.CopyOutN. 3321 //go:nosplit 3322 func (r *FUSEDirents) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3323 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3324 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3325 r.MarshalBytes(buf) // escapes: fallback. 3326 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3327 } 3328 3329 // CopyOut implements marshal.Marshallable.CopyOut. 3330 func (r *FUSEDirents) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3331 return r.CopyOutN(cc, addr, r.SizeBytes()) 3332 } 3333 3334 // CopyIn implements marshal.Marshallable.CopyIn. 3335 func (r *FUSEDirents) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3336 // Type FUSEDirents doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3337 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3338 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3339 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3340 // partially unmarshalled struct. 3341 r.UnmarshalBytes(buf) // escapes: fallback. 3342 return length, err 3343 } 3344 3345 // WriteTo implements io.WriterTo.WriteTo. 3346 func (r *FUSEDirents) WriteTo(writer io.Writer) (int64, error) { 3347 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3348 buf := make([]byte, r.SizeBytes()) 3349 r.MarshalBytes(buf) 3350 length, err := writer.Write(buf) 3351 return int64(length), err 3352 } 3353 3354 // Packed implements marshal.Marshallable.Packed. 3355 //go:nosplit 3356 func (r *FUSEEmptyIn) Packed() bool { 3357 // Type FUSEEmptyIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3358 return false 3359 } 3360 3361 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3362 func (r *FUSEEmptyIn) MarshalUnsafe(dst []byte) []byte { 3363 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3364 return r.MarshalBytes(dst) 3365 } 3366 3367 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3368 func (r *FUSEEmptyIn) UnmarshalUnsafe(src []byte) []byte { 3369 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3370 return r.UnmarshalBytes(src) 3371 } 3372 3373 // CopyOutN implements marshal.Marshallable.CopyOutN. 3374 //go:nosplit 3375 func (r *FUSEEmptyIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3376 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3377 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3378 r.MarshalBytes(buf) // escapes: fallback. 3379 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3380 } 3381 3382 // CopyOut implements marshal.Marshallable.CopyOut. 3383 func (r *FUSEEmptyIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3384 return r.CopyOutN(cc, addr, r.SizeBytes()) 3385 } 3386 3387 // CopyIn implements marshal.Marshallable.CopyIn. 3388 func (r *FUSEEmptyIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3389 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3390 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3391 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3392 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3393 // partially unmarshalled struct. 3394 r.UnmarshalBytes(buf) // escapes: fallback. 3395 return length, err 3396 } 3397 3398 // WriteTo implements io.WriterTo.WriteTo. 3399 func (r *FUSEEmptyIn) WriteTo(writer io.Writer) (int64, error) { 3400 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3401 buf := make([]byte, r.SizeBytes()) 3402 r.MarshalBytes(buf) 3403 length, err := writer.Write(buf) 3404 return int64(length), err 3405 } 3406 3407 // SizeBytes implements marshal.Marshallable.SizeBytes. 3408 func (f *FUSEEntryOut) SizeBytes() int { 3409 return 40 + 3410 (*FUSEAttr)(nil).SizeBytes() 3411 } 3412 3413 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3414 func (f *FUSEEntryOut) MarshalBytes(dst []byte) []byte { 3415 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3416 dst = dst[8:] 3417 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Generation)) 3418 dst = dst[8:] 3419 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.EntryValid)) 3420 dst = dst[8:] 3421 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 3422 dst = dst[8:] 3423 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.EntryValidNSec)) 3424 dst = dst[4:] 3425 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNSec)) 3426 dst = dst[4:] 3427 dst = f.Attr.MarshalUnsafe(dst) 3428 return dst 3429 } 3430 3431 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3432 func (f *FUSEEntryOut) UnmarshalBytes(src []byte) []byte { 3433 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3434 src = src[8:] 3435 f.Generation = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3436 src = src[8:] 3437 f.EntryValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3438 src = src[8:] 3439 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3440 src = src[8:] 3441 f.EntryValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3442 src = src[4:] 3443 f.AttrValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3444 src = src[4:] 3445 src = f.Attr.UnmarshalUnsafe(src) 3446 return src 3447 } 3448 3449 // Packed implements marshal.Marshallable.Packed. 3450 //go:nosplit 3451 func (f *FUSEEntryOut) Packed() bool { 3452 return f.Attr.Packed() 3453 } 3454 3455 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3456 func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) []byte { 3457 if f.Attr.Packed() { 3458 size := f.SizeBytes() 3459 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3460 return dst[size:] 3461 } 3462 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3463 return f.MarshalBytes(dst) 3464 } 3465 3466 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3467 func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) []byte { 3468 if f.Attr.Packed() { 3469 size := f.SizeBytes() 3470 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3471 return src[size:] 3472 } 3473 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3474 return f.UnmarshalBytes(src) 3475 } 3476 3477 // CopyOutN implements marshal.Marshallable.CopyOutN. 3478 func (f *FUSEEntryOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3479 if !f.Attr.Packed() { 3480 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3481 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3482 f.MarshalBytes(buf) // escapes: fallback. 3483 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3484 } 3485 3486 // Construct a slice backed by dst's underlying memory. 3487 var buf []byte 3488 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3489 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3490 hdr.Len = f.SizeBytes() 3491 hdr.Cap = f.SizeBytes() 3492 3493 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3494 // Since we bypassed the compiler's escape analysis, indicate that f 3495 // must live until the use above. 3496 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3497 return length, err 3498 } 3499 3500 // CopyOut implements marshal.Marshallable.CopyOut. 3501 func (f *FUSEEntryOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3502 return f.CopyOutN(cc, addr, f.SizeBytes()) 3503 } 3504 3505 // CopyIn implements marshal.Marshallable.CopyIn. 3506 func (f *FUSEEntryOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3507 if !f.Attr.Packed() { 3508 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3509 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3510 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3511 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3512 // partially unmarshalled struct. 3513 f.UnmarshalBytes(buf) // escapes: fallback. 3514 return length, err 3515 } 3516 3517 // Construct a slice backed by dst's underlying memory. 3518 var buf []byte 3519 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3520 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3521 hdr.Len = f.SizeBytes() 3522 hdr.Cap = f.SizeBytes() 3523 3524 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3525 // Since we bypassed the compiler's escape analysis, indicate that f 3526 // must live until the use above. 3527 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3528 return length, err 3529 } 3530 3531 // WriteTo implements io.WriterTo.WriteTo. 3532 func (f *FUSEEntryOut) WriteTo(writer io.Writer) (int64, error) { 3533 if !f.Attr.Packed() { 3534 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3535 buf := make([]byte, f.SizeBytes()) 3536 f.MarshalBytes(buf) 3537 length, err := writer.Write(buf) 3538 return int64(length), err 3539 } 3540 3541 // Construct a slice backed by dst's underlying memory. 3542 var buf []byte 3543 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3544 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3545 hdr.Len = f.SizeBytes() 3546 hdr.Cap = f.SizeBytes() 3547 3548 length, err := writer.Write(buf) 3549 // Since we bypassed the compiler's escape analysis, indicate that f 3550 // must live until the use above. 3551 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3552 return int64(length), err 3553 } 3554 3555 // SizeBytes implements marshal.Marshallable.SizeBytes. 3556 func (f *FUSEFallocateIn) SizeBytes() int { 3557 return 32 3558 } 3559 3560 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3561 func (f *FUSEFallocateIn) MarshalBytes(dst []byte) []byte { 3562 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3563 dst = dst[8:] 3564 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 3565 dst = dst[8:] 3566 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Length)) 3567 dst = dst[8:] 3568 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 3569 dst = dst[4:] 3570 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3571 dst = dst[4:] 3572 return dst 3573 } 3574 3575 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3576 func (f *FUSEFallocateIn) UnmarshalBytes(src []byte) []byte { 3577 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3578 src = src[8:] 3579 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3580 src = src[8:] 3581 f.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3582 src = src[8:] 3583 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3584 src = src[4:] 3585 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3586 src = src[4:] 3587 return src 3588 } 3589 3590 // Packed implements marshal.Marshallable.Packed. 3591 //go:nosplit 3592 func (f *FUSEFallocateIn) Packed() bool { 3593 return true 3594 } 3595 3596 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3597 func (f *FUSEFallocateIn) MarshalUnsafe(dst []byte) []byte { 3598 size := f.SizeBytes() 3599 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3600 return dst[size:] 3601 } 3602 3603 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3604 func (f *FUSEFallocateIn) UnmarshalUnsafe(src []byte) []byte { 3605 size := f.SizeBytes() 3606 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3607 return src[size:] 3608 } 3609 3610 // CopyOutN implements marshal.Marshallable.CopyOutN. 3611 func (f *FUSEFallocateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3612 // Construct a slice backed by dst's underlying memory. 3613 var buf []byte 3614 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3615 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3616 hdr.Len = f.SizeBytes() 3617 hdr.Cap = f.SizeBytes() 3618 3619 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3620 // Since we bypassed the compiler's escape analysis, indicate that f 3621 // must live until the use above. 3622 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3623 return length, err 3624 } 3625 3626 // CopyOut implements marshal.Marshallable.CopyOut. 3627 func (f *FUSEFallocateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3628 return f.CopyOutN(cc, addr, f.SizeBytes()) 3629 } 3630 3631 // CopyIn implements marshal.Marshallable.CopyIn. 3632 func (f *FUSEFallocateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3633 // Construct a slice backed by dst's underlying memory. 3634 var buf []byte 3635 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3636 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3637 hdr.Len = f.SizeBytes() 3638 hdr.Cap = f.SizeBytes() 3639 3640 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3641 // Since we bypassed the compiler's escape analysis, indicate that f 3642 // must live until the use above. 3643 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3644 return length, err 3645 } 3646 3647 // WriteTo implements io.WriterTo.WriteTo. 3648 func (f *FUSEFallocateIn) WriteTo(writer io.Writer) (int64, error) { 3649 // Construct a slice backed by dst's underlying memory. 3650 var buf []byte 3651 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3652 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3653 hdr.Len = f.SizeBytes() 3654 hdr.Cap = f.SizeBytes() 3655 3656 length, err := writer.Write(buf) 3657 // Since we bypassed the compiler's escape analysis, indicate that f 3658 // must live until the use above. 3659 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3660 return int64(length), err 3661 } 3662 3663 // SizeBytes implements marshal.Marshallable.SizeBytes. 3664 func (f *FUSEFsyncIn) SizeBytes() int { 3665 return 16 3666 } 3667 3668 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3669 func (f *FUSEFsyncIn) MarshalBytes(dst []byte) []byte { 3670 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3671 dst = dst[8:] 3672 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FsyncFlags)) 3673 dst = dst[4:] 3674 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3675 dst = dst[4:] 3676 return dst 3677 } 3678 3679 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3680 func (f *FUSEFsyncIn) UnmarshalBytes(src []byte) []byte { 3681 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3682 src = src[8:] 3683 f.FsyncFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3684 src = src[4:] 3685 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3686 src = src[4:] 3687 return src 3688 } 3689 3690 // Packed implements marshal.Marshallable.Packed. 3691 //go:nosplit 3692 func (f *FUSEFsyncIn) Packed() bool { 3693 return true 3694 } 3695 3696 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3697 func (f *FUSEFsyncIn) MarshalUnsafe(dst []byte) []byte { 3698 size := f.SizeBytes() 3699 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3700 return dst[size:] 3701 } 3702 3703 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3704 func (f *FUSEFsyncIn) UnmarshalUnsafe(src []byte) []byte { 3705 size := f.SizeBytes() 3706 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3707 return src[size:] 3708 } 3709 3710 // CopyOutN implements marshal.Marshallable.CopyOutN. 3711 func (f *FUSEFsyncIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3712 // Construct a slice backed by dst's underlying memory. 3713 var buf []byte 3714 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3715 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3716 hdr.Len = f.SizeBytes() 3717 hdr.Cap = f.SizeBytes() 3718 3719 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3720 // Since we bypassed the compiler's escape analysis, indicate that f 3721 // must live until the use above. 3722 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3723 return length, err 3724 } 3725 3726 // CopyOut implements marshal.Marshallable.CopyOut. 3727 func (f *FUSEFsyncIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3728 return f.CopyOutN(cc, addr, f.SizeBytes()) 3729 } 3730 3731 // CopyIn implements marshal.Marshallable.CopyIn. 3732 func (f *FUSEFsyncIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3733 // Construct a slice backed by dst's underlying memory. 3734 var buf []byte 3735 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3736 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3737 hdr.Len = f.SizeBytes() 3738 hdr.Cap = f.SizeBytes() 3739 3740 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3741 // Since we bypassed the compiler's escape analysis, indicate that f 3742 // must live until the use above. 3743 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3744 return length, err 3745 } 3746 3747 // WriteTo implements io.WriterTo.WriteTo. 3748 func (f *FUSEFsyncIn) WriteTo(writer io.Writer) (int64, error) { 3749 // Construct a slice backed by dst's underlying memory. 3750 var buf []byte 3751 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3752 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3753 hdr.Len = f.SizeBytes() 3754 hdr.Cap = f.SizeBytes() 3755 3756 length, err := writer.Write(buf) 3757 // Since we bypassed the compiler's escape analysis, indicate that f 3758 // must live until the use above. 3759 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3760 return int64(length), err 3761 } 3762 3763 // SizeBytes implements marshal.Marshallable.SizeBytes. 3764 func (f *FUSEGetAttrIn) SizeBytes() int { 3765 return 16 3766 } 3767 3768 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3769 func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) []byte { 3770 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GetAttrFlags)) 3771 dst = dst[4:] 3772 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3773 dst = dst[4:] 3774 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3775 dst = dst[8:] 3776 return dst 3777 } 3778 3779 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3780 func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) []byte { 3781 f.GetAttrFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3782 src = src[4:] 3783 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3784 src = src[4:] 3785 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3786 src = src[8:] 3787 return src 3788 } 3789 3790 // Packed implements marshal.Marshallable.Packed. 3791 //go:nosplit 3792 func (f *FUSEGetAttrIn) Packed() bool { 3793 return true 3794 } 3795 3796 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3797 func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) []byte { 3798 size := f.SizeBytes() 3799 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3800 return dst[size:] 3801 } 3802 3803 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3804 func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) []byte { 3805 size := f.SizeBytes() 3806 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3807 return src[size:] 3808 } 3809 3810 // CopyOutN implements marshal.Marshallable.CopyOutN. 3811 func (f *FUSEGetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3812 // Construct a slice backed by dst's underlying memory. 3813 var buf []byte 3814 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3815 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3816 hdr.Len = f.SizeBytes() 3817 hdr.Cap = f.SizeBytes() 3818 3819 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3820 // Since we bypassed the compiler's escape analysis, indicate that f 3821 // must live until the use above. 3822 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3823 return length, err 3824 } 3825 3826 // CopyOut implements marshal.Marshallable.CopyOut. 3827 func (f *FUSEGetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3828 return f.CopyOutN(cc, addr, f.SizeBytes()) 3829 } 3830 3831 // CopyIn implements marshal.Marshallable.CopyIn. 3832 func (f *FUSEGetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3833 // Construct a slice backed by dst's underlying memory. 3834 var buf []byte 3835 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3836 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3837 hdr.Len = f.SizeBytes() 3838 hdr.Cap = f.SizeBytes() 3839 3840 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3841 // Since we bypassed the compiler's escape analysis, indicate that f 3842 // must live until the use above. 3843 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3844 return length, err 3845 } 3846 3847 // WriteTo implements io.WriterTo.WriteTo. 3848 func (f *FUSEGetAttrIn) WriteTo(writer io.Writer) (int64, error) { 3849 // Construct a slice backed by dst's underlying memory. 3850 var buf []byte 3851 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3852 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3853 hdr.Len = f.SizeBytes() 3854 hdr.Cap = f.SizeBytes() 3855 3856 length, err := writer.Write(buf) 3857 // Since we bypassed the compiler's escape analysis, indicate that f 3858 // must live until the use above. 3859 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3860 return int64(length), err 3861 } 3862 3863 // SizeBytes implements marshal.Marshallable.SizeBytes. 3864 func (f *FUSEHeaderIn) SizeBytes() int { 3865 return 28 + 3866 (*FUSEOpcode)(nil).SizeBytes() + 3867 (*FUSEOpID)(nil).SizeBytes() 3868 } 3869 3870 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3871 func (f *FUSEHeaderIn) MarshalBytes(dst []byte) []byte { 3872 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 3873 dst = dst[4:] 3874 dst = f.Opcode.MarshalUnsafe(dst) 3875 dst = f.Unique.MarshalUnsafe(dst) 3876 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3877 dst = dst[8:] 3878 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 3879 dst = dst[4:] 3880 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 3881 dst = dst[4:] 3882 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 3883 dst = dst[4:] 3884 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3885 dst = dst[4:] 3886 return dst 3887 } 3888 3889 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3890 func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) []byte { 3891 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3892 src = src[4:] 3893 src = f.Opcode.UnmarshalUnsafe(src) 3894 src = f.Unique.UnmarshalUnsafe(src) 3895 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3896 src = src[8:] 3897 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3898 src = src[4:] 3899 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3900 src = src[4:] 3901 f.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3902 src = src[4:] 3903 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3904 src = src[4:] 3905 return src 3906 } 3907 3908 // Packed implements marshal.Marshallable.Packed. 3909 //go:nosplit 3910 func (f *FUSEHeaderIn) Packed() bool { 3911 return f.Opcode.Packed() && f.Unique.Packed() 3912 } 3913 3914 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3915 func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) []byte { 3916 if f.Opcode.Packed() && f.Unique.Packed() { 3917 size := f.SizeBytes() 3918 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3919 return dst[size:] 3920 } 3921 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3922 return f.MarshalBytes(dst) 3923 } 3924 3925 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3926 func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) []byte { 3927 if f.Opcode.Packed() && f.Unique.Packed() { 3928 size := f.SizeBytes() 3929 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3930 return src[size:] 3931 } 3932 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3933 return f.UnmarshalBytes(src) 3934 } 3935 3936 // CopyOutN implements marshal.Marshallable.CopyOutN. 3937 func (f *FUSEHeaderIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3938 if !f.Opcode.Packed() && f.Unique.Packed() { 3939 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3940 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3941 f.MarshalBytes(buf) // escapes: fallback. 3942 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3943 } 3944 3945 // Construct a slice backed by dst's underlying memory. 3946 var buf []byte 3947 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3948 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3949 hdr.Len = f.SizeBytes() 3950 hdr.Cap = f.SizeBytes() 3951 3952 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3953 // Since we bypassed the compiler's escape analysis, indicate that f 3954 // must live until the use above. 3955 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3956 return length, err 3957 } 3958 3959 // CopyOut implements marshal.Marshallable.CopyOut. 3960 func (f *FUSEHeaderIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3961 return f.CopyOutN(cc, addr, f.SizeBytes()) 3962 } 3963 3964 // CopyIn implements marshal.Marshallable.CopyIn. 3965 func (f *FUSEHeaderIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3966 if !f.Opcode.Packed() && f.Unique.Packed() { 3967 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3968 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3969 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3970 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3971 // partially unmarshalled struct. 3972 f.UnmarshalBytes(buf) // escapes: fallback. 3973 return length, err 3974 } 3975 3976 // Construct a slice backed by dst's underlying memory. 3977 var buf []byte 3978 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3979 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3980 hdr.Len = f.SizeBytes() 3981 hdr.Cap = f.SizeBytes() 3982 3983 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3984 // Since we bypassed the compiler's escape analysis, indicate that f 3985 // must live until the use above. 3986 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3987 return length, err 3988 } 3989 3990 // WriteTo implements io.WriterTo.WriteTo. 3991 func (f *FUSEHeaderIn) WriteTo(writer io.Writer) (int64, error) { 3992 if !f.Opcode.Packed() && f.Unique.Packed() { 3993 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3994 buf := make([]byte, f.SizeBytes()) 3995 f.MarshalBytes(buf) 3996 length, err := writer.Write(buf) 3997 return int64(length), err 3998 } 3999 4000 // Construct a slice backed by dst's underlying memory. 4001 var buf []byte 4002 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4003 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4004 hdr.Len = f.SizeBytes() 4005 hdr.Cap = f.SizeBytes() 4006 4007 length, err := writer.Write(buf) 4008 // Since we bypassed the compiler's escape analysis, indicate that f 4009 // must live until the use above. 4010 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4011 return int64(length), err 4012 } 4013 4014 // SizeBytes implements marshal.Marshallable.SizeBytes. 4015 func (f *FUSEHeaderOut) SizeBytes() int { 4016 return 8 + 4017 (*FUSEOpID)(nil).SizeBytes() 4018 } 4019 4020 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4021 func (f *FUSEHeaderOut) MarshalBytes(dst []byte) []byte { 4022 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 4023 dst = dst[4:] 4024 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Error)) 4025 dst = dst[4:] 4026 dst = f.Unique.MarshalUnsafe(dst) 4027 return dst 4028 } 4029 4030 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4031 func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) []byte { 4032 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4033 src = src[4:] 4034 f.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 4035 src = src[4:] 4036 src = f.Unique.UnmarshalUnsafe(src) 4037 return src 4038 } 4039 4040 // Packed implements marshal.Marshallable.Packed. 4041 //go:nosplit 4042 func (f *FUSEHeaderOut) Packed() bool { 4043 return f.Unique.Packed() 4044 } 4045 4046 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4047 func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) []byte { 4048 if f.Unique.Packed() { 4049 size := f.SizeBytes() 4050 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4051 return dst[size:] 4052 } 4053 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes. 4054 return f.MarshalBytes(dst) 4055 } 4056 4057 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4058 func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) []byte { 4059 if f.Unique.Packed() { 4060 size := f.SizeBytes() 4061 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4062 return src[size:] 4063 } 4064 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4065 return f.UnmarshalBytes(src) 4066 } 4067 4068 // CopyOutN implements marshal.Marshallable.CopyOutN. 4069 func (f *FUSEHeaderOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4070 if !f.Unique.Packed() { 4071 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4072 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4073 f.MarshalBytes(buf) // escapes: fallback. 4074 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4075 } 4076 4077 // Construct a slice backed by dst's underlying memory. 4078 var buf []byte 4079 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4080 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4081 hdr.Len = f.SizeBytes() 4082 hdr.Cap = f.SizeBytes() 4083 4084 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4085 // Since we bypassed the compiler's escape analysis, indicate that f 4086 // must live until the use above. 4087 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4088 return length, err 4089 } 4090 4091 // CopyOut implements marshal.Marshallable.CopyOut. 4092 func (f *FUSEHeaderOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4093 return f.CopyOutN(cc, addr, f.SizeBytes()) 4094 } 4095 4096 // CopyIn implements marshal.Marshallable.CopyIn. 4097 func (f *FUSEHeaderOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4098 if !f.Unique.Packed() { 4099 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4100 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4101 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4102 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4103 // partially unmarshalled struct. 4104 f.UnmarshalBytes(buf) // escapes: fallback. 4105 return length, err 4106 } 4107 4108 // Construct a slice backed by dst's underlying memory. 4109 var buf []byte 4110 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4111 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4112 hdr.Len = f.SizeBytes() 4113 hdr.Cap = f.SizeBytes() 4114 4115 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4116 // Since we bypassed the compiler's escape analysis, indicate that f 4117 // must live until the use above. 4118 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4119 return length, err 4120 } 4121 4122 // WriteTo implements io.WriterTo.WriteTo. 4123 func (f *FUSEHeaderOut) WriteTo(writer io.Writer) (int64, error) { 4124 if !f.Unique.Packed() { 4125 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4126 buf := make([]byte, f.SizeBytes()) 4127 f.MarshalBytes(buf) 4128 length, err := writer.Write(buf) 4129 return int64(length), err 4130 } 4131 4132 // Construct a slice backed by dst's underlying memory. 4133 var buf []byte 4134 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4135 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4136 hdr.Len = f.SizeBytes() 4137 hdr.Cap = f.SizeBytes() 4138 4139 length, err := writer.Write(buf) 4140 // Since we bypassed the compiler's escape analysis, indicate that f 4141 // must live until the use above. 4142 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4143 return int64(length), err 4144 } 4145 4146 // SizeBytes implements marshal.Marshallable.SizeBytes. 4147 func (f *FUSEInitIn) SizeBytes() int { 4148 return 16 4149 } 4150 4151 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4152 func (f *FUSEInitIn) MarshalBytes(dst []byte) []byte { 4153 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4154 dst = dst[4:] 4155 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4156 dst = dst[4:] 4157 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4158 dst = dst[4:] 4159 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4160 dst = dst[4:] 4161 return dst 4162 } 4163 4164 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4165 func (f *FUSEInitIn) UnmarshalBytes(src []byte) []byte { 4166 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4167 src = src[4:] 4168 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4169 src = src[4:] 4170 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4171 src = src[4:] 4172 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4173 src = src[4:] 4174 return src 4175 } 4176 4177 // Packed implements marshal.Marshallable.Packed. 4178 //go:nosplit 4179 func (f *FUSEInitIn) Packed() bool { 4180 return true 4181 } 4182 4183 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4184 func (f *FUSEInitIn) MarshalUnsafe(dst []byte) []byte { 4185 size := f.SizeBytes() 4186 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4187 return dst[size:] 4188 } 4189 4190 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4191 func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) []byte { 4192 size := f.SizeBytes() 4193 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4194 return src[size:] 4195 } 4196 4197 // CopyOutN implements marshal.Marshallable.CopyOutN. 4198 func (f *FUSEInitIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4199 // Construct a slice backed by dst's underlying memory. 4200 var buf []byte 4201 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4202 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4203 hdr.Len = f.SizeBytes() 4204 hdr.Cap = f.SizeBytes() 4205 4206 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4207 // Since we bypassed the compiler's escape analysis, indicate that f 4208 // must live until the use above. 4209 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4210 return length, err 4211 } 4212 4213 // CopyOut implements marshal.Marshallable.CopyOut. 4214 func (f *FUSEInitIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4215 return f.CopyOutN(cc, addr, f.SizeBytes()) 4216 } 4217 4218 // CopyIn implements marshal.Marshallable.CopyIn. 4219 func (f *FUSEInitIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4220 // Construct a slice backed by dst's underlying memory. 4221 var buf []byte 4222 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4223 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4224 hdr.Len = f.SizeBytes() 4225 hdr.Cap = f.SizeBytes() 4226 4227 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4228 // Since we bypassed the compiler's escape analysis, indicate that f 4229 // must live until the use above. 4230 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4231 return length, err 4232 } 4233 4234 // WriteTo implements io.WriterTo.WriteTo. 4235 func (f *FUSEInitIn) WriteTo(writer io.Writer) (int64, error) { 4236 // Construct a slice backed by dst's underlying memory. 4237 var buf []byte 4238 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4239 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4240 hdr.Len = f.SizeBytes() 4241 hdr.Cap = f.SizeBytes() 4242 4243 length, err := writer.Write(buf) 4244 // Since we bypassed the compiler's escape analysis, indicate that f 4245 // must live until the use above. 4246 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4247 return int64(length), err 4248 } 4249 4250 // SizeBytes implements marshal.Marshallable.SizeBytes. 4251 func (f *FUSEInitOut) SizeBytes() int { 4252 return 32 + 4253 4*8 4254 } 4255 4256 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4257 func (f *FUSEInitOut) MarshalBytes(dst []byte) []byte { 4258 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4259 dst = dst[4:] 4260 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4261 dst = dst[4:] 4262 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4263 dst = dst[4:] 4264 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4265 dst = dst[4:] 4266 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxBackground)) 4267 dst = dst[2:] 4268 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.CongestionThreshold)) 4269 dst = dst[2:] 4270 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxWrite)) 4271 dst = dst[4:] 4272 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.TimeGran)) 4273 dst = dst[4:] 4274 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxPages)) 4275 dst = dst[2:] 4276 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 4277 dst = dst[2:] 4278 // Padding: dst[:sizeof(uint32)*8] ~= [8]uint32{0} 4279 dst = dst[4*(8):] 4280 return dst 4281 } 4282 4283 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4284 func (f *FUSEInitOut) UnmarshalBytes(src []byte) []byte { 4285 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4286 src = src[4:] 4287 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4288 src = src[4:] 4289 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4290 src = src[4:] 4291 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4292 src = src[4:] 4293 f.MaxBackground = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4294 src = src[2:] 4295 f.CongestionThreshold = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4296 src = src[2:] 4297 f.MaxWrite = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4298 src = src[4:] 4299 f.TimeGran = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4300 src = src[4:] 4301 f.MaxPages = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4302 src = src[2:] 4303 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 4304 src = src[2:] 4305 // Padding: ~ copy([8]uint32(f._), src[:sizeof(uint32)*8]) 4306 src = src[4*(8):] 4307 return src 4308 } 4309 4310 // Packed implements marshal.Marshallable.Packed. 4311 //go:nosplit 4312 func (f *FUSEInitOut) Packed() bool { 4313 return true 4314 } 4315 4316 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4317 func (f *FUSEInitOut) MarshalUnsafe(dst []byte) []byte { 4318 size := f.SizeBytes() 4319 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4320 return dst[size:] 4321 } 4322 4323 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4324 func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) []byte { 4325 size := f.SizeBytes() 4326 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4327 return src[size:] 4328 } 4329 4330 // CopyOutN implements marshal.Marshallable.CopyOutN. 4331 func (f *FUSEInitOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4332 // Construct a slice backed by dst's underlying memory. 4333 var buf []byte 4334 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4335 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4336 hdr.Len = f.SizeBytes() 4337 hdr.Cap = f.SizeBytes() 4338 4339 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4340 // Since we bypassed the compiler's escape analysis, indicate that f 4341 // must live until the use above. 4342 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4343 return length, err 4344 } 4345 4346 // CopyOut implements marshal.Marshallable.CopyOut. 4347 func (f *FUSEInitOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4348 return f.CopyOutN(cc, addr, f.SizeBytes()) 4349 } 4350 4351 // CopyIn implements marshal.Marshallable.CopyIn. 4352 func (f *FUSEInitOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4353 // Construct a slice backed by dst's underlying memory. 4354 var buf []byte 4355 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4356 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4357 hdr.Len = f.SizeBytes() 4358 hdr.Cap = f.SizeBytes() 4359 4360 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4361 // Since we bypassed the compiler's escape analysis, indicate that f 4362 // must live until the use above. 4363 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4364 return length, err 4365 } 4366 4367 // WriteTo implements io.WriterTo.WriteTo. 4368 func (f *FUSEInitOut) WriteTo(writer io.Writer) (int64, error) { 4369 // Construct a slice backed by dst's underlying memory. 4370 var buf []byte 4371 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4372 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4373 hdr.Len = f.SizeBytes() 4374 hdr.Cap = f.SizeBytes() 4375 4376 length, err := writer.Write(buf) 4377 // Since we bypassed the compiler's escape analysis, indicate that f 4378 // must live until the use above. 4379 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4380 return int64(length), err 4381 } 4382 4383 // Packed implements marshal.Marshallable.Packed. 4384 //go:nosplit 4385 func (r *FUSELinkIn) Packed() bool { 4386 // Type FUSELinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4387 return false 4388 } 4389 4390 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4391 func (r *FUSELinkIn) MarshalUnsafe(dst []byte) []byte { 4392 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4393 return r.MarshalBytes(dst) 4394 } 4395 4396 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4397 func (r *FUSELinkIn) UnmarshalUnsafe(src []byte) []byte { 4398 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4399 return r.UnmarshalBytes(src) 4400 } 4401 4402 // CopyOutN implements marshal.Marshallable.CopyOutN. 4403 //go:nosplit 4404 func (r *FUSELinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4405 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4406 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4407 r.MarshalBytes(buf) // escapes: fallback. 4408 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4409 } 4410 4411 // CopyOut implements marshal.Marshallable.CopyOut. 4412 func (r *FUSELinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4413 return r.CopyOutN(cc, addr, r.SizeBytes()) 4414 } 4415 4416 // CopyIn implements marshal.Marshallable.CopyIn. 4417 func (r *FUSELinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4418 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4419 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4420 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4421 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4422 // partially unmarshalled struct. 4423 r.UnmarshalBytes(buf) // escapes: fallback. 4424 return length, err 4425 } 4426 4427 // WriteTo implements io.WriterTo.WriteTo. 4428 func (r *FUSELinkIn) WriteTo(writer io.Writer) (int64, error) { 4429 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4430 buf := make([]byte, r.SizeBytes()) 4431 r.MarshalBytes(buf) 4432 length, err := writer.Write(buf) 4433 return int64(length), err 4434 } 4435 4436 // Packed implements marshal.Marshallable.Packed. 4437 //go:nosplit 4438 func (r *FUSELookupIn) Packed() bool { 4439 // Type FUSELookupIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4440 return false 4441 } 4442 4443 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4444 func (r *FUSELookupIn) MarshalUnsafe(dst []byte) []byte { 4445 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4446 return r.MarshalBytes(dst) 4447 } 4448 4449 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4450 func (r *FUSELookupIn) UnmarshalUnsafe(src []byte) []byte { 4451 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4452 return r.UnmarshalBytes(src) 4453 } 4454 4455 // CopyOutN implements marshal.Marshallable.CopyOutN. 4456 //go:nosplit 4457 func (r *FUSELookupIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4458 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4459 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4460 r.MarshalBytes(buf) // escapes: fallback. 4461 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4462 } 4463 4464 // CopyOut implements marshal.Marshallable.CopyOut. 4465 func (r *FUSELookupIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4466 return r.CopyOutN(cc, addr, r.SizeBytes()) 4467 } 4468 4469 // CopyIn implements marshal.Marshallable.CopyIn. 4470 func (r *FUSELookupIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4471 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4472 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4473 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4474 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4475 // partially unmarshalled struct. 4476 r.UnmarshalBytes(buf) // escapes: fallback. 4477 return length, err 4478 } 4479 4480 // WriteTo implements io.WriterTo.WriteTo. 4481 func (r *FUSELookupIn) WriteTo(writer io.Writer) (int64, error) { 4482 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4483 buf := make([]byte, r.SizeBytes()) 4484 r.MarshalBytes(buf) 4485 length, err := writer.Write(buf) 4486 return int64(length), err 4487 } 4488 4489 // Packed implements marshal.Marshallable.Packed. 4490 //go:nosplit 4491 func (r *FUSEMkdirIn) Packed() bool { 4492 // Type FUSEMkdirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4493 return false 4494 } 4495 4496 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4497 func (r *FUSEMkdirIn) MarshalUnsafe(dst []byte) []byte { 4498 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4499 return r.MarshalBytes(dst) 4500 } 4501 4502 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4503 func (r *FUSEMkdirIn) UnmarshalUnsafe(src []byte) []byte { 4504 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4505 return r.UnmarshalBytes(src) 4506 } 4507 4508 // CopyOutN implements marshal.Marshallable.CopyOutN. 4509 //go:nosplit 4510 func (r *FUSEMkdirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4511 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4512 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4513 r.MarshalBytes(buf) // escapes: fallback. 4514 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4515 } 4516 4517 // CopyOut implements marshal.Marshallable.CopyOut. 4518 func (r *FUSEMkdirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4519 return r.CopyOutN(cc, addr, r.SizeBytes()) 4520 } 4521 4522 // CopyIn implements marshal.Marshallable.CopyIn. 4523 func (r *FUSEMkdirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4524 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4525 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4526 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4527 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4528 // partially unmarshalled struct. 4529 r.UnmarshalBytes(buf) // escapes: fallback. 4530 return length, err 4531 } 4532 4533 // WriteTo implements io.WriterTo.WriteTo. 4534 func (r *FUSEMkdirIn) WriteTo(writer io.Writer) (int64, error) { 4535 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4536 buf := make([]byte, r.SizeBytes()) 4537 r.MarshalBytes(buf) 4538 length, err := writer.Write(buf) 4539 return int64(length), err 4540 } 4541 4542 // SizeBytes implements marshal.Marshallable.SizeBytes. 4543 func (f *FUSEMkdirMeta) SizeBytes() int { 4544 return 8 4545 } 4546 4547 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4548 func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) []byte { 4549 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4550 dst = dst[4:] 4551 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4552 dst = dst[4:] 4553 return dst 4554 } 4555 4556 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4557 func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) []byte { 4558 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4559 src = src[4:] 4560 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4561 src = src[4:] 4562 return src 4563 } 4564 4565 // Packed implements marshal.Marshallable.Packed. 4566 //go:nosplit 4567 func (f *FUSEMkdirMeta) Packed() bool { 4568 return true 4569 } 4570 4571 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4572 func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) []byte { 4573 size := f.SizeBytes() 4574 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4575 return dst[size:] 4576 } 4577 4578 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4579 func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) []byte { 4580 size := f.SizeBytes() 4581 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4582 return src[size:] 4583 } 4584 4585 // CopyOutN implements marshal.Marshallable.CopyOutN. 4586 func (f *FUSEMkdirMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4587 // Construct a slice backed by dst's underlying memory. 4588 var buf []byte 4589 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4590 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4591 hdr.Len = f.SizeBytes() 4592 hdr.Cap = f.SizeBytes() 4593 4594 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4595 // Since we bypassed the compiler's escape analysis, indicate that f 4596 // must live until the use above. 4597 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4598 return length, err 4599 } 4600 4601 // CopyOut implements marshal.Marshallable.CopyOut. 4602 func (f *FUSEMkdirMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4603 return f.CopyOutN(cc, addr, f.SizeBytes()) 4604 } 4605 4606 // CopyIn implements marshal.Marshallable.CopyIn. 4607 func (f *FUSEMkdirMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4608 // Construct a slice backed by dst's underlying memory. 4609 var buf []byte 4610 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4611 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4612 hdr.Len = f.SizeBytes() 4613 hdr.Cap = f.SizeBytes() 4614 4615 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4616 // Since we bypassed the compiler's escape analysis, indicate that f 4617 // must live until the use above. 4618 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4619 return length, err 4620 } 4621 4622 // WriteTo implements io.WriterTo.WriteTo. 4623 func (f *FUSEMkdirMeta) WriteTo(writer io.Writer) (int64, error) { 4624 // Construct a slice backed by dst's underlying memory. 4625 var buf []byte 4626 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4627 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4628 hdr.Len = f.SizeBytes() 4629 hdr.Cap = f.SizeBytes() 4630 4631 length, err := writer.Write(buf) 4632 // Since we bypassed the compiler's escape analysis, indicate that f 4633 // must live until the use above. 4634 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4635 return int64(length), err 4636 } 4637 4638 // Packed implements marshal.Marshallable.Packed. 4639 //go:nosplit 4640 func (r *FUSEMknodIn) Packed() bool { 4641 // Type FUSEMknodIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4642 return false 4643 } 4644 4645 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4646 func (r *FUSEMknodIn) MarshalUnsafe(dst []byte) []byte { 4647 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4648 return r.MarshalBytes(dst) 4649 } 4650 4651 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4652 func (r *FUSEMknodIn) UnmarshalUnsafe(src []byte) []byte { 4653 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4654 return r.UnmarshalBytes(src) 4655 } 4656 4657 // CopyOutN implements marshal.Marshallable.CopyOutN. 4658 //go:nosplit 4659 func (r *FUSEMknodIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4660 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4661 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4662 r.MarshalBytes(buf) // escapes: fallback. 4663 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4664 } 4665 4666 // CopyOut implements marshal.Marshallable.CopyOut. 4667 func (r *FUSEMknodIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4668 return r.CopyOutN(cc, addr, r.SizeBytes()) 4669 } 4670 4671 // CopyIn implements marshal.Marshallable.CopyIn. 4672 func (r *FUSEMknodIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4673 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4674 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4675 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4676 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4677 // partially unmarshalled struct. 4678 r.UnmarshalBytes(buf) // escapes: fallback. 4679 return length, err 4680 } 4681 4682 // WriteTo implements io.WriterTo.WriteTo. 4683 func (r *FUSEMknodIn) WriteTo(writer io.Writer) (int64, error) { 4684 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4685 buf := make([]byte, r.SizeBytes()) 4686 r.MarshalBytes(buf) 4687 length, err := writer.Write(buf) 4688 return int64(length), err 4689 } 4690 4691 // SizeBytes implements marshal.Marshallable.SizeBytes. 4692 func (f *FUSEMknodMeta) SizeBytes() int { 4693 return 16 4694 } 4695 4696 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4697 func (f *FUSEMknodMeta) MarshalBytes(dst []byte) []byte { 4698 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4699 dst = dst[4:] 4700 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev)) 4701 dst = dst[4:] 4702 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4703 dst = dst[4:] 4704 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4705 dst = dst[4:] 4706 return dst 4707 } 4708 4709 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4710 func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) []byte { 4711 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4712 src = src[4:] 4713 f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4714 src = src[4:] 4715 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4716 src = src[4:] 4717 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4718 src = src[4:] 4719 return src 4720 } 4721 4722 // Packed implements marshal.Marshallable.Packed. 4723 //go:nosplit 4724 func (f *FUSEMknodMeta) Packed() bool { 4725 return true 4726 } 4727 4728 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4729 func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) []byte { 4730 size := f.SizeBytes() 4731 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4732 return dst[size:] 4733 } 4734 4735 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4736 func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) []byte { 4737 size := f.SizeBytes() 4738 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4739 return src[size:] 4740 } 4741 4742 // CopyOutN implements marshal.Marshallable.CopyOutN. 4743 func (f *FUSEMknodMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4744 // Construct a slice backed by dst's underlying memory. 4745 var buf []byte 4746 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4747 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4748 hdr.Len = f.SizeBytes() 4749 hdr.Cap = f.SizeBytes() 4750 4751 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4752 // Since we bypassed the compiler's escape analysis, indicate that f 4753 // must live until the use above. 4754 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4755 return length, err 4756 } 4757 4758 // CopyOut implements marshal.Marshallable.CopyOut. 4759 func (f *FUSEMknodMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4760 return f.CopyOutN(cc, addr, f.SizeBytes()) 4761 } 4762 4763 // CopyIn implements marshal.Marshallable.CopyIn. 4764 func (f *FUSEMknodMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4765 // Construct a slice backed by dst's underlying memory. 4766 var buf []byte 4767 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4768 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4769 hdr.Len = f.SizeBytes() 4770 hdr.Cap = f.SizeBytes() 4771 4772 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4773 // Since we bypassed the compiler's escape analysis, indicate that f 4774 // must live until the use above. 4775 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4776 return length, err 4777 } 4778 4779 // WriteTo implements io.WriterTo.WriteTo. 4780 func (f *FUSEMknodMeta) WriteTo(writer io.Writer) (int64, error) { 4781 // Construct a slice backed by dst's underlying memory. 4782 var buf []byte 4783 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4784 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4785 hdr.Len = f.SizeBytes() 4786 hdr.Cap = f.SizeBytes() 4787 4788 length, err := writer.Write(buf) 4789 // Since we bypassed the compiler's escape analysis, indicate that f 4790 // must live until the use above. 4791 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4792 return int64(length), err 4793 } 4794 4795 // SizeBytes implements marshal.Marshallable.SizeBytes. 4796 //go:nosplit 4797 func (f *FUSEOpID) SizeBytes() int { 4798 return 8 4799 } 4800 4801 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4802 func (f *FUSEOpID) MarshalBytes(dst []byte) []byte { 4803 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f)) 4804 return dst[8:] 4805 } 4806 4807 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4808 func (f *FUSEOpID) UnmarshalBytes(src []byte) []byte { 4809 *f = FUSEOpID(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 4810 return src[8:] 4811 } 4812 4813 // Packed implements marshal.Marshallable.Packed. 4814 //go:nosplit 4815 func (f *FUSEOpID) Packed() bool { 4816 // Scalar newtypes are always packed. 4817 return true 4818 } 4819 4820 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4821 func (f *FUSEOpID) MarshalUnsafe(dst []byte) []byte { 4822 size := f.SizeBytes() 4823 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4824 return dst[size:] 4825 } 4826 4827 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4828 func (f *FUSEOpID) UnmarshalUnsafe(src []byte) []byte { 4829 size := f.SizeBytes() 4830 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4831 return src[size:] 4832 } 4833 4834 // CopyOutN implements marshal.Marshallable.CopyOutN. 4835 func (f *FUSEOpID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4836 // Construct a slice backed by dst's underlying memory. 4837 var buf []byte 4838 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4839 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4840 hdr.Len = f.SizeBytes() 4841 hdr.Cap = f.SizeBytes() 4842 4843 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4844 // Since we bypassed the compiler's escape analysis, indicate that f 4845 // must live until the use above. 4846 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4847 return length, err 4848 } 4849 4850 // CopyOut implements marshal.Marshallable.CopyOut. 4851 func (f *FUSEOpID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4852 return f.CopyOutN(cc, addr, f.SizeBytes()) 4853 } 4854 4855 // CopyIn implements marshal.Marshallable.CopyIn. 4856 func (f *FUSEOpID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4857 // Construct a slice backed by dst's underlying memory. 4858 var buf []byte 4859 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4860 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4861 hdr.Len = f.SizeBytes() 4862 hdr.Cap = f.SizeBytes() 4863 4864 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4865 // Since we bypassed the compiler's escape analysis, indicate that f 4866 // must live until the use above. 4867 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4868 return length, err 4869 } 4870 4871 // WriteTo implements io.WriterTo.WriteTo. 4872 func (f *FUSEOpID) WriteTo(writer io.Writer) (int64, error) { 4873 // Construct a slice backed by dst's underlying memory. 4874 var buf []byte 4875 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4876 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4877 hdr.Len = f.SizeBytes() 4878 hdr.Cap = f.SizeBytes() 4879 4880 length, err := writer.Write(buf) 4881 // Since we bypassed the compiler's escape analysis, indicate that f 4882 // must live until the use above. 4883 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4884 return int64(length), err 4885 } 4886 4887 // SizeBytes implements marshal.Marshallable.SizeBytes. 4888 //go:nosplit 4889 func (f *FUSEOpcode) SizeBytes() int { 4890 return 4 4891 } 4892 4893 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4894 func (f *FUSEOpcode) MarshalBytes(dst []byte) []byte { 4895 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f)) 4896 return dst[4:] 4897 } 4898 4899 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4900 func (f *FUSEOpcode) UnmarshalBytes(src []byte) []byte { 4901 *f = FUSEOpcode(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 4902 return src[4:] 4903 } 4904 4905 // Packed implements marshal.Marshallable.Packed. 4906 //go:nosplit 4907 func (f *FUSEOpcode) Packed() bool { 4908 // Scalar newtypes are always packed. 4909 return true 4910 } 4911 4912 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4913 func (f *FUSEOpcode) MarshalUnsafe(dst []byte) []byte { 4914 size := f.SizeBytes() 4915 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4916 return dst[size:] 4917 } 4918 4919 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4920 func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) []byte { 4921 size := f.SizeBytes() 4922 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4923 return src[size:] 4924 } 4925 4926 // CopyOutN implements marshal.Marshallable.CopyOutN. 4927 func (f *FUSEOpcode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4928 // Construct a slice backed by dst's underlying memory. 4929 var buf []byte 4930 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4931 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4932 hdr.Len = f.SizeBytes() 4933 hdr.Cap = f.SizeBytes() 4934 4935 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4936 // Since we bypassed the compiler's escape analysis, indicate that f 4937 // must live until the use above. 4938 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4939 return length, err 4940 } 4941 4942 // CopyOut implements marshal.Marshallable.CopyOut. 4943 func (f *FUSEOpcode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4944 return f.CopyOutN(cc, addr, f.SizeBytes()) 4945 } 4946 4947 // CopyIn implements marshal.Marshallable.CopyIn. 4948 func (f *FUSEOpcode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4949 // Construct a slice backed by dst's underlying memory. 4950 var buf []byte 4951 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4952 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4953 hdr.Len = f.SizeBytes() 4954 hdr.Cap = f.SizeBytes() 4955 4956 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4957 // Since we bypassed the compiler's escape analysis, indicate that f 4958 // must live until the use above. 4959 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4960 return length, err 4961 } 4962 4963 // WriteTo implements io.WriterTo.WriteTo. 4964 func (f *FUSEOpcode) WriteTo(writer io.Writer) (int64, error) { 4965 // Construct a slice backed by dst's underlying memory. 4966 var buf []byte 4967 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4968 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4969 hdr.Len = f.SizeBytes() 4970 hdr.Cap = f.SizeBytes() 4971 4972 length, err := writer.Write(buf) 4973 // Since we bypassed the compiler's escape analysis, indicate that f 4974 // must live until the use above. 4975 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4976 return int64(length), err 4977 } 4978 4979 // SizeBytes implements marshal.Marshallable.SizeBytes. 4980 func (f *FUSEOpenIn) SizeBytes() int { 4981 return 8 4982 } 4983 4984 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4985 func (f *FUSEOpenIn) MarshalBytes(dst []byte) []byte { 4986 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4987 dst = dst[4:] 4988 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4989 dst = dst[4:] 4990 return dst 4991 } 4992 4993 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4994 func (f *FUSEOpenIn) UnmarshalBytes(src []byte) []byte { 4995 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4996 src = src[4:] 4997 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4998 src = src[4:] 4999 return src 5000 } 5001 5002 // Packed implements marshal.Marshallable.Packed. 5003 //go:nosplit 5004 func (f *FUSEOpenIn) Packed() bool { 5005 return true 5006 } 5007 5008 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5009 func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) []byte { 5010 size := f.SizeBytes() 5011 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5012 return dst[size:] 5013 } 5014 5015 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5016 func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) []byte { 5017 size := f.SizeBytes() 5018 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5019 return src[size:] 5020 } 5021 5022 // CopyOutN implements marshal.Marshallable.CopyOutN. 5023 func (f *FUSEOpenIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5024 // Construct a slice backed by dst's underlying memory. 5025 var buf []byte 5026 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5027 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5028 hdr.Len = f.SizeBytes() 5029 hdr.Cap = f.SizeBytes() 5030 5031 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5032 // Since we bypassed the compiler's escape analysis, indicate that f 5033 // must live until the use above. 5034 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5035 return length, err 5036 } 5037 5038 // CopyOut implements marshal.Marshallable.CopyOut. 5039 func (f *FUSEOpenIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5040 return f.CopyOutN(cc, addr, f.SizeBytes()) 5041 } 5042 5043 // CopyIn implements marshal.Marshallable.CopyIn. 5044 func (f *FUSEOpenIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5045 // Construct a slice backed by dst's underlying memory. 5046 var buf []byte 5047 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5048 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5049 hdr.Len = f.SizeBytes() 5050 hdr.Cap = f.SizeBytes() 5051 5052 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5053 // Since we bypassed the compiler's escape analysis, indicate that f 5054 // must live until the use above. 5055 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5056 return length, err 5057 } 5058 5059 // WriteTo implements io.WriterTo.WriteTo. 5060 func (f *FUSEOpenIn) WriteTo(writer io.Writer) (int64, error) { 5061 // Construct a slice backed by dst's underlying memory. 5062 var buf []byte 5063 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5064 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5065 hdr.Len = f.SizeBytes() 5066 hdr.Cap = f.SizeBytes() 5067 5068 length, err := writer.Write(buf) 5069 // Since we bypassed the compiler's escape analysis, indicate that f 5070 // must live until the use above. 5071 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5072 return int64(length), err 5073 } 5074 5075 // SizeBytes implements marshal.Marshallable.SizeBytes. 5076 func (f *FUSEOpenOut) SizeBytes() int { 5077 return 16 5078 } 5079 5080 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5081 func (f *FUSEOpenOut) MarshalBytes(dst []byte) []byte { 5082 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5083 dst = dst[8:] 5084 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.OpenFlag)) 5085 dst = dst[4:] 5086 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5087 dst = dst[4:] 5088 return dst 5089 } 5090 5091 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5092 func (f *FUSEOpenOut) UnmarshalBytes(src []byte) []byte { 5093 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5094 src = src[8:] 5095 f.OpenFlag = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5096 src = src[4:] 5097 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5098 src = src[4:] 5099 return src 5100 } 5101 5102 // Packed implements marshal.Marshallable.Packed. 5103 //go:nosplit 5104 func (f *FUSEOpenOut) Packed() bool { 5105 return true 5106 } 5107 5108 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5109 func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) []byte { 5110 size := f.SizeBytes() 5111 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5112 return dst[size:] 5113 } 5114 5115 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5116 func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) []byte { 5117 size := f.SizeBytes() 5118 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5119 return src[size:] 5120 } 5121 5122 // CopyOutN implements marshal.Marshallable.CopyOutN. 5123 func (f *FUSEOpenOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5124 // Construct a slice backed by dst's underlying memory. 5125 var buf []byte 5126 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5127 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5128 hdr.Len = f.SizeBytes() 5129 hdr.Cap = f.SizeBytes() 5130 5131 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5132 // Since we bypassed the compiler's escape analysis, indicate that f 5133 // must live until the use above. 5134 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5135 return length, err 5136 } 5137 5138 // CopyOut implements marshal.Marshallable.CopyOut. 5139 func (f *FUSEOpenOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5140 return f.CopyOutN(cc, addr, f.SizeBytes()) 5141 } 5142 5143 // CopyIn implements marshal.Marshallable.CopyIn. 5144 func (f *FUSEOpenOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5145 // Construct a slice backed by dst's underlying memory. 5146 var buf []byte 5147 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5148 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5149 hdr.Len = f.SizeBytes() 5150 hdr.Cap = f.SizeBytes() 5151 5152 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5153 // Since we bypassed the compiler's escape analysis, indicate that f 5154 // must live until the use above. 5155 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5156 return length, err 5157 } 5158 5159 // WriteTo implements io.WriterTo.WriteTo. 5160 func (f *FUSEOpenOut) WriteTo(writer io.Writer) (int64, error) { 5161 // Construct a slice backed by dst's underlying memory. 5162 var buf []byte 5163 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5164 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5165 hdr.Len = f.SizeBytes() 5166 hdr.Cap = f.SizeBytes() 5167 5168 length, err := writer.Write(buf) 5169 // Since we bypassed the compiler's escape analysis, indicate that f 5170 // must live until the use above. 5171 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5172 return int64(length), err 5173 } 5174 5175 // SizeBytes implements marshal.Marshallable.SizeBytes. 5176 func (f *FUSEReadIn) SizeBytes() int { 5177 return 40 5178 } 5179 5180 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5181 func (f *FUSEReadIn) MarshalBytes(dst []byte) []byte { 5182 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5183 dst = dst[8:] 5184 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5185 dst = dst[8:] 5186 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5187 dst = dst[4:] 5188 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReadFlags)) 5189 dst = dst[4:] 5190 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5191 dst = dst[8:] 5192 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5193 dst = dst[4:] 5194 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5195 dst = dst[4:] 5196 return dst 5197 } 5198 5199 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5200 func (f *FUSEReadIn) UnmarshalBytes(src []byte) []byte { 5201 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5202 src = src[8:] 5203 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5204 src = src[8:] 5205 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5206 src = src[4:] 5207 f.ReadFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5208 src = src[4:] 5209 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5210 src = src[8:] 5211 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5212 src = src[4:] 5213 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5214 src = src[4:] 5215 return src 5216 } 5217 5218 // Packed implements marshal.Marshallable.Packed. 5219 //go:nosplit 5220 func (f *FUSEReadIn) Packed() bool { 5221 return true 5222 } 5223 5224 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5225 func (f *FUSEReadIn) MarshalUnsafe(dst []byte) []byte { 5226 size := f.SizeBytes() 5227 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5228 return dst[size:] 5229 } 5230 5231 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5232 func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) []byte { 5233 size := f.SizeBytes() 5234 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5235 return src[size:] 5236 } 5237 5238 // CopyOutN implements marshal.Marshallable.CopyOutN. 5239 func (f *FUSEReadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5240 // Construct a slice backed by dst's underlying memory. 5241 var buf []byte 5242 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5243 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5244 hdr.Len = f.SizeBytes() 5245 hdr.Cap = f.SizeBytes() 5246 5247 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5248 // Since we bypassed the compiler's escape analysis, indicate that f 5249 // must live until the use above. 5250 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5251 return length, err 5252 } 5253 5254 // CopyOut implements marshal.Marshallable.CopyOut. 5255 func (f *FUSEReadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5256 return f.CopyOutN(cc, addr, f.SizeBytes()) 5257 } 5258 5259 // CopyIn implements marshal.Marshallable.CopyIn. 5260 func (f *FUSEReadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5261 // Construct a slice backed by dst's underlying memory. 5262 var buf []byte 5263 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5264 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5265 hdr.Len = f.SizeBytes() 5266 hdr.Cap = f.SizeBytes() 5267 5268 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5269 // Since we bypassed the compiler's escape analysis, indicate that f 5270 // must live until the use above. 5271 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5272 return length, err 5273 } 5274 5275 // WriteTo implements io.WriterTo.WriteTo. 5276 func (f *FUSEReadIn) WriteTo(writer io.Writer) (int64, error) { 5277 // Construct a slice backed by dst's underlying memory. 5278 var buf []byte 5279 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5280 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5281 hdr.Len = f.SizeBytes() 5282 hdr.Cap = f.SizeBytes() 5283 5284 length, err := writer.Write(buf) 5285 // Since we bypassed the compiler's escape analysis, indicate that f 5286 // must live until the use above. 5287 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5288 return int64(length), err 5289 } 5290 5291 // SizeBytes implements marshal.Marshallable.SizeBytes. 5292 func (f *FUSEReleaseIn) SizeBytes() int { 5293 return 24 5294 } 5295 5296 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5297 func (f *FUSEReleaseIn) MarshalBytes(dst []byte) []byte { 5298 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5299 dst = dst[8:] 5300 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5301 dst = dst[4:] 5302 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReleaseFlags)) 5303 dst = dst[4:] 5304 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5305 dst = dst[8:] 5306 return dst 5307 } 5308 5309 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5310 func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) []byte { 5311 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5312 src = src[8:] 5313 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5314 src = src[4:] 5315 f.ReleaseFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5316 src = src[4:] 5317 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5318 src = src[8:] 5319 return src 5320 } 5321 5322 // Packed implements marshal.Marshallable.Packed. 5323 //go:nosplit 5324 func (f *FUSEReleaseIn) Packed() bool { 5325 return true 5326 } 5327 5328 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5329 func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) []byte { 5330 size := f.SizeBytes() 5331 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5332 return dst[size:] 5333 } 5334 5335 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5336 func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) []byte { 5337 size := f.SizeBytes() 5338 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5339 return src[size:] 5340 } 5341 5342 // CopyOutN implements marshal.Marshallable.CopyOutN. 5343 func (f *FUSEReleaseIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5344 // Construct a slice backed by dst's underlying memory. 5345 var buf []byte 5346 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5347 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5348 hdr.Len = f.SizeBytes() 5349 hdr.Cap = f.SizeBytes() 5350 5351 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5352 // Since we bypassed the compiler's escape analysis, indicate that f 5353 // must live until the use above. 5354 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5355 return length, err 5356 } 5357 5358 // CopyOut implements marshal.Marshallable.CopyOut. 5359 func (f *FUSEReleaseIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5360 return f.CopyOutN(cc, addr, f.SizeBytes()) 5361 } 5362 5363 // CopyIn implements marshal.Marshallable.CopyIn. 5364 func (f *FUSEReleaseIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5365 // Construct a slice backed by dst's underlying memory. 5366 var buf []byte 5367 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5368 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5369 hdr.Len = f.SizeBytes() 5370 hdr.Cap = f.SizeBytes() 5371 5372 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5373 // Since we bypassed the compiler's escape analysis, indicate that f 5374 // must live until the use above. 5375 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5376 return length, err 5377 } 5378 5379 // WriteTo implements io.WriterTo.WriteTo. 5380 func (f *FUSEReleaseIn) WriteTo(writer io.Writer) (int64, error) { 5381 // Construct a slice backed by dst's underlying memory. 5382 var buf []byte 5383 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5384 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5385 hdr.Len = f.SizeBytes() 5386 hdr.Cap = f.SizeBytes() 5387 5388 length, err := writer.Write(buf) 5389 // Since we bypassed the compiler's escape analysis, indicate that f 5390 // must live until the use above. 5391 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5392 return int64(length), err 5393 } 5394 5395 // Packed implements marshal.Marshallable.Packed. 5396 //go:nosplit 5397 func (r *FUSERenameIn) Packed() bool { 5398 // Type FUSERenameIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5399 return false 5400 } 5401 5402 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5403 func (r *FUSERenameIn) MarshalUnsafe(dst []byte) []byte { 5404 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5405 return r.MarshalBytes(dst) 5406 } 5407 5408 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5409 func (r *FUSERenameIn) UnmarshalUnsafe(src []byte) []byte { 5410 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5411 return r.UnmarshalBytes(src) 5412 } 5413 5414 // CopyOutN implements marshal.Marshallable.CopyOutN. 5415 //go:nosplit 5416 func (r *FUSERenameIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5417 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5418 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5419 r.MarshalBytes(buf) // escapes: fallback. 5420 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5421 } 5422 5423 // CopyOut implements marshal.Marshallable.CopyOut. 5424 func (r *FUSERenameIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5425 return r.CopyOutN(cc, addr, r.SizeBytes()) 5426 } 5427 5428 // CopyIn implements marshal.Marshallable.CopyIn. 5429 func (r *FUSERenameIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5430 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5431 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5432 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5433 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5434 // partially unmarshalled struct. 5435 r.UnmarshalBytes(buf) // escapes: fallback. 5436 return length, err 5437 } 5438 5439 // WriteTo implements io.WriterTo.WriteTo. 5440 func (r *FUSERenameIn) WriteTo(writer io.Writer) (int64, error) { 5441 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5442 buf := make([]byte, r.SizeBytes()) 5443 r.MarshalBytes(buf) 5444 length, err := writer.Write(buf) 5445 return int64(length), err 5446 } 5447 5448 // Packed implements marshal.Marshallable.Packed. 5449 //go:nosplit 5450 func (r *FUSERmDirIn) Packed() bool { 5451 // Type FUSERmDirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5452 return false 5453 } 5454 5455 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5456 func (r *FUSERmDirIn) MarshalUnsafe(dst []byte) []byte { 5457 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5458 return r.MarshalBytes(dst) 5459 } 5460 5461 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5462 func (r *FUSERmDirIn) UnmarshalUnsafe(src []byte) []byte { 5463 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5464 return r.UnmarshalBytes(src) 5465 } 5466 5467 // CopyOutN implements marshal.Marshallable.CopyOutN. 5468 //go:nosplit 5469 func (r *FUSERmDirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5470 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5471 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5472 r.MarshalBytes(buf) // escapes: fallback. 5473 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5474 } 5475 5476 // CopyOut implements marshal.Marshallable.CopyOut. 5477 func (r *FUSERmDirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5478 return r.CopyOutN(cc, addr, r.SizeBytes()) 5479 } 5480 5481 // CopyIn implements marshal.Marshallable.CopyIn. 5482 func (r *FUSERmDirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5483 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5484 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5485 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5486 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5487 // partially unmarshalled struct. 5488 r.UnmarshalBytes(buf) // escapes: fallback. 5489 return length, err 5490 } 5491 5492 // WriteTo implements io.WriterTo.WriteTo. 5493 func (r *FUSERmDirIn) WriteTo(writer io.Writer) (int64, error) { 5494 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5495 buf := make([]byte, r.SizeBytes()) 5496 r.MarshalBytes(buf) 5497 length, err := writer.Write(buf) 5498 return int64(length), err 5499 } 5500 5501 // SizeBytes implements marshal.Marshallable.SizeBytes. 5502 func (f *FUSESetAttrIn) SizeBytes() int { 5503 return 88 5504 } 5505 5506 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5507 func (f *FUSESetAttrIn) MarshalBytes(dst []byte) []byte { 5508 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Valid)) 5509 dst = dst[4:] 5510 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5511 dst = dst[4:] 5512 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5513 dst = dst[8:] 5514 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size)) 5515 dst = dst[8:] 5516 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5517 dst = dst[8:] 5518 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Atime)) 5519 dst = dst[8:] 5520 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mtime)) 5521 dst = dst[8:] 5522 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ctime)) 5523 dst = dst[8:] 5524 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AtimeNsec)) 5525 dst = dst[4:] 5526 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MtimeNsec)) 5527 dst = dst[4:] 5528 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.CtimeNsec)) 5529 dst = dst[4:] 5530 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5531 dst = dst[4:] 5532 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5533 dst = dst[4:] 5534 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 5535 dst = dst[4:] 5536 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 5537 dst = dst[4:] 5538 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5539 dst = dst[4:] 5540 return dst 5541 } 5542 5543 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5544 func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) []byte { 5545 f.Valid = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5546 src = src[4:] 5547 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5548 src = src[4:] 5549 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5550 src = src[8:] 5551 f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5552 src = src[8:] 5553 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5554 src = src[8:] 5555 f.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5556 src = src[8:] 5557 f.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5558 src = src[8:] 5559 f.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5560 src = src[8:] 5561 f.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5562 src = src[4:] 5563 f.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5564 src = src[4:] 5565 f.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5566 src = src[4:] 5567 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5568 src = src[4:] 5569 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5570 src = src[4:] 5571 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5572 src = src[4:] 5573 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5574 src = src[4:] 5575 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5576 src = src[4:] 5577 return src 5578 } 5579 5580 // Packed implements marshal.Marshallable.Packed. 5581 //go:nosplit 5582 func (f *FUSESetAttrIn) Packed() bool { 5583 return true 5584 } 5585 5586 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5587 func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) []byte { 5588 size := f.SizeBytes() 5589 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5590 return dst[size:] 5591 } 5592 5593 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5594 func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) []byte { 5595 size := f.SizeBytes() 5596 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5597 return src[size:] 5598 } 5599 5600 // CopyOutN implements marshal.Marshallable.CopyOutN. 5601 func (f *FUSESetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5602 // Construct a slice backed by dst's underlying memory. 5603 var buf []byte 5604 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5605 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5606 hdr.Len = f.SizeBytes() 5607 hdr.Cap = f.SizeBytes() 5608 5609 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5610 // Since we bypassed the compiler's escape analysis, indicate that f 5611 // must live until the use above. 5612 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5613 return length, err 5614 } 5615 5616 // CopyOut implements marshal.Marshallable.CopyOut. 5617 func (f *FUSESetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5618 return f.CopyOutN(cc, addr, f.SizeBytes()) 5619 } 5620 5621 // CopyIn implements marshal.Marshallable.CopyIn. 5622 func (f *FUSESetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5623 // Construct a slice backed by dst's underlying memory. 5624 var buf []byte 5625 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5626 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5627 hdr.Len = f.SizeBytes() 5628 hdr.Cap = f.SizeBytes() 5629 5630 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5631 // Since we bypassed the compiler's escape analysis, indicate that f 5632 // must live until the use above. 5633 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5634 return length, err 5635 } 5636 5637 // WriteTo implements io.WriterTo.WriteTo. 5638 func (f *FUSESetAttrIn) WriteTo(writer io.Writer) (int64, error) { 5639 // Construct a slice backed by dst's underlying memory. 5640 var buf []byte 5641 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5642 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5643 hdr.Len = f.SizeBytes() 5644 hdr.Cap = f.SizeBytes() 5645 5646 length, err := writer.Write(buf) 5647 // Since we bypassed the compiler's escape analysis, indicate that f 5648 // must live until the use above. 5649 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5650 return int64(length), err 5651 } 5652 5653 // SizeBytes implements marshal.Marshallable.SizeBytes. 5654 func (f *FUSEStatfsOut) SizeBytes() int { 5655 return 56 + 5656 4*6 5657 } 5658 5659 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5660 func (f *FUSEStatfsOut) MarshalBytes(dst []byte) []byte { 5661 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Blocks)) 5662 dst = dst[8:] 5663 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksFree)) 5664 dst = dst[8:] 5665 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksAvailable)) 5666 dst = dst[8:] 5667 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Files)) 5668 dst = dst[8:] 5669 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.FilesFree)) 5670 dst = dst[8:] 5671 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.BlockSize)) 5672 dst = dst[4:] 5673 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLength)) 5674 dst = dst[4:] 5675 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FragmentSize)) 5676 dst = dst[4:] 5677 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5678 dst = dst[4:] 5679 for idx := 0; idx < 6; idx++ { 5680 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Spare[idx])) 5681 dst = dst[4:] 5682 } 5683 return dst 5684 } 5685 5686 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5687 func (f *FUSEStatfsOut) UnmarshalBytes(src []byte) []byte { 5688 f.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5689 src = src[8:] 5690 f.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5691 src = src[8:] 5692 f.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5693 src = src[8:] 5694 f.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5695 src = src[8:] 5696 f.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5697 src = src[8:] 5698 f.BlockSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5699 src = src[4:] 5700 f.NameLength = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5701 src = src[4:] 5702 f.FragmentSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5703 src = src[4:] 5704 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5705 src = src[4:] 5706 for idx := 0; idx < 6; idx++ { 5707 f.Spare[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5708 src = src[4:] 5709 } 5710 return src 5711 } 5712 5713 // Packed implements marshal.Marshallable.Packed. 5714 //go:nosplit 5715 func (f *FUSEStatfsOut) Packed() bool { 5716 return true 5717 } 5718 5719 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5720 func (f *FUSEStatfsOut) MarshalUnsafe(dst []byte) []byte { 5721 size := f.SizeBytes() 5722 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5723 return dst[size:] 5724 } 5725 5726 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5727 func (f *FUSEStatfsOut) UnmarshalUnsafe(src []byte) []byte { 5728 size := f.SizeBytes() 5729 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5730 return src[size:] 5731 } 5732 5733 // CopyOutN implements marshal.Marshallable.CopyOutN. 5734 func (f *FUSEStatfsOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5735 // Construct a slice backed by dst's underlying memory. 5736 var buf []byte 5737 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5738 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5739 hdr.Len = f.SizeBytes() 5740 hdr.Cap = f.SizeBytes() 5741 5742 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5743 // Since we bypassed the compiler's escape analysis, indicate that f 5744 // must live until the use above. 5745 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5746 return length, err 5747 } 5748 5749 // CopyOut implements marshal.Marshallable.CopyOut. 5750 func (f *FUSEStatfsOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5751 return f.CopyOutN(cc, addr, f.SizeBytes()) 5752 } 5753 5754 // CopyIn implements marshal.Marshallable.CopyIn. 5755 func (f *FUSEStatfsOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5756 // Construct a slice backed by dst's underlying memory. 5757 var buf []byte 5758 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5759 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5760 hdr.Len = f.SizeBytes() 5761 hdr.Cap = f.SizeBytes() 5762 5763 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5764 // Since we bypassed the compiler's escape analysis, indicate that f 5765 // must live until the use above. 5766 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5767 return length, err 5768 } 5769 5770 // WriteTo implements io.WriterTo.WriteTo. 5771 func (f *FUSEStatfsOut) WriteTo(writer io.Writer) (int64, error) { 5772 // Construct a slice backed by dst's underlying memory. 5773 var buf []byte 5774 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5775 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5776 hdr.Len = f.SizeBytes() 5777 hdr.Cap = f.SizeBytes() 5778 5779 length, err := writer.Write(buf) 5780 // Since we bypassed the compiler's escape analysis, indicate that f 5781 // must live until the use above. 5782 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5783 return int64(length), err 5784 } 5785 5786 // Packed implements marshal.Marshallable.Packed. 5787 //go:nosplit 5788 func (r *FUSESymlinkIn) Packed() bool { 5789 // Type FUSESymlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5790 return false 5791 } 5792 5793 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5794 func (r *FUSESymlinkIn) MarshalUnsafe(dst []byte) []byte { 5795 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5796 return r.MarshalBytes(dst) 5797 } 5798 5799 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5800 func (r *FUSESymlinkIn) UnmarshalUnsafe(src []byte) []byte { 5801 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5802 return r.UnmarshalBytes(src) 5803 } 5804 5805 // CopyOutN implements marshal.Marshallable.CopyOutN. 5806 //go:nosplit 5807 func (r *FUSESymlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5808 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5809 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5810 r.MarshalBytes(buf) // escapes: fallback. 5811 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5812 } 5813 5814 // CopyOut implements marshal.Marshallable.CopyOut. 5815 func (r *FUSESymlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5816 return r.CopyOutN(cc, addr, r.SizeBytes()) 5817 } 5818 5819 // CopyIn implements marshal.Marshallable.CopyIn. 5820 func (r *FUSESymlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5821 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5822 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5823 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5824 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5825 // partially unmarshalled struct. 5826 r.UnmarshalBytes(buf) // escapes: fallback. 5827 return length, err 5828 } 5829 5830 // WriteTo implements io.WriterTo.WriteTo. 5831 func (r *FUSESymlinkIn) WriteTo(writer io.Writer) (int64, error) { 5832 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5833 buf := make([]byte, r.SizeBytes()) 5834 r.MarshalBytes(buf) 5835 length, err := writer.Write(buf) 5836 return int64(length), err 5837 } 5838 5839 // Packed implements marshal.Marshallable.Packed. 5840 //go:nosplit 5841 func (r *FUSEUnlinkIn) Packed() bool { 5842 // Type FUSEUnlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5843 return false 5844 } 5845 5846 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5847 func (r *FUSEUnlinkIn) MarshalUnsafe(dst []byte) []byte { 5848 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5849 return r.MarshalBytes(dst) 5850 } 5851 5852 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5853 func (r *FUSEUnlinkIn) UnmarshalUnsafe(src []byte) []byte { 5854 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5855 return r.UnmarshalBytes(src) 5856 } 5857 5858 // CopyOutN implements marshal.Marshallable.CopyOutN. 5859 //go:nosplit 5860 func (r *FUSEUnlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5861 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5862 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5863 r.MarshalBytes(buf) // escapes: fallback. 5864 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5865 } 5866 5867 // CopyOut implements marshal.Marshallable.CopyOut. 5868 func (r *FUSEUnlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5869 return r.CopyOutN(cc, addr, r.SizeBytes()) 5870 } 5871 5872 // CopyIn implements marshal.Marshallable.CopyIn. 5873 func (r *FUSEUnlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5874 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5875 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5876 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5877 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5878 // partially unmarshalled struct. 5879 r.UnmarshalBytes(buf) // escapes: fallback. 5880 return length, err 5881 } 5882 5883 // WriteTo implements io.WriterTo.WriteTo. 5884 func (r *FUSEUnlinkIn) WriteTo(writer io.Writer) (int64, error) { 5885 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5886 buf := make([]byte, r.SizeBytes()) 5887 r.MarshalBytes(buf) 5888 length, err := writer.Write(buf) 5889 return int64(length), err 5890 } 5891 5892 // SizeBytes implements marshal.Marshallable.SizeBytes. 5893 func (f *FUSEWriteIn) SizeBytes() int { 5894 return 40 5895 } 5896 5897 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5898 func (f *FUSEWriteIn) MarshalBytes(dst []byte) []byte { 5899 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5900 dst = dst[8:] 5901 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5902 dst = dst[8:] 5903 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5904 dst = dst[4:] 5905 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.WriteFlags)) 5906 dst = dst[4:] 5907 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5908 dst = dst[8:] 5909 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5910 dst = dst[4:] 5911 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5912 dst = dst[4:] 5913 return dst 5914 } 5915 5916 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5917 func (f *FUSEWriteIn) UnmarshalBytes(src []byte) []byte { 5918 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5919 src = src[8:] 5920 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5921 src = src[8:] 5922 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5923 src = src[4:] 5924 f.WriteFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5925 src = src[4:] 5926 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5927 src = src[8:] 5928 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5929 src = src[4:] 5930 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5931 src = src[4:] 5932 return src 5933 } 5934 5935 // Packed implements marshal.Marshallable.Packed. 5936 //go:nosplit 5937 func (f *FUSEWriteIn) Packed() bool { 5938 return true 5939 } 5940 5941 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5942 func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) []byte { 5943 size := f.SizeBytes() 5944 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5945 return dst[size:] 5946 } 5947 5948 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5949 func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) []byte { 5950 size := f.SizeBytes() 5951 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5952 return src[size:] 5953 } 5954 5955 // CopyOutN implements marshal.Marshallable.CopyOutN. 5956 func (f *FUSEWriteIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5957 // Construct a slice backed by dst's underlying memory. 5958 var buf []byte 5959 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5960 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5961 hdr.Len = f.SizeBytes() 5962 hdr.Cap = f.SizeBytes() 5963 5964 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5965 // Since we bypassed the compiler's escape analysis, indicate that f 5966 // must live until the use above. 5967 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5968 return length, err 5969 } 5970 5971 // CopyOut implements marshal.Marshallable.CopyOut. 5972 func (f *FUSEWriteIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5973 return f.CopyOutN(cc, addr, f.SizeBytes()) 5974 } 5975 5976 // CopyIn implements marshal.Marshallable.CopyIn. 5977 func (f *FUSEWriteIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5978 // Construct a slice backed by dst's underlying memory. 5979 var buf []byte 5980 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5981 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5982 hdr.Len = f.SizeBytes() 5983 hdr.Cap = f.SizeBytes() 5984 5985 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5986 // Since we bypassed the compiler's escape analysis, indicate that f 5987 // must live until the use above. 5988 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5989 return length, err 5990 } 5991 5992 // WriteTo implements io.WriterTo.WriteTo. 5993 func (f *FUSEWriteIn) WriteTo(writer io.Writer) (int64, error) { 5994 // Construct a slice backed by dst's underlying memory. 5995 var buf []byte 5996 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5997 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5998 hdr.Len = f.SizeBytes() 5999 hdr.Cap = f.SizeBytes() 6000 6001 length, err := writer.Write(buf) 6002 // Since we bypassed the compiler's escape analysis, indicate that f 6003 // must live until the use above. 6004 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6005 return int64(length), err 6006 } 6007 6008 // SizeBytes implements marshal.Marshallable.SizeBytes. 6009 func (f *FUSEWriteOut) SizeBytes() int { 6010 return 8 6011 } 6012 6013 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6014 func (f *FUSEWriteOut) MarshalBytes(dst []byte) []byte { 6015 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 6016 dst = dst[4:] 6017 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6018 dst = dst[4:] 6019 return dst 6020 } 6021 6022 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6023 func (f *FUSEWriteOut) UnmarshalBytes(src []byte) []byte { 6024 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6025 src = src[4:] 6026 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6027 src = src[4:] 6028 return src 6029 } 6030 6031 // Packed implements marshal.Marshallable.Packed. 6032 //go:nosplit 6033 func (f *FUSEWriteOut) Packed() bool { 6034 return true 6035 } 6036 6037 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6038 func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) []byte { 6039 size := f.SizeBytes() 6040 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6041 return dst[size:] 6042 } 6043 6044 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6045 func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) []byte { 6046 size := f.SizeBytes() 6047 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6048 return src[size:] 6049 } 6050 6051 // CopyOutN implements marshal.Marshallable.CopyOutN. 6052 func (f *FUSEWriteOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6053 // Construct a slice backed by dst's underlying memory. 6054 var buf []byte 6055 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6056 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6057 hdr.Len = f.SizeBytes() 6058 hdr.Cap = f.SizeBytes() 6059 6060 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6061 // Since we bypassed the compiler's escape analysis, indicate that f 6062 // must live until the use above. 6063 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6064 return length, err 6065 } 6066 6067 // CopyOut implements marshal.Marshallable.CopyOut. 6068 func (f *FUSEWriteOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6069 return f.CopyOutN(cc, addr, f.SizeBytes()) 6070 } 6071 6072 // CopyIn implements marshal.Marshallable.CopyIn. 6073 func (f *FUSEWriteOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6074 // Construct a slice backed by dst's underlying memory. 6075 var buf []byte 6076 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6077 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6078 hdr.Len = f.SizeBytes() 6079 hdr.Cap = f.SizeBytes() 6080 6081 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6082 // Since we bypassed the compiler's escape analysis, indicate that f 6083 // must live until the use above. 6084 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6085 return length, err 6086 } 6087 6088 // WriteTo implements io.WriterTo.WriteTo. 6089 func (f *FUSEWriteOut) WriteTo(writer io.Writer) (int64, error) { 6090 // Construct a slice backed by dst's underlying memory. 6091 var buf []byte 6092 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6093 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6094 hdr.Len = f.SizeBytes() 6095 hdr.Cap = f.SizeBytes() 6096 6097 length, err := writer.Write(buf) 6098 // Since we bypassed the compiler's escape analysis, indicate that f 6099 // must live until the use above. 6100 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6101 return int64(length), err 6102 } 6103 6104 // Packed implements marshal.Marshallable.Packed. 6105 //go:nosplit 6106 func (r *FUSEWritePayloadIn) Packed() bool { 6107 // Type FUSEWritePayloadIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6108 return false 6109 } 6110 6111 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6112 func (r *FUSEWritePayloadIn) MarshalUnsafe(dst []byte) []byte { 6113 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6114 return r.MarshalBytes(dst) 6115 } 6116 6117 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6118 func (r *FUSEWritePayloadIn) UnmarshalUnsafe(src []byte) []byte { 6119 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6120 return r.UnmarshalBytes(src) 6121 } 6122 6123 // CopyOutN implements marshal.Marshallable.CopyOutN. 6124 //go:nosplit 6125 func (r *FUSEWritePayloadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6126 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6127 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6128 r.MarshalBytes(buf) // escapes: fallback. 6129 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6130 } 6131 6132 // CopyOut implements marshal.Marshallable.CopyOut. 6133 func (r *FUSEWritePayloadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6134 return r.CopyOutN(cc, addr, r.SizeBytes()) 6135 } 6136 6137 // CopyIn implements marshal.Marshallable.CopyIn. 6138 func (r *FUSEWritePayloadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6139 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6140 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6141 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6142 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6143 // partially unmarshalled struct. 6144 r.UnmarshalBytes(buf) // escapes: fallback. 6145 return length, err 6146 } 6147 6148 // WriteTo implements io.WriterTo.WriteTo. 6149 func (r *FUSEWritePayloadIn) WriteTo(writer io.Writer) (int64, error) { 6150 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6151 buf := make([]byte, r.SizeBytes()) 6152 r.MarshalBytes(buf) 6153 length, err := writer.Write(buf) 6154 return int64(length), err 6155 } 6156 6157 // SizeBytes implements marshal.Marshallable.SizeBytes. 6158 func (r *RobustListHead) SizeBytes() int { 6159 return 24 6160 } 6161 6162 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6163 func (r *RobustListHead) MarshalBytes(dst []byte) []byte { 6164 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.List)) 6165 dst = dst[8:] 6166 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.FutexOffset)) 6167 dst = dst[8:] 6168 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ListOpPending)) 6169 dst = dst[8:] 6170 return dst 6171 } 6172 6173 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6174 func (r *RobustListHead) UnmarshalBytes(src []byte) []byte { 6175 r.List = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6176 src = src[8:] 6177 r.FutexOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6178 src = src[8:] 6179 r.ListOpPending = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6180 src = src[8:] 6181 return src 6182 } 6183 6184 // Packed implements marshal.Marshallable.Packed. 6185 //go:nosplit 6186 func (r *RobustListHead) Packed() bool { 6187 return true 6188 } 6189 6190 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6191 func (r *RobustListHead) MarshalUnsafe(dst []byte) []byte { 6192 size := r.SizeBytes() 6193 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 6194 return dst[size:] 6195 } 6196 6197 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6198 func (r *RobustListHead) UnmarshalUnsafe(src []byte) []byte { 6199 size := r.SizeBytes() 6200 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 6201 return src[size:] 6202 } 6203 6204 // CopyOutN implements marshal.Marshallable.CopyOutN. 6205 func (r *RobustListHead) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6206 // Construct a slice backed by dst's underlying memory. 6207 var buf []byte 6208 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6209 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6210 hdr.Len = r.SizeBytes() 6211 hdr.Cap = r.SizeBytes() 6212 6213 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6214 // Since we bypassed the compiler's escape analysis, indicate that r 6215 // must live until the use above. 6216 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6217 return length, err 6218 } 6219 6220 // CopyOut implements marshal.Marshallable.CopyOut. 6221 func (r *RobustListHead) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6222 return r.CopyOutN(cc, addr, r.SizeBytes()) 6223 } 6224 6225 // CopyIn implements marshal.Marshallable.CopyIn. 6226 func (r *RobustListHead) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6227 // Construct a slice backed by dst's underlying memory. 6228 var buf []byte 6229 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6230 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6231 hdr.Len = r.SizeBytes() 6232 hdr.Cap = r.SizeBytes() 6233 6234 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6235 // Since we bypassed the compiler's escape analysis, indicate that r 6236 // must live until the use above. 6237 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6238 return length, err 6239 } 6240 6241 // WriteTo implements io.WriterTo.WriteTo. 6242 func (r *RobustListHead) WriteTo(writer io.Writer) (int64, error) { 6243 // Construct a slice backed by dst's underlying memory. 6244 var buf []byte 6245 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6246 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6247 hdr.Len = r.SizeBytes() 6248 hdr.Cap = r.SizeBytes() 6249 6250 length, err := writer.Write(buf) 6251 // Since we bypassed the compiler's escape analysis, indicate that r 6252 // must live until the use above. 6253 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6254 return int64(length), err 6255 } 6256 6257 // SizeBytes implements marshal.Marshallable.SizeBytes. 6258 func (i *IOCqRingOffsets) SizeBytes() int { 6259 return 40 6260 } 6261 6262 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6263 func (i *IOCqRingOffsets) MarshalBytes(dst []byte) []byte { 6264 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6265 dst = dst[4:] 6266 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6267 dst = dst[4:] 6268 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 6269 dst = dst[4:] 6270 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 6271 dst = dst[4:] 6272 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Overflow)) 6273 dst = dst[4:] 6274 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Cqes)) 6275 dst = dst[4:] 6276 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6277 dst = dst[4:] 6278 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 6279 dst = dst[4:] 6280 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 6281 dst = dst[8:] 6282 return dst 6283 } 6284 6285 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6286 func (i *IOCqRingOffsets) UnmarshalBytes(src []byte) []byte { 6287 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6288 src = src[4:] 6289 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6290 src = src[4:] 6291 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6292 src = src[4:] 6293 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6294 src = src[4:] 6295 i.Overflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6296 src = src[4:] 6297 i.Cqes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6298 src = src[4:] 6299 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6300 src = src[4:] 6301 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6302 src = src[4:] 6303 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6304 src = src[8:] 6305 return src 6306 } 6307 6308 // Packed implements marshal.Marshallable.Packed. 6309 //go:nosplit 6310 func (i *IOCqRingOffsets) Packed() bool { 6311 return true 6312 } 6313 6314 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6315 func (i *IOCqRingOffsets) MarshalUnsafe(dst []byte) []byte { 6316 size := i.SizeBytes() 6317 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6318 return dst[size:] 6319 } 6320 6321 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6322 func (i *IOCqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 6323 size := i.SizeBytes() 6324 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6325 return src[size:] 6326 } 6327 6328 // CopyOutN implements marshal.Marshallable.CopyOutN. 6329 func (i *IOCqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6330 // Construct a slice backed by dst's underlying memory. 6331 var buf []byte 6332 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6333 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6334 hdr.Len = i.SizeBytes() 6335 hdr.Cap = i.SizeBytes() 6336 6337 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6338 // Since we bypassed the compiler's escape analysis, indicate that i 6339 // must live until the use above. 6340 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6341 return length, err 6342 } 6343 6344 // CopyOut implements marshal.Marshallable.CopyOut. 6345 func (i *IOCqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6346 return i.CopyOutN(cc, addr, i.SizeBytes()) 6347 } 6348 6349 // CopyIn implements marshal.Marshallable.CopyIn. 6350 func (i *IOCqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6351 // Construct a slice backed by dst's underlying memory. 6352 var buf []byte 6353 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6354 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6355 hdr.Len = i.SizeBytes() 6356 hdr.Cap = i.SizeBytes() 6357 6358 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6359 // Since we bypassed the compiler's escape analysis, indicate that i 6360 // must live until the use above. 6361 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6362 return length, err 6363 } 6364 6365 // WriteTo implements io.WriterTo.WriteTo. 6366 func (i *IOCqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 6367 // Construct a slice backed by dst's underlying memory. 6368 var buf []byte 6369 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6370 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6371 hdr.Len = i.SizeBytes() 6372 hdr.Cap = i.SizeBytes() 6373 6374 length, err := writer.Write(buf) 6375 // Since we bypassed the compiler's escape analysis, indicate that i 6376 // must live until the use above. 6377 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6378 return int64(length), err 6379 } 6380 6381 // SizeBytes implements marshal.Marshallable.SizeBytes. 6382 //go:nosplit 6383 func (i *IORingIndex) SizeBytes() int { 6384 return 4 6385 } 6386 6387 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6388 func (i *IORingIndex) MarshalBytes(dst []byte) []byte { 6389 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i)) 6390 return dst[4:] 6391 } 6392 6393 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6394 func (i *IORingIndex) UnmarshalBytes(src []byte) []byte { 6395 *i = IORingIndex(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 6396 return src[4:] 6397 } 6398 6399 // Packed implements marshal.Marshallable.Packed. 6400 //go:nosplit 6401 func (i *IORingIndex) Packed() bool { 6402 // Scalar newtypes are always packed. 6403 return true 6404 } 6405 6406 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6407 func (i *IORingIndex) MarshalUnsafe(dst []byte) []byte { 6408 size := i.SizeBytes() 6409 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6410 return dst[size:] 6411 } 6412 6413 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6414 func (i *IORingIndex) UnmarshalUnsafe(src []byte) []byte { 6415 size := i.SizeBytes() 6416 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6417 return src[size:] 6418 } 6419 6420 // CopyOutN implements marshal.Marshallable.CopyOutN. 6421 func (i *IORingIndex) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6422 // Construct a slice backed by dst's underlying memory. 6423 var buf []byte 6424 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6425 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6426 hdr.Len = i.SizeBytes() 6427 hdr.Cap = i.SizeBytes() 6428 6429 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6430 // Since we bypassed the compiler's escape analysis, indicate that i 6431 // must live until the use above. 6432 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6433 return length, err 6434 } 6435 6436 // CopyOut implements marshal.Marshallable.CopyOut. 6437 func (i *IORingIndex) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6438 return i.CopyOutN(cc, addr, i.SizeBytes()) 6439 } 6440 6441 // CopyIn implements marshal.Marshallable.CopyIn. 6442 func (i *IORingIndex) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6443 // Construct a slice backed by dst's underlying memory. 6444 var buf []byte 6445 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6446 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6447 hdr.Len = i.SizeBytes() 6448 hdr.Cap = i.SizeBytes() 6449 6450 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6451 // Since we bypassed the compiler's escape analysis, indicate that i 6452 // must live until the use above. 6453 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6454 return length, err 6455 } 6456 6457 // WriteTo implements io.WriterTo.WriteTo. 6458 func (i *IORingIndex) WriteTo(writer io.Writer) (int64, error) { 6459 // Construct a slice backed by dst's underlying memory. 6460 var buf []byte 6461 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6462 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6463 hdr.Len = i.SizeBytes() 6464 hdr.Cap = i.SizeBytes() 6465 6466 length, err := writer.Write(buf) 6467 // Since we bypassed the compiler's escape analysis, indicate that i 6468 // must live until the use above. 6469 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6470 return int64(length), err 6471 } 6472 6473 // SizeBytes implements marshal.Marshallable.SizeBytes. 6474 func (i *IORings) SizeBytes() int { 6475 return 32 + 6476 (*IOUring)(nil).SizeBytes() + 6477 (*IOUring)(nil).SizeBytes() + 6478 1*32 6479 } 6480 6481 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6482 func (i *IORings) MarshalBytes(dst []byte) []byte { 6483 dst = i.Sq.MarshalUnsafe(dst) 6484 dst = i.Cq.MarshalUnsafe(dst) 6485 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingMask)) 6486 dst = dst[4:] 6487 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingMask)) 6488 dst = dst[4:] 6489 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingEntries)) 6490 dst = dst[4:] 6491 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingEntries)) 6492 dst = dst[4:] 6493 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqDropped)) 6494 dst = dst[4:] 6495 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqFlags)) 6496 dst = dst[4:] 6497 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.cqFlags)) 6498 dst = dst[4:] 6499 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqOverflow)) 6500 dst = dst[4:] 6501 // Padding: dst[:sizeof(byte)*32] ~= [32]byte{0} 6502 dst = dst[1*(32):] 6503 return dst 6504 } 6505 6506 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6507 func (i *IORings) UnmarshalBytes(src []byte) []byte { 6508 src = i.Sq.UnmarshalUnsafe(src) 6509 src = i.Cq.UnmarshalUnsafe(src) 6510 i.SqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6511 src = src[4:] 6512 i.CqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6513 src = src[4:] 6514 i.SqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6515 src = src[4:] 6516 i.CqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6517 src = src[4:] 6518 i.sqDropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6519 src = src[4:] 6520 i.sqFlags = int32(hostarch.ByteOrder.Uint32(src[:4])) 6521 src = src[4:] 6522 i.cqFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6523 src = src[4:] 6524 i.CqOverflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6525 src = src[4:] 6526 // Padding: ~ copy([32]byte(i._), src[:sizeof(byte)*32]) 6527 src = src[1*(32):] 6528 return src 6529 } 6530 6531 // Packed implements marshal.Marshallable.Packed. 6532 //go:nosplit 6533 func (i *IORings) Packed() bool { 6534 return i.Cq.Packed() && i.Sq.Packed() 6535 } 6536 6537 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6538 func (i *IORings) MarshalUnsafe(dst []byte) []byte { 6539 if i.Cq.Packed() && i.Sq.Packed() { 6540 size := i.SizeBytes() 6541 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6542 return dst[size:] 6543 } 6544 // Type IORings doesn't have a packed layout in memory, fallback to MarshalBytes. 6545 return i.MarshalBytes(dst) 6546 } 6547 6548 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6549 func (i *IORings) UnmarshalUnsafe(src []byte) []byte { 6550 if i.Cq.Packed() && i.Sq.Packed() { 6551 size := i.SizeBytes() 6552 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6553 return src[size:] 6554 } 6555 // Type IORings doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6556 return i.UnmarshalBytes(src) 6557 } 6558 6559 // CopyOutN implements marshal.Marshallable.CopyOutN. 6560 func (i *IORings) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6561 if !i.Cq.Packed() && i.Sq.Packed() { 6562 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 6563 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 6564 i.MarshalBytes(buf) // escapes: fallback. 6565 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6566 } 6567 6568 // Construct a slice backed by dst's underlying memory. 6569 var buf []byte 6570 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6571 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6572 hdr.Len = i.SizeBytes() 6573 hdr.Cap = i.SizeBytes() 6574 6575 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6576 // Since we bypassed the compiler's escape analysis, indicate that i 6577 // must live until the use above. 6578 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6579 return length, err 6580 } 6581 6582 // CopyOut implements marshal.Marshallable.CopyOut. 6583 func (i *IORings) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6584 return i.CopyOutN(cc, addr, i.SizeBytes()) 6585 } 6586 6587 // CopyIn implements marshal.Marshallable.CopyIn. 6588 func (i *IORings) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6589 if !i.Cq.Packed() && i.Sq.Packed() { 6590 // Type IORings doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6591 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 6592 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6593 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6594 // partially unmarshalled struct. 6595 i.UnmarshalBytes(buf) // escapes: fallback. 6596 return length, err 6597 } 6598 6599 // Construct a slice backed by dst's underlying memory. 6600 var buf []byte 6601 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6602 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6603 hdr.Len = i.SizeBytes() 6604 hdr.Cap = i.SizeBytes() 6605 6606 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6607 // Since we bypassed the compiler's escape analysis, indicate that i 6608 // must live until the use above. 6609 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6610 return length, err 6611 } 6612 6613 // WriteTo implements io.WriterTo.WriteTo. 6614 func (i *IORings) WriteTo(writer io.Writer) (int64, error) { 6615 if !i.Cq.Packed() && i.Sq.Packed() { 6616 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 6617 buf := make([]byte, i.SizeBytes()) 6618 i.MarshalBytes(buf) 6619 length, err := writer.Write(buf) 6620 return int64(length), err 6621 } 6622 6623 // Construct a slice backed by dst's underlying memory. 6624 var buf []byte 6625 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6626 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6627 hdr.Len = i.SizeBytes() 6628 hdr.Cap = i.SizeBytes() 6629 6630 length, err := writer.Write(buf) 6631 // Since we bypassed the compiler's escape analysis, indicate that i 6632 // must live until the use above. 6633 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6634 return int64(length), err 6635 } 6636 6637 // SizeBytes implements marshal.Marshallable.SizeBytes. 6638 func (i *IOSqRingOffsets) SizeBytes() int { 6639 return 40 6640 } 6641 6642 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6643 func (i *IOSqRingOffsets) MarshalBytes(dst []byte) []byte { 6644 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6645 dst = dst[4:] 6646 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6647 dst = dst[4:] 6648 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 6649 dst = dst[4:] 6650 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 6651 dst = dst[4:] 6652 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6653 dst = dst[4:] 6654 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Dropped)) 6655 dst = dst[4:] 6656 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Array)) 6657 dst = dst[4:] 6658 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 6659 dst = dst[4:] 6660 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 6661 dst = dst[8:] 6662 return dst 6663 } 6664 6665 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6666 func (i *IOSqRingOffsets) UnmarshalBytes(src []byte) []byte { 6667 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6668 src = src[4:] 6669 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6670 src = src[4:] 6671 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6672 src = src[4:] 6673 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6674 src = src[4:] 6675 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6676 src = src[4:] 6677 i.Dropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6678 src = src[4:] 6679 i.Array = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6680 src = src[4:] 6681 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6682 src = src[4:] 6683 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6684 src = src[8:] 6685 return src 6686 } 6687 6688 // Packed implements marshal.Marshallable.Packed. 6689 //go:nosplit 6690 func (i *IOSqRingOffsets) Packed() bool { 6691 return true 6692 } 6693 6694 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6695 func (i *IOSqRingOffsets) MarshalUnsafe(dst []byte) []byte { 6696 size := i.SizeBytes() 6697 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6698 return dst[size:] 6699 } 6700 6701 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6702 func (i *IOSqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 6703 size := i.SizeBytes() 6704 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6705 return src[size:] 6706 } 6707 6708 // CopyOutN implements marshal.Marshallable.CopyOutN. 6709 func (i *IOSqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6710 // Construct a slice backed by dst's underlying memory. 6711 var buf []byte 6712 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6713 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6714 hdr.Len = i.SizeBytes() 6715 hdr.Cap = i.SizeBytes() 6716 6717 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6718 // Since we bypassed the compiler's escape analysis, indicate that i 6719 // must live until the use above. 6720 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6721 return length, err 6722 } 6723 6724 // CopyOut implements marshal.Marshallable.CopyOut. 6725 func (i *IOSqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6726 return i.CopyOutN(cc, addr, i.SizeBytes()) 6727 } 6728 6729 // CopyIn implements marshal.Marshallable.CopyIn. 6730 func (i *IOSqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6731 // Construct a slice backed by dst's underlying memory. 6732 var buf []byte 6733 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6734 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6735 hdr.Len = i.SizeBytes() 6736 hdr.Cap = i.SizeBytes() 6737 6738 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6739 // Since we bypassed the compiler's escape analysis, indicate that i 6740 // must live until the use above. 6741 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6742 return length, err 6743 } 6744 6745 // WriteTo implements io.WriterTo.WriteTo. 6746 func (i *IOSqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 6747 // Construct a slice backed by dst's underlying memory. 6748 var buf []byte 6749 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6750 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6751 hdr.Len = i.SizeBytes() 6752 hdr.Cap = i.SizeBytes() 6753 6754 length, err := writer.Write(buf) 6755 // Since we bypassed the compiler's escape analysis, indicate that i 6756 // must live until the use above. 6757 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6758 return int64(length), err 6759 } 6760 6761 // SizeBytes implements marshal.Marshallable.SizeBytes. 6762 func (i *IOUring) SizeBytes() int { 6763 return 8 + 6764 1*60 + 6765 1*60 6766 } 6767 6768 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6769 func (i *IOUring) MarshalBytes(dst []byte) []byte { 6770 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6771 dst = dst[4:] 6772 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 6773 dst = dst[1*(60):] 6774 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6775 dst = dst[4:] 6776 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 6777 dst = dst[1*(60):] 6778 return dst 6779 } 6780 6781 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6782 func (i *IOUring) UnmarshalBytes(src []byte) []byte { 6783 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6784 src = src[4:] 6785 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 6786 src = src[1*(60):] 6787 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6788 src = src[4:] 6789 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 6790 src = src[1*(60):] 6791 return src 6792 } 6793 6794 // Packed implements marshal.Marshallable.Packed. 6795 //go:nosplit 6796 func (i *IOUring) Packed() bool { 6797 return true 6798 } 6799 6800 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6801 func (i *IOUring) MarshalUnsafe(dst []byte) []byte { 6802 size := i.SizeBytes() 6803 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6804 return dst[size:] 6805 } 6806 6807 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6808 func (i *IOUring) UnmarshalUnsafe(src []byte) []byte { 6809 size := i.SizeBytes() 6810 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6811 return src[size:] 6812 } 6813 6814 // CopyOutN implements marshal.Marshallable.CopyOutN. 6815 func (i *IOUring) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6816 // Construct a slice backed by dst's underlying memory. 6817 var buf []byte 6818 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6819 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6820 hdr.Len = i.SizeBytes() 6821 hdr.Cap = i.SizeBytes() 6822 6823 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6824 // Since we bypassed the compiler's escape analysis, indicate that i 6825 // must live until the use above. 6826 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6827 return length, err 6828 } 6829 6830 // CopyOut implements marshal.Marshallable.CopyOut. 6831 func (i *IOUring) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6832 return i.CopyOutN(cc, addr, i.SizeBytes()) 6833 } 6834 6835 // CopyIn implements marshal.Marshallable.CopyIn. 6836 func (i *IOUring) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6837 // Construct a slice backed by dst's underlying memory. 6838 var buf []byte 6839 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6840 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6841 hdr.Len = i.SizeBytes() 6842 hdr.Cap = i.SizeBytes() 6843 6844 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6845 // Since we bypassed the compiler's escape analysis, indicate that i 6846 // must live until the use above. 6847 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6848 return length, err 6849 } 6850 6851 // WriteTo implements io.WriterTo.WriteTo. 6852 func (i *IOUring) WriteTo(writer io.Writer) (int64, error) { 6853 // Construct a slice backed by dst's underlying memory. 6854 var buf []byte 6855 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6856 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6857 hdr.Len = i.SizeBytes() 6858 hdr.Cap = i.SizeBytes() 6859 6860 length, err := writer.Write(buf) 6861 // Since we bypassed the compiler's escape analysis, indicate that i 6862 // must live until the use above. 6863 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6864 return int64(length), err 6865 } 6866 6867 // SizeBytes implements marshal.Marshallable.SizeBytes. 6868 func (i *IOUringCqe) SizeBytes() int { 6869 return 16 6870 } 6871 6872 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6873 func (i *IOUringCqe) MarshalBytes(dst []byte) []byte { 6874 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 6875 dst = dst[8:] 6876 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Res)) 6877 dst = dst[4:] 6878 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6879 dst = dst[4:] 6880 return dst 6881 } 6882 6883 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6884 func (i *IOUringCqe) UnmarshalBytes(src []byte) []byte { 6885 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6886 src = src[8:] 6887 i.Res = int32(hostarch.ByteOrder.Uint32(src[:4])) 6888 src = src[4:] 6889 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6890 src = src[4:] 6891 return src 6892 } 6893 6894 // Packed implements marshal.Marshallable.Packed. 6895 //go:nosplit 6896 func (i *IOUringCqe) Packed() bool { 6897 return true 6898 } 6899 6900 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6901 func (i *IOUringCqe) MarshalUnsafe(dst []byte) []byte { 6902 size := i.SizeBytes() 6903 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6904 return dst[size:] 6905 } 6906 6907 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6908 func (i *IOUringCqe) UnmarshalUnsafe(src []byte) []byte { 6909 size := i.SizeBytes() 6910 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6911 return src[size:] 6912 } 6913 6914 // CopyOutN implements marshal.Marshallable.CopyOutN. 6915 func (i *IOUringCqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6916 // Construct a slice backed by dst's underlying memory. 6917 var buf []byte 6918 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6919 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6920 hdr.Len = i.SizeBytes() 6921 hdr.Cap = i.SizeBytes() 6922 6923 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6924 // Since we bypassed the compiler's escape analysis, indicate that i 6925 // must live until the use above. 6926 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6927 return length, err 6928 } 6929 6930 // CopyOut implements marshal.Marshallable.CopyOut. 6931 func (i *IOUringCqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6932 return i.CopyOutN(cc, addr, i.SizeBytes()) 6933 } 6934 6935 // CopyIn implements marshal.Marshallable.CopyIn. 6936 func (i *IOUringCqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6937 // Construct a slice backed by dst's underlying memory. 6938 var buf []byte 6939 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6940 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6941 hdr.Len = i.SizeBytes() 6942 hdr.Cap = i.SizeBytes() 6943 6944 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6945 // Since we bypassed the compiler's escape analysis, indicate that i 6946 // must live until the use above. 6947 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6948 return length, err 6949 } 6950 6951 // WriteTo implements io.WriterTo.WriteTo. 6952 func (i *IOUringCqe) WriteTo(writer io.Writer) (int64, error) { 6953 // Construct a slice backed by dst's underlying memory. 6954 var buf []byte 6955 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6956 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6957 hdr.Len = i.SizeBytes() 6958 hdr.Cap = i.SizeBytes() 6959 6960 length, err := writer.Write(buf) 6961 // Since we bypassed the compiler's escape analysis, indicate that i 6962 // must live until the use above. 6963 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6964 return int64(length), err 6965 } 6966 6967 // SizeBytes implements marshal.Marshallable.SizeBytes. 6968 func (i *IOUringParams) SizeBytes() int { 6969 return 28 + 6970 4*3 + 6971 (*IOSqRingOffsets)(nil).SizeBytes() + 6972 (*IOCqRingOffsets)(nil).SizeBytes() 6973 } 6974 6975 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6976 func (i *IOUringParams) MarshalBytes(dst []byte) []byte { 6977 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqEntries)) 6978 dst = dst[4:] 6979 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqEntries)) 6980 dst = dst[4:] 6981 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6982 dst = dst[4:] 6983 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadCPU)) 6984 dst = dst[4:] 6985 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadIdle)) 6986 dst = dst[4:] 6987 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Features)) 6988 dst = dst[4:] 6989 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.WqFd)) 6990 dst = dst[4:] 6991 for idx := 0; idx < 3; idx++ { 6992 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv[idx])) 6993 dst = dst[4:] 6994 } 6995 dst = i.SqOff.MarshalUnsafe(dst) 6996 dst = i.CqOff.MarshalUnsafe(dst) 6997 return dst 6998 } 6999 7000 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7001 func (i *IOUringParams) UnmarshalBytes(src []byte) []byte { 7002 i.SqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7003 src = src[4:] 7004 i.CqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7005 src = src[4:] 7006 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7007 src = src[4:] 7008 i.SqThreadCPU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7009 src = src[4:] 7010 i.SqThreadIdle = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7011 src = src[4:] 7012 i.Features = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7013 src = src[4:] 7014 i.WqFd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7015 src = src[4:] 7016 for idx := 0; idx < 3; idx++ { 7017 i.Resv[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7018 src = src[4:] 7019 } 7020 src = i.SqOff.UnmarshalUnsafe(src) 7021 src = i.CqOff.UnmarshalUnsafe(src) 7022 return src 7023 } 7024 7025 // Packed implements marshal.Marshallable.Packed. 7026 //go:nosplit 7027 func (i *IOUringParams) Packed() bool { 7028 return i.CqOff.Packed() && i.SqOff.Packed() 7029 } 7030 7031 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7032 func (i *IOUringParams) MarshalUnsafe(dst []byte) []byte { 7033 if i.CqOff.Packed() && i.SqOff.Packed() { 7034 size := i.SizeBytes() 7035 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7036 return dst[size:] 7037 } 7038 // Type IOUringParams doesn't have a packed layout in memory, fallback to MarshalBytes. 7039 return i.MarshalBytes(dst) 7040 } 7041 7042 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7043 func (i *IOUringParams) UnmarshalUnsafe(src []byte) []byte { 7044 if i.CqOff.Packed() && i.SqOff.Packed() { 7045 size := i.SizeBytes() 7046 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7047 return src[size:] 7048 } 7049 // Type IOUringParams doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7050 return i.UnmarshalBytes(src) 7051 } 7052 7053 // CopyOutN implements marshal.Marshallable.CopyOutN. 7054 func (i *IOUringParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7055 if !i.CqOff.Packed() && i.SqOff.Packed() { 7056 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7057 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7058 i.MarshalBytes(buf) // escapes: fallback. 7059 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7060 } 7061 7062 // Construct a slice backed by dst's underlying memory. 7063 var buf []byte 7064 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7065 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7066 hdr.Len = i.SizeBytes() 7067 hdr.Cap = i.SizeBytes() 7068 7069 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7070 // Since we bypassed the compiler's escape analysis, indicate that i 7071 // must live until the use above. 7072 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7073 return length, err 7074 } 7075 7076 // CopyOut implements marshal.Marshallable.CopyOut. 7077 func (i *IOUringParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7078 return i.CopyOutN(cc, addr, i.SizeBytes()) 7079 } 7080 7081 // CopyIn implements marshal.Marshallable.CopyIn. 7082 func (i *IOUringParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7083 if !i.CqOff.Packed() && i.SqOff.Packed() { 7084 // Type IOUringParams doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7085 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7086 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7087 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7088 // partially unmarshalled struct. 7089 i.UnmarshalBytes(buf) // escapes: fallback. 7090 return length, err 7091 } 7092 7093 // Construct a slice backed by dst's underlying memory. 7094 var buf []byte 7095 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7096 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7097 hdr.Len = i.SizeBytes() 7098 hdr.Cap = i.SizeBytes() 7099 7100 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7101 // Since we bypassed the compiler's escape analysis, indicate that i 7102 // must live until the use above. 7103 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7104 return length, err 7105 } 7106 7107 // WriteTo implements io.WriterTo.WriteTo. 7108 func (i *IOUringParams) WriteTo(writer io.Writer) (int64, error) { 7109 if !i.CqOff.Packed() && i.SqOff.Packed() { 7110 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7111 buf := make([]byte, i.SizeBytes()) 7112 i.MarshalBytes(buf) 7113 length, err := writer.Write(buf) 7114 return int64(length), err 7115 } 7116 7117 // Construct a slice backed by dst's underlying memory. 7118 var buf []byte 7119 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7120 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7121 hdr.Len = i.SizeBytes() 7122 hdr.Cap = i.SizeBytes() 7123 7124 length, err := writer.Write(buf) 7125 // Since we bypassed the compiler's escape analysis, indicate that i 7126 // must live until the use above. 7127 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7128 return int64(length), err 7129 } 7130 7131 // SizeBytes implements marshal.Marshallable.SizeBytes. 7132 func (i *IOUringSqe) SizeBytes() int { 7133 return 64 7134 } 7135 7136 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7137 func (i *IOUringSqe) MarshalBytes(dst []byte) []byte { 7138 dst[0] = byte(i.Opcode) 7139 dst = dst[1:] 7140 dst[0] = byte(i.Flags) 7141 dst = dst[1:] 7142 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.IoPrio)) 7143 dst = dst[2:] 7144 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Fd)) 7145 dst = dst[4:] 7146 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.OffOrAddrOrCmdOp)) 7147 dst = dst[8:] 7148 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.AddrOrSpliceOff)) 7149 dst = dst[8:] 7150 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 7151 dst = dst[4:] 7152 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.specialFlags)) 7153 dst = dst[4:] 7154 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 7155 dst = dst[8:] 7156 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.BufIndexOrGroup)) 7157 dst = dst[2:] 7158 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.personality)) 7159 dst = dst[2:] 7160 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.spliceFDOrFileIndex)) 7161 dst = dst[4:] 7162 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.addr3)) 7163 dst = dst[8:] 7164 // Padding: dst[:sizeof(uint64)] ~= uint64(0) 7165 dst = dst[8:] 7166 return dst 7167 } 7168 7169 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7170 func (i *IOUringSqe) UnmarshalBytes(src []byte) []byte { 7171 i.Opcode = uint8(src[0]) 7172 src = src[1:] 7173 i.Flags = uint8(src[0]) 7174 src = src[1:] 7175 i.IoPrio = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7176 src = src[2:] 7177 i.Fd = int32(hostarch.ByteOrder.Uint32(src[:4])) 7178 src = src[4:] 7179 i.OffOrAddrOrCmdOp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7180 src = src[8:] 7181 i.AddrOrSpliceOff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7182 src = src[8:] 7183 i.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7184 src = src[4:] 7185 i.specialFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7186 src = src[4:] 7187 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7188 src = src[8:] 7189 i.BufIndexOrGroup = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7190 src = src[2:] 7191 i.personality = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7192 src = src[2:] 7193 i.spliceFDOrFileIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 7194 src = src[4:] 7195 i.addr3 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7196 src = src[8:] 7197 // Padding: var _ uint64 ~= src[:sizeof(uint64)] 7198 src = src[8:] 7199 return src 7200 } 7201 7202 // Packed implements marshal.Marshallable.Packed. 7203 //go:nosplit 7204 func (i *IOUringSqe) Packed() bool { 7205 return true 7206 } 7207 7208 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7209 func (i *IOUringSqe) MarshalUnsafe(dst []byte) []byte { 7210 size := i.SizeBytes() 7211 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7212 return dst[size:] 7213 } 7214 7215 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7216 func (i *IOUringSqe) UnmarshalUnsafe(src []byte) []byte { 7217 size := i.SizeBytes() 7218 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7219 return src[size:] 7220 } 7221 7222 // CopyOutN implements marshal.Marshallable.CopyOutN. 7223 func (i *IOUringSqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7224 // Construct a slice backed by dst's underlying memory. 7225 var buf []byte 7226 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7227 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7228 hdr.Len = i.SizeBytes() 7229 hdr.Cap = i.SizeBytes() 7230 7231 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7232 // Since we bypassed the compiler's escape analysis, indicate that i 7233 // must live until the use above. 7234 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7235 return length, err 7236 } 7237 7238 // CopyOut implements marshal.Marshallable.CopyOut. 7239 func (i *IOUringSqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7240 return i.CopyOutN(cc, addr, i.SizeBytes()) 7241 } 7242 7243 // CopyIn implements marshal.Marshallable.CopyIn. 7244 func (i *IOUringSqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7245 // Construct a slice backed by dst's underlying memory. 7246 var buf []byte 7247 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7248 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7249 hdr.Len = i.SizeBytes() 7250 hdr.Cap = i.SizeBytes() 7251 7252 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7253 // Since we bypassed the compiler's escape analysis, indicate that i 7254 // must live until the use above. 7255 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7256 return length, err 7257 } 7258 7259 // WriteTo implements io.WriterTo.WriteTo. 7260 func (i *IOUringSqe) WriteTo(writer io.Writer) (int64, error) { 7261 // Construct a slice backed by dst's underlying memory. 7262 var buf []byte 7263 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7264 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7265 hdr.Len = i.SizeBytes() 7266 hdr.Cap = i.SizeBytes() 7267 7268 length, err := writer.Write(buf) 7269 // Since we bypassed the compiler's escape analysis, indicate that i 7270 // must live until the use above. 7271 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7272 return int64(length), err 7273 } 7274 7275 // SizeBytes implements marshal.Marshallable.SizeBytes. 7276 func (i *IPCPerm) SizeBytes() int { 7277 return 48 7278 } 7279 7280 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7281 func (i *IPCPerm) MarshalBytes(dst []byte) []byte { 7282 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 7283 dst = dst[4:] 7284 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 7285 dst = dst[4:] 7286 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 7287 dst = dst[4:] 7288 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CUID)) 7289 dst = dst[4:] 7290 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CGID)) 7291 dst = dst[4:] 7292 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Mode)) 7293 dst = dst[2:] 7294 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7295 dst = dst[2:] 7296 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Seq)) 7297 dst = dst[2:] 7298 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7299 dst = dst[2:] 7300 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 7301 dst = dst[4:] 7302 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused1)) 7303 dst = dst[8:] 7304 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused2)) 7305 dst = dst[8:] 7306 return dst 7307 } 7308 7309 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7310 func (i *IPCPerm) UnmarshalBytes(src []byte) []byte { 7311 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7312 src = src[4:] 7313 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7314 src = src[4:] 7315 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7316 src = src[4:] 7317 i.CUID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7318 src = src[4:] 7319 i.CGID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7320 src = src[4:] 7321 i.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7322 src = src[2:] 7323 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7324 src = src[2:] 7325 i.Seq = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7326 src = src[2:] 7327 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7328 src = src[2:] 7329 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 7330 src = src[4:] 7331 i.unused1 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7332 src = src[8:] 7333 i.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7334 src = src[8:] 7335 return src 7336 } 7337 7338 // Packed implements marshal.Marshallable.Packed. 7339 //go:nosplit 7340 func (i *IPCPerm) Packed() bool { 7341 return true 7342 } 7343 7344 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7345 func (i *IPCPerm) MarshalUnsafe(dst []byte) []byte { 7346 size := i.SizeBytes() 7347 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7348 return dst[size:] 7349 } 7350 7351 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7352 func (i *IPCPerm) UnmarshalUnsafe(src []byte) []byte { 7353 size := i.SizeBytes() 7354 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7355 return src[size:] 7356 } 7357 7358 // CopyOutN implements marshal.Marshallable.CopyOutN. 7359 func (i *IPCPerm) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7360 // Construct a slice backed by dst's underlying memory. 7361 var buf []byte 7362 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7363 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7364 hdr.Len = i.SizeBytes() 7365 hdr.Cap = i.SizeBytes() 7366 7367 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7368 // Since we bypassed the compiler's escape analysis, indicate that i 7369 // must live until the use above. 7370 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7371 return length, err 7372 } 7373 7374 // CopyOut implements marshal.Marshallable.CopyOut. 7375 func (i *IPCPerm) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7376 return i.CopyOutN(cc, addr, i.SizeBytes()) 7377 } 7378 7379 // CopyIn implements marshal.Marshallable.CopyIn. 7380 func (i *IPCPerm) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7381 // Construct a slice backed by dst's underlying memory. 7382 var buf []byte 7383 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7384 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7385 hdr.Len = i.SizeBytes() 7386 hdr.Cap = i.SizeBytes() 7387 7388 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7389 // Since we bypassed the compiler's escape analysis, indicate that i 7390 // must live until the use above. 7391 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7392 return length, err 7393 } 7394 7395 // WriteTo implements io.WriterTo.WriteTo. 7396 func (i *IPCPerm) WriteTo(writer io.Writer) (int64, error) { 7397 // Construct a slice backed by dst's underlying memory. 7398 var buf []byte 7399 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7400 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7401 hdr.Len = i.SizeBytes() 7402 hdr.Cap = i.SizeBytes() 7403 7404 length, err := writer.Write(buf) 7405 // Since we bypassed the compiler's escape analysis, indicate that i 7406 // must live until the use above. 7407 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7408 return int64(length), err 7409 } 7410 7411 // SizeBytes implements marshal.Marshallable.SizeBytes. 7412 func (s *Sysinfo) SizeBytes() int { 7413 return 78 + 7414 8*3 + 7415 1*6 7416 } 7417 7418 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7419 func (s *Sysinfo) MarshalBytes(dst []byte) []byte { 7420 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Uptime)) 7421 dst = dst[8:] 7422 for idx := 0; idx < 3; idx++ { 7423 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Loads[idx])) 7424 dst = dst[8:] 7425 } 7426 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalRAM)) 7427 dst = dst[8:] 7428 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeRAM)) 7429 dst = dst[8:] 7430 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SharedRAM)) 7431 dst = dst[8:] 7432 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BufferRAM)) 7433 dst = dst[8:] 7434 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalSwap)) 7435 dst = dst[8:] 7436 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeSwap)) 7437 dst = dst[8:] 7438 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Procs)) 7439 dst = dst[2:] 7440 // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0} 7441 dst = dst[1*(6):] 7442 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalHigh)) 7443 dst = dst[8:] 7444 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeHigh)) 7445 dst = dst[8:] 7446 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Unit)) 7447 dst = dst[4:] 7448 return dst 7449 } 7450 7451 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7452 func (s *Sysinfo) UnmarshalBytes(src []byte) []byte { 7453 s.Uptime = int64(hostarch.ByteOrder.Uint64(src[:8])) 7454 src = src[8:] 7455 for idx := 0; idx < 3; idx++ { 7456 s.Loads[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7457 src = src[8:] 7458 } 7459 s.TotalRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7460 src = src[8:] 7461 s.FreeRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7462 src = src[8:] 7463 s.SharedRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7464 src = src[8:] 7465 s.BufferRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7466 src = src[8:] 7467 s.TotalSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7468 src = src[8:] 7469 s.FreeSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7470 src = src[8:] 7471 s.Procs = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7472 src = src[2:] 7473 // Padding: ~ copy([6]byte(s._), src[:sizeof(byte)*6]) 7474 src = src[1*(6):] 7475 s.TotalHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7476 src = src[8:] 7477 s.FreeHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7478 src = src[8:] 7479 s.Unit = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7480 src = src[4:] 7481 return src 7482 } 7483 7484 // Packed implements marshal.Marshallable.Packed. 7485 //go:nosplit 7486 func (s *Sysinfo) Packed() bool { 7487 return false 7488 } 7489 7490 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7491 func (s *Sysinfo) MarshalUnsafe(dst []byte) []byte { 7492 // Type Sysinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7493 return s.MarshalBytes(dst) 7494 } 7495 7496 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7497 func (s *Sysinfo) UnmarshalUnsafe(src []byte) []byte { 7498 // Type Sysinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7499 return s.UnmarshalBytes(src) 7500 } 7501 7502 // CopyOutN implements marshal.Marshallable.CopyOutN. 7503 func (s *Sysinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7504 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7505 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 7506 s.MarshalBytes(buf) // escapes: fallback. 7507 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7508 } 7509 7510 // CopyOut implements marshal.Marshallable.CopyOut. 7511 func (s *Sysinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7512 return s.CopyOutN(cc, addr, s.SizeBytes()) 7513 } 7514 7515 // CopyIn implements marshal.Marshallable.CopyIn. 7516 func (s *Sysinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7517 // Type Sysinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7518 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 7519 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7520 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7521 // partially unmarshalled struct. 7522 s.UnmarshalBytes(buf) // escapes: fallback. 7523 return length, err 7524 } 7525 7526 // WriteTo implements io.WriterTo.WriteTo. 7527 func (s *Sysinfo) WriteTo(writer io.Writer) (int64, error) { 7528 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7529 buf := make([]byte, s.SizeBytes()) 7530 s.MarshalBytes(buf) 7531 length, err := writer.Write(buf) 7532 return int64(length), err 7533 } 7534 7535 // SizeBytes implements marshal.Marshallable.SizeBytes. 7536 //go:nosplit 7537 func (n *NumaPolicy) SizeBytes() int { 7538 return 4 7539 } 7540 7541 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7542 func (n *NumaPolicy) MarshalBytes(dst []byte) []byte { 7543 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*n)) 7544 return dst[4:] 7545 } 7546 7547 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7548 func (n *NumaPolicy) UnmarshalBytes(src []byte) []byte { 7549 *n = NumaPolicy(int32(hostarch.ByteOrder.Uint32(src[:4]))) 7550 return src[4:] 7551 } 7552 7553 // Packed implements marshal.Marshallable.Packed. 7554 //go:nosplit 7555 func (n *NumaPolicy) Packed() bool { 7556 // Scalar newtypes are always packed. 7557 return true 7558 } 7559 7560 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7561 func (n *NumaPolicy) MarshalUnsafe(dst []byte) []byte { 7562 size := n.SizeBytes() 7563 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 7564 return dst[size:] 7565 } 7566 7567 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7568 func (n *NumaPolicy) UnmarshalUnsafe(src []byte) []byte { 7569 size := n.SizeBytes() 7570 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 7571 return src[size:] 7572 } 7573 7574 // CopyOutN implements marshal.Marshallable.CopyOutN. 7575 func (n *NumaPolicy) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7576 // Construct a slice backed by dst's underlying memory. 7577 var buf []byte 7578 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7579 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 7580 hdr.Len = n.SizeBytes() 7581 hdr.Cap = n.SizeBytes() 7582 7583 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7584 // Since we bypassed the compiler's escape analysis, indicate that n 7585 // must live until the use above. 7586 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 7587 return length, err 7588 } 7589 7590 // CopyOut implements marshal.Marshallable.CopyOut. 7591 func (n *NumaPolicy) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7592 return n.CopyOutN(cc, addr, n.SizeBytes()) 7593 } 7594 7595 // CopyIn implements marshal.Marshallable.CopyIn. 7596 func (n *NumaPolicy) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7597 // Construct a slice backed by dst's underlying memory. 7598 var buf []byte 7599 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7600 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 7601 hdr.Len = n.SizeBytes() 7602 hdr.Cap = n.SizeBytes() 7603 7604 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7605 // Since we bypassed the compiler's escape analysis, indicate that n 7606 // must live until the use above. 7607 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 7608 return length, err 7609 } 7610 7611 // WriteTo implements io.WriterTo.WriteTo. 7612 func (n *NumaPolicy) WriteTo(writer io.Writer) (int64, error) { 7613 // Construct a slice backed by dst's underlying memory. 7614 var buf []byte 7615 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7616 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 7617 hdr.Len = n.SizeBytes() 7618 hdr.Cap = n.SizeBytes() 7619 7620 length, err := writer.Write(buf) 7621 // Since we bypassed the compiler's escape analysis, indicate that n 7622 // must live until the use above. 7623 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 7624 return int64(length), err 7625 } 7626 7627 // SizeBytes implements marshal.Marshallable.SizeBytes. 7628 func (m *MqAttr) SizeBytes() int { 7629 return 32 + 7630 8*4 7631 } 7632 7633 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7634 func (m *MqAttr) MarshalBytes(dst []byte) []byte { 7635 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqFlags)) 7636 dst = dst[8:] 7637 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMaxmsg)) 7638 dst = dst[8:] 7639 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMsgsize)) 7640 dst = dst[8:] 7641 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqCurmsgs)) 7642 dst = dst[8:] 7643 // Padding: dst[:sizeof(int64)*4] ~= [4]int64{0} 7644 dst = dst[8*(4):] 7645 return dst 7646 } 7647 7648 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7649 func (m *MqAttr) UnmarshalBytes(src []byte) []byte { 7650 m.MqFlags = int64(hostarch.ByteOrder.Uint64(src[:8])) 7651 src = src[8:] 7652 m.MqMaxmsg = int64(hostarch.ByteOrder.Uint64(src[:8])) 7653 src = src[8:] 7654 m.MqMsgsize = int64(hostarch.ByteOrder.Uint64(src[:8])) 7655 src = src[8:] 7656 m.MqCurmsgs = int64(hostarch.ByteOrder.Uint64(src[:8])) 7657 src = src[8:] 7658 // Padding: ~ copy([4]int64(m._), src[:sizeof(int64)*4]) 7659 src = src[8*(4):] 7660 return src 7661 } 7662 7663 // Packed implements marshal.Marshallable.Packed. 7664 //go:nosplit 7665 func (m *MqAttr) Packed() bool { 7666 return true 7667 } 7668 7669 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7670 func (m *MqAttr) MarshalUnsafe(dst []byte) []byte { 7671 size := m.SizeBytes() 7672 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 7673 return dst[size:] 7674 } 7675 7676 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7677 func (m *MqAttr) UnmarshalUnsafe(src []byte) []byte { 7678 size := m.SizeBytes() 7679 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 7680 return src[size:] 7681 } 7682 7683 // CopyOutN implements marshal.Marshallable.CopyOutN. 7684 func (m *MqAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7685 // Construct a slice backed by dst's underlying memory. 7686 var buf []byte 7687 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7688 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7689 hdr.Len = m.SizeBytes() 7690 hdr.Cap = m.SizeBytes() 7691 7692 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7693 // Since we bypassed the compiler's escape analysis, indicate that m 7694 // must live until the use above. 7695 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7696 return length, err 7697 } 7698 7699 // CopyOut implements marshal.Marshallable.CopyOut. 7700 func (m *MqAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7701 return m.CopyOutN(cc, addr, m.SizeBytes()) 7702 } 7703 7704 // CopyIn implements marshal.Marshallable.CopyIn. 7705 func (m *MqAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7706 // Construct a slice backed by dst's underlying memory. 7707 var buf []byte 7708 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7709 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7710 hdr.Len = m.SizeBytes() 7711 hdr.Cap = m.SizeBytes() 7712 7713 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7714 // Since we bypassed the compiler's escape analysis, indicate that m 7715 // must live until the use above. 7716 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7717 return length, err 7718 } 7719 7720 // WriteTo implements io.WriterTo.WriteTo. 7721 func (m *MqAttr) WriteTo(writer io.Writer) (int64, error) { 7722 // Construct a slice backed by dst's underlying memory. 7723 var buf []byte 7724 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7725 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7726 hdr.Len = m.SizeBytes() 7727 hdr.Cap = m.SizeBytes() 7728 7729 length, err := writer.Write(buf) 7730 // Since we bypassed the compiler's escape analysis, indicate that m 7731 // must live until the use above. 7732 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7733 return int64(length), err 7734 } 7735 7736 // Packed implements marshal.Marshallable.Packed. 7737 //go:nosplit 7738 func (b *MsgBuf) Packed() bool { 7739 // Type MsgBuf is dynamic so it might have slice/string headers. Hence, it is not packed. 7740 return false 7741 } 7742 7743 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7744 func (b *MsgBuf) MarshalUnsafe(dst []byte) []byte { 7745 // Type MsgBuf doesn't have a packed layout in memory, fallback to MarshalBytes. 7746 return b.MarshalBytes(dst) 7747 } 7748 7749 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7750 func (b *MsgBuf) UnmarshalUnsafe(src []byte) []byte { 7751 // Type MsgBuf doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7752 return b.UnmarshalBytes(src) 7753 } 7754 7755 // CopyOutN implements marshal.Marshallable.CopyOutN. 7756 //go:nosplit 7757 func (b *MsgBuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7758 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 7759 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 7760 b.MarshalBytes(buf) // escapes: fallback. 7761 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7762 } 7763 7764 // CopyOut implements marshal.Marshallable.CopyOut. 7765 func (b *MsgBuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7766 return b.CopyOutN(cc, addr, b.SizeBytes()) 7767 } 7768 7769 // CopyIn implements marshal.Marshallable.CopyIn. 7770 func (b *MsgBuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7771 // Type MsgBuf doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7772 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 7773 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7774 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7775 // partially unmarshalled struct. 7776 b.UnmarshalBytes(buf) // escapes: fallback. 7777 return length, err 7778 } 7779 7780 // WriteTo implements io.WriterTo.WriteTo. 7781 func (b *MsgBuf) WriteTo(writer io.Writer) (int64, error) { 7782 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 7783 buf := make([]byte, b.SizeBytes()) 7784 b.MarshalBytes(buf) 7785 length, err := writer.Write(buf) 7786 return int64(length), err 7787 } 7788 7789 // SizeBytes implements marshal.Marshallable.SizeBytes. 7790 func (m *MsgInfo) SizeBytes() int { 7791 return 30 7792 } 7793 7794 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7795 func (m *MsgInfo) MarshalBytes(dst []byte) []byte { 7796 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgPool)) 7797 dst = dst[4:] 7798 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMap)) 7799 dst = dst[4:] 7800 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMax)) 7801 dst = dst[4:] 7802 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMnb)) 7803 dst = dst[4:] 7804 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMni)) 7805 dst = dst[4:] 7806 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgSsz)) 7807 dst = dst[4:] 7808 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgTql)) 7809 dst = dst[4:] 7810 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.MsgSeg)) 7811 dst = dst[2:] 7812 return dst 7813 } 7814 7815 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7816 func (m *MsgInfo) UnmarshalBytes(src []byte) []byte { 7817 m.MsgPool = int32(hostarch.ByteOrder.Uint32(src[:4])) 7818 src = src[4:] 7819 m.MsgMap = int32(hostarch.ByteOrder.Uint32(src[:4])) 7820 src = src[4:] 7821 m.MsgMax = int32(hostarch.ByteOrder.Uint32(src[:4])) 7822 src = src[4:] 7823 m.MsgMnb = int32(hostarch.ByteOrder.Uint32(src[:4])) 7824 src = src[4:] 7825 m.MsgMni = int32(hostarch.ByteOrder.Uint32(src[:4])) 7826 src = src[4:] 7827 m.MsgSsz = int32(hostarch.ByteOrder.Uint32(src[:4])) 7828 src = src[4:] 7829 m.MsgTql = int32(hostarch.ByteOrder.Uint32(src[:4])) 7830 src = src[4:] 7831 m.MsgSeg = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7832 src = src[2:] 7833 return src 7834 } 7835 7836 // Packed implements marshal.Marshallable.Packed. 7837 //go:nosplit 7838 func (m *MsgInfo) Packed() bool { 7839 return false 7840 } 7841 7842 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7843 func (m *MsgInfo) MarshalUnsafe(dst []byte) []byte { 7844 // Type MsgInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7845 return m.MarshalBytes(dst) 7846 } 7847 7848 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7849 func (m *MsgInfo) UnmarshalUnsafe(src []byte) []byte { 7850 // Type MsgInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7851 return m.UnmarshalBytes(src) 7852 } 7853 7854 // CopyOutN implements marshal.Marshallable.CopyOutN. 7855 func (m *MsgInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7856 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7857 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 7858 m.MarshalBytes(buf) // escapes: fallback. 7859 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7860 } 7861 7862 // CopyOut implements marshal.Marshallable.CopyOut. 7863 func (m *MsgInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7864 return m.CopyOutN(cc, addr, m.SizeBytes()) 7865 } 7866 7867 // CopyIn implements marshal.Marshallable.CopyIn. 7868 func (m *MsgInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7869 // Type MsgInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7870 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 7871 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7872 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7873 // partially unmarshalled struct. 7874 m.UnmarshalBytes(buf) // escapes: fallback. 7875 return length, err 7876 } 7877 7878 // WriteTo implements io.WriterTo.WriteTo. 7879 func (m *MsgInfo) WriteTo(writer io.Writer) (int64, error) { 7880 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7881 buf := make([]byte, m.SizeBytes()) 7882 m.MarshalBytes(buf) 7883 length, err := writer.Write(buf) 7884 return int64(length), err 7885 } 7886 7887 // SizeBytes implements marshal.Marshallable.SizeBytes. 7888 func (m *MsqidDS) SizeBytes() int { 7889 return 48 + 7890 (*IPCPerm)(nil).SizeBytes() + 7891 (*TimeT)(nil).SizeBytes() + 7892 (*TimeT)(nil).SizeBytes() + 7893 (*TimeT)(nil).SizeBytes() 7894 } 7895 7896 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7897 func (m *MsqidDS) MarshalBytes(dst []byte) []byte { 7898 dst = m.MsgPerm.MarshalUnsafe(dst) 7899 dst = m.MsgStime.MarshalUnsafe(dst) 7900 dst = m.MsgRtime.MarshalUnsafe(dst) 7901 dst = m.MsgCtime.MarshalUnsafe(dst) 7902 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgCbytes)) 7903 dst = dst[8:] 7904 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQnum)) 7905 dst = dst[8:] 7906 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQbytes)) 7907 dst = dst[8:] 7908 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLspid)) 7909 dst = dst[4:] 7910 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLrpid)) 7911 dst = dst[4:] 7912 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused4)) 7913 dst = dst[8:] 7914 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused5)) 7915 dst = dst[8:] 7916 return dst 7917 } 7918 7919 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7920 func (m *MsqidDS) UnmarshalBytes(src []byte) []byte { 7921 src = m.MsgPerm.UnmarshalUnsafe(src) 7922 src = m.MsgStime.UnmarshalUnsafe(src) 7923 src = m.MsgRtime.UnmarshalUnsafe(src) 7924 src = m.MsgCtime.UnmarshalUnsafe(src) 7925 m.MsgCbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7926 src = src[8:] 7927 m.MsgQnum = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7928 src = src[8:] 7929 m.MsgQbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7930 src = src[8:] 7931 m.MsgLspid = int32(hostarch.ByteOrder.Uint32(src[:4])) 7932 src = src[4:] 7933 m.MsgLrpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 7934 src = src[4:] 7935 m.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7936 src = src[8:] 7937 m.unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7938 src = src[8:] 7939 return src 7940 } 7941 7942 // Packed implements marshal.Marshallable.Packed. 7943 //go:nosplit 7944 func (m *MsqidDS) Packed() bool { 7945 return m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() 7946 } 7947 7948 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7949 func (m *MsqidDS) MarshalUnsafe(dst []byte) []byte { 7950 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 7951 size := m.SizeBytes() 7952 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 7953 return dst[size:] 7954 } 7955 // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 7956 return m.MarshalBytes(dst) 7957 } 7958 7959 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7960 func (m *MsqidDS) UnmarshalUnsafe(src []byte) []byte { 7961 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 7962 size := m.SizeBytes() 7963 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 7964 return src[size:] 7965 } 7966 // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7967 return m.UnmarshalBytes(src) 7968 } 7969 7970 // CopyOutN implements marshal.Marshallable.CopyOutN. 7971 func (m *MsqidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7972 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 7973 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 7974 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 7975 m.MarshalBytes(buf) // escapes: fallback. 7976 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7977 } 7978 7979 // Construct a slice backed by dst's underlying memory. 7980 var buf []byte 7981 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7982 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7983 hdr.Len = m.SizeBytes() 7984 hdr.Cap = m.SizeBytes() 7985 7986 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7987 // Since we bypassed the compiler's escape analysis, indicate that m 7988 // must live until the use above. 7989 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7990 return length, err 7991 } 7992 7993 // CopyOut implements marshal.Marshallable.CopyOut. 7994 func (m *MsqidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7995 return m.CopyOutN(cc, addr, m.SizeBytes()) 7996 } 7997 7998 // CopyIn implements marshal.Marshallable.CopyIn. 7999 func (m *MsqidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8000 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8001 // Type MsqidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8002 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8003 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8004 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8005 // partially unmarshalled struct. 8006 m.UnmarshalBytes(buf) // escapes: fallback. 8007 return length, err 8008 } 8009 8010 // Construct a slice backed by dst's underlying memory. 8011 var buf []byte 8012 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8013 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8014 hdr.Len = m.SizeBytes() 8015 hdr.Cap = m.SizeBytes() 8016 8017 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8018 // Since we bypassed the compiler's escape analysis, indicate that m 8019 // must live until the use above. 8020 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8021 return length, err 8022 } 8023 8024 // WriteTo implements io.WriterTo.WriteTo. 8025 func (m *MsqidDS) WriteTo(writer io.Writer) (int64, error) { 8026 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8027 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8028 buf := make([]byte, m.SizeBytes()) 8029 m.MarshalBytes(buf) 8030 length, err := writer.Write(buf) 8031 return int64(length), err 8032 } 8033 8034 // Construct a slice backed by dst's underlying memory. 8035 var buf []byte 8036 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8037 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8038 hdr.Len = m.SizeBytes() 8039 hdr.Cap = m.SizeBytes() 8040 8041 length, err := writer.Write(buf) 8042 // Since we bypassed the compiler's escape analysis, indicate that m 8043 // must live until the use above. 8044 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8045 return int64(length), err 8046 } 8047 8048 // SizeBytes implements marshal.Marshallable.SizeBytes. 8049 //go:nosplit 8050 func (e *EthtoolCmd) SizeBytes() int { 8051 return 4 8052 } 8053 8054 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8055 func (e *EthtoolCmd) MarshalBytes(dst []byte) []byte { 8056 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*e)) 8057 return dst[4:] 8058 } 8059 8060 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8061 func (e *EthtoolCmd) UnmarshalBytes(src []byte) []byte { 8062 *e = EthtoolCmd(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 8063 return src[4:] 8064 } 8065 8066 // Packed implements marshal.Marshallable.Packed. 8067 //go:nosplit 8068 func (e *EthtoolCmd) Packed() bool { 8069 // Scalar newtypes are always packed. 8070 return true 8071 } 8072 8073 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8074 func (e *EthtoolCmd) MarshalUnsafe(dst []byte) []byte { 8075 size := e.SizeBytes() 8076 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8077 return dst[size:] 8078 } 8079 8080 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8081 func (e *EthtoolCmd) UnmarshalUnsafe(src []byte) []byte { 8082 size := e.SizeBytes() 8083 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8084 return src[size:] 8085 } 8086 8087 // CopyOutN implements marshal.Marshallable.CopyOutN. 8088 func (e *EthtoolCmd) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8089 // Construct a slice backed by dst's underlying memory. 8090 var buf []byte 8091 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8092 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8093 hdr.Len = e.SizeBytes() 8094 hdr.Cap = e.SizeBytes() 8095 8096 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8097 // Since we bypassed the compiler's escape analysis, indicate that e 8098 // must live until the use above. 8099 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8100 return length, err 8101 } 8102 8103 // CopyOut implements marshal.Marshallable.CopyOut. 8104 func (e *EthtoolCmd) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8105 return e.CopyOutN(cc, addr, e.SizeBytes()) 8106 } 8107 8108 // CopyIn implements marshal.Marshallable.CopyIn. 8109 func (e *EthtoolCmd) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8110 // Construct a slice backed by dst's underlying memory. 8111 var buf []byte 8112 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8113 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8114 hdr.Len = e.SizeBytes() 8115 hdr.Cap = e.SizeBytes() 8116 8117 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8118 // Since we bypassed the compiler's escape analysis, indicate that e 8119 // must live until the use above. 8120 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8121 return length, err 8122 } 8123 8124 // WriteTo implements io.WriterTo.WriteTo. 8125 func (e *EthtoolCmd) WriteTo(writer io.Writer) (int64, error) { 8126 // Construct a slice backed by dst's underlying memory. 8127 var buf []byte 8128 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8129 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8130 hdr.Len = e.SizeBytes() 8131 hdr.Cap = e.SizeBytes() 8132 8133 length, err := writer.Write(buf) 8134 // Since we bypassed the compiler's escape analysis, indicate that e 8135 // must live until the use above. 8136 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8137 return int64(length), err 8138 } 8139 8140 // SizeBytes implements marshal.Marshallable.SizeBytes. 8141 func (e *EthtoolGFeatures) SizeBytes() int { 8142 return 8 8143 } 8144 8145 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8146 func (e *EthtoolGFeatures) MarshalBytes(dst []byte) []byte { 8147 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Cmd)) 8148 dst = dst[4:] 8149 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Size)) 8150 dst = dst[4:] 8151 return dst 8152 } 8153 8154 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8155 func (e *EthtoolGFeatures) UnmarshalBytes(src []byte) []byte { 8156 e.Cmd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8157 src = src[4:] 8158 e.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8159 src = src[4:] 8160 return src 8161 } 8162 8163 // Packed implements marshal.Marshallable.Packed. 8164 //go:nosplit 8165 func (e *EthtoolGFeatures) Packed() bool { 8166 return true 8167 } 8168 8169 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8170 func (e *EthtoolGFeatures) MarshalUnsafe(dst []byte) []byte { 8171 size := e.SizeBytes() 8172 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8173 return dst[size:] 8174 } 8175 8176 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8177 func (e *EthtoolGFeatures) UnmarshalUnsafe(src []byte) []byte { 8178 size := e.SizeBytes() 8179 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8180 return src[size:] 8181 } 8182 8183 // CopyOutN implements marshal.Marshallable.CopyOutN. 8184 func (e *EthtoolGFeatures) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8185 // Construct a slice backed by dst's underlying memory. 8186 var buf []byte 8187 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8188 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8189 hdr.Len = e.SizeBytes() 8190 hdr.Cap = e.SizeBytes() 8191 8192 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8193 // Since we bypassed the compiler's escape analysis, indicate that e 8194 // must live until the use above. 8195 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8196 return length, err 8197 } 8198 8199 // CopyOut implements marshal.Marshallable.CopyOut. 8200 func (e *EthtoolGFeatures) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8201 return e.CopyOutN(cc, addr, e.SizeBytes()) 8202 } 8203 8204 // CopyIn implements marshal.Marshallable.CopyIn. 8205 func (e *EthtoolGFeatures) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8206 // Construct a slice backed by dst's underlying memory. 8207 var buf []byte 8208 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8209 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8210 hdr.Len = e.SizeBytes() 8211 hdr.Cap = e.SizeBytes() 8212 8213 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8214 // Since we bypassed the compiler's escape analysis, indicate that e 8215 // must live until the use above. 8216 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8217 return length, err 8218 } 8219 8220 // WriteTo implements io.WriterTo.WriteTo. 8221 func (e *EthtoolGFeatures) WriteTo(writer io.Writer) (int64, error) { 8222 // Construct a slice backed by dst's underlying memory. 8223 var buf []byte 8224 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8225 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8226 hdr.Len = e.SizeBytes() 8227 hdr.Cap = e.SizeBytes() 8228 8229 length, err := writer.Write(buf) 8230 // Since we bypassed the compiler's escape analysis, indicate that e 8231 // must live until the use above. 8232 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8233 return int64(length), err 8234 } 8235 8236 // SizeBytes implements marshal.Marshallable.SizeBytes. 8237 func (e *EthtoolGetFeaturesBlock) SizeBytes() int { 8238 return 16 8239 } 8240 8241 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8242 func (e *EthtoolGetFeaturesBlock) MarshalBytes(dst []byte) []byte { 8243 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Available)) 8244 dst = dst[4:] 8245 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Requested)) 8246 dst = dst[4:] 8247 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Active)) 8248 dst = dst[4:] 8249 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.NeverChanged)) 8250 dst = dst[4:] 8251 return dst 8252 } 8253 8254 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8255 func (e *EthtoolGetFeaturesBlock) UnmarshalBytes(src []byte) []byte { 8256 e.Available = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8257 src = src[4:] 8258 e.Requested = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8259 src = src[4:] 8260 e.Active = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8261 src = src[4:] 8262 e.NeverChanged = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8263 src = src[4:] 8264 return src 8265 } 8266 8267 // Packed implements marshal.Marshallable.Packed. 8268 //go:nosplit 8269 func (e *EthtoolGetFeaturesBlock) Packed() bool { 8270 return true 8271 } 8272 8273 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8274 func (e *EthtoolGetFeaturesBlock) MarshalUnsafe(dst []byte) []byte { 8275 size := e.SizeBytes() 8276 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8277 return dst[size:] 8278 } 8279 8280 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8281 func (e *EthtoolGetFeaturesBlock) UnmarshalUnsafe(src []byte) []byte { 8282 size := e.SizeBytes() 8283 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8284 return src[size:] 8285 } 8286 8287 // CopyOutN implements marshal.Marshallable.CopyOutN. 8288 func (e *EthtoolGetFeaturesBlock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8289 // Construct a slice backed by dst's underlying memory. 8290 var buf []byte 8291 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8292 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8293 hdr.Len = e.SizeBytes() 8294 hdr.Cap = e.SizeBytes() 8295 8296 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8297 // Since we bypassed the compiler's escape analysis, indicate that e 8298 // must live until the use above. 8299 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8300 return length, err 8301 } 8302 8303 // CopyOut implements marshal.Marshallable.CopyOut. 8304 func (e *EthtoolGetFeaturesBlock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8305 return e.CopyOutN(cc, addr, e.SizeBytes()) 8306 } 8307 8308 // CopyIn implements marshal.Marshallable.CopyIn. 8309 func (e *EthtoolGetFeaturesBlock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8310 // Construct a slice backed by dst's underlying memory. 8311 var buf []byte 8312 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8313 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8314 hdr.Len = e.SizeBytes() 8315 hdr.Cap = e.SizeBytes() 8316 8317 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8318 // Since we bypassed the compiler's escape analysis, indicate that e 8319 // must live until the use above. 8320 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8321 return length, err 8322 } 8323 8324 // WriteTo implements io.WriterTo.WriteTo. 8325 func (e *EthtoolGetFeaturesBlock) WriteTo(writer io.Writer) (int64, error) { 8326 // Construct a slice backed by dst's underlying memory. 8327 var buf []byte 8328 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8329 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8330 hdr.Len = e.SizeBytes() 8331 hdr.Cap = e.SizeBytes() 8332 8333 length, err := writer.Write(buf) 8334 // Since we bypassed the compiler's escape analysis, indicate that e 8335 // must live until the use above. 8336 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8337 return int64(length), err 8338 } 8339 8340 // SizeBytes implements marshal.Marshallable.SizeBytes. 8341 func (i *IFConf) SizeBytes() int { 8342 return 12 + 8343 1*4 8344 } 8345 8346 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8347 func (i *IFConf) MarshalBytes(dst []byte) []byte { 8348 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 8349 dst = dst[4:] 8350 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 8351 dst = dst[1*(4):] 8352 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Ptr)) 8353 dst = dst[8:] 8354 return dst 8355 } 8356 8357 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8358 func (i *IFConf) UnmarshalBytes(src []byte) []byte { 8359 i.Len = int32(hostarch.ByteOrder.Uint32(src[:4])) 8360 src = src[4:] 8361 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 8362 src = src[1*(4):] 8363 i.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8364 src = src[8:] 8365 return src 8366 } 8367 8368 // Packed implements marshal.Marshallable.Packed. 8369 //go:nosplit 8370 func (i *IFConf) Packed() bool { 8371 return true 8372 } 8373 8374 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8375 func (i *IFConf) MarshalUnsafe(dst []byte) []byte { 8376 size := i.SizeBytes() 8377 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 8378 return dst[size:] 8379 } 8380 8381 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8382 func (i *IFConf) UnmarshalUnsafe(src []byte) []byte { 8383 size := i.SizeBytes() 8384 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 8385 return src[size:] 8386 } 8387 8388 // CopyOutN implements marshal.Marshallable.CopyOutN. 8389 func (i *IFConf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8390 // Construct a slice backed by dst's underlying memory. 8391 var buf []byte 8392 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8393 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8394 hdr.Len = i.SizeBytes() 8395 hdr.Cap = i.SizeBytes() 8396 8397 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8398 // Since we bypassed the compiler's escape analysis, indicate that i 8399 // must live until the use above. 8400 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8401 return length, err 8402 } 8403 8404 // CopyOut implements marshal.Marshallable.CopyOut. 8405 func (i *IFConf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8406 return i.CopyOutN(cc, addr, i.SizeBytes()) 8407 } 8408 8409 // CopyIn implements marshal.Marshallable.CopyIn. 8410 func (i *IFConf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8411 // Construct a slice backed by dst's underlying memory. 8412 var buf []byte 8413 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8414 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8415 hdr.Len = i.SizeBytes() 8416 hdr.Cap = i.SizeBytes() 8417 8418 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8419 // Since we bypassed the compiler's escape analysis, indicate that i 8420 // must live until the use above. 8421 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8422 return length, err 8423 } 8424 8425 // WriteTo implements io.WriterTo.WriteTo. 8426 func (i *IFConf) WriteTo(writer io.Writer) (int64, error) { 8427 // Construct a slice backed by dst's underlying memory. 8428 var buf []byte 8429 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8430 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8431 hdr.Len = i.SizeBytes() 8432 hdr.Cap = i.SizeBytes() 8433 8434 length, err := writer.Write(buf) 8435 // Since we bypassed the compiler's escape analysis, indicate that i 8436 // must live until the use above. 8437 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8438 return int64(length), err 8439 } 8440 8441 // SizeBytes implements marshal.Marshallable.SizeBytes. 8442 func (ifr *IFReq) SizeBytes() int { 8443 return 0 + 8444 1*IFNAMSIZ + 8445 1*24 8446 } 8447 8448 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8449 func (ifr *IFReq) MarshalBytes(dst []byte) []byte { 8450 for idx := 0; idx < IFNAMSIZ; idx++ { 8451 dst[0] = byte(ifr.IFName[idx]) 8452 dst = dst[1:] 8453 } 8454 for idx := 0; idx < 24; idx++ { 8455 dst[0] = byte(ifr.Data[idx]) 8456 dst = dst[1:] 8457 } 8458 return dst 8459 } 8460 8461 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8462 func (ifr *IFReq) UnmarshalBytes(src []byte) []byte { 8463 for idx := 0; idx < IFNAMSIZ; idx++ { 8464 ifr.IFName[idx] = src[0] 8465 src = src[1:] 8466 } 8467 for idx := 0; idx < 24; idx++ { 8468 ifr.Data[idx] = src[0] 8469 src = src[1:] 8470 } 8471 return src 8472 } 8473 8474 // Packed implements marshal.Marshallable.Packed. 8475 //go:nosplit 8476 func (ifr *IFReq) Packed() bool { 8477 return true 8478 } 8479 8480 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8481 func (ifr *IFReq) MarshalUnsafe(dst []byte) []byte { 8482 size := ifr.SizeBytes() 8483 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(size)) 8484 return dst[size:] 8485 } 8486 8487 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8488 func (ifr *IFReq) UnmarshalUnsafe(src []byte) []byte { 8489 size := ifr.SizeBytes() 8490 gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(size)) 8491 return src[size:] 8492 } 8493 8494 // CopyOutN implements marshal.Marshallable.CopyOutN. 8495 func (ifr *IFReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8496 // Construct a slice backed by dst's underlying memory. 8497 var buf []byte 8498 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8499 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 8500 hdr.Len = ifr.SizeBytes() 8501 hdr.Cap = ifr.SizeBytes() 8502 8503 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8504 // Since we bypassed the compiler's escape analysis, indicate that ifr 8505 // must live until the use above. 8506 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 8507 return length, err 8508 } 8509 8510 // CopyOut implements marshal.Marshallable.CopyOut. 8511 func (ifr *IFReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8512 return ifr.CopyOutN(cc, addr, ifr.SizeBytes()) 8513 } 8514 8515 // CopyIn implements marshal.Marshallable.CopyIn. 8516 func (ifr *IFReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8517 // Construct a slice backed by dst's underlying memory. 8518 var buf []byte 8519 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8520 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 8521 hdr.Len = ifr.SizeBytes() 8522 hdr.Cap = ifr.SizeBytes() 8523 8524 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8525 // Since we bypassed the compiler's escape analysis, indicate that ifr 8526 // must live until the use above. 8527 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 8528 return length, err 8529 } 8530 8531 // WriteTo implements io.WriterTo.WriteTo. 8532 func (ifr *IFReq) WriteTo(writer io.Writer) (int64, error) { 8533 // Construct a slice backed by dst's underlying memory. 8534 var buf []byte 8535 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8536 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 8537 hdr.Len = ifr.SizeBytes() 8538 hdr.Cap = ifr.SizeBytes() 8539 8540 length, err := writer.Write(buf) 8541 // Since we bypassed the compiler's escape analysis, indicate that ifr 8542 // must live until the use above. 8543 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 8544 return int64(length), err 8545 } 8546 8547 // SizeBytes implements marshal.Marshallable.SizeBytes. 8548 //go:nosplit 8549 func (en *ErrorName) SizeBytes() int { 8550 return 1 * XT_FUNCTION_MAXNAMELEN 8551 } 8552 8553 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8554 func (en *ErrorName) MarshalBytes(dst []byte) []byte { 8555 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 8556 dst[0] = byte(en[idx]) 8557 dst = dst[1:] 8558 } 8559 return dst 8560 } 8561 8562 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8563 func (en *ErrorName) UnmarshalBytes(src []byte) []byte { 8564 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 8565 en[idx] = src[0] 8566 src = src[1:] 8567 } 8568 return src 8569 } 8570 8571 // Packed implements marshal.Marshallable.Packed. 8572 //go:nosplit 8573 func (en *ErrorName) Packed() bool { 8574 // Array newtypes are always packed. 8575 return true 8576 } 8577 8578 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8579 func (en *ErrorName) MarshalUnsafe(dst []byte) []byte { 8580 size := en.SizeBytes() 8581 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 8582 return dst[size:] 8583 } 8584 8585 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8586 func (en *ErrorName) UnmarshalUnsafe(src []byte) []byte { 8587 size := en.SizeBytes() 8588 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 8589 return src[size:] 8590 } 8591 8592 // CopyOutN implements marshal.Marshallable.CopyOutN. 8593 func (en *ErrorName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8594 // Construct a slice backed by dst's underlying memory. 8595 var buf []byte 8596 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8597 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8598 hdr.Len = en.SizeBytes() 8599 hdr.Cap = en.SizeBytes() 8600 8601 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8602 // Since we bypassed the compiler's escape analysis, indicate that en 8603 // must live until the use above. 8604 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8605 return length, err 8606 } 8607 8608 // CopyOut implements marshal.Marshallable.CopyOut. 8609 func (en *ErrorName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8610 return en.CopyOutN(cc, addr, en.SizeBytes()) 8611 } 8612 8613 // CopyIn implements marshal.Marshallable.CopyIn. 8614 func (en *ErrorName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8615 // Construct a slice backed by dst's underlying memory. 8616 var buf []byte 8617 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8618 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8619 hdr.Len = en.SizeBytes() 8620 hdr.Cap = en.SizeBytes() 8621 8622 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8623 // Since we bypassed the compiler's escape analysis, indicate that en 8624 // must live until the use above. 8625 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8626 return length, err 8627 } 8628 8629 // WriteTo implements io.WriterTo.WriteTo. 8630 func (en *ErrorName) WriteTo(writer io.Writer) (int64, error) { 8631 // Construct a slice backed by dst's underlying memory. 8632 var buf []byte 8633 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8634 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8635 hdr.Len = en.SizeBytes() 8636 hdr.Cap = en.SizeBytes() 8637 8638 length, err := writer.Write(buf) 8639 // Since we bypassed the compiler's escape analysis, indicate that en 8640 // must live until the use above. 8641 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8642 return int64(length), err 8643 } 8644 8645 // SizeBytes implements marshal.Marshallable.SizeBytes. 8646 //go:nosplit 8647 func (en *ExtensionName) SizeBytes() int { 8648 return 1 * XT_EXTENSION_MAXNAMELEN 8649 } 8650 8651 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8652 func (en *ExtensionName) MarshalBytes(dst []byte) []byte { 8653 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 8654 dst[0] = byte(en[idx]) 8655 dst = dst[1:] 8656 } 8657 return dst 8658 } 8659 8660 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8661 func (en *ExtensionName) UnmarshalBytes(src []byte) []byte { 8662 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 8663 en[idx] = src[0] 8664 src = src[1:] 8665 } 8666 return src 8667 } 8668 8669 // Packed implements marshal.Marshallable.Packed. 8670 //go:nosplit 8671 func (en *ExtensionName) Packed() bool { 8672 // Array newtypes are always packed. 8673 return true 8674 } 8675 8676 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8677 func (en *ExtensionName) MarshalUnsafe(dst []byte) []byte { 8678 size := en.SizeBytes() 8679 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 8680 return dst[size:] 8681 } 8682 8683 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8684 func (en *ExtensionName) UnmarshalUnsafe(src []byte) []byte { 8685 size := en.SizeBytes() 8686 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 8687 return src[size:] 8688 } 8689 8690 // CopyOutN implements marshal.Marshallable.CopyOutN. 8691 func (en *ExtensionName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8692 // Construct a slice backed by dst's underlying memory. 8693 var buf []byte 8694 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8695 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8696 hdr.Len = en.SizeBytes() 8697 hdr.Cap = en.SizeBytes() 8698 8699 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8700 // Since we bypassed the compiler's escape analysis, indicate that en 8701 // must live until the use above. 8702 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8703 return length, err 8704 } 8705 8706 // CopyOut implements marshal.Marshallable.CopyOut. 8707 func (en *ExtensionName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8708 return en.CopyOutN(cc, addr, en.SizeBytes()) 8709 } 8710 8711 // CopyIn implements marshal.Marshallable.CopyIn. 8712 func (en *ExtensionName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8713 // Construct a slice backed by dst's underlying memory. 8714 var buf []byte 8715 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8716 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8717 hdr.Len = en.SizeBytes() 8718 hdr.Cap = en.SizeBytes() 8719 8720 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8721 // Since we bypassed the compiler's escape analysis, indicate that en 8722 // must live until the use above. 8723 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8724 return length, err 8725 } 8726 8727 // WriteTo implements io.WriterTo.WriteTo. 8728 func (en *ExtensionName) WriteTo(writer io.Writer) (int64, error) { 8729 // Construct a slice backed by dst's underlying memory. 8730 var buf []byte 8731 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8732 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8733 hdr.Len = en.SizeBytes() 8734 hdr.Cap = en.SizeBytes() 8735 8736 length, err := writer.Write(buf) 8737 // Since we bypassed the compiler's escape analysis, indicate that en 8738 // must live until the use above. 8739 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8740 return int64(length), err 8741 } 8742 8743 // SizeBytes implements marshal.Marshallable.SizeBytes. 8744 func (i *IPTEntry) SizeBytes() int { 8745 return 12 + 8746 (*IPTIP)(nil).SizeBytes() + 8747 (*XTCounters)(nil).SizeBytes() 8748 } 8749 8750 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8751 func (i *IPTEntry) MarshalBytes(dst []byte) []byte { 8752 dst = i.IP.MarshalUnsafe(dst) 8753 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 8754 dst = dst[4:] 8755 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 8756 dst = dst[2:] 8757 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 8758 dst = dst[2:] 8759 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 8760 dst = dst[4:] 8761 dst = i.Counters.MarshalUnsafe(dst) 8762 return dst 8763 } 8764 8765 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8766 func (i *IPTEntry) UnmarshalBytes(src []byte) []byte { 8767 src = i.IP.UnmarshalUnsafe(src) 8768 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8769 src = src[4:] 8770 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8771 src = src[2:] 8772 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8773 src = src[2:] 8774 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8775 src = src[4:] 8776 src = i.Counters.UnmarshalUnsafe(src) 8777 return src 8778 } 8779 8780 // Packed implements marshal.Marshallable.Packed. 8781 //go:nosplit 8782 func (i *IPTEntry) Packed() bool { 8783 return i.Counters.Packed() && i.IP.Packed() 8784 } 8785 8786 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8787 func (i *IPTEntry) MarshalUnsafe(dst []byte) []byte { 8788 if i.Counters.Packed() && i.IP.Packed() { 8789 size := i.SizeBytes() 8790 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 8791 return dst[size:] 8792 } 8793 // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 8794 return i.MarshalBytes(dst) 8795 } 8796 8797 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8798 func (i *IPTEntry) UnmarshalUnsafe(src []byte) []byte { 8799 if i.Counters.Packed() && i.IP.Packed() { 8800 size := i.SizeBytes() 8801 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 8802 return src[size:] 8803 } 8804 // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8805 return i.UnmarshalBytes(src) 8806 } 8807 8808 // CopyOutN implements marshal.Marshallable.CopyOutN. 8809 func (i *IPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8810 if !i.Counters.Packed() && i.IP.Packed() { 8811 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 8812 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 8813 i.MarshalBytes(buf) // escapes: fallback. 8814 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8815 } 8816 8817 // Construct a slice backed by dst's underlying memory. 8818 var buf []byte 8819 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8820 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8821 hdr.Len = i.SizeBytes() 8822 hdr.Cap = i.SizeBytes() 8823 8824 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8825 // Since we bypassed the compiler's escape analysis, indicate that i 8826 // must live until the use above. 8827 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8828 return length, err 8829 } 8830 8831 // CopyOut implements marshal.Marshallable.CopyOut. 8832 func (i *IPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8833 return i.CopyOutN(cc, addr, i.SizeBytes()) 8834 } 8835 8836 // CopyIn implements marshal.Marshallable.CopyIn. 8837 func (i *IPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8838 if !i.Counters.Packed() && i.IP.Packed() { 8839 // Type IPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8840 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 8841 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8842 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8843 // partially unmarshalled struct. 8844 i.UnmarshalBytes(buf) // escapes: fallback. 8845 return length, err 8846 } 8847 8848 // Construct a slice backed by dst's underlying memory. 8849 var buf []byte 8850 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8851 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8852 hdr.Len = i.SizeBytes() 8853 hdr.Cap = i.SizeBytes() 8854 8855 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8856 // Since we bypassed the compiler's escape analysis, indicate that i 8857 // must live until the use above. 8858 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8859 return length, err 8860 } 8861 8862 // WriteTo implements io.WriterTo.WriteTo. 8863 func (i *IPTEntry) WriteTo(writer io.Writer) (int64, error) { 8864 if !i.Counters.Packed() && i.IP.Packed() { 8865 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 8866 buf := make([]byte, i.SizeBytes()) 8867 i.MarshalBytes(buf) 8868 length, err := writer.Write(buf) 8869 return int64(length), err 8870 } 8871 8872 // Construct a slice backed by dst's underlying memory. 8873 var buf []byte 8874 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8875 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8876 hdr.Len = i.SizeBytes() 8877 hdr.Cap = i.SizeBytes() 8878 8879 length, err := writer.Write(buf) 8880 // Since we bypassed the compiler's escape analysis, indicate that i 8881 // must live until the use above. 8882 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8883 return int64(length), err 8884 } 8885 8886 // SizeBytes implements marshal.Marshallable.SizeBytes. 8887 func (i *IPTGetEntries) SizeBytes() int { 8888 return 4 + 8889 (*TableName)(nil).SizeBytes() + 8890 1*4 8891 } 8892 8893 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8894 func (i *IPTGetEntries) MarshalBytes(dst []byte) []byte { 8895 dst = i.Name.MarshalUnsafe(dst) 8896 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 8897 dst = dst[4:] 8898 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 8899 dst = dst[1*(4):] 8900 return dst 8901 } 8902 8903 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8904 func (i *IPTGetEntries) UnmarshalBytes(src []byte) []byte { 8905 src = i.Name.UnmarshalUnsafe(src) 8906 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8907 src = src[4:] 8908 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 8909 src = src[1*(4):] 8910 return src 8911 } 8912 8913 // Packed implements marshal.Marshallable.Packed. 8914 //go:nosplit 8915 func (i *IPTGetEntries) Packed() bool { 8916 return i.Name.Packed() 8917 } 8918 8919 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8920 func (i *IPTGetEntries) MarshalUnsafe(dst []byte) []byte { 8921 if i.Name.Packed() { 8922 size := i.SizeBytes() 8923 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 8924 return dst[size:] 8925 } 8926 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 8927 return i.MarshalBytes(dst) 8928 } 8929 8930 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8931 func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 8932 if i.Name.Packed() { 8933 size := i.SizeBytes() 8934 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 8935 return src[size:] 8936 } 8937 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8938 return i.UnmarshalBytes(src) 8939 } 8940 8941 // CopyOutN implements marshal.Marshallable.CopyOutN. 8942 func (i *IPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8943 if !i.Name.Packed() { 8944 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 8945 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 8946 i.MarshalBytes(buf) // escapes: fallback. 8947 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8948 } 8949 8950 // Construct a slice backed by dst's underlying memory. 8951 var buf []byte 8952 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8953 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8954 hdr.Len = i.SizeBytes() 8955 hdr.Cap = i.SizeBytes() 8956 8957 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8958 // Since we bypassed the compiler's escape analysis, indicate that i 8959 // must live until the use above. 8960 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8961 return length, err 8962 } 8963 8964 // CopyOut implements marshal.Marshallable.CopyOut. 8965 func (i *IPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8966 return i.CopyOutN(cc, addr, i.SizeBytes()) 8967 } 8968 8969 // CopyIn implements marshal.Marshallable.CopyIn. 8970 func (i *IPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8971 if !i.Name.Packed() { 8972 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8973 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 8974 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8975 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8976 // partially unmarshalled struct. 8977 i.UnmarshalBytes(buf) // escapes: fallback. 8978 return length, err 8979 } 8980 8981 // Construct a slice backed by dst's underlying memory. 8982 var buf []byte 8983 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8984 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8985 hdr.Len = i.SizeBytes() 8986 hdr.Cap = i.SizeBytes() 8987 8988 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8989 // Since we bypassed the compiler's escape analysis, indicate that i 8990 // must live until the use above. 8991 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8992 return length, err 8993 } 8994 8995 // WriteTo implements io.WriterTo.WriteTo. 8996 func (i *IPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 8997 if !i.Name.Packed() { 8998 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 8999 buf := make([]byte, i.SizeBytes()) 9000 i.MarshalBytes(buf) 9001 length, err := writer.Write(buf) 9002 return int64(length), err 9003 } 9004 9005 // Construct a slice backed by dst's underlying memory. 9006 var buf []byte 9007 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9008 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9009 hdr.Len = i.SizeBytes() 9010 hdr.Cap = i.SizeBytes() 9011 9012 length, err := writer.Write(buf) 9013 // Since we bypassed the compiler's escape analysis, indicate that i 9014 // must live until the use above. 9015 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9016 return int64(length), err 9017 } 9018 9019 // SizeBytes implements marshal.Marshallable.SizeBytes. 9020 func (i *IPTGetinfo) SizeBytes() int { 9021 return 12 + 9022 (*TableName)(nil).SizeBytes() + 9023 4*NF_INET_NUMHOOKS + 9024 4*NF_INET_NUMHOOKS 9025 } 9026 9027 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9028 func (i *IPTGetinfo) MarshalBytes(dst []byte) []byte { 9029 dst = i.Name.MarshalUnsafe(dst) 9030 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9031 dst = dst[4:] 9032 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9033 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9034 dst = dst[4:] 9035 } 9036 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9037 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9038 dst = dst[4:] 9039 } 9040 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9041 dst = dst[4:] 9042 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9043 dst = dst[4:] 9044 return dst 9045 } 9046 9047 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9048 func (i *IPTGetinfo) UnmarshalBytes(src []byte) []byte { 9049 src = i.Name.UnmarshalUnsafe(src) 9050 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9051 src = src[4:] 9052 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9053 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9054 src = src[4:] 9055 } 9056 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9057 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9058 src = src[4:] 9059 } 9060 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9061 src = src[4:] 9062 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9063 src = src[4:] 9064 return src 9065 } 9066 9067 // Packed implements marshal.Marshallable.Packed. 9068 //go:nosplit 9069 func (i *IPTGetinfo) Packed() bool { 9070 return i.Name.Packed() 9071 } 9072 9073 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9074 func (i *IPTGetinfo) MarshalUnsafe(dst []byte) []byte { 9075 if i.Name.Packed() { 9076 size := i.SizeBytes() 9077 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9078 return dst[size:] 9079 } 9080 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9081 return i.MarshalBytes(dst) 9082 } 9083 9084 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9085 func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) []byte { 9086 if i.Name.Packed() { 9087 size := i.SizeBytes() 9088 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9089 return src[size:] 9090 } 9091 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9092 return i.UnmarshalBytes(src) 9093 } 9094 9095 // CopyOutN implements marshal.Marshallable.CopyOutN. 9096 func (i *IPTGetinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9097 if !i.Name.Packed() { 9098 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9099 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9100 i.MarshalBytes(buf) // escapes: fallback. 9101 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9102 } 9103 9104 // Construct a slice backed by dst's underlying memory. 9105 var buf []byte 9106 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9107 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9108 hdr.Len = i.SizeBytes() 9109 hdr.Cap = i.SizeBytes() 9110 9111 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9112 // Since we bypassed the compiler's escape analysis, indicate that i 9113 // must live until the use above. 9114 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9115 return length, err 9116 } 9117 9118 // CopyOut implements marshal.Marshallable.CopyOut. 9119 func (i *IPTGetinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9120 return i.CopyOutN(cc, addr, i.SizeBytes()) 9121 } 9122 9123 // CopyIn implements marshal.Marshallable.CopyIn. 9124 func (i *IPTGetinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9125 if !i.Name.Packed() { 9126 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9127 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9128 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9129 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9130 // partially unmarshalled struct. 9131 i.UnmarshalBytes(buf) // escapes: fallback. 9132 return length, err 9133 } 9134 9135 // Construct a slice backed by dst's underlying memory. 9136 var buf []byte 9137 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9138 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9139 hdr.Len = i.SizeBytes() 9140 hdr.Cap = i.SizeBytes() 9141 9142 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9143 // Since we bypassed the compiler's escape analysis, indicate that i 9144 // must live until the use above. 9145 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9146 return length, err 9147 } 9148 9149 // WriteTo implements io.WriterTo.WriteTo. 9150 func (i *IPTGetinfo) WriteTo(writer io.Writer) (int64, error) { 9151 if !i.Name.Packed() { 9152 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9153 buf := make([]byte, i.SizeBytes()) 9154 i.MarshalBytes(buf) 9155 length, err := writer.Write(buf) 9156 return int64(length), err 9157 } 9158 9159 // Construct a slice backed by dst's underlying memory. 9160 var buf []byte 9161 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9162 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9163 hdr.Len = i.SizeBytes() 9164 hdr.Cap = i.SizeBytes() 9165 9166 length, err := writer.Write(buf) 9167 // Since we bypassed the compiler's escape analysis, indicate that i 9168 // must live until the use above. 9169 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9170 return int64(length), err 9171 } 9172 9173 // SizeBytes implements marshal.Marshallable.SizeBytes. 9174 func (i *IPTIP) SizeBytes() int { 9175 return 4 + 9176 (*InetAddr)(nil).SizeBytes() + 9177 (*InetAddr)(nil).SizeBytes() + 9178 (*InetAddr)(nil).SizeBytes() + 9179 (*InetAddr)(nil).SizeBytes() + 9180 1*IFNAMSIZ + 9181 1*IFNAMSIZ + 9182 1*IFNAMSIZ + 9183 1*IFNAMSIZ 9184 } 9185 9186 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9187 func (i *IPTIP) MarshalBytes(dst []byte) []byte { 9188 dst = i.Src.MarshalUnsafe(dst) 9189 dst = i.Dst.MarshalUnsafe(dst) 9190 dst = i.SrcMask.MarshalUnsafe(dst) 9191 dst = i.DstMask.MarshalUnsafe(dst) 9192 for idx := 0; idx < IFNAMSIZ; idx++ { 9193 dst[0] = byte(i.InputInterface[idx]) 9194 dst = dst[1:] 9195 } 9196 for idx := 0; idx < IFNAMSIZ; idx++ { 9197 dst[0] = byte(i.OutputInterface[idx]) 9198 dst = dst[1:] 9199 } 9200 for idx := 0; idx < IFNAMSIZ; idx++ { 9201 dst[0] = byte(i.InputInterfaceMask[idx]) 9202 dst = dst[1:] 9203 } 9204 for idx := 0; idx < IFNAMSIZ; idx++ { 9205 dst[0] = byte(i.OutputInterfaceMask[idx]) 9206 dst = dst[1:] 9207 } 9208 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 9209 dst = dst[2:] 9210 dst[0] = byte(i.Flags) 9211 dst = dst[1:] 9212 dst[0] = byte(i.InverseFlags) 9213 dst = dst[1:] 9214 return dst 9215 } 9216 9217 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9218 func (i *IPTIP) UnmarshalBytes(src []byte) []byte { 9219 src = i.Src.UnmarshalUnsafe(src) 9220 src = i.Dst.UnmarshalUnsafe(src) 9221 src = i.SrcMask.UnmarshalUnsafe(src) 9222 src = i.DstMask.UnmarshalUnsafe(src) 9223 for idx := 0; idx < IFNAMSIZ; idx++ { 9224 i.InputInterface[idx] = src[0] 9225 src = src[1:] 9226 } 9227 for idx := 0; idx < IFNAMSIZ; idx++ { 9228 i.OutputInterface[idx] = src[0] 9229 src = src[1:] 9230 } 9231 for idx := 0; idx < IFNAMSIZ; idx++ { 9232 i.InputInterfaceMask[idx] = src[0] 9233 src = src[1:] 9234 } 9235 for idx := 0; idx < IFNAMSIZ; idx++ { 9236 i.OutputInterfaceMask[idx] = src[0] 9237 src = src[1:] 9238 } 9239 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9240 src = src[2:] 9241 i.Flags = uint8(src[0]) 9242 src = src[1:] 9243 i.InverseFlags = uint8(src[0]) 9244 src = src[1:] 9245 return src 9246 } 9247 9248 // Packed implements marshal.Marshallable.Packed. 9249 //go:nosplit 9250 func (i *IPTIP) Packed() bool { 9251 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 9252 } 9253 9254 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9255 func (i *IPTIP) MarshalUnsafe(dst []byte) []byte { 9256 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9257 size := i.SizeBytes() 9258 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9259 return dst[size:] 9260 } 9261 // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes. 9262 return i.MarshalBytes(dst) 9263 } 9264 9265 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9266 func (i *IPTIP) UnmarshalUnsafe(src []byte) []byte { 9267 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9268 size := i.SizeBytes() 9269 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9270 return src[size:] 9271 } 9272 // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9273 return i.UnmarshalBytes(src) 9274 } 9275 9276 // CopyOutN implements marshal.Marshallable.CopyOutN. 9277 func (i *IPTIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9278 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9279 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9280 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9281 i.MarshalBytes(buf) // escapes: fallback. 9282 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9283 } 9284 9285 // Construct a slice backed by dst's underlying memory. 9286 var buf []byte 9287 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9288 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9289 hdr.Len = i.SizeBytes() 9290 hdr.Cap = i.SizeBytes() 9291 9292 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9293 // Since we bypassed the compiler's escape analysis, indicate that i 9294 // must live until the use above. 9295 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9296 return length, err 9297 } 9298 9299 // CopyOut implements marshal.Marshallable.CopyOut. 9300 func (i *IPTIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9301 return i.CopyOutN(cc, addr, i.SizeBytes()) 9302 } 9303 9304 // CopyIn implements marshal.Marshallable.CopyIn. 9305 func (i *IPTIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9306 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9307 // Type IPTIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9308 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9309 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9310 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9311 // partially unmarshalled struct. 9312 i.UnmarshalBytes(buf) // escapes: fallback. 9313 return length, err 9314 } 9315 9316 // Construct a slice backed by dst's underlying memory. 9317 var buf []byte 9318 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9319 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9320 hdr.Len = i.SizeBytes() 9321 hdr.Cap = i.SizeBytes() 9322 9323 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9324 // Since we bypassed the compiler's escape analysis, indicate that i 9325 // must live until the use above. 9326 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9327 return length, err 9328 } 9329 9330 // WriteTo implements io.WriterTo.WriteTo. 9331 func (i *IPTIP) WriteTo(writer io.Writer) (int64, error) { 9332 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9333 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9334 buf := make([]byte, i.SizeBytes()) 9335 i.MarshalBytes(buf) 9336 length, err := writer.Write(buf) 9337 return int64(length), err 9338 } 9339 9340 // Construct a slice backed by dst's underlying memory. 9341 var buf []byte 9342 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9343 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9344 hdr.Len = i.SizeBytes() 9345 hdr.Cap = i.SizeBytes() 9346 9347 length, err := writer.Write(buf) 9348 // Since we bypassed the compiler's escape analysis, indicate that i 9349 // must live until the use above. 9350 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9351 return int64(length), err 9352 } 9353 9354 // SizeBytes implements marshal.Marshallable.SizeBytes. 9355 func (i *IPTOwnerInfo) SizeBytes() int { 9356 return 18 + 9357 1*16 9358 } 9359 9360 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9361 func (i *IPTOwnerInfo) MarshalBytes(dst []byte) []byte { 9362 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 9363 dst = dst[4:] 9364 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 9365 dst = dst[4:] 9366 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.PID)) 9367 dst = dst[4:] 9368 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SID)) 9369 dst = dst[4:] 9370 for idx := 0; idx < 16; idx++ { 9371 dst[0] = byte(i.Comm[idx]) 9372 dst = dst[1:] 9373 } 9374 dst[0] = byte(i.Match) 9375 dst = dst[1:] 9376 dst[0] = byte(i.Invert) 9377 dst = dst[1:] 9378 return dst 9379 } 9380 9381 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9382 func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) []byte { 9383 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9384 src = src[4:] 9385 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9386 src = src[4:] 9387 i.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9388 src = src[4:] 9389 i.SID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9390 src = src[4:] 9391 for idx := 0; idx < 16; idx++ { 9392 i.Comm[idx] = src[0] 9393 src = src[1:] 9394 } 9395 i.Match = uint8(src[0]) 9396 src = src[1:] 9397 i.Invert = uint8(src[0]) 9398 src = src[1:] 9399 return src 9400 } 9401 9402 // Packed implements marshal.Marshallable.Packed. 9403 //go:nosplit 9404 func (i *IPTOwnerInfo) Packed() bool { 9405 return false 9406 } 9407 9408 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9409 func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) []byte { 9410 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9411 return i.MarshalBytes(dst) 9412 } 9413 9414 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9415 func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) []byte { 9416 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9417 return i.UnmarshalBytes(src) 9418 } 9419 9420 // CopyOutN implements marshal.Marshallable.CopyOutN. 9421 func (i *IPTOwnerInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9422 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9423 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9424 i.MarshalBytes(buf) // escapes: fallback. 9425 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9426 } 9427 9428 // CopyOut implements marshal.Marshallable.CopyOut. 9429 func (i *IPTOwnerInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9430 return i.CopyOutN(cc, addr, i.SizeBytes()) 9431 } 9432 9433 // CopyIn implements marshal.Marshallable.CopyIn. 9434 func (i *IPTOwnerInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9435 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9436 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9437 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9438 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9439 // partially unmarshalled struct. 9440 i.UnmarshalBytes(buf) // escapes: fallback. 9441 return length, err 9442 } 9443 9444 // WriteTo implements io.WriterTo.WriteTo. 9445 func (i *IPTOwnerInfo) WriteTo(writer io.Writer) (int64, error) { 9446 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9447 buf := make([]byte, i.SizeBytes()) 9448 i.MarshalBytes(buf) 9449 length, err := writer.Write(buf) 9450 return int64(length), err 9451 } 9452 9453 // SizeBytes implements marshal.Marshallable.SizeBytes. 9454 func (i *IPTReplace) SizeBytes() int { 9455 return 24 + 9456 (*TableName)(nil).SizeBytes() + 9457 4*NF_INET_NUMHOOKS + 9458 4*NF_INET_NUMHOOKS 9459 } 9460 9461 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9462 func (i *IPTReplace) MarshalBytes(dst []byte) []byte { 9463 dst = i.Name.MarshalUnsafe(dst) 9464 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9465 dst = dst[4:] 9466 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9467 dst = dst[4:] 9468 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9469 dst = dst[4:] 9470 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9471 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9472 dst = dst[4:] 9473 } 9474 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9475 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9476 dst = dst[4:] 9477 } 9478 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 9479 dst = dst[4:] 9480 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 9481 dst = dst[8:] 9482 return dst 9483 } 9484 9485 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9486 func (i *IPTReplace) UnmarshalBytes(src []byte) []byte { 9487 src = i.Name.UnmarshalUnsafe(src) 9488 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9489 src = src[4:] 9490 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9491 src = src[4:] 9492 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9493 src = src[4:] 9494 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9495 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9496 src = src[4:] 9497 } 9498 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9499 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9500 src = src[4:] 9501 } 9502 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9503 src = src[4:] 9504 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 9505 src = src[8:] 9506 return src 9507 } 9508 9509 // Packed implements marshal.Marshallable.Packed. 9510 //go:nosplit 9511 func (i *IPTReplace) Packed() bool { 9512 return i.Name.Packed() 9513 } 9514 9515 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9516 func (i *IPTReplace) MarshalUnsafe(dst []byte) []byte { 9517 if i.Name.Packed() { 9518 size := i.SizeBytes() 9519 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9520 return dst[size:] 9521 } 9522 // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 9523 return i.MarshalBytes(dst) 9524 } 9525 9526 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9527 func (i *IPTReplace) UnmarshalUnsafe(src []byte) []byte { 9528 if i.Name.Packed() { 9529 size := i.SizeBytes() 9530 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9531 return src[size:] 9532 } 9533 // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9534 return i.UnmarshalBytes(src) 9535 } 9536 9537 // CopyOutN implements marshal.Marshallable.CopyOutN. 9538 func (i *IPTReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9539 if !i.Name.Packed() { 9540 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 9541 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9542 i.MarshalBytes(buf) // escapes: fallback. 9543 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9544 } 9545 9546 // Construct a slice backed by dst's underlying memory. 9547 var buf []byte 9548 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9549 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9550 hdr.Len = i.SizeBytes() 9551 hdr.Cap = i.SizeBytes() 9552 9553 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9554 // Since we bypassed the compiler's escape analysis, indicate that i 9555 // must live until the use above. 9556 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9557 return length, err 9558 } 9559 9560 // CopyOut implements marshal.Marshallable.CopyOut. 9561 func (i *IPTReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9562 return i.CopyOutN(cc, addr, i.SizeBytes()) 9563 } 9564 9565 // CopyIn implements marshal.Marshallable.CopyIn. 9566 func (i *IPTReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9567 if !i.Name.Packed() { 9568 // Type IPTReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9569 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9570 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9571 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9572 // partially unmarshalled struct. 9573 i.UnmarshalBytes(buf) // escapes: fallback. 9574 return length, err 9575 } 9576 9577 // Construct a slice backed by dst's underlying memory. 9578 var buf []byte 9579 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9580 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9581 hdr.Len = i.SizeBytes() 9582 hdr.Cap = i.SizeBytes() 9583 9584 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9585 // Since we bypassed the compiler's escape analysis, indicate that i 9586 // must live until the use above. 9587 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9588 return length, err 9589 } 9590 9591 // WriteTo implements io.WriterTo.WriteTo. 9592 func (i *IPTReplace) WriteTo(writer io.Writer) (int64, error) { 9593 if !i.Name.Packed() { 9594 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 9595 buf := make([]byte, i.SizeBytes()) 9596 i.MarshalBytes(buf) 9597 length, err := writer.Write(buf) 9598 return int64(length), err 9599 } 9600 9601 // Construct a slice backed by dst's underlying memory. 9602 var buf []byte 9603 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9604 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9605 hdr.Len = i.SizeBytes() 9606 hdr.Cap = i.SizeBytes() 9607 9608 length, err := writer.Write(buf) 9609 // Since we bypassed the compiler's escape analysis, indicate that i 9610 // must live until the use above. 9611 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9612 return int64(length), err 9613 } 9614 9615 // Packed implements marshal.Marshallable.Packed. 9616 //go:nosplit 9617 func (ke *KernelIPTEntry) Packed() bool { 9618 // Type KernelIPTEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 9619 return false 9620 } 9621 9622 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9623 func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) []byte { 9624 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 9625 return ke.MarshalBytes(dst) 9626 } 9627 9628 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9629 func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) []byte { 9630 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9631 return ke.UnmarshalBytes(src) 9632 } 9633 9634 // CopyOutN implements marshal.Marshallable.CopyOutN. 9635 //go:nosplit 9636 func (ke *KernelIPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9637 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9638 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9639 ke.MarshalBytes(buf) // escapes: fallback. 9640 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9641 } 9642 9643 // CopyOut implements marshal.Marshallable.CopyOut. 9644 func (ke *KernelIPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9645 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 9646 } 9647 9648 // CopyIn implements marshal.Marshallable.CopyIn. 9649 func (ke *KernelIPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9650 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9651 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9652 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9653 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9654 // partially unmarshalled struct. 9655 ke.UnmarshalBytes(buf) // escapes: fallback. 9656 return length, err 9657 } 9658 9659 // WriteTo implements io.WriterTo.WriteTo. 9660 func (ke *KernelIPTEntry) WriteTo(writer io.Writer) (int64, error) { 9661 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9662 buf := make([]byte, ke.SizeBytes()) 9663 ke.MarshalBytes(buf) 9664 length, err := writer.Write(buf) 9665 return int64(length), err 9666 } 9667 9668 // Packed implements marshal.Marshallable.Packed. 9669 //go:nosplit 9670 func (ke *KernelIPTGetEntries) Packed() bool { 9671 // Type KernelIPTGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 9672 return false 9673 } 9674 9675 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9676 func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) []byte { 9677 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 9678 return ke.MarshalBytes(dst) 9679 } 9680 9681 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9682 func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 9683 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9684 return ke.UnmarshalBytes(src) 9685 } 9686 9687 // CopyOutN implements marshal.Marshallable.CopyOutN. 9688 //go:nosplit 9689 func (ke *KernelIPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9690 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9691 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9692 ke.MarshalBytes(buf) // escapes: fallback. 9693 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9694 } 9695 9696 // CopyOut implements marshal.Marshallable.CopyOut. 9697 func (ke *KernelIPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9698 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 9699 } 9700 9701 // CopyIn implements marshal.Marshallable.CopyIn. 9702 func (ke *KernelIPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9703 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9704 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9705 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9706 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9707 // partially unmarshalled struct. 9708 ke.UnmarshalBytes(buf) // escapes: fallback. 9709 return length, err 9710 } 9711 9712 // WriteTo implements io.WriterTo.WriteTo. 9713 func (ke *KernelIPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 9714 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9715 buf := make([]byte, ke.SizeBytes()) 9716 ke.MarshalBytes(buf) 9717 length, err := writer.Write(buf) 9718 return int64(length), err 9719 } 9720 9721 // SizeBytes implements marshal.Marshallable.SizeBytes. 9722 func (n *NfNATIPV4MultiRangeCompat) SizeBytes() int { 9723 return 4 + 9724 (*NfNATIPV4Range)(nil).SizeBytes() 9725 } 9726 9727 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9728 func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) []byte { 9729 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.RangeSize)) 9730 dst = dst[4:] 9731 dst = n.RangeIPV4.MarshalUnsafe(dst) 9732 return dst 9733 } 9734 9735 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9736 func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) []byte { 9737 n.RangeSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9738 src = src[4:] 9739 src = n.RangeIPV4.UnmarshalUnsafe(src) 9740 return src 9741 } 9742 9743 // Packed implements marshal.Marshallable.Packed. 9744 //go:nosplit 9745 func (n *NfNATIPV4MultiRangeCompat) Packed() bool { 9746 return n.RangeIPV4.Packed() 9747 } 9748 9749 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9750 func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) []byte { 9751 if n.RangeIPV4.Packed() { 9752 size := n.SizeBytes() 9753 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 9754 return dst[size:] 9755 } 9756 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes. 9757 return n.MarshalBytes(dst) 9758 } 9759 9760 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9761 func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) []byte { 9762 if n.RangeIPV4.Packed() { 9763 size := n.SizeBytes() 9764 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 9765 return src[size:] 9766 } 9767 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9768 return n.UnmarshalBytes(src) 9769 } 9770 9771 // CopyOutN implements marshal.Marshallable.CopyOutN. 9772 func (n *NfNATIPV4MultiRangeCompat) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9773 if !n.RangeIPV4.Packed() { 9774 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 9775 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 9776 n.MarshalBytes(buf) // escapes: fallback. 9777 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9778 } 9779 9780 // Construct a slice backed by dst's underlying memory. 9781 var buf []byte 9782 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9783 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9784 hdr.Len = n.SizeBytes() 9785 hdr.Cap = n.SizeBytes() 9786 9787 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9788 // Since we bypassed the compiler's escape analysis, indicate that n 9789 // must live until the use above. 9790 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9791 return length, err 9792 } 9793 9794 // CopyOut implements marshal.Marshallable.CopyOut. 9795 func (n *NfNATIPV4MultiRangeCompat) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9796 return n.CopyOutN(cc, addr, n.SizeBytes()) 9797 } 9798 9799 // CopyIn implements marshal.Marshallable.CopyIn. 9800 func (n *NfNATIPV4MultiRangeCompat) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9801 if !n.RangeIPV4.Packed() { 9802 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9803 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 9804 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9805 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9806 // partially unmarshalled struct. 9807 n.UnmarshalBytes(buf) // escapes: fallback. 9808 return length, err 9809 } 9810 9811 // Construct a slice backed by dst's underlying memory. 9812 var buf []byte 9813 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9814 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9815 hdr.Len = n.SizeBytes() 9816 hdr.Cap = n.SizeBytes() 9817 9818 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9819 // Since we bypassed the compiler's escape analysis, indicate that n 9820 // must live until the use above. 9821 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9822 return length, err 9823 } 9824 9825 // WriteTo implements io.WriterTo.WriteTo. 9826 func (n *NfNATIPV4MultiRangeCompat) WriteTo(writer io.Writer) (int64, error) { 9827 if !n.RangeIPV4.Packed() { 9828 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 9829 buf := make([]byte, n.SizeBytes()) 9830 n.MarshalBytes(buf) 9831 length, err := writer.Write(buf) 9832 return int64(length), err 9833 } 9834 9835 // Construct a slice backed by dst's underlying memory. 9836 var buf []byte 9837 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9838 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9839 hdr.Len = n.SizeBytes() 9840 hdr.Cap = n.SizeBytes() 9841 9842 length, err := writer.Write(buf) 9843 // Since we bypassed the compiler's escape analysis, indicate that n 9844 // must live until the use above. 9845 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9846 return int64(length), err 9847 } 9848 9849 // SizeBytes implements marshal.Marshallable.SizeBytes. 9850 func (n *NfNATIPV4Range) SizeBytes() int { 9851 return 8 + 9852 1*4 + 9853 1*4 9854 } 9855 9856 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9857 func (n *NfNATIPV4Range) MarshalBytes(dst []byte) []byte { 9858 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 9859 dst = dst[4:] 9860 for idx := 0; idx < 4; idx++ { 9861 dst[0] = byte(n.MinIP[idx]) 9862 dst = dst[1:] 9863 } 9864 for idx := 0; idx < 4; idx++ { 9865 dst[0] = byte(n.MaxIP[idx]) 9866 dst = dst[1:] 9867 } 9868 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinPort)) 9869 dst = dst[2:] 9870 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxPort)) 9871 dst = dst[2:] 9872 return dst 9873 } 9874 9875 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9876 func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) []byte { 9877 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9878 src = src[4:] 9879 for idx := 0; idx < 4; idx++ { 9880 n.MinIP[idx] = src[0] 9881 src = src[1:] 9882 } 9883 for idx := 0; idx < 4; idx++ { 9884 n.MaxIP[idx] = src[0] 9885 src = src[1:] 9886 } 9887 n.MinPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9888 src = src[2:] 9889 n.MaxPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9890 src = src[2:] 9891 return src 9892 } 9893 9894 // Packed implements marshal.Marshallable.Packed. 9895 //go:nosplit 9896 func (n *NfNATIPV4Range) Packed() bool { 9897 return true 9898 } 9899 9900 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9901 func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) []byte { 9902 size := n.SizeBytes() 9903 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 9904 return dst[size:] 9905 } 9906 9907 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9908 func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) []byte { 9909 size := n.SizeBytes() 9910 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 9911 return src[size:] 9912 } 9913 9914 // CopyOutN implements marshal.Marshallable.CopyOutN. 9915 func (n *NfNATIPV4Range) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9916 // Construct a slice backed by dst's underlying memory. 9917 var buf []byte 9918 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9919 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9920 hdr.Len = n.SizeBytes() 9921 hdr.Cap = n.SizeBytes() 9922 9923 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9924 // Since we bypassed the compiler's escape analysis, indicate that n 9925 // must live until the use above. 9926 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9927 return length, err 9928 } 9929 9930 // CopyOut implements marshal.Marshallable.CopyOut. 9931 func (n *NfNATIPV4Range) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9932 return n.CopyOutN(cc, addr, n.SizeBytes()) 9933 } 9934 9935 // CopyIn implements marshal.Marshallable.CopyIn. 9936 func (n *NfNATIPV4Range) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9937 // Construct a slice backed by dst's underlying memory. 9938 var buf []byte 9939 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9940 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9941 hdr.Len = n.SizeBytes() 9942 hdr.Cap = n.SizeBytes() 9943 9944 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9945 // Since we bypassed the compiler's escape analysis, indicate that n 9946 // must live until the use above. 9947 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9948 return length, err 9949 } 9950 9951 // WriteTo implements io.WriterTo.WriteTo. 9952 func (n *NfNATIPV4Range) WriteTo(writer io.Writer) (int64, error) { 9953 // Construct a slice backed by dst's underlying memory. 9954 var buf []byte 9955 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9956 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9957 hdr.Len = n.SizeBytes() 9958 hdr.Cap = n.SizeBytes() 9959 9960 length, err := writer.Write(buf) 9961 // Since we bypassed the compiler's escape analysis, indicate that n 9962 // must live until the use above. 9963 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9964 return int64(length), err 9965 } 9966 9967 // SizeBytes implements marshal.Marshallable.SizeBytes. 9968 //go:nosplit 9969 func (tn *TableName) SizeBytes() int { 9970 return 1 * XT_TABLE_MAXNAMELEN 9971 } 9972 9973 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9974 func (tn *TableName) MarshalBytes(dst []byte) []byte { 9975 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 9976 dst[0] = byte(tn[idx]) 9977 dst = dst[1:] 9978 } 9979 return dst 9980 } 9981 9982 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9983 func (tn *TableName) UnmarshalBytes(src []byte) []byte { 9984 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 9985 tn[idx] = src[0] 9986 src = src[1:] 9987 } 9988 return src 9989 } 9990 9991 // Packed implements marshal.Marshallable.Packed. 9992 //go:nosplit 9993 func (tn *TableName) Packed() bool { 9994 // Array newtypes are always packed. 9995 return true 9996 } 9997 9998 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9999 func (tn *TableName) MarshalUnsafe(dst []byte) []byte { 10000 size := tn.SizeBytes() 10001 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(size)) 10002 return dst[size:] 10003 } 10004 10005 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10006 func (tn *TableName) UnmarshalUnsafe(src []byte) []byte { 10007 size := tn.SizeBytes() 10008 gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(size)) 10009 return src[size:] 10010 } 10011 10012 // CopyOutN implements marshal.Marshallable.CopyOutN. 10013 func (tn *TableName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10014 // Construct a slice backed by dst's underlying memory. 10015 var buf []byte 10016 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10017 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10018 hdr.Len = tn.SizeBytes() 10019 hdr.Cap = tn.SizeBytes() 10020 10021 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10022 // Since we bypassed the compiler's escape analysis, indicate that tn 10023 // must live until the use above. 10024 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10025 return length, err 10026 } 10027 10028 // CopyOut implements marshal.Marshallable.CopyOut. 10029 func (tn *TableName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10030 return tn.CopyOutN(cc, addr, tn.SizeBytes()) 10031 } 10032 10033 // CopyIn implements marshal.Marshallable.CopyIn. 10034 func (tn *TableName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10035 // Construct a slice backed by dst's underlying memory. 10036 var buf []byte 10037 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10038 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10039 hdr.Len = tn.SizeBytes() 10040 hdr.Cap = tn.SizeBytes() 10041 10042 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10043 // Since we bypassed the compiler's escape analysis, indicate that tn 10044 // must live until the use above. 10045 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10046 return length, err 10047 } 10048 10049 // WriteTo implements io.WriterTo.WriteTo. 10050 func (tn *TableName) WriteTo(writer io.Writer) (int64, error) { 10051 // Construct a slice backed by dst's underlying memory. 10052 var buf []byte 10053 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10054 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10055 hdr.Len = tn.SizeBytes() 10056 hdr.Cap = tn.SizeBytes() 10057 10058 length, err := writer.Write(buf) 10059 // Since we bypassed the compiler's escape analysis, indicate that tn 10060 // must live until the use above. 10061 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10062 return int64(length), err 10063 } 10064 10065 // SizeBytes implements marshal.Marshallable.SizeBytes. 10066 func (x *XTCounters) SizeBytes() int { 10067 return 16 10068 } 10069 10070 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10071 func (x *XTCounters) MarshalBytes(dst []byte) []byte { 10072 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Pcnt)) 10073 dst = dst[8:] 10074 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Bcnt)) 10075 dst = dst[8:] 10076 return dst 10077 } 10078 10079 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10080 func (x *XTCounters) UnmarshalBytes(src []byte) []byte { 10081 x.Pcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10082 src = src[8:] 10083 x.Bcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10084 src = src[8:] 10085 return src 10086 } 10087 10088 // Packed implements marshal.Marshallable.Packed. 10089 //go:nosplit 10090 func (x *XTCounters) Packed() bool { 10091 return true 10092 } 10093 10094 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10095 func (x *XTCounters) MarshalUnsafe(dst []byte) []byte { 10096 size := x.SizeBytes() 10097 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10098 return dst[size:] 10099 } 10100 10101 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10102 func (x *XTCounters) UnmarshalUnsafe(src []byte) []byte { 10103 size := x.SizeBytes() 10104 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10105 return src[size:] 10106 } 10107 10108 // CopyOutN implements marshal.Marshallable.CopyOutN. 10109 func (x *XTCounters) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10110 // Construct a slice backed by dst's underlying memory. 10111 var buf []byte 10112 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10113 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10114 hdr.Len = x.SizeBytes() 10115 hdr.Cap = x.SizeBytes() 10116 10117 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10118 // Since we bypassed the compiler's escape analysis, indicate that x 10119 // must live until the use above. 10120 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10121 return length, err 10122 } 10123 10124 // CopyOut implements marshal.Marshallable.CopyOut. 10125 func (x *XTCounters) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10126 return x.CopyOutN(cc, addr, x.SizeBytes()) 10127 } 10128 10129 // CopyIn implements marshal.Marshallable.CopyIn. 10130 func (x *XTCounters) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10131 // Construct a slice backed by dst's underlying memory. 10132 var buf []byte 10133 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10134 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10135 hdr.Len = x.SizeBytes() 10136 hdr.Cap = x.SizeBytes() 10137 10138 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10139 // Since we bypassed the compiler's escape analysis, indicate that x 10140 // must live until the use above. 10141 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10142 return length, err 10143 } 10144 10145 // WriteTo implements io.WriterTo.WriteTo. 10146 func (x *XTCounters) WriteTo(writer io.Writer) (int64, error) { 10147 // Construct a slice backed by dst's underlying memory. 10148 var buf []byte 10149 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10150 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10151 hdr.Len = x.SizeBytes() 10152 hdr.Cap = x.SizeBytes() 10153 10154 length, err := writer.Write(buf) 10155 // Since we bypassed the compiler's escape analysis, indicate that x 10156 // must live until the use above. 10157 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10158 return int64(length), err 10159 } 10160 10161 // SizeBytes implements marshal.Marshallable.SizeBytes. 10162 func (x *XTEntryMatch) SizeBytes() int { 10163 return 3 + 10164 (*ExtensionName)(nil).SizeBytes() 10165 } 10166 10167 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10168 func (x *XTEntryMatch) MarshalBytes(dst []byte) []byte { 10169 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.MatchSize)) 10170 dst = dst[2:] 10171 dst = x.Name.MarshalUnsafe(dst) 10172 dst[0] = byte(x.Revision) 10173 dst = dst[1:] 10174 return dst 10175 } 10176 10177 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10178 func (x *XTEntryMatch) UnmarshalBytes(src []byte) []byte { 10179 x.MatchSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10180 src = src[2:] 10181 src = x.Name.UnmarshalUnsafe(src) 10182 x.Revision = uint8(src[0]) 10183 src = src[1:] 10184 return src 10185 } 10186 10187 // Packed implements marshal.Marshallable.Packed. 10188 //go:nosplit 10189 func (x *XTEntryMatch) Packed() bool { 10190 return x.Name.Packed() 10191 } 10192 10193 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10194 func (x *XTEntryMatch) MarshalUnsafe(dst []byte) []byte { 10195 if x.Name.Packed() { 10196 size := x.SizeBytes() 10197 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10198 return dst[size:] 10199 } 10200 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes. 10201 return x.MarshalBytes(dst) 10202 } 10203 10204 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10205 func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) []byte { 10206 if x.Name.Packed() { 10207 size := x.SizeBytes() 10208 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10209 return src[size:] 10210 } 10211 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10212 return x.UnmarshalBytes(src) 10213 } 10214 10215 // CopyOutN implements marshal.Marshallable.CopyOutN. 10216 func (x *XTEntryMatch) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10217 if !x.Name.Packed() { 10218 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10219 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10220 x.MarshalBytes(buf) // escapes: fallback. 10221 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10222 } 10223 10224 // Construct a slice backed by dst's underlying memory. 10225 var buf []byte 10226 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10227 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10228 hdr.Len = x.SizeBytes() 10229 hdr.Cap = x.SizeBytes() 10230 10231 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10232 // Since we bypassed the compiler's escape analysis, indicate that x 10233 // must live until the use above. 10234 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10235 return length, err 10236 } 10237 10238 // CopyOut implements marshal.Marshallable.CopyOut. 10239 func (x *XTEntryMatch) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10240 return x.CopyOutN(cc, addr, x.SizeBytes()) 10241 } 10242 10243 // CopyIn implements marshal.Marshallable.CopyIn. 10244 func (x *XTEntryMatch) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10245 if !x.Name.Packed() { 10246 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10247 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10248 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10249 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10250 // partially unmarshalled struct. 10251 x.UnmarshalBytes(buf) // escapes: fallback. 10252 return length, err 10253 } 10254 10255 // Construct a slice backed by dst's underlying memory. 10256 var buf []byte 10257 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10258 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10259 hdr.Len = x.SizeBytes() 10260 hdr.Cap = x.SizeBytes() 10261 10262 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10263 // Since we bypassed the compiler's escape analysis, indicate that x 10264 // must live until the use above. 10265 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10266 return length, err 10267 } 10268 10269 // WriteTo implements io.WriterTo.WriteTo. 10270 func (x *XTEntryMatch) WriteTo(writer io.Writer) (int64, error) { 10271 if !x.Name.Packed() { 10272 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10273 buf := make([]byte, x.SizeBytes()) 10274 x.MarshalBytes(buf) 10275 length, err := writer.Write(buf) 10276 return int64(length), err 10277 } 10278 10279 // Construct a slice backed by dst's underlying memory. 10280 var buf []byte 10281 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10282 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10283 hdr.Len = x.SizeBytes() 10284 hdr.Cap = x.SizeBytes() 10285 10286 length, err := writer.Write(buf) 10287 // Since we bypassed the compiler's escape analysis, indicate that x 10288 // must live until the use above. 10289 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10290 return int64(length), err 10291 } 10292 10293 // SizeBytes implements marshal.Marshallable.SizeBytes. 10294 func (x *XTEntryTarget) SizeBytes() int { 10295 return 3 + 10296 (*ExtensionName)(nil).SizeBytes() 10297 } 10298 10299 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10300 func (x *XTEntryTarget) MarshalBytes(dst []byte) []byte { 10301 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.TargetSize)) 10302 dst = dst[2:] 10303 dst = x.Name.MarshalUnsafe(dst) 10304 dst[0] = byte(x.Revision) 10305 dst = dst[1:] 10306 return dst 10307 } 10308 10309 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10310 func (x *XTEntryTarget) UnmarshalBytes(src []byte) []byte { 10311 x.TargetSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10312 src = src[2:] 10313 src = x.Name.UnmarshalUnsafe(src) 10314 x.Revision = uint8(src[0]) 10315 src = src[1:] 10316 return src 10317 } 10318 10319 // Packed implements marshal.Marshallable.Packed. 10320 //go:nosplit 10321 func (x *XTEntryTarget) Packed() bool { 10322 return x.Name.Packed() 10323 } 10324 10325 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10326 func (x *XTEntryTarget) MarshalUnsafe(dst []byte) []byte { 10327 if x.Name.Packed() { 10328 size := x.SizeBytes() 10329 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10330 return dst[size:] 10331 } 10332 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10333 return x.MarshalBytes(dst) 10334 } 10335 10336 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10337 func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) []byte { 10338 if x.Name.Packed() { 10339 size := x.SizeBytes() 10340 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10341 return src[size:] 10342 } 10343 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10344 return x.UnmarshalBytes(src) 10345 } 10346 10347 // CopyOutN implements marshal.Marshallable.CopyOutN. 10348 func (x *XTEntryTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10349 if !x.Name.Packed() { 10350 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10351 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10352 x.MarshalBytes(buf) // escapes: fallback. 10353 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10354 } 10355 10356 // Construct a slice backed by dst's underlying memory. 10357 var buf []byte 10358 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10359 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10360 hdr.Len = x.SizeBytes() 10361 hdr.Cap = x.SizeBytes() 10362 10363 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10364 // Since we bypassed the compiler's escape analysis, indicate that x 10365 // must live until the use above. 10366 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10367 return length, err 10368 } 10369 10370 // CopyOut implements marshal.Marshallable.CopyOut. 10371 func (x *XTEntryTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10372 return x.CopyOutN(cc, addr, x.SizeBytes()) 10373 } 10374 10375 // CopyIn implements marshal.Marshallable.CopyIn. 10376 func (x *XTEntryTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10377 if !x.Name.Packed() { 10378 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10379 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10380 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10381 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10382 // partially unmarshalled struct. 10383 x.UnmarshalBytes(buf) // escapes: fallback. 10384 return length, err 10385 } 10386 10387 // Construct a slice backed by dst's underlying memory. 10388 var buf []byte 10389 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10390 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10391 hdr.Len = x.SizeBytes() 10392 hdr.Cap = x.SizeBytes() 10393 10394 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10395 // Since we bypassed the compiler's escape analysis, indicate that x 10396 // must live until the use above. 10397 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10398 return length, err 10399 } 10400 10401 // WriteTo implements io.WriterTo.WriteTo. 10402 func (x *XTEntryTarget) WriteTo(writer io.Writer) (int64, error) { 10403 if !x.Name.Packed() { 10404 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10405 buf := make([]byte, x.SizeBytes()) 10406 x.MarshalBytes(buf) 10407 length, err := writer.Write(buf) 10408 return int64(length), err 10409 } 10410 10411 // Construct a slice backed by dst's underlying memory. 10412 var buf []byte 10413 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10414 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10415 hdr.Len = x.SizeBytes() 10416 hdr.Cap = x.SizeBytes() 10417 10418 length, err := writer.Write(buf) 10419 // Since we bypassed the compiler's escape analysis, indicate that x 10420 // must live until the use above. 10421 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10422 return int64(length), err 10423 } 10424 10425 // SizeBytes implements marshal.Marshallable.SizeBytes. 10426 func (x *XTErrorTarget) SizeBytes() int { 10427 return 0 + 10428 (*XTEntryTarget)(nil).SizeBytes() + 10429 (*ErrorName)(nil).SizeBytes() + 10430 1*2 10431 } 10432 10433 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10434 func (x *XTErrorTarget) MarshalBytes(dst []byte) []byte { 10435 dst = x.Target.MarshalUnsafe(dst) 10436 dst = x.Name.MarshalUnsafe(dst) 10437 // Padding: dst[:sizeof(byte)*2] ~= [2]byte{0} 10438 dst = dst[1*(2):] 10439 return dst 10440 } 10441 10442 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10443 func (x *XTErrorTarget) UnmarshalBytes(src []byte) []byte { 10444 src = x.Target.UnmarshalUnsafe(src) 10445 src = x.Name.UnmarshalUnsafe(src) 10446 // Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2]) 10447 src = src[1*(2):] 10448 return src 10449 } 10450 10451 // Packed implements marshal.Marshallable.Packed. 10452 //go:nosplit 10453 func (x *XTErrorTarget) Packed() bool { 10454 return x.Name.Packed() && x.Target.Packed() 10455 } 10456 10457 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10458 func (x *XTErrorTarget) MarshalUnsafe(dst []byte) []byte { 10459 if x.Name.Packed() && x.Target.Packed() { 10460 size := x.SizeBytes() 10461 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10462 return dst[size:] 10463 } 10464 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10465 return x.MarshalBytes(dst) 10466 } 10467 10468 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10469 func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) []byte { 10470 if x.Name.Packed() && x.Target.Packed() { 10471 size := x.SizeBytes() 10472 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10473 return src[size:] 10474 } 10475 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10476 return x.UnmarshalBytes(src) 10477 } 10478 10479 // CopyOutN implements marshal.Marshallable.CopyOutN. 10480 func (x *XTErrorTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10481 if !x.Name.Packed() && x.Target.Packed() { 10482 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10483 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10484 x.MarshalBytes(buf) // escapes: fallback. 10485 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10486 } 10487 10488 // Construct a slice backed by dst's underlying memory. 10489 var buf []byte 10490 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10491 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10492 hdr.Len = x.SizeBytes() 10493 hdr.Cap = x.SizeBytes() 10494 10495 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10496 // Since we bypassed the compiler's escape analysis, indicate that x 10497 // must live until the use above. 10498 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10499 return length, err 10500 } 10501 10502 // CopyOut implements marshal.Marshallable.CopyOut. 10503 func (x *XTErrorTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10504 return x.CopyOutN(cc, addr, x.SizeBytes()) 10505 } 10506 10507 // CopyIn implements marshal.Marshallable.CopyIn. 10508 func (x *XTErrorTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10509 if !x.Name.Packed() && x.Target.Packed() { 10510 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10511 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10512 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10513 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10514 // partially unmarshalled struct. 10515 x.UnmarshalBytes(buf) // escapes: fallback. 10516 return length, err 10517 } 10518 10519 // Construct a slice backed by dst's underlying memory. 10520 var buf []byte 10521 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10522 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10523 hdr.Len = x.SizeBytes() 10524 hdr.Cap = x.SizeBytes() 10525 10526 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10527 // Since we bypassed the compiler's escape analysis, indicate that x 10528 // must live until the use above. 10529 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10530 return length, err 10531 } 10532 10533 // WriteTo implements io.WriterTo.WriteTo. 10534 func (x *XTErrorTarget) WriteTo(writer io.Writer) (int64, error) { 10535 if !x.Name.Packed() && x.Target.Packed() { 10536 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10537 buf := make([]byte, x.SizeBytes()) 10538 x.MarshalBytes(buf) 10539 length, err := writer.Write(buf) 10540 return int64(length), err 10541 } 10542 10543 // Construct a slice backed by dst's underlying memory. 10544 var buf []byte 10545 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10546 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10547 hdr.Len = x.SizeBytes() 10548 hdr.Cap = x.SizeBytes() 10549 10550 length, err := writer.Write(buf) 10551 // Since we bypassed the compiler's escape analysis, indicate that x 10552 // must live until the use above. 10553 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10554 return int64(length), err 10555 } 10556 10557 // SizeBytes implements marshal.Marshallable.SizeBytes. 10558 func (x *XTGetRevision) SizeBytes() int { 10559 return 1 + 10560 (*ExtensionName)(nil).SizeBytes() 10561 } 10562 10563 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10564 func (x *XTGetRevision) MarshalBytes(dst []byte) []byte { 10565 dst = x.Name.MarshalUnsafe(dst) 10566 dst[0] = byte(x.Revision) 10567 dst = dst[1:] 10568 return dst 10569 } 10570 10571 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10572 func (x *XTGetRevision) UnmarshalBytes(src []byte) []byte { 10573 src = x.Name.UnmarshalUnsafe(src) 10574 x.Revision = uint8(src[0]) 10575 src = src[1:] 10576 return src 10577 } 10578 10579 // Packed implements marshal.Marshallable.Packed. 10580 //go:nosplit 10581 func (x *XTGetRevision) Packed() bool { 10582 return x.Name.Packed() 10583 } 10584 10585 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10586 func (x *XTGetRevision) MarshalUnsafe(dst []byte) []byte { 10587 if x.Name.Packed() { 10588 size := x.SizeBytes() 10589 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10590 return dst[size:] 10591 } 10592 // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes. 10593 return x.MarshalBytes(dst) 10594 } 10595 10596 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10597 func (x *XTGetRevision) UnmarshalUnsafe(src []byte) []byte { 10598 if x.Name.Packed() { 10599 size := x.SizeBytes() 10600 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10601 return src[size:] 10602 } 10603 // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10604 return x.UnmarshalBytes(src) 10605 } 10606 10607 // CopyOutN implements marshal.Marshallable.CopyOutN. 10608 func (x *XTGetRevision) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10609 if !x.Name.Packed() { 10610 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 10611 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10612 x.MarshalBytes(buf) // escapes: fallback. 10613 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10614 } 10615 10616 // Construct a slice backed by dst's underlying memory. 10617 var buf []byte 10618 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10619 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10620 hdr.Len = x.SizeBytes() 10621 hdr.Cap = x.SizeBytes() 10622 10623 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10624 // Since we bypassed the compiler's escape analysis, indicate that x 10625 // must live until the use above. 10626 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10627 return length, err 10628 } 10629 10630 // CopyOut implements marshal.Marshallable.CopyOut. 10631 func (x *XTGetRevision) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10632 return x.CopyOutN(cc, addr, x.SizeBytes()) 10633 } 10634 10635 // CopyIn implements marshal.Marshallable.CopyIn. 10636 func (x *XTGetRevision) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10637 if !x.Name.Packed() { 10638 // Type XTGetRevision doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10639 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10640 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10641 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10642 // partially unmarshalled struct. 10643 x.UnmarshalBytes(buf) // escapes: fallback. 10644 return length, err 10645 } 10646 10647 // Construct a slice backed by dst's underlying memory. 10648 var buf []byte 10649 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10650 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10651 hdr.Len = x.SizeBytes() 10652 hdr.Cap = x.SizeBytes() 10653 10654 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10655 // Since we bypassed the compiler's escape analysis, indicate that x 10656 // must live until the use above. 10657 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10658 return length, err 10659 } 10660 10661 // WriteTo implements io.WriterTo.WriteTo. 10662 func (x *XTGetRevision) WriteTo(writer io.Writer) (int64, error) { 10663 if !x.Name.Packed() { 10664 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 10665 buf := make([]byte, x.SizeBytes()) 10666 x.MarshalBytes(buf) 10667 length, err := writer.Write(buf) 10668 return int64(length), err 10669 } 10670 10671 // Construct a slice backed by dst's underlying memory. 10672 var buf []byte 10673 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10674 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10675 hdr.Len = x.SizeBytes() 10676 hdr.Cap = x.SizeBytes() 10677 10678 length, err := writer.Write(buf) 10679 // Since we bypassed the compiler's escape analysis, indicate that x 10680 // must live until the use above. 10681 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10682 return int64(length), err 10683 } 10684 10685 // SizeBytes implements marshal.Marshallable.SizeBytes. 10686 func (x *XTRedirectTarget) SizeBytes() int { 10687 return 0 + 10688 (*XTEntryTarget)(nil).SizeBytes() + 10689 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 10690 1*4 10691 } 10692 10693 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10694 func (x *XTRedirectTarget) MarshalBytes(dst []byte) []byte { 10695 dst = x.Target.MarshalUnsafe(dst) 10696 dst = x.NfRange.MarshalUnsafe(dst) 10697 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 10698 dst = dst[1*(4):] 10699 return dst 10700 } 10701 10702 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10703 func (x *XTRedirectTarget) UnmarshalBytes(src []byte) []byte { 10704 src = x.Target.UnmarshalUnsafe(src) 10705 src = x.NfRange.UnmarshalUnsafe(src) 10706 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 10707 src = src[1*(4):] 10708 return src 10709 } 10710 10711 // Packed implements marshal.Marshallable.Packed. 10712 //go:nosplit 10713 func (x *XTRedirectTarget) Packed() bool { 10714 return x.NfRange.Packed() && x.Target.Packed() 10715 } 10716 10717 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10718 func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) []byte { 10719 if x.NfRange.Packed() && x.Target.Packed() { 10720 size := x.SizeBytes() 10721 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10722 return dst[size:] 10723 } 10724 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10725 return x.MarshalBytes(dst) 10726 } 10727 10728 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10729 func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) []byte { 10730 if x.NfRange.Packed() && x.Target.Packed() { 10731 size := x.SizeBytes() 10732 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10733 return src[size:] 10734 } 10735 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10736 return x.UnmarshalBytes(src) 10737 } 10738 10739 // CopyOutN implements marshal.Marshallable.CopyOutN. 10740 func (x *XTRedirectTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10741 if !x.NfRange.Packed() && x.Target.Packed() { 10742 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10743 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10744 x.MarshalBytes(buf) // escapes: fallback. 10745 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10746 } 10747 10748 // Construct a slice backed by dst's underlying memory. 10749 var buf []byte 10750 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10751 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10752 hdr.Len = x.SizeBytes() 10753 hdr.Cap = x.SizeBytes() 10754 10755 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10756 // Since we bypassed the compiler's escape analysis, indicate that x 10757 // must live until the use above. 10758 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10759 return length, err 10760 } 10761 10762 // CopyOut implements marshal.Marshallable.CopyOut. 10763 func (x *XTRedirectTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10764 return x.CopyOutN(cc, addr, x.SizeBytes()) 10765 } 10766 10767 // CopyIn implements marshal.Marshallable.CopyIn. 10768 func (x *XTRedirectTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10769 if !x.NfRange.Packed() && x.Target.Packed() { 10770 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10771 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10772 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10773 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10774 // partially unmarshalled struct. 10775 x.UnmarshalBytes(buf) // escapes: fallback. 10776 return length, err 10777 } 10778 10779 // Construct a slice backed by dst's underlying memory. 10780 var buf []byte 10781 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10782 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10783 hdr.Len = x.SizeBytes() 10784 hdr.Cap = x.SizeBytes() 10785 10786 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10787 // Since we bypassed the compiler's escape analysis, indicate that x 10788 // must live until the use above. 10789 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10790 return length, err 10791 } 10792 10793 // WriteTo implements io.WriterTo.WriteTo. 10794 func (x *XTRedirectTarget) WriteTo(writer io.Writer) (int64, error) { 10795 if !x.NfRange.Packed() && x.Target.Packed() { 10796 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10797 buf := make([]byte, x.SizeBytes()) 10798 x.MarshalBytes(buf) 10799 length, err := writer.Write(buf) 10800 return int64(length), err 10801 } 10802 10803 // Construct a slice backed by dst's underlying memory. 10804 var buf []byte 10805 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10806 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10807 hdr.Len = x.SizeBytes() 10808 hdr.Cap = x.SizeBytes() 10809 10810 length, err := writer.Write(buf) 10811 // Since we bypassed the compiler's escape analysis, indicate that x 10812 // must live until the use above. 10813 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10814 return int64(length), err 10815 } 10816 10817 // SizeBytes implements marshal.Marshallable.SizeBytes. 10818 func (x *XTSNATTarget) SizeBytes() int { 10819 return 0 + 10820 (*XTEntryTarget)(nil).SizeBytes() + 10821 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 10822 1*4 10823 } 10824 10825 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10826 func (x *XTSNATTarget) MarshalBytes(dst []byte) []byte { 10827 dst = x.Target.MarshalUnsafe(dst) 10828 dst = x.NfRange.MarshalUnsafe(dst) 10829 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 10830 dst = dst[1*(4):] 10831 return dst 10832 } 10833 10834 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10835 func (x *XTSNATTarget) UnmarshalBytes(src []byte) []byte { 10836 src = x.Target.UnmarshalUnsafe(src) 10837 src = x.NfRange.UnmarshalUnsafe(src) 10838 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 10839 src = src[1*(4):] 10840 return src 10841 } 10842 10843 // Packed implements marshal.Marshallable.Packed. 10844 //go:nosplit 10845 func (x *XTSNATTarget) Packed() bool { 10846 return x.NfRange.Packed() && x.Target.Packed() 10847 } 10848 10849 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10850 func (x *XTSNATTarget) MarshalUnsafe(dst []byte) []byte { 10851 if x.NfRange.Packed() && x.Target.Packed() { 10852 size := x.SizeBytes() 10853 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10854 return dst[size:] 10855 } 10856 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10857 return x.MarshalBytes(dst) 10858 } 10859 10860 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10861 func (x *XTSNATTarget) UnmarshalUnsafe(src []byte) []byte { 10862 if x.NfRange.Packed() && x.Target.Packed() { 10863 size := x.SizeBytes() 10864 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10865 return src[size:] 10866 } 10867 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10868 return x.UnmarshalBytes(src) 10869 } 10870 10871 // CopyOutN implements marshal.Marshallable.CopyOutN. 10872 func (x *XTSNATTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10873 if !x.NfRange.Packed() && x.Target.Packed() { 10874 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10875 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10876 x.MarshalBytes(buf) // escapes: fallback. 10877 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10878 } 10879 10880 // Construct a slice backed by dst's underlying memory. 10881 var buf []byte 10882 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10883 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10884 hdr.Len = x.SizeBytes() 10885 hdr.Cap = x.SizeBytes() 10886 10887 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10888 // Since we bypassed the compiler's escape analysis, indicate that x 10889 // must live until the use above. 10890 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10891 return length, err 10892 } 10893 10894 // CopyOut implements marshal.Marshallable.CopyOut. 10895 func (x *XTSNATTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10896 return x.CopyOutN(cc, addr, x.SizeBytes()) 10897 } 10898 10899 // CopyIn implements marshal.Marshallable.CopyIn. 10900 func (x *XTSNATTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10901 if !x.NfRange.Packed() && x.Target.Packed() { 10902 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10903 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10904 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10905 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10906 // partially unmarshalled struct. 10907 x.UnmarshalBytes(buf) // escapes: fallback. 10908 return length, err 10909 } 10910 10911 // Construct a slice backed by dst's underlying memory. 10912 var buf []byte 10913 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10914 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10915 hdr.Len = x.SizeBytes() 10916 hdr.Cap = x.SizeBytes() 10917 10918 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10919 // Since we bypassed the compiler's escape analysis, indicate that x 10920 // must live until the use above. 10921 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10922 return length, err 10923 } 10924 10925 // WriteTo implements io.WriterTo.WriteTo. 10926 func (x *XTSNATTarget) WriteTo(writer io.Writer) (int64, error) { 10927 if !x.NfRange.Packed() && x.Target.Packed() { 10928 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10929 buf := make([]byte, x.SizeBytes()) 10930 x.MarshalBytes(buf) 10931 length, err := writer.Write(buf) 10932 return int64(length), err 10933 } 10934 10935 // Construct a slice backed by dst's underlying memory. 10936 var buf []byte 10937 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10938 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10939 hdr.Len = x.SizeBytes() 10940 hdr.Cap = x.SizeBytes() 10941 10942 length, err := writer.Write(buf) 10943 // Since we bypassed the compiler's escape analysis, indicate that x 10944 // must live until the use above. 10945 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10946 return int64(length), err 10947 } 10948 10949 // SizeBytes implements marshal.Marshallable.SizeBytes. 10950 func (x *XTStandardTarget) SizeBytes() int { 10951 return 4 + 10952 (*XTEntryTarget)(nil).SizeBytes() + 10953 1*4 10954 } 10955 10956 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10957 func (x *XTStandardTarget) MarshalBytes(dst []byte) []byte { 10958 dst = x.Target.MarshalUnsafe(dst) 10959 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.Verdict)) 10960 dst = dst[4:] 10961 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 10962 dst = dst[1*(4):] 10963 return dst 10964 } 10965 10966 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10967 func (x *XTStandardTarget) UnmarshalBytes(src []byte) []byte { 10968 src = x.Target.UnmarshalUnsafe(src) 10969 x.Verdict = int32(hostarch.ByteOrder.Uint32(src[:4])) 10970 src = src[4:] 10971 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 10972 src = src[1*(4):] 10973 return src 10974 } 10975 10976 // Packed implements marshal.Marshallable.Packed. 10977 //go:nosplit 10978 func (x *XTStandardTarget) Packed() bool { 10979 return x.Target.Packed() 10980 } 10981 10982 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10983 func (x *XTStandardTarget) MarshalUnsafe(dst []byte) []byte { 10984 if x.Target.Packed() { 10985 size := x.SizeBytes() 10986 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10987 return dst[size:] 10988 } 10989 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10990 return x.MarshalBytes(dst) 10991 } 10992 10993 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10994 func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) []byte { 10995 if x.Target.Packed() { 10996 size := x.SizeBytes() 10997 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10998 return src[size:] 10999 } 11000 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11001 return x.UnmarshalBytes(src) 11002 } 11003 11004 // CopyOutN implements marshal.Marshallable.CopyOutN. 11005 func (x *XTStandardTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11006 if !x.Target.Packed() { 11007 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11008 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11009 x.MarshalBytes(buf) // escapes: fallback. 11010 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11011 } 11012 11013 // Construct a slice backed by dst's underlying memory. 11014 var buf []byte 11015 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11016 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11017 hdr.Len = x.SizeBytes() 11018 hdr.Cap = x.SizeBytes() 11019 11020 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11021 // Since we bypassed the compiler's escape analysis, indicate that x 11022 // must live until the use above. 11023 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11024 return length, err 11025 } 11026 11027 // CopyOut implements marshal.Marshallable.CopyOut. 11028 func (x *XTStandardTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11029 return x.CopyOutN(cc, addr, x.SizeBytes()) 11030 } 11031 11032 // CopyIn implements marshal.Marshallable.CopyIn. 11033 func (x *XTStandardTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11034 if !x.Target.Packed() { 11035 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11036 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11037 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11038 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11039 // partially unmarshalled struct. 11040 x.UnmarshalBytes(buf) // escapes: fallback. 11041 return length, err 11042 } 11043 11044 // Construct a slice backed by dst's underlying memory. 11045 var buf []byte 11046 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11047 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11048 hdr.Len = x.SizeBytes() 11049 hdr.Cap = x.SizeBytes() 11050 11051 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11052 // Since we bypassed the compiler's escape analysis, indicate that x 11053 // must live until the use above. 11054 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11055 return length, err 11056 } 11057 11058 // WriteTo implements io.WriterTo.WriteTo. 11059 func (x *XTStandardTarget) WriteTo(writer io.Writer) (int64, error) { 11060 if !x.Target.Packed() { 11061 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11062 buf := make([]byte, x.SizeBytes()) 11063 x.MarshalBytes(buf) 11064 length, err := writer.Write(buf) 11065 return int64(length), err 11066 } 11067 11068 // Construct a slice backed by dst's underlying memory. 11069 var buf []byte 11070 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11071 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11072 hdr.Len = x.SizeBytes() 11073 hdr.Cap = x.SizeBytes() 11074 11075 length, err := writer.Write(buf) 11076 // Since we bypassed the compiler's escape analysis, indicate that x 11077 // must live until the use above. 11078 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11079 return int64(length), err 11080 } 11081 11082 // SizeBytes implements marshal.Marshallable.SizeBytes. 11083 func (x *XTTCP) SizeBytes() int { 11084 return 12 11085 } 11086 11087 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11088 func (x *XTTCP) MarshalBytes(dst []byte) []byte { 11089 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 11090 dst = dst[2:] 11091 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 11092 dst = dst[2:] 11093 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 11094 dst = dst[2:] 11095 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 11096 dst = dst[2:] 11097 dst[0] = byte(x.Option) 11098 dst = dst[1:] 11099 dst[0] = byte(x.FlagMask) 11100 dst = dst[1:] 11101 dst[0] = byte(x.FlagCompare) 11102 dst = dst[1:] 11103 dst[0] = byte(x.InverseFlags) 11104 dst = dst[1:] 11105 return dst 11106 } 11107 11108 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11109 func (x *XTTCP) UnmarshalBytes(src []byte) []byte { 11110 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11111 src = src[2:] 11112 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11113 src = src[2:] 11114 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11115 src = src[2:] 11116 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11117 src = src[2:] 11118 x.Option = uint8(src[0]) 11119 src = src[1:] 11120 x.FlagMask = uint8(src[0]) 11121 src = src[1:] 11122 x.FlagCompare = uint8(src[0]) 11123 src = src[1:] 11124 x.InverseFlags = uint8(src[0]) 11125 src = src[1:] 11126 return src 11127 } 11128 11129 // Packed implements marshal.Marshallable.Packed. 11130 //go:nosplit 11131 func (x *XTTCP) Packed() bool { 11132 return true 11133 } 11134 11135 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11136 func (x *XTTCP) MarshalUnsafe(dst []byte) []byte { 11137 size := x.SizeBytes() 11138 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11139 return dst[size:] 11140 } 11141 11142 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11143 func (x *XTTCP) UnmarshalUnsafe(src []byte) []byte { 11144 size := x.SizeBytes() 11145 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11146 return src[size:] 11147 } 11148 11149 // CopyOutN implements marshal.Marshallable.CopyOutN. 11150 func (x *XTTCP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11151 // Construct a slice backed by dst's underlying memory. 11152 var buf []byte 11153 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11154 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11155 hdr.Len = x.SizeBytes() 11156 hdr.Cap = x.SizeBytes() 11157 11158 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11159 // Since we bypassed the compiler's escape analysis, indicate that x 11160 // must live until the use above. 11161 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11162 return length, err 11163 } 11164 11165 // CopyOut implements marshal.Marshallable.CopyOut. 11166 func (x *XTTCP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11167 return x.CopyOutN(cc, addr, x.SizeBytes()) 11168 } 11169 11170 // CopyIn implements marshal.Marshallable.CopyIn. 11171 func (x *XTTCP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11172 // Construct a slice backed by dst's underlying memory. 11173 var buf []byte 11174 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11175 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11176 hdr.Len = x.SizeBytes() 11177 hdr.Cap = x.SizeBytes() 11178 11179 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11180 // Since we bypassed the compiler's escape analysis, indicate that x 11181 // must live until the use above. 11182 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11183 return length, err 11184 } 11185 11186 // WriteTo implements io.WriterTo.WriteTo. 11187 func (x *XTTCP) WriteTo(writer io.Writer) (int64, error) { 11188 // Construct a slice backed by dst's underlying memory. 11189 var buf []byte 11190 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11191 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11192 hdr.Len = x.SizeBytes() 11193 hdr.Cap = x.SizeBytes() 11194 11195 length, err := writer.Write(buf) 11196 // Since we bypassed the compiler's escape analysis, indicate that x 11197 // must live until the use above. 11198 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11199 return int64(length), err 11200 } 11201 11202 // SizeBytes implements marshal.Marshallable.SizeBytes. 11203 func (x *XTUDP) SizeBytes() int { 11204 return 10 11205 } 11206 11207 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11208 func (x *XTUDP) MarshalBytes(dst []byte) []byte { 11209 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 11210 dst = dst[2:] 11211 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 11212 dst = dst[2:] 11213 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 11214 dst = dst[2:] 11215 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 11216 dst = dst[2:] 11217 dst[0] = byte(x.InverseFlags) 11218 dst = dst[1:] 11219 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 11220 dst = dst[1:] 11221 return dst 11222 } 11223 11224 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11225 func (x *XTUDP) UnmarshalBytes(src []byte) []byte { 11226 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11227 src = src[2:] 11228 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11229 src = src[2:] 11230 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11231 src = src[2:] 11232 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11233 src = src[2:] 11234 x.InverseFlags = uint8(src[0]) 11235 src = src[1:] 11236 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 11237 src = src[1:] 11238 return src 11239 } 11240 11241 // Packed implements marshal.Marshallable.Packed. 11242 //go:nosplit 11243 func (x *XTUDP) Packed() bool { 11244 return true 11245 } 11246 11247 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11248 func (x *XTUDP) MarshalUnsafe(dst []byte) []byte { 11249 size := x.SizeBytes() 11250 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11251 return dst[size:] 11252 } 11253 11254 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11255 func (x *XTUDP) UnmarshalUnsafe(src []byte) []byte { 11256 size := x.SizeBytes() 11257 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11258 return src[size:] 11259 } 11260 11261 // CopyOutN implements marshal.Marshallable.CopyOutN. 11262 func (x *XTUDP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11263 // Construct a slice backed by dst's underlying memory. 11264 var buf []byte 11265 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11266 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11267 hdr.Len = x.SizeBytes() 11268 hdr.Cap = x.SizeBytes() 11269 11270 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11271 // Since we bypassed the compiler's escape analysis, indicate that x 11272 // must live until the use above. 11273 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11274 return length, err 11275 } 11276 11277 // CopyOut implements marshal.Marshallable.CopyOut. 11278 func (x *XTUDP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11279 return x.CopyOutN(cc, addr, x.SizeBytes()) 11280 } 11281 11282 // CopyIn implements marshal.Marshallable.CopyIn. 11283 func (x *XTUDP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11284 // Construct a slice backed by dst's underlying memory. 11285 var buf []byte 11286 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11287 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11288 hdr.Len = x.SizeBytes() 11289 hdr.Cap = x.SizeBytes() 11290 11291 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11292 // Since we bypassed the compiler's escape analysis, indicate that x 11293 // must live until the use above. 11294 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11295 return length, err 11296 } 11297 11298 // WriteTo implements io.WriterTo.WriteTo. 11299 func (x *XTUDP) WriteTo(writer io.Writer) (int64, error) { 11300 // Construct a slice backed by dst's underlying memory. 11301 var buf []byte 11302 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11303 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11304 hdr.Len = x.SizeBytes() 11305 hdr.Cap = x.SizeBytes() 11306 11307 length, err := writer.Write(buf) 11308 // Since we bypassed the compiler's escape analysis, indicate that x 11309 // must live until the use above. 11310 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11311 return int64(length), err 11312 } 11313 11314 // SizeBytes implements marshal.Marshallable.SizeBytes. 11315 func (i *IP6TEntry) SizeBytes() int { 11316 return 12 + 11317 (*IP6TIP)(nil).SizeBytes() + 11318 1*4 + 11319 (*XTCounters)(nil).SizeBytes() 11320 } 11321 11322 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11323 func (i *IP6TEntry) MarshalBytes(dst []byte) []byte { 11324 dst = i.IPv6.MarshalUnsafe(dst) 11325 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 11326 dst = dst[4:] 11327 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 11328 dst = dst[2:] 11329 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 11330 dst = dst[2:] 11331 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 11332 dst = dst[4:] 11333 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11334 dst = dst[1*(4):] 11335 dst = i.Counters.MarshalUnsafe(dst) 11336 return dst 11337 } 11338 11339 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11340 func (i *IP6TEntry) UnmarshalBytes(src []byte) []byte { 11341 src = i.IPv6.UnmarshalUnsafe(src) 11342 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11343 src = src[4:] 11344 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11345 src = src[2:] 11346 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11347 src = src[2:] 11348 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11349 src = src[4:] 11350 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 11351 src = src[1*(4):] 11352 src = i.Counters.UnmarshalUnsafe(src) 11353 return src 11354 } 11355 11356 // Packed implements marshal.Marshallable.Packed. 11357 //go:nosplit 11358 func (i *IP6TEntry) Packed() bool { 11359 return i.Counters.Packed() && i.IPv6.Packed() 11360 } 11361 11362 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11363 func (i *IP6TEntry) MarshalUnsafe(dst []byte) []byte { 11364 if i.Counters.Packed() && i.IPv6.Packed() { 11365 size := i.SizeBytes() 11366 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 11367 return dst[size:] 11368 } 11369 // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 11370 return i.MarshalBytes(dst) 11371 } 11372 11373 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11374 func (i *IP6TEntry) UnmarshalUnsafe(src []byte) []byte { 11375 if i.Counters.Packed() && i.IPv6.Packed() { 11376 size := i.SizeBytes() 11377 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 11378 return src[size:] 11379 } 11380 // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11381 return i.UnmarshalBytes(src) 11382 } 11383 11384 // CopyOutN implements marshal.Marshallable.CopyOutN. 11385 func (i *IP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11386 if !i.Counters.Packed() && i.IPv6.Packed() { 11387 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11388 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11389 i.MarshalBytes(buf) // escapes: fallback. 11390 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11391 } 11392 11393 // Construct a slice backed by dst's underlying memory. 11394 var buf []byte 11395 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11396 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11397 hdr.Len = i.SizeBytes() 11398 hdr.Cap = i.SizeBytes() 11399 11400 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11401 // Since we bypassed the compiler's escape analysis, indicate that i 11402 // must live until the use above. 11403 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11404 return length, err 11405 } 11406 11407 // CopyOut implements marshal.Marshallable.CopyOut. 11408 func (i *IP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11409 return i.CopyOutN(cc, addr, i.SizeBytes()) 11410 } 11411 11412 // CopyIn implements marshal.Marshallable.CopyIn. 11413 func (i *IP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11414 if !i.Counters.Packed() && i.IPv6.Packed() { 11415 // Type IP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11416 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11417 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11418 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11419 // partially unmarshalled struct. 11420 i.UnmarshalBytes(buf) // escapes: fallback. 11421 return length, err 11422 } 11423 11424 // Construct a slice backed by dst's underlying memory. 11425 var buf []byte 11426 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11427 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11428 hdr.Len = i.SizeBytes() 11429 hdr.Cap = i.SizeBytes() 11430 11431 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11432 // Since we bypassed the compiler's escape analysis, indicate that i 11433 // must live until the use above. 11434 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11435 return length, err 11436 } 11437 11438 // WriteTo implements io.WriterTo.WriteTo. 11439 func (i *IP6TEntry) WriteTo(writer io.Writer) (int64, error) { 11440 if !i.Counters.Packed() && i.IPv6.Packed() { 11441 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11442 buf := make([]byte, i.SizeBytes()) 11443 i.MarshalBytes(buf) 11444 length, err := writer.Write(buf) 11445 return int64(length), err 11446 } 11447 11448 // Construct a slice backed by dst's underlying memory. 11449 var buf []byte 11450 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11451 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11452 hdr.Len = i.SizeBytes() 11453 hdr.Cap = i.SizeBytes() 11454 11455 length, err := writer.Write(buf) 11456 // Since we bypassed the compiler's escape analysis, indicate that i 11457 // must live until the use above. 11458 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11459 return int64(length), err 11460 } 11461 11462 // SizeBytes implements marshal.Marshallable.SizeBytes. 11463 func (i *IP6TIP) SizeBytes() int { 11464 return 5 + 11465 (*Inet6Addr)(nil).SizeBytes() + 11466 (*Inet6Addr)(nil).SizeBytes() + 11467 (*Inet6Addr)(nil).SizeBytes() + 11468 (*Inet6Addr)(nil).SizeBytes() + 11469 1*IFNAMSIZ + 11470 1*IFNAMSIZ + 11471 1*IFNAMSIZ + 11472 1*IFNAMSIZ + 11473 1*3 11474 } 11475 11476 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11477 func (i *IP6TIP) MarshalBytes(dst []byte) []byte { 11478 dst = i.Src.MarshalUnsafe(dst) 11479 dst = i.Dst.MarshalUnsafe(dst) 11480 dst = i.SrcMask.MarshalUnsafe(dst) 11481 dst = i.DstMask.MarshalUnsafe(dst) 11482 for idx := 0; idx < IFNAMSIZ; idx++ { 11483 dst[0] = byte(i.InputInterface[idx]) 11484 dst = dst[1:] 11485 } 11486 for idx := 0; idx < IFNAMSIZ; idx++ { 11487 dst[0] = byte(i.OutputInterface[idx]) 11488 dst = dst[1:] 11489 } 11490 for idx := 0; idx < IFNAMSIZ; idx++ { 11491 dst[0] = byte(i.InputInterfaceMask[idx]) 11492 dst = dst[1:] 11493 } 11494 for idx := 0; idx < IFNAMSIZ; idx++ { 11495 dst[0] = byte(i.OutputInterfaceMask[idx]) 11496 dst = dst[1:] 11497 } 11498 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 11499 dst = dst[2:] 11500 dst[0] = byte(i.TOS) 11501 dst = dst[1:] 11502 dst[0] = byte(i.Flags) 11503 dst = dst[1:] 11504 dst[0] = byte(i.InverseFlags) 11505 dst = dst[1:] 11506 // Padding: dst[:sizeof(byte)*3] ~= [3]byte{0} 11507 dst = dst[1*(3):] 11508 return dst 11509 } 11510 11511 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11512 func (i *IP6TIP) UnmarshalBytes(src []byte) []byte { 11513 src = i.Src.UnmarshalUnsafe(src) 11514 src = i.Dst.UnmarshalUnsafe(src) 11515 src = i.SrcMask.UnmarshalUnsafe(src) 11516 src = i.DstMask.UnmarshalUnsafe(src) 11517 for idx := 0; idx < IFNAMSIZ; idx++ { 11518 i.InputInterface[idx] = src[0] 11519 src = src[1:] 11520 } 11521 for idx := 0; idx < IFNAMSIZ; idx++ { 11522 i.OutputInterface[idx] = src[0] 11523 src = src[1:] 11524 } 11525 for idx := 0; idx < IFNAMSIZ; idx++ { 11526 i.InputInterfaceMask[idx] = src[0] 11527 src = src[1:] 11528 } 11529 for idx := 0; idx < IFNAMSIZ; idx++ { 11530 i.OutputInterfaceMask[idx] = src[0] 11531 src = src[1:] 11532 } 11533 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11534 src = src[2:] 11535 i.TOS = uint8(src[0]) 11536 src = src[1:] 11537 i.Flags = uint8(src[0]) 11538 src = src[1:] 11539 i.InverseFlags = uint8(src[0]) 11540 src = src[1:] 11541 // Padding: ~ copy([3]byte(i._), src[:sizeof(byte)*3]) 11542 src = src[1*(3):] 11543 return src 11544 } 11545 11546 // Packed implements marshal.Marshallable.Packed. 11547 //go:nosplit 11548 func (i *IP6TIP) Packed() bool { 11549 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 11550 } 11551 11552 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11553 func (i *IP6TIP) MarshalUnsafe(dst []byte) []byte { 11554 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11555 size := i.SizeBytes() 11556 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 11557 return dst[size:] 11558 } 11559 // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes. 11560 return i.MarshalBytes(dst) 11561 } 11562 11563 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11564 func (i *IP6TIP) UnmarshalUnsafe(src []byte) []byte { 11565 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11566 size := i.SizeBytes() 11567 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 11568 return src[size:] 11569 } 11570 // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11571 return i.UnmarshalBytes(src) 11572 } 11573 11574 // CopyOutN implements marshal.Marshallable.CopyOutN. 11575 func (i *IP6TIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11576 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11577 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 11578 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11579 i.MarshalBytes(buf) // escapes: fallback. 11580 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11581 } 11582 11583 // Construct a slice backed by dst's underlying memory. 11584 var buf []byte 11585 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11586 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11587 hdr.Len = i.SizeBytes() 11588 hdr.Cap = i.SizeBytes() 11589 11590 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11591 // Since we bypassed the compiler's escape analysis, indicate that i 11592 // must live until the use above. 11593 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11594 return length, err 11595 } 11596 11597 // CopyOut implements marshal.Marshallable.CopyOut. 11598 func (i *IP6TIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11599 return i.CopyOutN(cc, addr, i.SizeBytes()) 11600 } 11601 11602 // CopyIn implements marshal.Marshallable.CopyIn. 11603 func (i *IP6TIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11604 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11605 // Type IP6TIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11606 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11607 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11608 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11609 // partially unmarshalled struct. 11610 i.UnmarshalBytes(buf) // escapes: fallback. 11611 return length, err 11612 } 11613 11614 // Construct a slice backed by dst's underlying memory. 11615 var buf []byte 11616 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11617 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11618 hdr.Len = i.SizeBytes() 11619 hdr.Cap = i.SizeBytes() 11620 11621 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11622 // Since we bypassed the compiler's escape analysis, indicate that i 11623 // must live until the use above. 11624 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11625 return length, err 11626 } 11627 11628 // WriteTo implements io.WriterTo.WriteTo. 11629 func (i *IP6TIP) WriteTo(writer io.Writer) (int64, error) { 11630 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11631 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 11632 buf := make([]byte, i.SizeBytes()) 11633 i.MarshalBytes(buf) 11634 length, err := writer.Write(buf) 11635 return int64(length), err 11636 } 11637 11638 // Construct a slice backed by dst's underlying memory. 11639 var buf []byte 11640 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11641 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11642 hdr.Len = i.SizeBytes() 11643 hdr.Cap = i.SizeBytes() 11644 11645 length, err := writer.Write(buf) 11646 // Since we bypassed the compiler's escape analysis, indicate that i 11647 // must live until the use above. 11648 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11649 return int64(length), err 11650 } 11651 11652 // SizeBytes implements marshal.Marshallable.SizeBytes. 11653 func (i *IP6TReplace) SizeBytes() int { 11654 return 24 + 11655 (*TableName)(nil).SizeBytes() + 11656 4*NF_INET_NUMHOOKS + 11657 4*NF_INET_NUMHOOKS 11658 } 11659 11660 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11661 func (i *IP6TReplace) MarshalBytes(dst []byte) []byte { 11662 dst = i.Name.MarshalUnsafe(dst) 11663 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 11664 dst = dst[4:] 11665 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 11666 dst = dst[4:] 11667 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 11668 dst = dst[4:] 11669 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11670 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 11671 dst = dst[4:] 11672 } 11673 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11674 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 11675 dst = dst[4:] 11676 } 11677 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 11678 dst = dst[4:] 11679 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 11680 dst = dst[8:] 11681 return dst 11682 } 11683 11684 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11685 func (i *IP6TReplace) UnmarshalBytes(src []byte) []byte { 11686 src = i.Name.UnmarshalUnsafe(src) 11687 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11688 src = src[4:] 11689 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11690 src = src[4:] 11691 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11692 src = src[4:] 11693 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11694 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11695 src = src[4:] 11696 } 11697 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11698 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11699 src = src[4:] 11700 } 11701 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11702 src = src[4:] 11703 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11704 src = src[8:] 11705 return src 11706 } 11707 11708 // Packed implements marshal.Marshallable.Packed. 11709 //go:nosplit 11710 func (i *IP6TReplace) Packed() bool { 11711 return i.Name.Packed() 11712 } 11713 11714 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11715 func (i *IP6TReplace) MarshalUnsafe(dst []byte) []byte { 11716 if i.Name.Packed() { 11717 size := i.SizeBytes() 11718 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 11719 return dst[size:] 11720 } 11721 // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 11722 return i.MarshalBytes(dst) 11723 } 11724 11725 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11726 func (i *IP6TReplace) UnmarshalUnsafe(src []byte) []byte { 11727 if i.Name.Packed() { 11728 size := i.SizeBytes() 11729 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 11730 return src[size:] 11731 } 11732 // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11733 return i.UnmarshalBytes(src) 11734 } 11735 11736 // CopyOutN implements marshal.Marshallable.CopyOutN. 11737 func (i *IP6TReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11738 if !i.Name.Packed() { 11739 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 11740 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11741 i.MarshalBytes(buf) // escapes: fallback. 11742 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11743 } 11744 11745 // Construct a slice backed by dst's underlying memory. 11746 var buf []byte 11747 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11748 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11749 hdr.Len = i.SizeBytes() 11750 hdr.Cap = i.SizeBytes() 11751 11752 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11753 // Since we bypassed the compiler's escape analysis, indicate that i 11754 // must live until the use above. 11755 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11756 return length, err 11757 } 11758 11759 // CopyOut implements marshal.Marshallable.CopyOut. 11760 func (i *IP6TReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11761 return i.CopyOutN(cc, addr, i.SizeBytes()) 11762 } 11763 11764 // CopyIn implements marshal.Marshallable.CopyIn. 11765 func (i *IP6TReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11766 if !i.Name.Packed() { 11767 // Type IP6TReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11768 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11769 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11770 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11771 // partially unmarshalled struct. 11772 i.UnmarshalBytes(buf) // escapes: fallback. 11773 return length, err 11774 } 11775 11776 // Construct a slice backed by dst's underlying memory. 11777 var buf []byte 11778 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11779 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11780 hdr.Len = i.SizeBytes() 11781 hdr.Cap = i.SizeBytes() 11782 11783 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11784 // Since we bypassed the compiler's escape analysis, indicate that i 11785 // must live until the use above. 11786 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11787 return length, err 11788 } 11789 11790 // WriteTo implements io.WriterTo.WriteTo. 11791 func (i *IP6TReplace) WriteTo(writer io.Writer) (int64, error) { 11792 if !i.Name.Packed() { 11793 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 11794 buf := make([]byte, i.SizeBytes()) 11795 i.MarshalBytes(buf) 11796 length, err := writer.Write(buf) 11797 return int64(length), err 11798 } 11799 11800 // Construct a slice backed by dst's underlying memory. 11801 var buf []byte 11802 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11803 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11804 hdr.Len = i.SizeBytes() 11805 hdr.Cap = i.SizeBytes() 11806 11807 length, err := writer.Write(buf) 11808 // Since we bypassed the compiler's escape analysis, indicate that i 11809 // must live until the use above. 11810 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11811 return int64(length), err 11812 } 11813 11814 // Packed implements marshal.Marshallable.Packed. 11815 //go:nosplit 11816 func (ke *KernelIP6TEntry) Packed() bool { 11817 // Type KernelIP6TEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 11818 return false 11819 } 11820 11821 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11822 func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) []byte { 11823 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 11824 return ke.MarshalBytes(dst) 11825 } 11826 11827 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11828 func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) []byte { 11829 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11830 return ke.UnmarshalBytes(src) 11831 } 11832 11833 // CopyOutN implements marshal.Marshallable.CopyOutN. 11834 //go:nosplit 11835 func (ke *KernelIP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11836 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11837 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 11838 ke.MarshalBytes(buf) // escapes: fallback. 11839 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11840 } 11841 11842 // CopyOut implements marshal.Marshallable.CopyOut. 11843 func (ke *KernelIP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11844 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 11845 } 11846 11847 // CopyIn implements marshal.Marshallable.CopyIn. 11848 func (ke *KernelIP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11849 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11850 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 11851 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11852 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11853 // partially unmarshalled struct. 11854 ke.UnmarshalBytes(buf) // escapes: fallback. 11855 return length, err 11856 } 11857 11858 // WriteTo implements io.WriterTo.WriteTo. 11859 func (ke *KernelIP6TEntry) WriteTo(writer io.Writer) (int64, error) { 11860 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11861 buf := make([]byte, ke.SizeBytes()) 11862 ke.MarshalBytes(buf) 11863 length, err := writer.Write(buf) 11864 return int64(length), err 11865 } 11866 11867 // Packed implements marshal.Marshallable.Packed. 11868 //go:nosplit 11869 func (ke *KernelIP6TGetEntries) Packed() bool { 11870 // Type KernelIP6TGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 11871 return false 11872 } 11873 11874 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11875 func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) []byte { 11876 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 11877 return ke.MarshalBytes(dst) 11878 } 11879 11880 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11881 func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) []byte { 11882 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11883 return ke.UnmarshalBytes(src) 11884 } 11885 11886 // CopyOutN implements marshal.Marshallable.CopyOutN. 11887 //go:nosplit 11888 func (ke *KernelIP6TGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11889 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 11890 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 11891 ke.MarshalBytes(buf) // escapes: fallback. 11892 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11893 } 11894 11895 // CopyOut implements marshal.Marshallable.CopyOut. 11896 func (ke *KernelIP6TGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11897 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 11898 } 11899 11900 // CopyIn implements marshal.Marshallable.CopyIn. 11901 func (ke *KernelIP6TGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11902 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11903 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 11904 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11905 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11906 // partially unmarshalled struct. 11907 ke.UnmarshalBytes(buf) // escapes: fallback. 11908 return length, err 11909 } 11910 11911 // WriteTo implements io.WriterTo.WriteTo. 11912 func (ke *KernelIP6TGetEntries) WriteTo(writer io.Writer) (int64, error) { 11913 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 11914 buf := make([]byte, ke.SizeBytes()) 11915 ke.MarshalBytes(buf) 11916 length, err := writer.Write(buf) 11917 return int64(length), err 11918 } 11919 11920 // SizeBytes implements marshal.Marshallable.SizeBytes. 11921 func (n *NFNATRange) SizeBytes() int { 11922 return 8 + 11923 (*Inet6Addr)(nil).SizeBytes() + 11924 (*Inet6Addr)(nil).SizeBytes() 11925 } 11926 11927 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11928 func (n *NFNATRange) MarshalBytes(dst []byte) []byte { 11929 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 11930 dst = dst[4:] 11931 dst = n.MinAddr.MarshalUnsafe(dst) 11932 dst = n.MaxAddr.MarshalUnsafe(dst) 11933 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto)) 11934 dst = dst[2:] 11935 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto)) 11936 dst = dst[2:] 11937 return dst 11938 } 11939 11940 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11941 func (n *NFNATRange) UnmarshalBytes(src []byte) []byte { 11942 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11943 src = src[4:] 11944 src = n.MinAddr.UnmarshalUnsafe(src) 11945 src = n.MaxAddr.UnmarshalUnsafe(src) 11946 n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11947 src = src[2:] 11948 n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11949 src = src[2:] 11950 return src 11951 } 11952 11953 // Packed implements marshal.Marshallable.Packed. 11954 //go:nosplit 11955 func (n *NFNATRange) Packed() bool { 11956 return n.MaxAddr.Packed() && n.MinAddr.Packed() 11957 } 11958 11959 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11960 func (n *NFNATRange) MarshalUnsafe(dst []byte) []byte { 11961 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 11962 size := n.SizeBytes() 11963 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 11964 return dst[size:] 11965 } 11966 // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes. 11967 return n.MarshalBytes(dst) 11968 } 11969 11970 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11971 func (n *NFNATRange) UnmarshalUnsafe(src []byte) []byte { 11972 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 11973 size := n.SizeBytes() 11974 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 11975 return src[size:] 11976 } 11977 // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11978 return n.UnmarshalBytes(src) 11979 } 11980 11981 // CopyOutN implements marshal.Marshallable.CopyOutN. 11982 func (n *NFNATRange) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11983 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 11984 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 11985 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 11986 n.MarshalBytes(buf) // escapes: fallback. 11987 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11988 } 11989 11990 // Construct a slice backed by dst's underlying memory. 11991 var buf []byte 11992 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11993 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 11994 hdr.Len = n.SizeBytes() 11995 hdr.Cap = n.SizeBytes() 11996 11997 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11998 // Since we bypassed the compiler's escape analysis, indicate that n 11999 // must live until the use above. 12000 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12001 return length, err 12002 } 12003 12004 // CopyOut implements marshal.Marshallable.CopyOut. 12005 func (n *NFNATRange) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12006 return n.CopyOutN(cc, addr, n.SizeBytes()) 12007 } 12008 12009 // CopyIn implements marshal.Marshallable.CopyIn. 12010 func (n *NFNATRange) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12011 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12012 // Type NFNATRange doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12013 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12014 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12015 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12016 // partially unmarshalled struct. 12017 n.UnmarshalBytes(buf) // escapes: fallback. 12018 return length, err 12019 } 12020 12021 // Construct a slice backed by dst's underlying memory. 12022 var buf []byte 12023 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12024 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12025 hdr.Len = n.SizeBytes() 12026 hdr.Cap = n.SizeBytes() 12027 12028 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12029 // Since we bypassed the compiler's escape analysis, indicate that n 12030 // must live until the use above. 12031 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12032 return length, err 12033 } 12034 12035 // WriteTo implements io.WriterTo.WriteTo. 12036 func (n *NFNATRange) WriteTo(writer io.Writer) (int64, error) { 12037 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12038 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 12039 buf := make([]byte, n.SizeBytes()) 12040 n.MarshalBytes(buf) 12041 length, err := writer.Write(buf) 12042 return int64(length), err 12043 } 12044 12045 // Construct a slice backed by dst's underlying memory. 12046 var buf []byte 12047 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12048 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12049 hdr.Len = n.SizeBytes() 12050 hdr.Cap = n.SizeBytes() 12051 12052 length, err := writer.Write(buf) 12053 // Since we bypassed the compiler's escape analysis, indicate that n 12054 // must live until the use above. 12055 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12056 return int64(length), err 12057 } 12058 12059 // SizeBytes implements marshal.Marshallable.SizeBytes. 12060 func (n *NetlinkAttrHeader) SizeBytes() int { 12061 return 4 12062 } 12063 12064 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12065 func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) []byte { 12066 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Length)) 12067 dst = dst[2:] 12068 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 12069 dst = dst[2:] 12070 return dst 12071 } 12072 12073 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12074 func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) []byte { 12075 n.Length = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12076 src = src[2:] 12077 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12078 src = src[2:] 12079 return src 12080 } 12081 12082 // Packed implements marshal.Marshallable.Packed. 12083 //go:nosplit 12084 func (n *NetlinkAttrHeader) Packed() bool { 12085 return true 12086 } 12087 12088 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12089 func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) []byte { 12090 size := n.SizeBytes() 12091 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12092 return dst[size:] 12093 } 12094 12095 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12096 func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) []byte { 12097 size := n.SizeBytes() 12098 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12099 return src[size:] 12100 } 12101 12102 // CopyOutN implements marshal.Marshallable.CopyOutN. 12103 func (n *NetlinkAttrHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12104 // Construct a slice backed by dst's underlying memory. 12105 var buf []byte 12106 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12107 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12108 hdr.Len = n.SizeBytes() 12109 hdr.Cap = n.SizeBytes() 12110 12111 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12112 // Since we bypassed the compiler's escape analysis, indicate that n 12113 // must live until the use above. 12114 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12115 return length, err 12116 } 12117 12118 // CopyOut implements marshal.Marshallable.CopyOut. 12119 func (n *NetlinkAttrHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12120 return n.CopyOutN(cc, addr, n.SizeBytes()) 12121 } 12122 12123 // CopyIn implements marshal.Marshallable.CopyIn. 12124 func (n *NetlinkAttrHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12125 // Construct a slice backed by dst's underlying memory. 12126 var buf []byte 12127 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12128 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12129 hdr.Len = n.SizeBytes() 12130 hdr.Cap = n.SizeBytes() 12131 12132 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12133 // Since we bypassed the compiler's escape analysis, indicate that n 12134 // must live until the use above. 12135 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12136 return length, err 12137 } 12138 12139 // WriteTo implements io.WriterTo.WriteTo. 12140 func (n *NetlinkAttrHeader) WriteTo(writer io.Writer) (int64, error) { 12141 // Construct a slice backed by dst's underlying memory. 12142 var buf []byte 12143 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12144 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12145 hdr.Len = n.SizeBytes() 12146 hdr.Cap = n.SizeBytes() 12147 12148 length, err := writer.Write(buf) 12149 // Since we bypassed the compiler's escape analysis, indicate that n 12150 // must live until the use above. 12151 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12152 return int64(length), err 12153 } 12154 12155 // SizeBytes implements marshal.Marshallable.SizeBytes. 12156 func (n *NetlinkErrorMessage) SizeBytes() int { 12157 return 4 + 12158 (*NetlinkMessageHeader)(nil).SizeBytes() 12159 } 12160 12161 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12162 func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) []byte { 12163 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Error)) 12164 dst = dst[4:] 12165 dst = n.Header.MarshalUnsafe(dst) 12166 return dst 12167 } 12168 12169 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12170 func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) []byte { 12171 n.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 12172 src = src[4:] 12173 src = n.Header.UnmarshalUnsafe(src) 12174 return src 12175 } 12176 12177 // Packed implements marshal.Marshallable.Packed. 12178 //go:nosplit 12179 func (n *NetlinkErrorMessage) Packed() bool { 12180 return n.Header.Packed() 12181 } 12182 12183 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12184 func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) []byte { 12185 if n.Header.Packed() { 12186 size := n.SizeBytes() 12187 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12188 return dst[size:] 12189 } 12190 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes. 12191 return n.MarshalBytes(dst) 12192 } 12193 12194 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12195 func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) []byte { 12196 if n.Header.Packed() { 12197 size := n.SizeBytes() 12198 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12199 return src[size:] 12200 } 12201 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12202 return n.UnmarshalBytes(src) 12203 } 12204 12205 // CopyOutN implements marshal.Marshallable.CopyOutN. 12206 func (n *NetlinkErrorMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12207 if !n.Header.Packed() { 12208 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 12209 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12210 n.MarshalBytes(buf) // escapes: fallback. 12211 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12212 } 12213 12214 // Construct a slice backed by dst's underlying memory. 12215 var buf []byte 12216 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12217 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12218 hdr.Len = n.SizeBytes() 12219 hdr.Cap = n.SizeBytes() 12220 12221 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12222 // Since we bypassed the compiler's escape analysis, indicate that n 12223 // must live until the use above. 12224 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12225 return length, err 12226 } 12227 12228 // CopyOut implements marshal.Marshallable.CopyOut. 12229 func (n *NetlinkErrorMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12230 return n.CopyOutN(cc, addr, n.SizeBytes()) 12231 } 12232 12233 // CopyIn implements marshal.Marshallable.CopyIn. 12234 func (n *NetlinkErrorMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12235 if !n.Header.Packed() { 12236 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12237 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12238 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12239 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12240 // partially unmarshalled struct. 12241 n.UnmarshalBytes(buf) // escapes: fallback. 12242 return length, err 12243 } 12244 12245 // Construct a slice backed by dst's underlying memory. 12246 var buf []byte 12247 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12248 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12249 hdr.Len = n.SizeBytes() 12250 hdr.Cap = n.SizeBytes() 12251 12252 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12253 // Since we bypassed the compiler's escape analysis, indicate that n 12254 // must live until the use above. 12255 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12256 return length, err 12257 } 12258 12259 // WriteTo implements io.WriterTo.WriteTo. 12260 func (n *NetlinkErrorMessage) WriteTo(writer io.Writer) (int64, error) { 12261 if !n.Header.Packed() { 12262 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 12263 buf := make([]byte, n.SizeBytes()) 12264 n.MarshalBytes(buf) 12265 length, err := writer.Write(buf) 12266 return int64(length), err 12267 } 12268 12269 // Construct a slice backed by dst's underlying memory. 12270 var buf []byte 12271 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12272 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12273 hdr.Len = n.SizeBytes() 12274 hdr.Cap = n.SizeBytes() 12275 12276 length, err := writer.Write(buf) 12277 // Since we bypassed the compiler's escape analysis, indicate that n 12278 // must live until the use above. 12279 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12280 return int64(length), err 12281 } 12282 12283 // SizeBytes implements marshal.Marshallable.SizeBytes. 12284 func (n *NetlinkMessageHeader) SizeBytes() int { 12285 return 16 12286 } 12287 12288 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12289 func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) []byte { 12290 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Length)) 12291 dst = dst[4:] 12292 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 12293 dst = dst[2:] 12294 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Flags)) 12295 dst = dst[2:] 12296 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Seq)) 12297 dst = dst[4:] 12298 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.PortID)) 12299 dst = dst[4:] 12300 return dst 12301 } 12302 12303 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12304 func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) []byte { 12305 n.Length = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12306 src = src[4:] 12307 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12308 src = src[2:] 12309 n.Flags = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12310 src = src[2:] 12311 n.Seq = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12312 src = src[4:] 12313 n.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12314 src = src[4:] 12315 return src 12316 } 12317 12318 // Packed implements marshal.Marshallable.Packed. 12319 //go:nosplit 12320 func (n *NetlinkMessageHeader) Packed() bool { 12321 return true 12322 } 12323 12324 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12325 func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) []byte { 12326 size := n.SizeBytes() 12327 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12328 return dst[size:] 12329 } 12330 12331 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12332 func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) []byte { 12333 size := n.SizeBytes() 12334 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12335 return src[size:] 12336 } 12337 12338 // CopyOutN implements marshal.Marshallable.CopyOutN. 12339 func (n *NetlinkMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12340 // Construct a slice backed by dst's underlying memory. 12341 var buf []byte 12342 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12343 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12344 hdr.Len = n.SizeBytes() 12345 hdr.Cap = n.SizeBytes() 12346 12347 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12348 // Since we bypassed the compiler's escape analysis, indicate that n 12349 // must live until the use above. 12350 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12351 return length, err 12352 } 12353 12354 // CopyOut implements marshal.Marshallable.CopyOut. 12355 func (n *NetlinkMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12356 return n.CopyOutN(cc, addr, n.SizeBytes()) 12357 } 12358 12359 // CopyIn implements marshal.Marshallable.CopyIn. 12360 func (n *NetlinkMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12361 // Construct a slice backed by dst's underlying memory. 12362 var buf []byte 12363 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12364 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12365 hdr.Len = n.SizeBytes() 12366 hdr.Cap = n.SizeBytes() 12367 12368 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12369 // Since we bypassed the compiler's escape analysis, indicate that n 12370 // must live until the use above. 12371 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12372 return length, err 12373 } 12374 12375 // WriteTo implements io.WriterTo.WriteTo. 12376 func (n *NetlinkMessageHeader) WriteTo(writer io.Writer) (int64, error) { 12377 // Construct a slice backed by dst's underlying memory. 12378 var buf []byte 12379 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12380 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12381 hdr.Len = n.SizeBytes() 12382 hdr.Cap = n.SizeBytes() 12383 12384 length, err := writer.Write(buf) 12385 // Since we bypassed the compiler's escape analysis, indicate that n 12386 // must live until the use above. 12387 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12388 return int64(length), err 12389 } 12390 12391 // SizeBytes implements marshal.Marshallable.SizeBytes. 12392 func (s *SockAddrNetlink) SizeBytes() int { 12393 return 12 12394 } 12395 12396 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12397 func (s *SockAddrNetlink) MarshalBytes(dst []byte) []byte { 12398 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 12399 dst = dst[2:] 12400 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 12401 dst = dst[2:] 12402 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PortID)) 12403 dst = dst[4:] 12404 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Groups)) 12405 dst = dst[4:] 12406 return dst 12407 } 12408 12409 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12410 func (s *SockAddrNetlink) UnmarshalBytes(src []byte) []byte { 12411 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12412 src = src[2:] 12413 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 12414 src = src[2:] 12415 s.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12416 src = src[4:] 12417 s.Groups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12418 src = src[4:] 12419 return src 12420 } 12421 12422 // Packed implements marshal.Marshallable.Packed. 12423 //go:nosplit 12424 func (s *SockAddrNetlink) Packed() bool { 12425 return true 12426 } 12427 12428 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12429 func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) []byte { 12430 size := s.SizeBytes() 12431 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12432 return dst[size:] 12433 } 12434 12435 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12436 func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) []byte { 12437 size := s.SizeBytes() 12438 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12439 return src[size:] 12440 } 12441 12442 // CopyOutN implements marshal.Marshallable.CopyOutN. 12443 func (s *SockAddrNetlink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12444 // Construct a slice backed by dst's underlying memory. 12445 var buf []byte 12446 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12447 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12448 hdr.Len = s.SizeBytes() 12449 hdr.Cap = s.SizeBytes() 12450 12451 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12452 // Since we bypassed the compiler's escape analysis, indicate that s 12453 // must live until the use above. 12454 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12455 return length, err 12456 } 12457 12458 // CopyOut implements marshal.Marshallable.CopyOut. 12459 func (s *SockAddrNetlink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12460 return s.CopyOutN(cc, addr, s.SizeBytes()) 12461 } 12462 12463 // CopyIn implements marshal.Marshallable.CopyIn. 12464 func (s *SockAddrNetlink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12465 // Construct a slice backed by dst's underlying memory. 12466 var buf []byte 12467 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12468 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12469 hdr.Len = s.SizeBytes() 12470 hdr.Cap = s.SizeBytes() 12471 12472 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12473 // Since we bypassed the compiler's escape analysis, indicate that s 12474 // must live until the use above. 12475 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12476 return length, err 12477 } 12478 12479 // WriteTo implements io.WriterTo.WriteTo. 12480 func (s *SockAddrNetlink) WriteTo(writer io.Writer) (int64, error) { 12481 // Construct a slice backed by dst's underlying memory. 12482 var buf []byte 12483 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12484 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12485 hdr.Len = s.SizeBytes() 12486 hdr.Cap = s.SizeBytes() 12487 12488 length, err := writer.Write(buf) 12489 // Since we bypassed the compiler's escape analysis, indicate that s 12490 // must live until the use above. 12491 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12492 return int64(length), err 12493 } 12494 12495 // SizeBytes implements marshal.Marshallable.SizeBytes. 12496 func (i *InterfaceAddrMessage) SizeBytes() int { 12497 return 8 12498 } 12499 12500 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12501 func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) []byte { 12502 dst[0] = byte(i.Family) 12503 dst = dst[1:] 12504 dst[0] = byte(i.PrefixLen) 12505 dst = dst[1:] 12506 dst[0] = byte(i.Flags) 12507 dst = dst[1:] 12508 dst[0] = byte(i.Scope) 12509 dst = dst[1:] 12510 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 12511 dst = dst[4:] 12512 return dst 12513 } 12514 12515 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12516 func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) []byte { 12517 i.Family = uint8(src[0]) 12518 src = src[1:] 12519 i.PrefixLen = uint8(src[0]) 12520 src = src[1:] 12521 i.Flags = uint8(src[0]) 12522 src = src[1:] 12523 i.Scope = uint8(src[0]) 12524 src = src[1:] 12525 i.Index = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12526 src = src[4:] 12527 return src 12528 } 12529 12530 // Packed implements marshal.Marshallable.Packed. 12531 //go:nosplit 12532 func (i *InterfaceAddrMessage) Packed() bool { 12533 return true 12534 } 12535 12536 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12537 func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) []byte { 12538 size := i.SizeBytes() 12539 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12540 return dst[size:] 12541 } 12542 12543 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12544 func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) []byte { 12545 size := i.SizeBytes() 12546 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12547 return src[size:] 12548 } 12549 12550 // CopyOutN implements marshal.Marshallable.CopyOutN. 12551 func (i *InterfaceAddrMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12552 // Construct a slice backed by dst's underlying memory. 12553 var buf []byte 12554 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12555 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12556 hdr.Len = i.SizeBytes() 12557 hdr.Cap = i.SizeBytes() 12558 12559 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12560 // Since we bypassed the compiler's escape analysis, indicate that i 12561 // must live until the use above. 12562 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12563 return length, err 12564 } 12565 12566 // CopyOut implements marshal.Marshallable.CopyOut. 12567 func (i *InterfaceAddrMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12568 return i.CopyOutN(cc, addr, i.SizeBytes()) 12569 } 12570 12571 // CopyIn implements marshal.Marshallable.CopyIn. 12572 func (i *InterfaceAddrMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12573 // Construct a slice backed by dst's underlying memory. 12574 var buf []byte 12575 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12576 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12577 hdr.Len = i.SizeBytes() 12578 hdr.Cap = i.SizeBytes() 12579 12580 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12581 // Since we bypassed the compiler's escape analysis, indicate that i 12582 // must live until the use above. 12583 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12584 return length, err 12585 } 12586 12587 // WriteTo implements io.WriterTo.WriteTo. 12588 func (i *InterfaceAddrMessage) WriteTo(writer io.Writer) (int64, error) { 12589 // Construct a slice backed by dst's underlying memory. 12590 var buf []byte 12591 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12592 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12593 hdr.Len = i.SizeBytes() 12594 hdr.Cap = i.SizeBytes() 12595 12596 length, err := writer.Write(buf) 12597 // Since we bypassed the compiler's escape analysis, indicate that i 12598 // must live until the use above. 12599 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12600 return int64(length), err 12601 } 12602 12603 // SizeBytes implements marshal.Marshallable.SizeBytes. 12604 func (i *InterfaceInfoMessage) SizeBytes() int { 12605 return 16 12606 } 12607 12608 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12609 func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) []byte { 12610 dst[0] = byte(i.Family) 12611 dst = dst[1:] 12612 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 12613 dst = dst[1:] 12614 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Type)) 12615 dst = dst[2:] 12616 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 12617 dst = dst[4:] 12618 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 12619 dst = dst[4:] 12620 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Change)) 12621 dst = dst[4:] 12622 return dst 12623 } 12624 12625 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12626 func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) []byte { 12627 i.Family = uint8(src[0]) 12628 src = src[1:] 12629 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 12630 src = src[1:] 12631 i.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12632 src = src[2:] 12633 i.Index = int32(hostarch.ByteOrder.Uint32(src[:4])) 12634 src = src[4:] 12635 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12636 src = src[4:] 12637 i.Change = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12638 src = src[4:] 12639 return src 12640 } 12641 12642 // Packed implements marshal.Marshallable.Packed. 12643 //go:nosplit 12644 func (i *InterfaceInfoMessage) Packed() bool { 12645 return true 12646 } 12647 12648 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12649 func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) []byte { 12650 size := i.SizeBytes() 12651 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12652 return dst[size:] 12653 } 12654 12655 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12656 func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) []byte { 12657 size := i.SizeBytes() 12658 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12659 return src[size:] 12660 } 12661 12662 // CopyOutN implements marshal.Marshallable.CopyOutN. 12663 func (i *InterfaceInfoMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12664 // Construct a slice backed by dst's underlying memory. 12665 var buf []byte 12666 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12667 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12668 hdr.Len = i.SizeBytes() 12669 hdr.Cap = i.SizeBytes() 12670 12671 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12672 // Since we bypassed the compiler's escape analysis, indicate that i 12673 // must live until the use above. 12674 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12675 return length, err 12676 } 12677 12678 // CopyOut implements marshal.Marshallable.CopyOut. 12679 func (i *InterfaceInfoMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12680 return i.CopyOutN(cc, addr, i.SizeBytes()) 12681 } 12682 12683 // CopyIn implements marshal.Marshallable.CopyIn. 12684 func (i *InterfaceInfoMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12685 // Construct a slice backed by dst's underlying memory. 12686 var buf []byte 12687 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12688 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12689 hdr.Len = i.SizeBytes() 12690 hdr.Cap = i.SizeBytes() 12691 12692 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12693 // Since we bypassed the compiler's escape analysis, indicate that i 12694 // must live until the use above. 12695 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12696 return length, err 12697 } 12698 12699 // WriteTo implements io.WriterTo.WriteTo. 12700 func (i *InterfaceInfoMessage) WriteTo(writer io.Writer) (int64, error) { 12701 // Construct a slice backed by dst's underlying memory. 12702 var buf []byte 12703 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12704 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12705 hdr.Len = i.SizeBytes() 12706 hdr.Cap = i.SizeBytes() 12707 12708 length, err := writer.Write(buf) 12709 // Since we bypassed the compiler's escape analysis, indicate that i 12710 // must live until the use above. 12711 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12712 return int64(length), err 12713 } 12714 12715 // SizeBytes implements marshal.Marshallable.SizeBytes. 12716 func (r *RouteMessage) SizeBytes() int { 12717 return 12 12718 } 12719 12720 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12721 func (r *RouteMessage) MarshalBytes(dst []byte) []byte { 12722 dst[0] = byte(r.Family) 12723 dst = dst[1:] 12724 dst[0] = byte(r.DstLen) 12725 dst = dst[1:] 12726 dst[0] = byte(r.SrcLen) 12727 dst = dst[1:] 12728 dst[0] = byte(r.TOS) 12729 dst = dst[1:] 12730 dst[0] = byte(r.Table) 12731 dst = dst[1:] 12732 dst[0] = byte(r.Protocol) 12733 dst = dst[1:] 12734 dst[0] = byte(r.Scope) 12735 dst = dst[1:] 12736 dst[0] = byte(r.Type) 12737 dst = dst[1:] 12738 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 12739 dst = dst[4:] 12740 return dst 12741 } 12742 12743 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12744 func (r *RouteMessage) UnmarshalBytes(src []byte) []byte { 12745 r.Family = uint8(src[0]) 12746 src = src[1:] 12747 r.DstLen = uint8(src[0]) 12748 src = src[1:] 12749 r.SrcLen = uint8(src[0]) 12750 src = src[1:] 12751 r.TOS = uint8(src[0]) 12752 src = src[1:] 12753 r.Table = uint8(src[0]) 12754 src = src[1:] 12755 r.Protocol = uint8(src[0]) 12756 src = src[1:] 12757 r.Scope = uint8(src[0]) 12758 src = src[1:] 12759 r.Type = uint8(src[0]) 12760 src = src[1:] 12761 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12762 src = src[4:] 12763 return src 12764 } 12765 12766 // Packed implements marshal.Marshallable.Packed. 12767 //go:nosplit 12768 func (r *RouteMessage) Packed() bool { 12769 return true 12770 } 12771 12772 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12773 func (r *RouteMessage) MarshalUnsafe(dst []byte) []byte { 12774 size := r.SizeBytes() 12775 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 12776 return dst[size:] 12777 } 12778 12779 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12780 func (r *RouteMessage) UnmarshalUnsafe(src []byte) []byte { 12781 size := r.SizeBytes() 12782 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 12783 return src[size:] 12784 } 12785 12786 // CopyOutN implements marshal.Marshallable.CopyOutN. 12787 func (r *RouteMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12788 // Construct a slice backed by dst's underlying memory. 12789 var buf []byte 12790 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12791 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12792 hdr.Len = r.SizeBytes() 12793 hdr.Cap = r.SizeBytes() 12794 12795 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12796 // Since we bypassed the compiler's escape analysis, indicate that r 12797 // must live until the use above. 12798 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12799 return length, err 12800 } 12801 12802 // CopyOut implements marshal.Marshallable.CopyOut. 12803 func (r *RouteMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12804 return r.CopyOutN(cc, addr, r.SizeBytes()) 12805 } 12806 12807 // CopyIn implements marshal.Marshallable.CopyIn. 12808 func (r *RouteMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12809 // Construct a slice backed by dst's underlying memory. 12810 var buf []byte 12811 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12812 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12813 hdr.Len = r.SizeBytes() 12814 hdr.Cap = r.SizeBytes() 12815 12816 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12817 // Since we bypassed the compiler's escape analysis, indicate that r 12818 // must live until the use above. 12819 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12820 return length, err 12821 } 12822 12823 // WriteTo implements io.WriterTo.WriteTo. 12824 func (r *RouteMessage) WriteTo(writer io.Writer) (int64, error) { 12825 // Construct a slice backed by dst's underlying memory. 12826 var buf []byte 12827 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12828 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12829 hdr.Len = r.SizeBytes() 12830 hdr.Cap = r.SizeBytes() 12831 12832 length, err := writer.Write(buf) 12833 // Since we bypassed the compiler's escape analysis, indicate that r 12834 // must live until the use above. 12835 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12836 return int64(length), err 12837 } 12838 12839 // SizeBytes implements marshal.Marshallable.SizeBytes. 12840 func (r *RtAttr) SizeBytes() int { 12841 return 4 12842 } 12843 12844 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12845 func (r *RtAttr) MarshalBytes(dst []byte) []byte { 12846 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Len)) 12847 dst = dst[2:] 12848 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Type)) 12849 dst = dst[2:] 12850 return dst 12851 } 12852 12853 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12854 func (r *RtAttr) UnmarshalBytes(src []byte) []byte { 12855 r.Len = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12856 src = src[2:] 12857 r.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12858 src = src[2:] 12859 return src 12860 } 12861 12862 // Packed implements marshal.Marshallable.Packed. 12863 //go:nosplit 12864 func (r *RtAttr) Packed() bool { 12865 return true 12866 } 12867 12868 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12869 func (r *RtAttr) MarshalUnsafe(dst []byte) []byte { 12870 size := r.SizeBytes() 12871 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 12872 return dst[size:] 12873 } 12874 12875 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12876 func (r *RtAttr) UnmarshalUnsafe(src []byte) []byte { 12877 size := r.SizeBytes() 12878 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 12879 return src[size:] 12880 } 12881 12882 // CopyOutN implements marshal.Marshallable.CopyOutN. 12883 func (r *RtAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12884 // Construct a slice backed by dst's underlying memory. 12885 var buf []byte 12886 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12887 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12888 hdr.Len = r.SizeBytes() 12889 hdr.Cap = r.SizeBytes() 12890 12891 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12892 // Since we bypassed the compiler's escape analysis, indicate that r 12893 // must live until the use above. 12894 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12895 return length, err 12896 } 12897 12898 // CopyOut implements marshal.Marshallable.CopyOut. 12899 func (r *RtAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12900 return r.CopyOutN(cc, addr, r.SizeBytes()) 12901 } 12902 12903 // CopyIn implements marshal.Marshallable.CopyIn. 12904 func (r *RtAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12905 // Construct a slice backed by dst's underlying memory. 12906 var buf []byte 12907 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12908 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12909 hdr.Len = r.SizeBytes() 12910 hdr.Cap = r.SizeBytes() 12911 12912 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12913 // Since we bypassed the compiler's escape analysis, indicate that r 12914 // must live until the use above. 12915 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12916 return length, err 12917 } 12918 12919 // WriteTo implements io.WriterTo.WriteTo. 12920 func (r *RtAttr) WriteTo(writer io.Writer) (int64, error) { 12921 // Construct a slice backed by dst's underlying memory. 12922 var buf []byte 12923 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12924 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12925 hdr.Len = r.SizeBytes() 12926 hdr.Cap = r.SizeBytes() 12927 12928 length, err := writer.Write(buf) 12929 // Since we bypassed the compiler's escape analysis, indicate that r 12930 // must live until the use above. 12931 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12932 return int64(length), err 12933 } 12934 12935 // SizeBytes implements marshal.Marshallable.SizeBytes. 12936 func (p *PollFD) SizeBytes() int { 12937 return 8 12938 } 12939 12940 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12941 func (p *PollFD) MarshalBytes(dst []byte) []byte { 12942 hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.FD)) 12943 dst = dst[4:] 12944 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.Events)) 12945 dst = dst[2:] 12946 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.REvents)) 12947 dst = dst[2:] 12948 return dst 12949 } 12950 12951 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12952 func (p *PollFD) UnmarshalBytes(src []byte) []byte { 12953 p.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 12954 src = src[4:] 12955 p.Events = int16(hostarch.ByteOrder.Uint16(src[:2])) 12956 src = src[2:] 12957 p.REvents = int16(hostarch.ByteOrder.Uint16(src[:2])) 12958 src = src[2:] 12959 return src 12960 } 12961 12962 // Packed implements marshal.Marshallable.Packed. 12963 //go:nosplit 12964 func (p *PollFD) Packed() bool { 12965 return true 12966 } 12967 12968 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12969 func (p *PollFD) MarshalUnsafe(dst []byte) []byte { 12970 size := p.SizeBytes() 12971 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size)) 12972 return dst[size:] 12973 } 12974 12975 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12976 func (p *PollFD) UnmarshalUnsafe(src []byte) []byte { 12977 size := p.SizeBytes() 12978 gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size)) 12979 return src[size:] 12980 } 12981 12982 // CopyOutN implements marshal.Marshallable.CopyOutN. 12983 func (p *PollFD) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12984 // Construct a slice backed by dst's underlying memory. 12985 var buf []byte 12986 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12987 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 12988 hdr.Len = p.SizeBytes() 12989 hdr.Cap = p.SizeBytes() 12990 12991 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12992 // Since we bypassed the compiler's escape analysis, indicate that p 12993 // must live until the use above. 12994 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 12995 return length, err 12996 } 12997 12998 // CopyOut implements marshal.Marshallable.CopyOut. 12999 func (p *PollFD) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13000 return p.CopyOutN(cc, addr, p.SizeBytes()) 13001 } 13002 13003 // CopyIn implements marshal.Marshallable.CopyIn. 13004 func (p *PollFD) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13005 // Construct a slice backed by dst's underlying memory. 13006 var buf []byte 13007 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13008 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13009 hdr.Len = p.SizeBytes() 13010 hdr.Cap = p.SizeBytes() 13011 13012 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13013 // Since we bypassed the compiler's escape analysis, indicate that p 13014 // must live until the use above. 13015 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13016 return length, err 13017 } 13018 13019 // WriteTo implements io.WriterTo.WriteTo. 13020 func (p *PollFD) WriteTo(writer io.Writer) (int64, error) { 13021 // Construct a slice backed by dst's underlying memory. 13022 var buf []byte 13023 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13024 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13025 hdr.Len = p.SizeBytes() 13026 hdr.Cap = p.SizeBytes() 13027 13028 length, err := writer.Write(buf) 13029 // Since we bypassed the compiler's escape analysis, indicate that p 13030 // must live until the use above. 13031 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13032 return int64(length), err 13033 } 13034 13035 // CopyPollFDSliceIn copies in a slice of PollFD objects from the task's memory. 13036 func CopyPollFDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []PollFD) (int, error) { 13037 count := len(dst) 13038 if count == 0 { 13039 return 0, nil 13040 } 13041 size := (*PollFD)(nil).SizeBytes() 13042 13043 ptr := unsafe.Pointer(&dst) 13044 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13045 13046 // Construct a slice backed by dst's underlying memory. 13047 var buf []byte 13048 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13049 hdr.Data = uintptr(val) 13050 hdr.Len = size * count 13051 hdr.Cap = size * count 13052 13053 length, err := cc.CopyInBytes(addr, buf) 13054 // Since we bypassed the compiler's escape analysis, indicate that dst 13055 // must live until the use above. 13056 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 13057 return length, err 13058 } 13059 13060 // CopyPollFDSliceOut copies a slice of PollFD objects to the task's memory. 13061 func CopyPollFDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []PollFD) (int, error) { 13062 count := len(src) 13063 if count == 0 { 13064 return 0, nil 13065 } 13066 size := (*PollFD)(nil).SizeBytes() 13067 13068 ptr := unsafe.Pointer(&src) 13069 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13070 13071 // Construct a slice backed by dst's underlying memory. 13072 var buf []byte 13073 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13074 hdr.Data = uintptr(val) 13075 hdr.Len = size * count 13076 hdr.Cap = size * count 13077 13078 length, err := cc.CopyOutBytes(addr, buf) 13079 // Since we bypassed the compiler's escape analysis, indicate that src 13080 // must live until the use above. 13081 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 13082 return length, err 13083 } 13084 13085 // MarshalUnsafePollFDSlice is like PollFD.MarshalUnsafe, but for a []PollFD. 13086 func MarshalUnsafePollFDSlice(src []PollFD, dst []byte) []byte { 13087 count := len(src) 13088 if count == 0 { 13089 return dst 13090 } 13091 13092 size := (*PollFD)(nil).SizeBytes() 13093 buf := dst[:size*count] 13094 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 13095 return dst[size*count:] 13096 } 13097 13098 // UnmarshalUnsafePollFDSlice is like PollFD.UnmarshalUnsafe, but for a []PollFD. 13099 func UnmarshalUnsafePollFDSlice(dst []PollFD, src []byte) []byte { 13100 count := len(dst) 13101 if count == 0 { 13102 return src 13103 } 13104 13105 size := (*PollFD)(nil).SizeBytes() 13106 buf := src[:size*count] 13107 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 13108 return src[size*count:] 13109 } 13110 13111 // SizeBytes implements marshal.Marshallable.SizeBytes. 13112 func (r *RSeqCriticalSection) SizeBytes() int { 13113 return 32 13114 } 13115 13116 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13117 func (r *RSeqCriticalSection) MarshalBytes(dst []byte) []byte { 13118 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Version)) 13119 dst = dst[4:] 13120 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 13121 dst = dst[4:] 13122 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Start)) 13123 dst = dst[8:] 13124 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.PostCommitOffset)) 13125 dst = dst[8:] 13126 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Abort)) 13127 dst = dst[8:] 13128 return dst 13129 } 13130 13131 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13132 func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) []byte { 13133 r.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13134 src = src[4:] 13135 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13136 src = src[4:] 13137 r.Start = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13138 src = src[8:] 13139 r.PostCommitOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13140 src = src[8:] 13141 r.Abort = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13142 src = src[8:] 13143 return src 13144 } 13145 13146 // Packed implements marshal.Marshallable.Packed. 13147 //go:nosplit 13148 func (r *RSeqCriticalSection) Packed() bool { 13149 return true 13150 } 13151 13152 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13153 func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) []byte { 13154 size := r.SizeBytes() 13155 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13156 return dst[size:] 13157 } 13158 13159 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13160 func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) []byte { 13161 size := r.SizeBytes() 13162 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13163 return src[size:] 13164 } 13165 13166 // CopyOutN implements marshal.Marshallable.CopyOutN. 13167 func (r *RSeqCriticalSection) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13168 // Construct a slice backed by dst's underlying memory. 13169 var buf []byte 13170 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13171 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13172 hdr.Len = r.SizeBytes() 13173 hdr.Cap = r.SizeBytes() 13174 13175 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13176 // Since we bypassed the compiler's escape analysis, indicate that r 13177 // must live until the use above. 13178 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13179 return length, err 13180 } 13181 13182 // CopyOut implements marshal.Marshallable.CopyOut. 13183 func (r *RSeqCriticalSection) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13184 return r.CopyOutN(cc, addr, r.SizeBytes()) 13185 } 13186 13187 // CopyIn implements marshal.Marshallable.CopyIn. 13188 func (r *RSeqCriticalSection) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13189 // Construct a slice backed by dst's underlying memory. 13190 var buf []byte 13191 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13192 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13193 hdr.Len = r.SizeBytes() 13194 hdr.Cap = r.SizeBytes() 13195 13196 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13197 // Since we bypassed the compiler's escape analysis, indicate that r 13198 // must live until the use above. 13199 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13200 return length, err 13201 } 13202 13203 // WriteTo implements io.WriterTo.WriteTo. 13204 func (r *RSeqCriticalSection) WriteTo(writer io.Writer) (int64, error) { 13205 // Construct a slice backed by dst's underlying memory. 13206 var buf []byte 13207 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13208 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13209 hdr.Len = r.SizeBytes() 13210 hdr.Cap = r.SizeBytes() 13211 13212 length, err := writer.Write(buf) 13213 // Since we bypassed the compiler's escape analysis, indicate that r 13214 // must live until the use above. 13215 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13216 return int64(length), err 13217 } 13218 13219 // SizeBytes implements marshal.Marshallable.SizeBytes. 13220 func (r *Rusage) SizeBytes() int { 13221 return 112 + 13222 (*Timeval)(nil).SizeBytes() + 13223 (*Timeval)(nil).SizeBytes() 13224 } 13225 13226 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13227 func (r *Rusage) MarshalBytes(dst []byte) []byte { 13228 dst = r.UTime.MarshalUnsafe(dst) 13229 dst = r.STime.MarshalUnsafe(dst) 13230 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MaxRSS)) 13231 dst = dst[8:] 13232 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IXRSS)) 13233 dst = dst[8:] 13234 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IDRSS)) 13235 dst = dst[8:] 13236 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ISRSS)) 13237 dst = dst[8:] 13238 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MinFlt)) 13239 dst = dst[8:] 13240 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MajFlt)) 13241 dst = dst[8:] 13242 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSwap)) 13243 dst = dst[8:] 13244 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.InBlock)) 13245 dst = dst[8:] 13246 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.OuBlock)) 13247 dst = dst[8:] 13248 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgSnd)) 13249 dst = dst[8:] 13250 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgRcv)) 13251 dst = dst[8:] 13252 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSignals)) 13253 dst = dst[8:] 13254 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NVCSw)) 13255 dst = dst[8:] 13256 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NIvCSw)) 13257 dst = dst[8:] 13258 return dst 13259 } 13260 13261 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13262 func (r *Rusage) UnmarshalBytes(src []byte) []byte { 13263 src = r.UTime.UnmarshalUnsafe(src) 13264 src = r.STime.UnmarshalUnsafe(src) 13265 r.MaxRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13266 src = src[8:] 13267 r.IXRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13268 src = src[8:] 13269 r.IDRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13270 src = src[8:] 13271 r.ISRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13272 src = src[8:] 13273 r.MinFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 13274 src = src[8:] 13275 r.MajFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 13276 src = src[8:] 13277 r.NSwap = int64(hostarch.ByteOrder.Uint64(src[:8])) 13278 src = src[8:] 13279 r.InBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 13280 src = src[8:] 13281 r.OuBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 13282 src = src[8:] 13283 r.MsgSnd = int64(hostarch.ByteOrder.Uint64(src[:8])) 13284 src = src[8:] 13285 r.MsgRcv = int64(hostarch.ByteOrder.Uint64(src[:8])) 13286 src = src[8:] 13287 r.NSignals = int64(hostarch.ByteOrder.Uint64(src[:8])) 13288 src = src[8:] 13289 r.NVCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 13290 src = src[8:] 13291 r.NIvCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 13292 src = src[8:] 13293 return src 13294 } 13295 13296 // Packed implements marshal.Marshallable.Packed. 13297 //go:nosplit 13298 func (r *Rusage) Packed() bool { 13299 return r.STime.Packed() && r.UTime.Packed() 13300 } 13301 13302 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13303 func (r *Rusage) MarshalUnsafe(dst []byte) []byte { 13304 if r.STime.Packed() && r.UTime.Packed() { 13305 size := r.SizeBytes() 13306 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13307 return dst[size:] 13308 } 13309 // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes. 13310 return r.MarshalBytes(dst) 13311 } 13312 13313 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13314 func (r *Rusage) UnmarshalUnsafe(src []byte) []byte { 13315 if r.STime.Packed() && r.UTime.Packed() { 13316 size := r.SizeBytes() 13317 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13318 return src[size:] 13319 } 13320 // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13321 return r.UnmarshalBytes(src) 13322 } 13323 13324 // CopyOutN implements marshal.Marshallable.CopyOutN. 13325 func (r *Rusage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13326 if !r.STime.Packed() && r.UTime.Packed() { 13327 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 13328 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 13329 r.MarshalBytes(buf) // escapes: fallback. 13330 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13331 } 13332 13333 // Construct a slice backed by dst's underlying memory. 13334 var buf []byte 13335 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13336 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13337 hdr.Len = r.SizeBytes() 13338 hdr.Cap = r.SizeBytes() 13339 13340 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13341 // Since we bypassed the compiler's escape analysis, indicate that r 13342 // must live until the use above. 13343 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13344 return length, err 13345 } 13346 13347 // CopyOut implements marshal.Marshallable.CopyOut. 13348 func (r *Rusage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13349 return r.CopyOutN(cc, addr, r.SizeBytes()) 13350 } 13351 13352 // CopyIn implements marshal.Marshallable.CopyIn. 13353 func (r *Rusage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13354 if !r.STime.Packed() && r.UTime.Packed() { 13355 // Type Rusage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13356 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 13357 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13358 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13359 // partially unmarshalled struct. 13360 r.UnmarshalBytes(buf) // escapes: fallback. 13361 return length, err 13362 } 13363 13364 // Construct a slice backed by dst's underlying memory. 13365 var buf []byte 13366 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13367 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13368 hdr.Len = r.SizeBytes() 13369 hdr.Cap = r.SizeBytes() 13370 13371 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13372 // Since we bypassed the compiler's escape analysis, indicate that r 13373 // must live until the use above. 13374 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13375 return length, err 13376 } 13377 13378 // WriteTo implements io.WriterTo.WriteTo. 13379 func (r *Rusage) WriteTo(writer io.Writer) (int64, error) { 13380 if !r.STime.Packed() && r.UTime.Packed() { 13381 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 13382 buf := make([]byte, r.SizeBytes()) 13383 r.MarshalBytes(buf) 13384 length, err := writer.Write(buf) 13385 return int64(length), err 13386 } 13387 13388 // Construct a slice backed by dst's underlying memory. 13389 var buf []byte 13390 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13391 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13392 hdr.Len = r.SizeBytes() 13393 hdr.Cap = r.SizeBytes() 13394 13395 length, err := writer.Write(buf) 13396 // Since we bypassed the compiler's escape analysis, indicate that r 13397 // must live until the use above. 13398 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13399 return int64(length), err 13400 } 13401 13402 // SizeBytes implements marshal.Marshallable.SizeBytes. 13403 func (s *SeccompData) SizeBytes() int { 13404 return 16 + 13405 8*6 13406 } 13407 13408 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13409 func (s *SeccompData) MarshalBytes(dst []byte) []byte { 13410 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nr)) 13411 dst = dst[4:] 13412 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Arch)) 13413 dst = dst[4:] 13414 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.InstructionPointer)) 13415 dst = dst[8:] 13416 for idx := 0; idx < 6; idx++ { 13417 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Args[idx])) 13418 dst = dst[8:] 13419 } 13420 return dst 13421 } 13422 13423 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13424 func (s *SeccompData) UnmarshalBytes(src []byte) []byte { 13425 s.Nr = int32(hostarch.ByteOrder.Uint32(src[:4])) 13426 src = src[4:] 13427 s.Arch = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13428 src = src[4:] 13429 s.InstructionPointer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13430 src = src[8:] 13431 for idx := 0; idx < 6; idx++ { 13432 s.Args[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13433 src = src[8:] 13434 } 13435 return src 13436 } 13437 13438 // Packed implements marshal.Marshallable.Packed. 13439 //go:nosplit 13440 func (s *SeccompData) Packed() bool { 13441 return true 13442 } 13443 13444 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13445 func (s *SeccompData) MarshalUnsafe(dst []byte) []byte { 13446 size := s.SizeBytes() 13447 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13448 return dst[size:] 13449 } 13450 13451 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13452 func (s *SeccompData) UnmarshalUnsafe(src []byte) []byte { 13453 size := s.SizeBytes() 13454 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13455 return src[size:] 13456 } 13457 13458 // CopyOutN implements marshal.Marshallable.CopyOutN. 13459 func (s *SeccompData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13460 // Construct a slice backed by dst's underlying memory. 13461 var buf []byte 13462 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13463 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13464 hdr.Len = s.SizeBytes() 13465 hdr.Cap = s.SizeBytes() 13466 13467 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13468 // Since we bypassed the compiler's escape analysis, indicate that s 13469 // must live until the use above. 13470 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13471 return length, err 13472 } 13473 13474 // CopyOut implements marshal.Marshallable.CopyOut. 13475 func (s *SeccompData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13476 return s.CopyOutN(cc, addr, s.SizeBytes()) 13477 } 13478 13479 // CopyIn implements marshal.Marshallable.CopyIn. 13480 func (s *SeccompData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13481 // Construct a slice backed by dst's underlying memory. 13482 var buf []byte 13483 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13484 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13485 hdr.Len = s.SizeBytes() 13486 hdr.Cap = s.SizeBytes() 13487 13488 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13489 // Since we bypassed the compiler's escape analysis, indicate that s 13490 // must live until the use above. 13491 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13492 return length, err 13493 } 13494 13495 // WriteTo implements io.WriterTo.WriteTo. 13496 func (s *SeccompData) WriteTo(writer io.Writer) (int64, error) { 13497 // Construct a slice backed by dst's underlying memory. 13498 var buf []byte 13499 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13500 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13501 hdr.Len = s.SizeBytes() 13502 hdr.Cap = s.SizeBytes() 13503 13504 length, err := writer.Write(buf) 13505 // Since we bypassed the compiler's escape analysis, indicate that s 13506 // must live until the use above. 13507 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13508 return int64(length), err 13509 } 13510 13511 // SizeBytes implements marshal.Marshallable.SizeBytes. 13512 func (s *SemInfo) SizeBytes() int { 13513 return 40 13514 } 13515 13516 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13517 func (s *SemInfo) MarshalBytes(dst []byte) []byte { 13518 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMap)) 13519 dst = dst[4:] 13520 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMni)) 13521 dst = dst[4:] 13522 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMns)) 13523 dst = dst[4:] 13524 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMnu)) 13525 dst = dst[4:] 13526 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMsl)) 13527 dst = dst[4:] 13528 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemOpm)) 13529 dst = dst[4:] 13530 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUme)) 13531 dst = dst[4:] 13532 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUsz)) 13533 dst = dst[4:] 13534 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemVmx)) 13535 dst = dst[4:] 13536 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemAem)) 13537 dst = dst[4:] 13538 return dst 13539 } 13540 13541 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13542 func (s *SemInfo) UnmarshalBytes(src []byte) []byte { 13543 s.SemMap = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13544 src = src[4:] 13545 s.SemMni = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13546 src = src[4:] 13547 s.SemMns = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13548 src = src[4:] 13549 s.SemMnu = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13550 src = src[4:] 13551 s.SemMsl = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13552 src = src[4:] 13553 s.SemOpm = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13554 src = src[4:] 13555 s.SemUme = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13556 src = src[4:] 13557 s.SemUsz = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13558 src = src[4:] 13559 s.SemVmx = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13560 src = src[4:] 13561 s.SemAem = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13562 src = src[4:] 13563 return src 13564 } 13565 13566 // Packed implements marshal.Marshallable.Packed. 13567 //go:nosplit 13568 func (s *SemInfo) Packed() bool { 13569 return true 13570 } 13571 13572 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13573 func (s *SemInfo) MarshalUnsafe(dst []byte) []byte { 13574 size := s.SizeBytes() 13575 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13576 return dst[size:] 13577 } 13578 13579 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13580 func (s *SemInfo) UnmarshalUnsafe(src []byte) []byte { 13581 size := s.SizeBytes() 13582 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13583 return src[size:] 13584 } 13585 13586 // CopyOutN implements marshal.Marshallable.CopyOutN. 13587 func (s *SemInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13588 // Construct a slice backed by dst's underlying memory. 13589 var buf []byte 13590 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13591 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13592 hdr.Len = s.SizeBytes() 13593 hdr.Cap = s.SizeBytes() 13594 13595 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13596 // Since we bypassed the compiler's escape analysis, indicate that s 13597 // must live until the use above. 13598 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13599 return length, err 13600 } 13601 13602 // CopyOut implements marshal.Marshallable.CopyOut. 13603 func (s *SemInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13604 return s.CopyOutN(cc, addr, s.SizeBytes()) 13605 } 13606 13607 // CopyIn implements marshal.Marshallable.CopyIn. 13608 func (s *SemInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13609 // Construct a slice backed by dst's underlying memory. 13610 var buf []byte 13611 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13612 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13613 hdr.Len = s.SizeBytes() 13614 hdr.Cap = s.SizeBytes() 13615 13616 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13617 // Since we bypassed the compiler's escape analysis, indicate that s 13618 // must live until the use above. 13619 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13620 return length, err 13621 } 13622 13623 // WriteTo implements io.WriterTo.WriteTo. 13624 func (s *SemInfo) WriteTo(writer io.Writer) (int64, error) { 13625 // Construct a slice backed by dst's underlying memory. 13626 var buf []byte 13627 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13628 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13629 hdr.Len = s.SizeBytes() 13630 hdr.Cap = s.SizeBytes() 13631 13632 length, err := writer.Write(buf) 13633 // Since we bypassed the compiler's escape analysis, indicate that s 13634 // must live until the use above. 13635 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13636 return int64(length), err 13637 } 13638 13639 // SizeBytes implements marshal.Marshallable.SizeBytes. 13640 func (s *Sembuf) SizeBytes() int { 13641 return 6 13642 } 13643 13644 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13645 func (s *Sembuf) MarshalBytes(dst []byte) []byte { 13646 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemNum)) 13647 dst = dst[2:] 13648 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemOp)) 13649 dst = dst[2:] 13650 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemFlg)) 13651 dst = dst[2:] 13652 return dst 13653 } 13654 13655 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13656 func (s *Sembuf) UnmarshalBytes(src []byte) []byte { 13657 s.SemNum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13658 src = src[2:] 13659 s.SemOp = int16(hostarch.ByteOrder.Uint16(src[:2])) 13660 src = src[2:] 13661 s.SemFlg = int16(hostarch.ByteOrder.Uint16(src[:2])) 13662 src = src[2:] 13663 return src 13664 } 13665 13666 // Packed implements marshal.Marshallable.Packed. 13667 //go:nosplit 13668 func (s *Sembuf) Packed() bool { 13669 return true 13670 } 13671 13672 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13673 func (s *Sembuf) MarshalUnsafe(dst []byte) []byte { 13674 size := s.SizeBytes() 13675 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13676 return dst[size:] 13677 } 13678 13679 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13680 func (s *Sembuf) UnmarshalUnsafe(src []byte) []byte { 13681 size := s.SizeBytes() 13682 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13683 return src[size:] 13684 } 13685 13686 // CopyOutN implements marshal.Marshallable.CopyOutN. 13687 func (s *Sembuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13688 // Construct a slice backed by dst's underlying memory. 13689 var buf []byte 13690 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13691 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13692 hdr.Len = s.SizeBytes() 13693 hdr.Cap = s.SizeBytes() 13694 13695 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13696 // Since we bypassed the compiler's escape analysis, indicate that s 13697 // must live until the use above. 13698 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13699 return length, err 13700 } 13701 13702 // CopyOut implements marshal.Marshallable.CopyOut. 13703 func (s *Sembuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13704 return s.CopyOutN(cc, addr, s.SizeBytes()) 13705 } 13706 13707 // CopyIn implements marshal.Marshallable.CopyIn. 13708 func (s *Sembuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13709 // Construct a slice backed by dst's underlying memory. 13710 var buf []byte 13711 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13712 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13713 hdr.Len = s.SizeBytes() 13714 hdr.Cap = s.SizeBytes() 13715 13716 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13717 // Since we bypassed the compiler's escape analysis, indicate that s 13718 // must live until the use above. 13719 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13720 return length, err 13721 } 13722 13723 // WriteTo implements io.WriterTo.WriteTo. 13724 func (s *Sembuf) WriteTo(writer io.Writer) (int64, error) { 13725 // Construct a slice backed by dst's underlying memory. 13726 var buf []byte 13727 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13728 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13729 hdr.Len = s.SizeBytes() 13730 hdr.Cap = s.SizeBytes() 13731 13732 length, err := writer.Write(buf) 13733 // Since we bypassed the compiler's escape analysis, indicate that s 13734 // must live until the use above. 13735 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13736 return int64(length), err 13737 } 13738 13739 // CopySembufSliceIn copies in a slice of Sembuf objects from the task's memory. 13740 func CopySembufSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Sembuf) (int, error) { 13741 count := len(dst) 13742 if count == 0 { 13743 return 0, nil 13744 } 13745 size := (*Sembuf)(nil).SizeBytes() 13746 13747 ptr := unsafe.Pointer(&dst) 13748 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13749 13750 // Construct a slice backed by dst's underlying memory. 13751 var buf []byte 13752 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13753 hdr.Data = uintptr(val) 13754 hdr.Len = size * count 13755 hdr.Cap = size * count 13756 13757 length, err := cc.CopyInBytes(addr, buf) 13758 // Since we bypassed the compiler's escape analysis, indicate that dst 13759 // must live until the use above. 13760 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 13761 return length, err 13762 } 13763 13764 // CopySembufSliceOut copies a slice of Sembuf objects to the task's memory. 13765 func CopySembufSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Sembuf) (int, error) { 13766 count := len(src) 13767 if count == 0 { 13768 return 0, nil 13769 } 13770 size := (*Sembuf)(nil).SizeBytes() 13771 13772 ptr := unsafe.Pointer(&src) 13773 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13774 13775 // Construct a slice backed by dst's underlying memory. 13776 var buf []byte 13777 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13778 hdr.Data = uintptr(val) 13779 hdr.Len = size * count 13780 hdr.Cap = size * count 13781 13782 length, err := cc.CopyOutBytes(addr, buf) 13783 // Since we bypassed the compiler's escape analysis, indicate that src 13784 // must live until the use above. 13785 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 13786 return length, err 13787 } 13788 13789 // MarshalUnsafeSembufSlice is like Sembuf.MarshalUnsafe, but for a []Sembuf. 13790 func MarshalUnsafeSembufSlice(src []Sembuf, dst []byte) []byte { 13791 count := len(src) 13792 if count == 0 { 13793 return dst 13794 } 13795 13796 size := (*Sembuf)(nil).SizeBytes() 13797 buf := dst[:size*count] 13798 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 13799 return dst[size*count:] 13800 } 13801 13802 // UnmarshalUnsafeSembufSlice is like Sembuf.UnmarshalUnsafe, but for a []Sembuf. 13803 func UnmarshalUnsafeSembufSlice(dst []Sembuf, src []byte) []byte { 13804 count := len(dst) 13805 if count == 0 { 13806 return src 13807 } 13808 13809 size := (*Sembuf)(nil).SizeBytes() 13810 buf := src[:size*count] 13811 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 13812 return src[size*count:] 13813 } 13814 13815 // SizeBytes implements marshal.Marshallable.SizeBytes. 13816 func (s *ShmInfo) SizeBytes() int { 13817 return 44 + 13818 1*4 13819 } 13820 13821 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13822 func (s *ShmInfo) MarshalBytes(dst []byte) []byte { 13823 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UsedIDs)) 13824 dst = dst[4:] 13825 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 13826 dst = dst[1*(4):] 13827 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmTot)) 13828 dst = dst[8:] 13829 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmRss)) 13830 dst = dst[8:] 13831 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSwp)) 13832 dst = dst[8:] 13833 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapAttempts)) 13834 dst = dst[8:] 13835 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapSuccesses)) 13836 dst = dst[8:] 13837 return dst 13838 } 13839 13840 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13841 func (s *ShmInfo) UnmarshalBytes(src []byte) []byte { 13842 s.UsedIDs = int32(hostarch.ByteOrder.Uint32(src[:4])) 13843 src = src[4:] 13844 // Padding: ~ copy([4]byte(s._), src[:sizeof(byte)*4]) 13845 src = src[1*(4):] 13846 s.ShmTot = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13847 src = src[8:] 13848 s.ShmRss = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13849 src = src[8:] 13850 s.ShmSwp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13851 src = src[8:] 13852 s.SwapAttempts = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13853 src = src[8:] 13854 s.SwapSuccesses = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13855 src = src[8:] 13856 return src 13857 } 13858 13859 // Packed implements marshal.Marshallable.Packed. 13860 //go:nosplit 13861 func (s *ShmInfo) Packed() bool { 13862 return true 13863 } 13864 13865 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13866 func (s *ShmInfo) MarshalUnsafe(dst []byte) []byte { 13867 size := s.SizeBytes() 13868 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13869 return dst[size:] 13870 } 13871 13872 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13873 func (s *ShmInfo) UnmarshalUnsafe(src []byte) []byte { 13874 size := s.SizeBytes() 13875 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13876 return src[size:] 13877 } 13878 13879 // CopyOutN implements marshal.Marshallable.CopyOutN. 13880 func (s *ShmInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13881 // Construct a slice backed by dst's underlying memory. 13882 var buf []byte 13883 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13884 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13885 hdr.Len = s.SizeBytes() 13886 hdr.Cap = s.SizeBytes() 13887 13888 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13889 // Since we bypassed the compiler's escape analysis, indicate that s 13890 // must live until the use above. 13891 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13892 return length, err 13893 } 13894 13895 // CopyOut implements marshal.Marshallable.CopyOut. 13896 func (s *ShmInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13897 return s.CopyOutN(cc, addr, s.SizeBytes()) 13898 } 13899 13900 // CopyIn implements marshal.Marshallable.CopyIn. 13901 func (s *ShmInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13902 // Construct a slice backed by dst's underlying memory. 13903 var buf []byte 13904 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13905 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13906 hdr.Len = s.SizeBytes() 13907 hdr.Cap = s.SizeBytes() 13908 13909 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13910 // Since we bypassed the compiler's escape analysis, indicate that s 13911 // must live until the use above. 13912 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13913 return length, err 13914 } 13915 13916 // WriteTo implements io.WriterTo.WriteTo. 13917 func (s *ShmInfo) WriteTo(writer io.Writer) (int64, error) { 13918 // Construct a slice backed by dst's underlying memory. 13919 var buf []byte 13920 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13921 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13922 hdr.Len = s.SizeBytes() 13923 hdr.Cap = s.SizeBytes() 13924 13925 length, err := writer.Write(buf) 13926 // Since we bypassed the compiler's escape analysis, indicate that s 13927 // must live until the use above. 13928 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13929 return int64(length), err 13930 } 13931 13932 // SizeBytes implements marshal.Marshallable.SizeBytes. 13933 func (s *ShmParams) SizeBytes() int { 13934 return 40 13935 } 13936 13937 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13938 func (s *ShmParams) MarshalBytes(dst []byte) []byte { 13939 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMax)) 13940 dst = dst[8:] 13941 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMin)) 13942 dst = dst[8:] 13943 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMni)) 13944 dst = dst[8:] 13945 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSeg)) 13946 dst = dst[8:] 13947 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmAll)) 13948 dst = dst[8:] 13949 return dst 13950 } 13951 13952 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13953 func (s *ShmParams) UnmarshalBytes(src []byte) []byte { 13954 s.ShmMax = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13955 src = src[8:] 13956 s.ShmMin = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13957 src = src[8:] 13958 s.ShmMni = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13959 src = src[8:] 13960 s.ShmSeg = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13961 src = src[8:] 13962 s.ShmAll = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13963 src = src[8:] 13964 return src 13965 } 13966 13967 // Packed implements marshal.Marshallable.Packed. 13968 //go:nosplit 13969 func (s *ShmParams) Packed() bool { 13970 return true 13971 } 13972 13973 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13974 func (s *ShmParams) MarshalUnsafe(dst []byte) []byte { 13975 size := s.SizeBytes() 13976 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13977 return dst[size:] 13978 } 13979 13980 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13981 func (s *ShmParams) UnmarshalUnsafe(src []byte) []byte { 13982 size := s.SizeBytes() 13983 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13984 return src[size:] 13985 } 13986 13987 // CopyOutN implements marshal.Marshallable.CopyOutN. 13988 func (s *ShmParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13989 // Construct a slice backed by dst's underlying memory. 13990 var buf []byte 13991 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13992 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13993 hdr.Len = s.SizeBytes() 13994 hdr.Cap = s.SizeBytes() 13995 13996 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13997 // Since we bypassed the compiler's escape analysis, indicate that s 13998 // must live until the use above. 13999 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14000 return length, err 14001 } 14002 14003 // CopyOut implements marshal.Marshallable.CopyOut. 14004 func (s *ShmParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14005 return s.CopyOutN(cc, addr, s.SizeBytes()) 14006 } 14007 14008 // CopyIn implements marshal.Marshallable.CopyIn. 14009 func (s *ShmParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14010 // Construct a slice backed by dst's underlying memory. 14011 var buf []byte 14012 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14013 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14014 hdr.Len = s.SizeBytes() 14015 hdr.Cap = s.SizeBytes() 14016 14017 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14018 // Since we bypassed the compiler's escape analysis, indicate that s 14019 // must live until the use above. 14020 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14021 return length, err 14022 } 14023 14024 // WriteTo implements io.WriterTo.WriteTo. 14025 func (s *ShmParams) WriteTo(writer io.Writer) (int64, error) { 14026 // Construct a slice backed by dst's underlying memory. 14027 var buf []byte 14028 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14029 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14030 hdr.Len = s.SizeBytes() 14031 hdr.Cap = s.SizeBytes() 14032 14033 length, err := writer.Write(buf) 14034 // Since we bypassed the compiler's escape analysis, indicate that s 14035 // must live until the use above. 14036 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14037 return int64(length), err 14038 } 14039 14040 // SizeBytes implements marshal.Marshallable.SizeBytes. 14041 func (s *ShmidDS) SizeBytes() int { 14042 return 40 + 14043 (*IPCPerm)(nil).SizeBytes() + 14044 (*TimeT)(nil).SizeBytes() + 14045 (*TimeT)(nil).SizeBytes() + 14046 (*TimeT)(nil).SizeBytes() 14047 } 14048 14049 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14050 func (s *ShmidDS) MarshalBytes(dst []byte) []byte { 14051 dst = s.ShmPerm.MarshalUnsafe(dst) 14052 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSegsz)) 14053 dst = dst[8:] 14054 dst = s.ShmAtime.MarshalUnsafe(dst) 14055 dst = s.ShmDtime.MarshalUnsafe(dst) 14056 dst = s.ShmCtime.MarshalUnsafe(dst) 14057 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmCpid)) 14058 dst = dst[4:] 14059 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmLpid)) 14060 dst = dst[4:] 14061 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmNattach)) 14062 dst = dst[8:] 14063 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused4)) 14064 dst = dst[8:] 14065 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused5)) 14066 dst = dst[8:] 14067 return dst 14068 } 14069 14070 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14071 func (s *ShmidDS) UnmarshalBytes(src []byte) []byte { 14072 src = s.ShmPerm.UnmarshalUnsafe(src) 14073 s.ShmSegsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14074 src = src[8:] 14075 src = s.ShmAtime.UnmarshalUnsafe(src) 14076 src = s.ShmDtime.UnmarshalUnsafe(src) 14077 src = s.ShmCtime.UnmarshalUnsafe(src) 14078 s.ShmCpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14079 src = src[4:] 14080 s.ShmLpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14081 src = src[4:] 14082 s.ShmNattach = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14083 src = src[8:] 14084 s.Unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14085 src = src[8:] 14086 s.Unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14087 src = src[8:] 14088 return src 14089 } 14090 14091 // Packed implements marshal.Marshallable.Packed. 14092 //go:nosplit 14093 func (s *ShmidDS) Packed() bool { 14094 return s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() 14095 } 14096 14097 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14098 func (s *ShmidDS) MarshalUnsafe(dst []byte) []byte { 14099 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14100 size := s.SizeBytes() 14101 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14102 return dst[size:] 14103 } 14104 // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 14105 return s.MarshalBytes(dst) 14106 } 14107 14108 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14109 func (s *ShmidDS) UnmarshalUnsafe(src []byte) []byte { 14110 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14111 size := s.SizeBytes() 14112 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14113 return src[size:] 14114 } 14115 // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14116 return s.UnmarshalBytes(src) 14117 } 14118 14119 // CopyOutN implements marshal.Marshallable.CopyOutN. 14120 func (s *ShmidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14121 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14122 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 14123 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14124 s.MarshalBytes(buf) // escapes: fallback. 14125 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14126 } 14127 14128 // Construct a slice backed by dst's underlying memory. 14129 var buf []byte 14130 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14131 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14132 hdr.Len = s.SizeBytes() 14133 hdr.Cap = s.SizeBytes() 14134 14135 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14136 // Since we bypassed the compiler's escape analysis, indicate that s 14137 // must live until the use above. 14138 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14139 return length, err 14140 } 14141 14142 // CopyOut implements marshal.Marshallable.CopyOut. 14143 func (s *ShmidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14144 return s.CopyOutN(cc, addr, s.SizeBytes()) 14145 } 14146 14147 // CopyIn implements marshal.Marshallable.CopyIn. 14148 func (s *ShmidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14149 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14150 // Type ShmidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14151 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14152 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14153 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14154 // partially unmarshalled struct. 14155 s.UnmarshalBytes(buf) // escapes: fallback. 14156 return length, err 14157 } 14158 14159 // Construct a slice backed by dst's underlying memory. 14160 var buf []byte 14161 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14162 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14163 hdr.Len = s.SizeBytes() 14164 hdr.Cap = s.SizeBytes() 14165 14166 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14167 // Since we bypassed the compiler's escape analysis, indicate that s 14168 // must live until the use above. 14169 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14170 return length, err 14171 } 14172 14173 // WriteTo implements io.WriterTo.WriteTo. 14174 func (s *ShmidDS) WriteTo(writer io.Writer) (int64, error) { 14175 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14176 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 14177 buf := make([]byte, s.SizeBytes()) 14178 s.MarshalBytes(buf) 14179 length, err := writer.Write(buf) 14180 return int64(length), err 14181 } 14182 14183 // Construct a slice backed by dst's underlying memory. 14184 var buf []byte 14185 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14186 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14187 hdr.Len = s.SizeBytes() 14188 hdr.Cap = s.SizeBytes() 14189 14190 length, err := writer.Write(buf) 14191 // Since we bypassed the compiler's escape analysis, indicate that s 14192 // must live until the use above. 14193 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14194 return int64(length), err 14195 } 14196 14197 // SizeBytes implements marshal.Marshallable.SizeBytes. 14198 func (s *SigAction) SizeBytes() int { 14199 return 24 + 14200 (*SignalSet)(nil).SizeBytes() 14201 } 14202 14203 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14204 func (s *SigAction) MarshalBytes(dst []byte) []byte { 14205 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Handler)) 14206 dst = dst[8:] 14207 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 14208 dst = dst[8:] 14209 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Restorer)) 14210 dst = dst[8:] 14211 dst = s.Mask.MarshalUnsafe(dst) 14212 return dst 14213 } 14214 14215 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14216 func (s *SigAction) UnmarshalBytes(src []byte) []byte { 14217 s.Handler = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14218 src = src[8:] 14219 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14220 src = src[8:] 14221 s.Restorer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14222 src = src[8:] 14223 src = s.Mask.UnmarshalUnsafe(src) 14224 return src 14225 } 14226 14227 // Packed implements marshal.Marshallable.Packed. 14228 //go:nosplit 14229 func (s *SigAction) Packed() bool { 14230 return s.Mask.Packed() 14231 } 14232 14233 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14234 func (s *SigAction) MarshalUnsafe(dst []byte) []byte { 14235 if s.Mask.Packed() { 14236 size := s.SizeBytes() 14237 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14238 return dst[size:] 14239 } 14240 // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes. 14241 return s.MarshalBytes(dst) 14242 } 14243 14244 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14245 func (s *SigAction) UnmarshalUnsafe(src []byte) []byte { 14246 if s.Mask.Packed() { 14247 size := s.SizeBytes() 14248 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14249 return src[size:] 14250 } 14251 // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14252 return s.UnmarshalBytes(src) 14253 } 14254 14255 // CopyOutN implements marshal.Marshallable.CopyOutN. 14256 func (s *SigAction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14257 if !s.Mask.Packed() { 14258 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 14259 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14260 s.MarshalBytes(buf) // escapes: fallback. 14261 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14262 } 14263 14264 // Construct a slice backed by dst's underlying memory. 14265 var buf []byte 14266 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14267 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14268 hdr.Len = s.SizeBytes() 14269 hdr.Cap = s.SizeBytes() 14270 14271 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14272 // Since we bypassed the compiler's escape analysis, indicate that s 14273 // must live until the use above. 14274 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14275 return length, err 14276 } 14277 14278 // CopyOut implements marshal.Marshallable.CopyOut. 14279 func (s *SigAction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14280 return s.CopyOutN(cc, addr, s.SizeBytes()) 14281 } 14282 14283 // CopyIn implements marshal.Marshallable.CopyIn. 14284 func (s *SigAction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14285 if !s.Mask.Packed() { 14286 // Type SigAction doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14287 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14288 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14289 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14290 // partially unmarshalled struct. 14291 s.UnmarshalBytes(buf) // escapes: fallback. 14292 return length, err 14293 } 14294 14295 // Construct a slice backed by dst's underlying memory. 14296 var buf []byte 14297 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14298 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14299 hdr.Len = s.SizeBytes() 14300 hdr.Cap = s.SizeBytes() 14301 14302 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14303 // Since we bypassed the compiler's escape analysis, indicate that s 14304 // must live until the use above. 14305 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14306 return length, err 14307 } 14308 14309 // WriteTo implements io.WriterTo.WriteTo. 14310 func (s *SigAction) WriteTo(writer io.Writer) (int64, error) { 14311 if !s.Mask.Packed() { 14312 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 14313 buf := make([]byte, s.SizeBytes()) 14314 s.MarshalBytes(buf) 14315 length, err := writer.Write(buf) 14316 return int64(length), err 14317 } 14318 14319 // Construct a slice backed by dst's underlying memory. 14320 var buf []byte 14321 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14322 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14323 hdr.Len = s.SizeBytes() 14324 hdr.Cap = s.SizeBytes() 14325 14326 length, err := writer.Write(buf) 14327 // Since we bypassed the compiler's escape analysis, indicate that s 14328 // must live until the use above. 14329 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14330 return int64(length), err 14331 } 14332 14333 // SizeBytes implements marshal.Marshallable.SizeBytes. 14334 func (s *Sigevent) SizeBytes() int { 14335 return 20 + 14336 1*44 14337 } 14338 14339 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14340 func (s *Sigevent) MarshalBytes(dst []byte) []byte { 14341 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Value)) 14342 dst = dst[8:] 14343 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 14344 dst = dst[4:] 14345 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Notify)) 14346 dst = dst[4:] 14347 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Tid)) 14348 dst = dst[4:] 14349 for idx := 0; idx < 44; idx++ { 14350 dst[0] = byte(s.UnRemainder[idx]) 14351 dst = dst[1:] 14352 } 14353 return dst 14354 } 14355 14356 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14357 func (s *Sigevent) UnmarshalBytes(src []byte) []byte { 14358 s.Value = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14359 src = src[8:] 14360 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 14361 src = src[4:] 14362 s.Notify = int32(hostarch.ByteOrder.Uint32(src[:4])) 14363 src = src[4:] 14364 s.Tid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14365 src = src[4:] 14366 for idx := 0; idx < 44; idx++ { 14367 s.UnRemainder[idx] = src[0] 14368 src = src[1:] 14369 } 14370 return src 14371 } 14372 14373 // Packed implements marshal.Marshallable.Packed. 14374 //go:nosplit 14375 func (s *Sigevent) Packed() bool { 14376 return true 14377 } 14378 14379 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14380 func (s *Sigevent) MarshalUnsafe(dst []byte) []byte { 14381 size := s.SizeBytes() 14382 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14383 return dst[size:] 14384 } 14385 14386 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14387 func (s *Sigevent) UnmarshalUnsafe(src []byte) []byte { 14388 size := s.SizeBytes() 14389 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14390 return src[size:] 14391 } 14392 14393 // CopyOutN implements marshal.Marshallable.CopyOutN. 14394 func (s *Sigevent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14395 // Construct a slice backed by dst's underlying memory. 14396 var buf []byte 14397 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14398 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14399 hdr.Len = s.SizeBytes() 14400 hdr.Cap = s.SizeBytes() 14401 14402 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14403 // Since we bypassed the compiler's escape analysis, indicate that s 14404 // must live until the use above. 14405 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14406 return length, err 14407 } 14408 14409 // CopyOut implements marshal.Marshallable.CopyOut. 14410 func (s *Sigevent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14411 return s.CopyOutN(cc, addr, s.SizeBytes()) 14412 } 14413 14414 // CopyIn implements marshal.Marshallable.CopyIn. 14415 func (s *Sigevent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14416 // Construct a slice backed by dst's underlying memory. 14417 var buf []byte 14418 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14419 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14420 hdr.Len = s.SizeBytes() 14421 hdr.Cap = s.SizeBytes() 14422 14423 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14424 // Since we bypassed the compiler's escape analysis, indicate that s 14425 // must live until the use above. 14426 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14427 return length, err 14428 } 14429 14430 // WriteTo implements io.WriterTo.WriteTo. 14431 func (s *Sigevent) WriteTo(writer io.Writer) (int64, error) { 14432 // Construct a slice backed by dst's underlying memory. 14433 var buf []byte 14434 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14435 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14436 hdr.Len = s.SizeBytes() 14437 hdr.Cap = s.SizeBytes() 14438 14439 length, err := writer.Write(buf) 14440 // Since we bypassed the compiler's escape analysis, indicate that s 14441 // must live until the use above. 14442 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14443 return int64(length), err 14444 } 14445 14446 // SizeBytes implements marshal.Marshallable.SizeBytes. 14447 func (s *SignalInfo) SizeBytes() int { 14448 return 16 + 14449 1*(128-16) 14450 } 14451 14452 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14453 func (s *SignalInfo) MarshalBytes(dst []byte) []byte { 14454 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 14455 dst = dst[4:] 14456 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 14457 dst = dst[4:] 14458 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 14459 dst = dst[4:] 14460 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 14461 dst = dst[4:] 14462 for idx := 0; idx < (128-16); idx++ { 14463 dst[0] = byte(s.Fields[idx]) 14464 dst = dst[1:] 14465 } 14466 return dst 14467 } 14468 14469 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14470 func (s *SignalInfo) UnmarshalBytes(src []byte) []byte { 14471 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 14472 src = src[4:] 14473 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 14474 src = src[4:] 14475 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 14476 src = src[4:] 14477 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 14478 src = src[4:] 14479 for idx := 0; idx < (128-16); idx++ { 14480 s.Fields[idx] = src[0] 14481 src = src[1:] 14482 } 14483 return src 14484 } 14485 14486 // Packed implements marshal.Marshallable.Packed. 14487 //go:nosplit 14488 func (s *SignalInfo) Packed() bool { 14489 return true 14490 } 14491 14492 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14493 func (s *SignalInfo) MarshalUnsafe(dst []byte) []byte { 14494 size := s.SizeBytes() 14495 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14496 return dst[size:] 14497 } 14498 14499 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14500 func (s *SignalInfo) UnmarshalUnsafe(src []byte) []byte { 14501 size := s.SizeBytes() 14502 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14503 return src[size:] 14504 } 14505 14506 // CopyOutN implements marshal.Marshallable.CopyOutN. 14507 func (s *SignalInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14508 // Construct a slice backed by dst's underlying memory. 14509 var buf []byte 14510 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14511 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14512 hdr.Len = s.SizeBytes() 14513 hdr.Cap = s.SizeBytes() 14514 14515 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14516 // Since we bypassed the compiler's escape analysis, indicate that s 14517 // must live until the use above. 14518 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14519 return length, err 14520 } 14521 14522 // CopyOut implements marshal.Marshallable.CopyOut. 14523 func (s *SignalInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14524 return s.CopyOutN(cc, addr, s.SizeBytes()) 14525 } 14526 14527 // CopyIn implements marshal.Marshallable.CopyIn. 14528 func (s *SignalInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14529 // Construct a slice backed by dst's underlying memory. 14530 var buf []byte 14531 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14532 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14533 hdr.Len = s.SizeBytes() 14534 hdr.Cap = s.SizeBytes() 14535 14536 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14537 // Since we bypassed the compiler's escape analysis, indicate that s 14538 // must live until the use above. 14539 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14540 return length, err 14541 } 14542 14543 // WriteTo implements io.WriterTo.WriteTo. 14544 func (s *SignalInfo) WriteTo(writer io.Writer) (int64, error) { 14545 // Construct a slice backed by dst's underlying memory. 14546 var buf []byte 14547 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14548 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14549 hdr.Len = s.SizeBytes() 14550 hdr.Cap = s.SizeBytes() 14551 14552 length, err := writer.Write(buf) 14553 // Since we bypassed the compiler's escape analysis, indicate that s 14554 // must live until the use above. 14555 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14556 return int64(length), err 14557 } 14558 14559 // SizeBytes implements marshal.Marshallable.SizeBytes. 14560 //go:nosplit 14561 func (s *SignalSet) SizeBytes() int { 14562 return 8 14563 } 14564 14565 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14566 func (s *SignalSet) MarshalBytes(dst []byte) []byte { 14567 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*s)) 14568 return dst[8:] 14569 } 14570 14571 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14572 func (s *SignalSet) UnmarshalBytes(src []byte) []byte { 14573 *s = SignalSet(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 14574 return src[8:] 14575 } 14576 14577 // Packed implements marshal.Marshallable.Packed. 14578 //go:nosplit 14579 func (s *SignalSet) Packed() bool { 14580 // Scalar newtypes are always packed. 14581 return true 14582 } 14583 14584 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14585 func (s *SignalSet) MarshalUnsafe(dst []byte) []byte { 14586 size := s.SizeBytes() 14587 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14588 return dst[size:] 14589 } 14590 14591 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14592 func (s *SignalSet) UnmarshalUnsafe(src []byte) []byte { 14593 size := s.SizeBytes() 14594 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14595 return src[size:] 14596 } 14597 14598 // CopyOutN implements marshal.Marshallable.CopyOutN. 14599 func (s *SignalSet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14600 // Construct a slice backed by dst's underlying memory. 14601 var buf []byte 14602 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14603 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14604 hdr.Len = s.SizeBytes() 14605 hdr.Cap = s.SizeBytes() 14606 14607 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14608 // Since we bypassed the compiler's escape analysis, indicate that s 14609 // must live until the use above. 14610 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14611 return length, err 14612 } 14613 14614 // CopyOut implements marshal.Marshallable.CopyOut. 14615 func (s *SignalSet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14616 return s.CopyOutN(cc, addr, s.SizeBytes()) 14617 } 14618 14619 // CopyIn implements marshal.Marshallable.CopyIn. 14620 func (s *SignalSet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14621 // Construct a slice backed by dst's underlying memory. 14622 var buf []byte 14623 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14624 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14625 hdr.Len = s.SizeBytes() 14626 hdr.Cap = s.SizeBytes() 14627 14628 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14629 // Since we bypassed the compiler's escape analysis, indicate that s 14630 // must live until the use above. 14631 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14632 return length, err 14633 } 14634 14635 // WriteTo implements io.WriterTo.WriteTo. 14636 func (s *SignalSet) WriteTo(writer io.Writer) (int64, error) { 14637 // Construct a slice backed by dst's underlying memory. 14638 var buf []byte 14639 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14640 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14641 hdr.Len = s.SizeBytes() 14642 hdr.Cap = s.SizeBytes() 14643 14644 length, err := writer.Write(buf) 14645 // Since we bypassed the compiler's escape analysis, indicate that s 14646 // must live until the use above. 14647 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14648 return int64(length), err 14649 } 14650 14651 // SizeBytes implements marshal.Marshallable.SizeBytes. 14652 func (s *SignalStack) SizeBytes() int { 14653 return 24 14654 } 14655 14656 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14657 func (s *SignalStack) MarshalBytes(dst []byte) []byte { 14658 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 14659 dst = dst[8:] 14660 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flags)) 14661 dst = dst[4:] 14662 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 14663 dst = dst[4:] 14664 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 14665 dst = dst[8:] 14666 return dst 14667 } 14668 14669 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14670 func (s *SignalStack) UnmarshalBytes(src []byte) []byte { 14671 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14672 src = src[8:] 14673 s.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14674 src = src[4:] 14675 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 14676 src = src[4:] 14677 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14678 src = src[8:] 14679 return src 14680 } 14681 14682 // Packed implements marshal.Marshallable.Packed. 14683 //go:nosplit 14684 func (s *SignalStack) Packed() bool { 14685 return true 14686 } 14687 14688 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14689 func (s *SignalStack) MarshalUnsafe(dst []byte) []byte { 14690 size := s.SizeBytes() 14691 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14692 return dst[size:] 14693 } 14694 14695 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14696 func (s *SignalStack) UnmarshalUnsafe(src []byte) []byte { 14697 size := s.SizeBytes() 14698 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14699 return src[size:] 14700 } 14701 14702 // CopyOutN implements marshal.Marshallable.CopyOutN. 14703 func (s *SignalStack) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14704 // Construct a slice backed by dst's underlying memory. 14705 var buf []byte 14706 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14707 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14708 hdr.Len = s.SizeBytes() 14709 hdr.Cap = s.SizeBytes() 14710 14711 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14712 // Since we bypassed the compiler's escape analysis, indicate that s 14713 // must live until the use above. 14714 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14715 return length, err 14716 } 14717 14718 // CopyOut implements marshal.Marshallable.CopyOut. 14719 func (s *SignalStack) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14720 return s.CopyOutN(cc, addr, s.SizeBytes()) 14721 } 14722 14723 // CopyIn implements marshal.Marshallable.CopyIn. 14724 func (s *SignalStack) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14725 // Construct a slice backed by dst's underlying memory. 14726 var buf []byte 14727 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14728 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14729 hdr.Len = s.SizeBytes() 14730 hdr.Cap = s.SizeBytes() 14731 14732 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14733 // Since we bypassed the compiler's escape analysis, indicate that s 14734 // must live until the use above. 14735 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14736 return length, err 14737 } 14738 14739 // WriteTo implements io.WriterTo.WriteTo. 14740 func (s *SignalStack) WriteTo(writer io.Writer) (int64, error) { 14741 // Construct a slice backed by dst's underlying memory. 14742 var buf []byte 14743 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14744 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14745 hdr.Len = s.SizeBytes() 14746 hdr.Cap = s.SizeBytes() 14747 14748 length, err := writer.Write(buf) 14749 // Since we bypassed the compiler's escape analysis, indicate that s 14750 // must live until the use above. 14751 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14752 return int64(length), err 14753 } 14754 14755 // SizeBytes implements marshal.Marshallable.SizeBytes. 14756 func (s *SignalfdSiginfo) SizeBytes() int { 14757 return 82 + 14758 1*48 14759 } 14760 14761 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14762 func (s *SignalfdSiginfo) MarshalBytes(dst []byte) []byte { 14763 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 14764 dst = dst[4:] 14765 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 14766 dst = dst[4:] 14767 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 14768 dst = dst[4:] 14769 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PID)) 14770 dst = dst[4:] 14771 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 14772 dst = dst[4:] 14773 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FD)) 14774 dst = dst[4:] 14775 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TID)) 14776 dst = dst[4:] 14777 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Band)) 14778 dst = dst[4:] 14779 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Overrun)) 14780 dst = dst[4:] 14781 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TrapNo)) 14782 dst = dst[4:] 14783 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Status)) 14784 dst = dst[4:] 14785 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Int)) 14786 dst = dst[4:] 14787 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ptr)) 14788 dst = dst[8:] 14789 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.UTime)) 14790 dst = dst[8:] 14791 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.STime)) 14792 dst = dst[8:] 14793 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 14794 dst = dst[8:] 14795 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.AddrLSB)) 14796 dst = dst[2:] 14797 // Padding: dst[:sizeof(uint8)*48] ~= [48]uint8{0} 14798 dst = dst[1*(48):] 14799 return dst 14800 } 14801 14802 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14803 func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) []byte { 14804 s.Signo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14805 src = src[4:] 14806 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 14807 src = src[4:] 14808 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 14809 src = src[4:] 14810 s.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14811 src = src[4:] 14812 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14813 src = src[4:] 14814 s.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 14815 src = src[4:] 14816 s.TID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14817 src = src[4:] 14818 s.Band = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14819 src = src[4:] 14820 s.Overrun = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14821 src = src[4:] 14822 s.TrapNo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14823 src = src[4:] 14824 s.Status = int32(hostarch.ByteOrder.Uint32(src[:4])) 14825 src = src[4:] 14826 s.Int = int32(hostarch.ByteOrder.Uint32(src[:4])) 14827 src = src[4:] 14828 s.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14829 src = src[8:] 14830 s.UTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14831 src = src[8:] 14832 s.STime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14833 src = src[8:] 14834 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14835 src = src[8:] 14836 s.AddrLSB = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14837 src = src[2:] 14838 // Padding: ~ copy([48]uint8(s._), src[:sizeof(uint8)*48]) 14839 src = src[1*(48):] 14840 return src 14841 } 14842 14843 // Packed implements marshal.Marshallable.Packed. 14844 //go:nosplit 14845 func (s *SignalfdSiginfo) Packed() bool { 14846 return false 14847 } 14848 14849 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14850 func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) []byte { 14851 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to MarshalBytes. 14852 return s.MarshalBytes(dst) 14853 } 14854 14855 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14856 func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) []byte { 14857 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14858 return s.UnmarshalBytes(src) 14859 } 14860 14861 // CopyOutN implements marshal.Marshallable.CopyOutN. 14862 func (s *SignalfdSiginfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14863 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 14864 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14865 s.MarshalBytes(buf) // escapes: fallback. 14866 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14867 } 14868 14869 // CopyOut implements marshal.Marshallable.CopyOut. 14870 func (s *SignalfdSiginfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14871 return s.CopyOutN(cc, addr, s.SizeBytes()) 14872 } 14873 14874 // CopyIn implements marshal.Marshallable.CopyIn. 14875 func (s *SignalfdSiginfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14876 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14877 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14878 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14879 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14880 // partially unmarshalled struct. 14881 s.UnmarshalBytes(buf) // escapes: fallback. 14882 return length, err 14883 } 14884 14885 // WriteTo implements io.WriterTo.WriteTo. 14886 func (s *SignalfdSiginfo) WriteTo(writer io.Writer) (int64, error) { 14887 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 14888 buf := make([]byte, s.SizeBytes()) 14889 s.MarshalBytes(buf) 14890 length, err := writer.Write(buf) 14891 return int64(length), err 14892 } 14893 14894 // SizeBytes implements marshal.Marshallable.SizeBytes. 14895 func (c *ControlMessageCredentials) SizeBytes() int { 14896 return 12 14897 } 14898 14899 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14900 func (c *ControlMessageCredentials) MarshalBytes(dst []byte) []byte { 14901 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.PID)) 14902 dst = dst[4:] 14903 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.UID)) 14904 dst = dst[4:] 14905 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.GID)) 14906 dst = dst[4:] 14907 return dst 14908 } 14909 14910 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14911 func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) []byte { 14912 c.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 14913 src = src[4:] 14914 c.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14915 src = src[4:] 14916 c.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14917 src = src[4:] 14918 return src 14919 } 14920 14921 // Packed implements marshal.Marshallable.Packed. 14922 //go:nosplit 14923 func (c *ControlMessageCredentials) Packed() bool { 14924 return true 14925 } 14926 14927 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14928 func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) []byte { 14929 size := c.SizeBytes() 14930 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 14931 return dst[size:] 14932 } 14933 14934 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14935 func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) []byte { 14936 size := c.SizeBytes() 14937 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 14938 return src[size:] 14939 } 14940 14941 // CopyOutN implements marshal.Marshallable.CopyOutN. 14942 func (c *ControlMessageCredentials) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14943 // Construct a slice backed by dst's underlying memory. 14944 var buf []byte 14945 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14946 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 14947 hdr.Len = c.SizeBytes() 14948 hdr.Cap = c.SizeBytes() 14949 14950 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14951 // Since we bypassed the compiler's escape analysis, indicate that c 14952 // must live until the use above. 14953 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 14954 return length, err 14955 } 14956 14957 // CopyOut implements marshal.Marshallable.CopyOut. 14958 func (c *ControlMessageCredentials) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14959 return c.CopyOutN(cc, addr, c.SizeBytes()) 14960 } 14961 14962 // CopyIn implements marshal.Marshallable.CopyIn. 14963 func (c *ControlMessageCredentials) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14964 // Construct a slice backed by dst's underlying memory. 14965 var buf []byte 14966 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14967 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 14968 hdr.Len = c.SizeBytes() 14969 hdr.Cap = c.SizeBytes() 14970 14971 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14972 // Since we bypassed the compiler's escape analysis, indicate that c 14973 // must live until the use above. 14974 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 14975 return length, err 14976 } 14977 14978 // WriteTo implements io.WriterTo.WriteTo. 14979 func (c *ControlMessageCredentials) WriteTo(writer io.Writer) (int64, error) { 14980 // Construct a slice backed by dst's underlying memory. 14981 var buf []byte 14982 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14983 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 14984 hdr.Len = c.SizeBytes() 14985 hdr.Cap = c.SizeBytes() 14986 14987 length, err := writer.Write(buf) 14988 // Since we bypassed the compiler's escape analysis, indicate that c 14989 // must live until the use above. 14990 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 14991 return int64(length), err 14992 } 14993 14994 // SizeBytes implements marshal.Marshallable.SizeBytes. 14995 func (c *ControlMessageHeader) SizeBytes() int { 14996 return 16 14997 } 14998 14999 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15000 func (c *ControlMessageHeader) MarshalBytes(dst []byte) []byte { 15001 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Length)) 15002 dst = dst[8:] 15003 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Level)) 15004 dst = dst[4:] 15005 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Type)) 15006 dst = dst[4:] 15007 return dst 15008 } 15009 15010 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15011 func (c *ControlMessageHeader) UnmarshalBytes(src []byte) []byte { 15012 c.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15013 src = src[8:] 15014 c.Level = int32(hostarch.ByteOrder.Uint32(src[:4])) 15015 src = src[4:] 15016 c.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 15017 src = src[4:] 15018 return src 15019 } 15020 15021 // Packed implements marshal.Marshallable.Packed. 15022 //go:nosplit 15023 func (c *ControlMessageHeader) Packed() bool { 15024 return true 15025 } 15026 15027 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15028 func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) []byte { 15029 size := c.SizeBytes() 15030 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15031 return dst[size:] 15032 } 15033 15034 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15035 func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) []byte { 15036 size := c.SizeBytes() 15037 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15038 return src[size:] 15039 } 15040 15041 // CopyOutN implements marshal.Marshallable.CopyOutN. 15042 func (c *ControlMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15043 // Construct a slice backed by dst's underlying memory. 15044 var buf []byte 15045 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15046 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15047 hdr.Len = c.SizeBytes() 15048 hdr.Cap = c.SizeBytes() 15049 15050 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15051 // Since we bypassed the compiler's escape analysis, indicate that c 15052 // must live until the use above. 15053 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15054 return length, err 15055 } 15056 15057 // CopyOut implements marshal.Marshallable.CopyOut. 15058 func (c *ControlMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15059 return c.CopyOutN(cc, addr, c.SizeBytes()) 15060 } 15061 15062 // CopyIn implements marshal.Marshallable.CopyIn. 15063 func (c *ControlMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15064 // Construct a slice backed by dst's underlying memory. 15065 var buf []byte 15066 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15067 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15068 hdr.Len = c.SizeBytes() 15069 hdr.Cap = c.SizeBytes() 15070 15071 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15072 // Since we bypassed the compiler's escape analysis, indicate that c 15073 // must live until the use above. 15074 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15075 return length, err 15076 } 15077 15078 // WriteTo implements io.WriterTo.WriteTo. 15079 func (c *ControlMessageHeader) WriteTo(writer io.Writer) (int64, error) { 15080 // Construct a slice backed by dst's underlying memory. 15081 var buf []byte 15082 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15083 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15084 hdr.Len = c.SizeBytes() 15085 hdr.Cap = c.SizeBytes() 15086 15087 length, err := writer.Write(buf) 15088 // Since we bypassed the compiler's escape analysis, indicate that c 15089 // must live until the use above. 15090 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15091 return int64(length), err 15092 } 15093 15094 // SizeBytes implements marshal.Marshallable.SizeBytes. 15095 func (c *ControlMessageIPPacketInfo) SizeBytes() int { 15096 return 4 + 15097 (*InetAddr)(nil).SizeBytes() + 15098 (*InetAddr)(nil).SizeBytes() 15099 } 15100 15101 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15102 func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) []byte { 15103 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 15104 dst = dst[4:] 15105 dst = c.LocalAddr.MarshalUnsafe(dst) 15106 dst = c.DestinationAddr.MarshalUnsafe(dst) 15107 return dst 15108 } 15109 15110 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15111 func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) []byte { 15112 c.NIC = int32(hostarch.ByteOrder.Uint32(src[:4])) 15113 src = src[4:] 15114 src = c.LocalAddr.UnmarshalUnsafe(src) 15115 src = c.DestinationAddr.UnmarshalUnsafe(src) 15116 return src 15117 } 15118 15119 // Packed implements marshal.Marshallable.Packed. 15120 //go:nosplit 15121 func (c *ControlMessageIPPacketInfo) Packed() bool { 15122 return c.DestinationAddr.Packed() && c.LocalAddr.Packed() 15123 } 15124 15125 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15126 func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) []byte { 15127 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15128 size := c.SizeBytes() 15129 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15130 return dst[size:] 15131 } 15132 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15133 return c.MarshalBytes(dst) 15134 } 15135 15136 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15137 func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) []byte { 15138 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15139 size := c.SizeBytes() 15140 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15141 return src[size:] 15142 } 15143 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15144 return c.UnmarshalBytes(src) 15145 } 15146 15147 // CopyOutN implements marshal.Marshallable.CopyOutN. 15148 func (c *ControlMessageIPPacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15149 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15150 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15151 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15152 c.MarshalBytes(buf) // escapes: fallback. 15153 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15154 } 15155 15156 // Construct a slice backed by dst's underlying memory. 15157 var buf []byte 15158 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15159 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15160 hdr.Len = c.SizeBytes() 15161 hdr.Cap = c.SizeBytes() 15162 15163 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15164 // Since we bypassed the compiler's escape analysis, indicate that c 15165 // must live until the use above. 15166 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15167 return length, err 15168 } 15169 15170 // CopyOut implements marshal.Marshallable.CopyOut. 15171 func (c *ControlMessageIPPacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15172 return c.CopyOutN(cc, addr, c.SizeBytes()) 15173 } 15174 15175 // CopyIn implements marshal.Marshallable.CopyIn. 15176 func (c *ControlMessageIPPacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15177 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15178 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15179 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15180 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15181 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15182 // partially unmarshalled struct. 15183 c.UnmarshalBytes(buf) // escapes: fallback. 15184 return length, err 15185 } 15186 15187 // Construct a slice backed by dst's underlying memory. 15188 var buf []byte 15189 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15190 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15191 hdr.Len = c.SizeBytes() 15192 hdr.Cap = c.SizeBytes() 15193 15194 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15195 // Since we bypassed the compiler's escape analysis, indicate that c 15196 // must live until the use above. 15197 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15198 return length, err 15199 } 15200 15201 // WriteTo implements io.WriterTo.WriteTo. 15202 func (c *ControlMessageIPPacketInfo) WriteTo(writer io.Writer) (int64, error) { 15203 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15204 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15205 buf := make([]byte, c.SizeBytes()) 15206 c.MarshalBytes(buf) 15207 length, err := writer.Write(buf) 15208 return int64(length), err 15209 } 15210 15211 // Construct a slice backed by dst's underlying memory. 15212 var buf []byte 15213 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15214 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15215 hdr.Len = c.SizeBytes() 15216 hdr.Cap = c.SizeBytes() 15217 15218 length, err := writer.Write(buf) 15219 // Since we bypassed the compiler's escape analysis, indicate that c 15220 // must live until the use above. 15221 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15222 return int64(length), err 15223 } 15224 15225 // SizeBytes implements marshal.Marshallable.SizeBytes. 15226 func (c *ControlMessageIPv6PacketInfo) SizeBytes() int { 15227 return 4 + 15228 (*Inet6Addr)(nil).SizeBytes() 15229 } 15230 15231 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15232 func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) []byte { 15233 dst = c.Addr.MarshalUnsafe(dst) 15234 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 15235 dst = dst[4:] 15236 return dst 15237 } 15238 15239 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15240 func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) []byte { 15241 src = c.Addr.UnmarshalUnsafe(src) 15242 c.NIC = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15243 src = src[4:] 15244 return src 15245 } 15246 15247 // Packed implements marshal.Marshallable.Packed. 15248 //go:nosplit 15249 func (c *ControlMessageIPv6PacketInfo) Packed() bool { 15250 return c.Addr.Packed() 15251 } 15252 15253 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15254 func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) []byte { 15255 if c.Addr.Packed() { 15256 size := c.SizeBytes() 15257 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15258 return dst[size:] 15259 } 15260 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15261 return c.MarshalBytes(dst) 15262 } 15263 15264 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15265 func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) []byte { 15266 if c.Addr.Packed() { 15267 size := c.SizeBytes() 15268 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15269 return src[size:] 15270 } 15271 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15272 return c.UnmarshalBytes(src) 15273 } 15274 15275 // CopyOutN implements marshal.Marshallable.CopyOutN. 15276 func (c *ControlMessageIPv6PacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15277 if !c.Addr.Packed() { 15278 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15279 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15280 c.MarshalBytes(buf) // escapes: fallback. 15281 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15282 } 15283 15284 // Construct a slice backed by dst's underlying memory. 15285 var buf []byte 15286 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15287 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15288 hdr.Len = c.SizeBytes() 15289 hdr.Cap = c.SizeBytes() 15290 15291 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15292 // Since we bypassed the compiler's escape analysis, indicate that c 15293 // must live until the use above. 15294 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15295 return length, err 15296 } 15297 15298 // CopyOut implements marshal.Marshallable.CopyOut. 15299 func (c *ControlMessageIPv6PacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15300 return c.CopyOutN(cc, addr, c.SizeBytes()) 15301 } 15302 15303 // CopyIn implements marshal.Marshallable.CopyIn. 15304 func (c *ControlMessageIPv6PacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15305 if !c.Addr.Packed() { 15306 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15307 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15308 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15309 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15310 // partially unmarshalled struct. 15311 c.UnmarshalBytes(buf) // escapes: fallback. 15312 return length, err 15313 } 15314 15315 // Construct a slice backed by dst's underlying memory. 15316 var buf []byte 15317 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15318 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15319 hdr.Len = c.SizeBytes() 15320 hdr.Cap = c.SizeBytes() 15321 15322 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15323 // Since we bypassed the compiler's escape analysis, indicate that c 15324 // must live until the use above. 15325 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15326 return length, err 15327 } 15328 15329 // WriteTo implements io.WriterTo.WriteTo. 15330 func (c *ControlMessageIPv6PacketInfo) WriteTo(writer io.Writer) (int64, error) { 15331 if !c.Addr.Packed() { 15332 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15333 buf := make([]byte, c.SizeBytes()) 15334 c.MarshalBytes(buf) 15335 length, err := writer.Write(buf) 15336 return int64(length), err 15337 } 15338 15339 // Construct a slice backed by dst's underlying memory. 15340 var buf []byte 15341 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15342 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15343 hdr.Len = c.SizeBytes() 15344 hdr.Cap = c.SizeBytes() 15345 15346 length, err := writer.Write(buf) 15347 // Since we bypassed the compiler's escape analysis, indicate that c 15348 // must live until the use above. 15349 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15350 return int64(length), err 15351 } 15352 15353 // SizeBytes implements marshal.Marshallable.SizeBytes. 15354 func (i *ICMP6Filter) SizeBytes() int { 15355 return 0 + 15356 4*8 15357 } 15358 15359 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15360 func (i *ICMP6Filter) MarshalBytes(dst []byte) []byte { 15361 for idx := 0; idx < 8; idx++ { 15362 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Filter[idx])) 15363 dst = dst[4:] 15364 } 15365 return dst 15366 } 15367 15368 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15369 func (i *ICMP6Filter) UnmarshalBytes(src []byte) []byte { 15370 for idx := 0; idx < 8; idx++ { 15371 i.Filter[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15372 src = src[4:] 15373 } 15374 return src 15375 } 15376 15377 // Packed implements marshal.Marshallable.Packed. 15378 //go:nosplit 15379 func (i *ICMP6Filter) Packed() bool { 15380 return true 15381 } 15382 15383 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15384 func (i *ICMP6Filter) MarshalUnsafe(dst []byte) []byte { 15385 size := i.SizeBytes() 15386 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15387 return dst[size:] 15388 } 15389 15390 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15391 func (i *ICMP6Filter) UnmarshalUnsafe(src []byte) []byte { 15392 size := i.SizeBytes() 15393 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15394 return src[size:] 15395 } 15396 15397 // CopyOutN implements marshal.Marshallable.CopyOutN. 15398 func (i *ICMP6Filter) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15399 // Construct a slice backed by dst's underlying memory. 15400 var buf []byte 15401 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15402 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15403 hdr.Len = i.SizeBytes() 15404 hdr.Cap = i.SizeBytes() 15405 15406 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15407 // Since we bypassed the compiler's escape analysis, indicate that i 15408 // must live until the use above. 15409 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15410 return length, err 15411 } 15412 15413 // CopyOut implements marshal.Marshallable.CopyOut. 15414 func (i *ICMP6Filter) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15415 return i.CopyOutN(cc, addr, i.SizeBytes()) 15416 } 15417 15418 // CopyIn implements marshal.Marshallable.CopyIn. 15419 func (i *ICMP6Filter) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15420 // Construct a slice backed by dst's underlying memory. 15421 var buf []byte 15422 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15423 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15424 hdr.Len = i.SizeBytes() 15425 hdr.Cap = i.SizeBytes() 15426 15427 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15428 // Since we bypassed the compiler's escape analysis, indicate that i 15429 // must live until the use above. 15430 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15431 return length, err 15432 } 15433 15434 // WriteTo implements io.WriterTo.WriteTo. 15435 func (i *ICMP6Filter) WriteTo(writer io.Writer) (int64, error) { 15436 // Construct a slice backed by dst's underlying memory. 15437 var buf []byte 15438 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15439 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15440 hdr.Len = i.SizeBytes() 15441 hdr.Cap = i.SizeBytes() 15442 15443 length, err := writer.Write(buf) 15444 // Since we bypassed the compiler's escape analysis, indicate that i 15445 // must live until the use above. 15446 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15447 return int64(length), err 15448 } 15449 15450 // SizeBytes implements marshal.Marshallable.SizeBytes. 15451 //go:nosplit 15452 func (i *Inet6Addr) SizeBytes() int { 15453 return 1 * 16 15454 } 15455 15456 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15457 func (i *Inet6Addr) MarshalBytes(dst []byte) []byte { 15458 for idx := 0; idx < 16; idx++ { 15459 dst[0] = byte(i[idx]) 15460 dst = dst[1:] 15461 } 15462 return dst 15463 } 15464 15465 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15466 func (i *Inet6Addr) UnmarshalBytes(src []byte) []byte { 15467 for idx := 0; idx < 16; idx++ { 15468 i[idx] = src[0] 15469 src = src[1:] 15470 } 15471 return src 15472 } 15473 15474 // Packed implements marshal.Marshallable.Packed. 15475 //go:nosplit 15476 func (i *Inet6Addr) Packed() bool { 15477 // Array newtypes are always packed. 15478 return true 15479 } 15480 15481 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15482 func (i *Inet6Addr) MarshalUnsafe(dst []byte) []byte { 15483 size := i.SizeBytes() 15484 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 15485 return dst[size:] 15486 } 15487 15488 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15489 func (i *Inet6Addr) UnmarshalUnsafe(src []byte) []byte { 15490 size := i.SizeBytes() 15491 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15492 return src[size:] 15493 } 15494 15495 // CopyOutN implements marshal.Marshallable.CopyOutN. 15496 func (i *Inet6Addr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15497 // Construct a slice backed by dst's underlying memory. 15498 var buf []byte 15499 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15500 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15501 hdr.Len = i.SizeBytes() 15502 hdr.Cap = i.SizeBytes() 15503 15504 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15505 // Since we bypassed the compiler's escape analysis, indicate that i 15506 // must live until the use above. 15507 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15508 return length, err 15509 } 15510 15511 // CopyOut implements marshal.Marshallable.CopyOut. 15512 func (i *Inet6Addr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15513 return i.CopyOutN(cc, addr, i.SizeBytes()) 15514 } 15515 15516 // CopyIn implements marshal.Marshallable.CopyIn. 15517 func (i *Inet6Addr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15518 // Construct a slice backed by dst's underlying memory. 15519 var buf []byte 15520 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15521 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15522 hdr.Len = i.SizeBytes() 15523 hdr.Cap = i.SizeBytes() 15524 15525 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15526 // Since we bypassed the compiler's escape analysis, indicate that i 15527 // must live until the use above. 15528 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15529 return length, err 15530 } 15531 15532 // WriteTo implements io.WriterTo.WriteTo. 15533 func (i *Inet6Addr) WriteTo(writer io.Writer) (int64, error) { 15534 // Construct a slice backed by dst's underlying memory. 15535 var buf []byte 15536 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15537 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15538 hdr.Len = i.SizeBytes() 15539 hdr.Cap = i.SizeBytes() 15540 15541 length, err := writer.Write(buf) 15542 // Since we bypassed the compiler's escape analysis, indicate that i 15543 // must live until the use above. 15544 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15545 return int64(length), err 15546 } 15547 15548 // SizeBytes implements marshal.Marshallable.SizeBytes. 15549 func (i *Inet6MulticastRequest) SizeBytes() int { 15550 return 4 + 15551 (*Inet6Addr)(nil).SizeBytes() 15552 } 15553 15554 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15555 func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) []byte { 15556 dst = i.MulticastAddr.MarshalUnsafe(dst) 15557 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 15558 dst = dst[4:] 15559 return dst 15560 } 15561 15562 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15563 func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) []byte { 15564 src = i.MulticastAddr.UnmarshalUnsafe(src) 15565 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 15566 src = src[4:] 15567 return src 15568 } 15569 15570 // Packed implements marshal.Marshallable.Packed. 15571 //go:nosplit 15572 func (i *Inet6MulticastRequest) Packed() bool { 15573 return i.MulticastAddr.Packed() 15574 } 15575 15576 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15577 func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) []byte { 15578 if i.MulticastAddr.Packed() { 15579 size := i.SizeBytes() 15580 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15581 return dst[size:] 15582 } 15583 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 15584 return i.MarshalBytes(dst) 15585 } 15586 15587 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15588 func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) []byte { 15589 if i.MulticastAddr.Packed() { 15590 size := i.SizeBytes() 15591 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15592 return src[size:] 15593 } 15594 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15595 return i.UnmarshalBytes(src) 15596 } 15597 15598 // CopyOutN implements marshal.Marshallable.CopyOutN. 15599 func (i *Inet6MulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15600 if !i.MulticastAddr.Packed() { 15601 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15602 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15603 i.MarshalBytes(buf) // escapes: fallback. 15604 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15605 } 15606 15607 // Construct a slice backed by dst's underlying memory. 15608 var buf []byte 15609 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15610 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15611 hdr.Len = i.SizeBytes() 15612 hdr.Cap = i.SizeBytes() 15613 15614 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15615 // Since we bypassed the compiler's escape analysis, indicate that i 15616 // must live until the use above. 15617 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15618 return length, err 15619 } 15620 15621 // CopyOut implements marshal.Marshallable.CopyOut. 15622 func (i *Inet6MulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15623 return i.CopyOutN(cc, addr, i.SizeBytes()) 15624 } 15625 15626 // CopyIn implements marshal.Marshallable.CopyIn. 15627 func (i *Inet6MulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15628 if !i.MulticastAddr.Packed() { 15629 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15630 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15631 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15632 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15633 // partially unmarshalled struct. 15634 i.UnmarshalBytes(buf) // escapes: fallback. 15635 return length, err 15636 } 15637 15638 // Construct a slice backed by dst's underlying memory. 15639 var buf []byte 15640 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15641 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15642 hdr.Len = i.SizeBytes() 15643 hdr.Cap = i.SizeBytes() 15644 15645 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15646 // Since we bypassed the compiler's escape analysis, indicate that i 15647 // must live until the use above. 15648 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15649 return length, err 15650 } 15651 15652 // WriteTo implements io.WriterTo.WriteTo. 15653 func (i *Inet6MulticastRequest) WriteTo(writer io.Writer) (int64, error) { 15654 if !i.MulticastAddr.Packed() { 15655 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15656 buf := make([]byte, i.SizeBytes()) 15657 i.MarshalBytes(buf) 15658 length, err := writer.Write(buf) 15659 return int64(length), err 15660 } 15661 15662 // Construct a slice backed by dst's underlying memory. 15663 var buf []byte 15664 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15665 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15666 hdr.Len = i.SizeBytes() 15667 hdr.Cap = i.SizeBytes() 15668 15669 length, err := writer.Write(buf) 15670 // Since we bypassed the compiler's escape analysis, indicate that i 15671 // must live until the use above. 15672 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15673 return int64(length), err 15674 } 15675 15676 // SizeBytes implements marshal.Marshallable.SizeBytes. 15677 //go:nosplit 15678 func (i *InetAddr) SizeBytes() int { 15679 return 1 * 4 15680 } 15681 15682 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15683 func (i *InetAddr) MarshalBytes(dst []byte) []byte { 15684 for idx := 0; idx < 4; idx++ { 15685 dst[0] = byte(i[idx]) 15686 dst = dst[1:] 15687 } 15688 return dst 15689 } 15690 15691 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15692 func (i *InetAddr) UnmarshalBytes(src []byte) []byte { 15693 for idx := 0; idx < 4; idx++ { 15694 i[idx] = src[0] 15695 src = src[1:] 15696 } 15697 return src 15698 } 15699 15700 // Packed implements marshal.Marshallable.Packed. 15701 //go:nosplit 15702 func (i *InetAddr) Packed() bool { 15703 // Array newtypes are always packed. 15704 return true 15705 } 15706 15707 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15708 func (i *InetAddr) MarshalUnsafe(dst []byte) []byte { 15709 size := i.SizeBytes() 15710 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 15711 return dst[size:] 15712 } 15713 15714 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15715 func (i *InetAddr) UnmarshalUnsafe(src []byte) []byte { 15716 size := i.SizeBytes() 15717 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15718 return src[size:] 15719 } 15720 15721 // CopyOutN implements marshal.Marshallable.CopyOutN. 15722 func (i *InetAddr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15723 // Construct a slice backed by dst's underlying memory. 15724 var buf []byte 15725 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15726 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15727 hdr.Len = i.SizeBytes() 15728 hdr.Cap = i.SizeBytes() 15729 15730 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15731 // Since we bypassed the compiler's escape analysis, indicate that i 15732 // must live until the use above. 15733 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15734 return length, err 15735 } 15736 15737 // CopyOut implements marshal.Marshallable.CopyOut. 15738 func (i *InetAddr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15739 return i.CopyOutN(cc, addr, i.SizeBytes()) 15740 } 15741 15742 // CopyIn implements marshal.Marshallable.CopyIn. 15743 func (i *InetAddr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15744 // Construct a slice backed by dst's underlying memory. 15745 var buf []byte 15746 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15747 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15748 hdr.Len = i.SizeBytes() 15749 hdr.Cap = i.SizeBytes() 15750 15751 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15752 // Since we bypassed the compiler's escape analysis, indicate that i 15753 // must live until the use above. 15754 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15755 return length, err 15756 } 15757 15758 // WriteTo implements io.WriterTo.WriteTo. 15759 func (i *InetAddr) WriteTo(writer io.Writer) (int64, error) { 15760 // Construct a slice backed by dst's underlying memory. 15761 var buf []byte 15762 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15763 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15764 hdr.Len = i.SizeBytes() 15765 hdr.Cap = i.SizeBytes() 15766 15767 length, err := writer.Write(buf) 15768 // Since we bypassed the compiler's escape analysis, indicate that i 15769 // must live until the use above. 15770 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15771 return int64(length), err 15772 } 15773 15774 // SizeBytes implements marshal.Marshallable.SizeBytes. 15775 func (i *InetMulticastRequest) SizeBytes() int { 15776 return 0 + 15777 (*InetAddr)(nil).SizeBytes() + 15778 (*InetAddr)(nil).SizeBytes() 15779 } 15780 15781 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15782 func (i *InetMulticastRequest) MarshalBytes(dst []byte) []byte { 15783 dst = i.MulticastAddr.MarshalUnsafe(dst) 15784 dst = i.InterfaceAddr.MarshalUnsafe(dst) 15785 return dst 15786 } 15787 15788 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15789 func (i *InetMulticastRequest) UnmarshalBytes(src []byte) []byte { 15790 src = i.MulticastAddr.UnmarshalUnsafe(src) 15791 src = i.InterfaceAddr.UnmarshalUnsafe(src) 15792 return src 15793 } 15794 15795 // Packed implements marshal.Marshallable.Packed. 15796 //go:nosplit 15797 func (i *InetMulticastRequest) Packed() bool { 15798 return i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() 15799 } 15800 15801 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15802 func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) []byte { 15803 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15804 size := i.SizeBytes() 15805 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15806 return dst[size:] 15807 } 15808 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 15809 return i.MarshalBytes(dst) 15810 } 15811 15812 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15813 func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) []byte { 15814 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15815 size := i.SizeBytes() 15816 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15817 return src[size:] 15818 } 15819 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15820 return i.UnmarshalBytes(src) 15821 } 15822 15823 // CopyOutN implements marshal.Marshallable.CopyOutN. 15824 func (i *InetMulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15825 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15826 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15827 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15828 i.MarshalBytes(buf) // escapes: fallback. 15829 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15830 } 15831 15832 // Construct a slice backed by dst's underlying memory. 15833 var buf []byte 15834 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15835 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15836 hdr.Len = i.SizeBytes() 15837 hdr.Cap = i.SizeBytes() 15838 15839 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15840 // Since we bypassed the compiler's escape analysis, indicate that i 15841 // must live until the use above. 15842 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15843 return length, err 15844 } 15845 15846 // CopyOut implements marshal.Marshallable.CopyOut. 15847 func (i *InetMulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15848 return i.CopyOutN(cc, addr, i.SizeBytes()) 15849 } 15850 15851 // CopyIn implements marshal.Marshallable.CopyIn. 15852 func (i *InetMulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15853 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15854 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15855 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15856 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15857 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15858 // partially unmarshalled struct. 15859 i.UnmarshalBytes(buf) // escapes: fallback. 15860 return length, err 15861 } 15862 15863 // Construct a slice backed by dst's underlying memory. 15864 var buf []byte 15865 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15866 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15867 hdr.Len = i.SizeBytes() 15868 hdr.Cap = i.SizeBytes() 15869 15870 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15871 // Since we bypassed the compiler's escape analysis, indicate that i 15872 // must live until the use above. 15873 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15874 return length, err 15875 } 15876 15877 // WriteTo implements io.WriterTo.WriteTo. 15878 func (i *InetMulticastRequest) WriteTo(writer io.Writer) (int64, error) { 15879 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15880 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15881 buf := make([]byte, i.SizeBytes()) 15882 i.MarshalBytes(buf) 15883 length, err := writer.Write(buf) 15884 return int64(length), err 15885 } 15886 15887 // Construct a slice backed by dst's underlying memory. 15888 var buf []byte 15889 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15890 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15891 hdr.Len = i.SizeBytes() 15892 hdr.Cap = i.SizeBytes() 15893 15894 length, err := writer.Write(buf) 15895 // Since we bypassed the compiler's escape analysis, indicate that i 15896 // must live until the use above. 15897 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15898 return int64(length), err 15899 } 15900 15901 // SizeBytes implements marshal.Marshallable.SizeBytes. 15902 func (i *InetMulticastRequestWithNIC) SizeBytes() int { 15903 return 4 + 15904 (*InetMulticastRequest)(nil).SizeBytes() 15905 } 15906 15907 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15908 func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) []byte { 15909 dst = i.InetMulticastRequest.MarshalUnsafe(dst) 15910 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 15911 dst = dst[4:] 15912 return dst 15913 } 15914 15915 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15916 func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) []byte { 15917 src = i.InetMulticastRequest.UnmarshalUnsafe(src) 15918 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 15919 src = src[4:] 15920 return src 15921 } 15922 15923 // Packed implements marshal.Marshallable.Packed. 15924 //go:nosplit 15925 func (i *InetMulticastRequestWithNIC) Packed() bool { 15926 return i.InetMulticastRequest.Packed() 15927 } 15928 15929 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15930 func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) []byte { 15931 if i.InetMulticastRequest.Packed() { 15932 size := i.SizeBytes() 15933 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15934 return dst[size:] 15935 } 15936 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes. 15937 return i.MarshalBytes(dst) 15938 } 15939 15940 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15941 func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) []byte { 15942 if i.InetMulticastRequest.Packed() { 15943 size := i.SizeBytes() 15944 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15945 return src[size:] 15946 } 15947 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15948 return i.UnmarshalBytes(src) 15949 } 15950 15951 // CopyOutN implements marshal.Marshallable.CopyOutN. 15952 func (i *InetMulticastRequestWithNIC) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15953 if !i.InetMulticastRequest.Packed() { 15954 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 15955 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15956 i.MarshalBytes(buf) // escapes: fallback. 15957 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15958 } 15959 15960 // Construct a slice backed by dst's underlying memory. 15961 var buf []byte 15962 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15963 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15964 hdr.Len = i.SizeBytes() 15965 hdr.Cap = i.SizeBytes() 15966 15967 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15968 // Since we bypassed the compiler's escape analysis, indicate that i 15969 // must live until the use above. 15970 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15971 return length, err 15972 } 15973 15974 // CopyOut implements marshal.Marshallable.CopyOut. 15975 func (i *InetMulticastRequestWithNIC) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15976 return i.CopyOutN(cc, addr, i.SizeBytes()) 15977 } 15978 15979 // CopyIn implements marshal.Marshallable.CopyIn. 15980 func (i *InetMulticastRequestWithNIC) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15981 if !i.InetMulticastRequest.Packed() { 15982 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15983 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15984 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15985 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15986 // partially unmarshalled struct. 15987 i.UnmarshalBytes(buf) // escapes: fallback. 15988 return length, err 15989 } 15990 15991 // Construct a slice backed by dst's underlying memory. 15992 var buf []byte 15993 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15994 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15995 hdr.Len = i.SizeBytes() 15996 hdr.Cap = i.SizeBytes() 15997 15998 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15999 // Since we bypassed the compiler's escape analysis, indicate that i 16000 // must live until the use above. 16001 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16002 return length, err 16003 } 16004 16005 // WriteTo implements io.WriterTo.WriteTo. 16006 func (i *InetMulticastRequestWithNIC) WriteTo(writer io.Writer) (int64, error) { 16007 if !i.InetMulticastRequest.Packed() { 16008 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 16009 buf := make([]byte, i.SizeBytes()) 16010 i.MarshalBytes(buf) 16011 length, err := writer.Write(buf) 16012 return int64(length), err 16013 } 16014 16015 // Construct a slice backed by dst's underlying memory. 16016 var buf []byte 16017 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16018 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16019 hdr.Len = i.SizeBytes() 16020 hdr.Cap = i.SizeBytes() 16021 16022 length, err := writer.Write(buf) 16023 // Since we bypassed the compiler's escape analysis, indicate that i 16024 // must live until the use above. 16025 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16026 return int64(length), err 16027 } 16028 16029 // SizeBytes implements marshal.Marshallable.SizeBytes. 16030 func (l *Linger) SizeBytes() int { 16031 return 8 16032 } 16033 16034 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16035 func (l *Linger) MarshalBytes(dst []byte) []byte { 16036 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.OnOff)) 16037 dst = dst[4:] 16038 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Linger)) 16039 dst = dst[4:] 16040 return dst 16041 } 16042 16043 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16044 func (l *Linger) UnmarshalBytes(src []byte) []byte { 16045 l.OnOff = int32(hostarch.ByteOrder.Uint32(src[:4])) 16046 src = src[4:] 16047 l.Linger = int32(hostarch.ByteOrder.Uint32(src[:4])) 16048 src = src[4:] 16049 return src 16050 } 16051 16052 // Packed implements marshal.Marshallable.Packed. 16053 //go:nosplit 16054 func (l *Linger) Packed() bool { 16055 return true 16056 } 16057 16058 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16059 func (l *Linger) MarshalUnsafe(dst []byte) []byte { 16060 size := l.SizeBytes() 16061 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 16062 return dst[size:] 16063 } 16064 16065 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16066 func (l *Linger) UnmarshalUnsafe(src []byte) []byte { 16067 size := l.SizeBytes() 16068 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 16069 return src[size:] 16070 } 16071 16072 // CopyOutN implements marshal.Marshallable.CopyOutN. 16073 func (l *Linger) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16074 // Construct a slice backed by dst's underlying memory. 16075 var buf []byte 16076 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16077 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16078 hdr.Len = l.SizeBytes() 16079 hdr.Cap = l.SizeBytes() 16080 16081 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16082 // Since we bypassed the compiler's escape analysis, indicate that l 16083 // must live until the use above. 16084 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16085 return length, err 16086 } 16087 16088 // CopyOut implements marshal.Marshallable.CopyOut. 16089 func (l *Linger) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16090 return l.CopyOutN(cc, addr, l.SizeBytes()) 16091 } 16092 16093 // CopyIn implements marshal.Marshallable.CopyIn. 16094 func (l *Linger) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16095 // Construct a slice backed by dst's underlying memory. 16096 var buf []byte 16097 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16098 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16099 hdr.Len = l.SizeBytes() 16100 hdr.Cap = l.SizeBytes() 16101 16102 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16103 // Since we bypassed the compiler's escape analysis, indicate that l 16104 // must live until the use above. 16105 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16106 return length, err 16107 } 16108 16109 // WriteTo implements io.WriterTo.WriteTo. 16110 func (l *Linger) WriteTo(writer io.Writer) (int64, error) { 16111 // Construct a slice backed by dst's underlying memory. 16112 var buf []byte 16113 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16114 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16115 hdr.Len = l.SizeBytes() 16116 hdr.Cap = l.SizeBytes() 16117 16118 length, err := writer.Write(buf) 16119 // Since we bypassed the compiler's escape analysis, indicate that l 16120 // must live until the use above. 16121 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16122 return int64(length), err 16123 } 16124 16125 // SizeBytes implements marshal.Marshallable.SizeBytes. 16126 func (s *SockAddrInet) SizeBytes() int { 16127 return 4 + 16128 (*InetAddr)(nil).SizeBytes() + 16129 1*8 16130 } 16131 16132 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16133 func (s *SockAddrInet) MarshalBytes(dst []byte) []byte { 16134 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16135 dst = dst[2:] 16136 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 16137 dst = dst[2:] 16138 dst = s.Addr.MarshalUnsafe(dst) 16139 // Padding: dst[:sizeof(uint8)*8] ~= [8]uint8{0} 16140 dst = dst[1*(8):] 16141 return dst 16142 } 16143 16144 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16145 func (s *SockAddrInet) UnmarshalBytes(src []byte) []byte { 16146 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16147 src = src[2:] 16148 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16149 src = src[2:] 16150 src = s.Addr.UnmarshalUnsafe(src) 16151 // Padding: ~ copy([8]uint8(s._), src[:sizeof(uint8)*8]) 16152 src = src[1*(8):] 16153 return src 16154 } 16155 16156 // Packed implements marshal.Marshallable.Packed. 16157 //go:nosplit 16158 func (s *SockAddrInet) Packed() bool { 16159 return s.Addr.Packed() 16160 } 16161 16162 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16163 func (s *SockAddrInet) MarshalUnsafe(dst []byte) []byte { 16164 if s.Addr.Packed() { 16165 size := s.SizeBytes() 16166 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16167 return dst[size:] 16168 } 16169 // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes. 16170 return s.MarshalBytes(dst) 16171 } 16172 16173 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16174 func (s *SockAddrInet) UnmarshalUnsafe(src []byte) []byte { 16175 if s.Addr.Packed() { 16176 size := s.SizeBytes() 16177 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16178 return src[size:] 16179 } 16180 // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16181 return s.UnmarshalBytes(src) 16182 } 16183 16184 // CopyOutN implements marshal.Marshallable.CopyOutN. 16185 func (s *SockAddrInet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16186 if !s.Addr.Packed() { 16187 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 16188 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 16189 s.MarshalBytes(buf) // escapes: fallback. 16190 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16191 } 16192 16193 // Construct a slice backed by dst's underlying memory. 16194 var buf []byte 16195 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16196 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16197 hdr.Len = s.SizeBytes() 16198 hdr.Cap = s.SizeBytes() 16199 16200 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16201 // Since we bypassed the compiler's escape analysis, indicate that s 16202 // must live until the use above. 16203 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16204 return length, err 16205 } 16206 16207 // CopyOut implements marshal.Marshallable.CopyOut. 16208 func (s *SockAddrInet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16209 return s.CopyOutN(cc, addr, s.SizeBytes()) 16210 } 16211 16212 // CopyIn implements marshal.Marshallable.CopyIn. 16213 func (s *SockAddrInet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16214 if !s.Addr.Packed() { 16215 // Type SockAddrInet doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16216 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 16217 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16218 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16219 // partially unmarshalled struct. 16220 s.UnmarshalBytes(buf) // escapes: fallback. 16221 return length, err 16222 } 16223 16224 // Construct a slice backed by dst's underlying memory. 16225 var buf []byte 16226 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16227 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16228 hdr.Len = s.SizeBytes() 16229 hdr.Cap = s.SizeBytes() 16230 16231 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16232 // Since we bypassed the compiler's escape analysis, indicate that s 16233 // must live until the use above. 16234 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16235 return length, err 16236 } 16237 16238 // WriteTo implements io.WriterTo.WriteTo. 16239 func (s *SockAddrInet) WriteTo(writer io.Writer) (int64, error) { 16240 if !s.Addr.Packed() { 16241 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 16242 buf := make([]byte, s.SizeBytes()) 16243 s.MarshalBytes(buf) 16244 length, err := writer.Write(buf) 16245 return int64(length), err 16246 } 16247 16248 // Construct a slice backed by dst's underlying memory. 16249 var buf []byte 16250 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16251 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16252 hdr.Len = s.SizeBytes() 16253 hdr.Cap = s.SizeBytes() 16254 16255 length, err := writer.Write(buf) 16256 // Since we bypassed the compiler's escape analysis, indicate that s 16257 // must live until the use above. 16258 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16259 return int64(length), err 16260 } 16261 16262 // SizeBytes implements marshal.Marshallable.SizeBytes. 16263 func (s *SockAddrInet6) SizeBytes() int { 16264 return 12 + 16265 1*16 16266 } 16267 16268 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16269 func (s *SockAddrInet6) MarshalBytes(dst []byte) []byte { 16270 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16271 dst = dst[2:] 16272 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 16273 dst = dst[2:] 16274 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flowinfo)) 16275 dst = dst[4:] 16276 for idx := 0; idx < 16; idx++ { 16277 dst[0] = byte(s.Addr[idx]) 16278 dst = dst[1:] 16279 } 16280 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Scope_id)) 16281 dst = dst[4:] 16282 return dst 16283 } 16284 16285 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16286 func (s *SockAddrInet6) UnmarshalBytes(src []byte) []byte { 16287 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16288 src = src[2:] 16289 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16290 src = src[2:] 16291 s.Flowinfo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16292 src = src[4:] 16293 for idx := 0; idx < 16; idx++ { 16294 s.Addr[idx] = src[0] 16295 src = src[1:] 16296 } 16297 s.Scope_id = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16298 src = src[4:] 16299 return src 16300 } 16301 16302 // Packed implements marshal.Marshallable.Packed. 16303 //go:nosplit 16304 func (s *SockAddrInet6) Packed() bool { 16305 return true 16306 } 16307 16308 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16309 func (s *SockAddrInet6) MarshalUnsafe(dst []byte) []byte { 16310 size := s.SizeBytes() 16311 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16312 return dst[size:] 16313 } 16314 16315 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16316 func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) []byte { 16317 size := s.SizeBytes() 16318 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16319 return src[size:] 16320 } 16321 16322 // CopyOutN implements marshal.Marshallable.CopyOutN. 16323 func (s *SockAddrInet6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16324 // Construct a slice backed by dst's underlying memory. 16325 var buf []byte 16326 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16327 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16328 hdr.Len = s.SizeBytes() 16329 hdr.Cap = s.SizeBytes() 16330 16331 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16332 // Since we bypassed the compiler's escape analysis, indicate that s 16333 // must live until the use above. 16334 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16335 return length, err 16336 } 16337 16338 // CopyOut implements marshal.Marshallable.CopyOut. 16339 func (s *SockAddrInet6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16340 return s.CopyOutN(cc, addr, s.SizeBytes()) 16341 } 16342 16343 // CopyIn implements marshal.Marshallable.CopyIn. 16344 func (s *SockAddrInet6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16345 // Construct a slice backed by dst's underlying memory. 16346 var buf []byte 16347 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16348 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16349 hdr.Len = s.SizeBytes() 16350 hdr.Cap = s.SizeBytes() 16351 16352 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16353 // Since we bypassed the compiler's escape analysis, indicate that s 16354 // must live until the use above. 16355 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16356 return length, err 16357 } 16358 16359 // WriteTo implements io.WriterTo.WriteTo. 16360 func (s *SockAddrInet6) WriteTo(writer io.Writer) (int64, error) { 16361 // Construct a slice backed by dst's underlying memory. 16362 var buf []byte 16363 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16364 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16365 hdr.Len = s.SizeBytes() 16366 hdr.Cap = s.SizeBytes() 16367 16368 length, err := writer.Write(buf) 16369 // Since we bypassed the compiler's escape analysis, indicate that s 16370 // must live until the use above. 16371 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16372 return int64(length), err 16373 } 16374 16375 // SizeBytes implements marshal.Marshallable.SizeBytes. 16376 func (s *SockAddrLink) SizeBytes() int { 16377 return 12 + 16378 1*8 16379 } 16380 16381 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16382 func (s *SockAddrLink) MarshalBytes(dst []byte) []byte { 16383 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16384 dst = dst[2:] 16385 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Protocol)) 16386 dst = dst[2:] 16387 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.InterfaceIndex)) 16388 dst = dst[4:] 16389 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.ARPHardwareType)) 16390 dst = dst[2:] 16391 dst[0] = byte(s.PacketType) 16392 dst = dst[1:] 16393 dst[0] = byte(s.HardwareAddrLen) 16394 dst = dst[1:] 16395 for idx := 0; idx < 8; idx++ { 16396 dst[0] = byte(s.HardwareAddr[idx]) 16397 dst = dst[1:] 16398 } 16399 return dst 16400 } 16401 16402 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16403 func (s *SockAddrLink) UnmarshalBytes(src []byte) []byte { 16404 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16405 src = src[2:] 16406 s.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16407 src = src[2:] 16408 s.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 16409 src = src[4:] 16410 s.ARPHardwareType = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16411 src = src[2:] 16412 s.PacketType = src[0] 16413 src = src[1:] 16414 s.HardwareAddrLen = src[0] 16415 src = src[1:] 16416 for idx := 0; idx < 8; idx++ { 16417 s.HardwareAddr[idx] = src[0] 16418 src = src[1:] 16419 } 16420 return src 16421 } 16422 16423 // Packed implements marshal.Marshallable.Packed. 16424 //go:nosplit 16425 func (s *SockAddrLink) Packed() bool { 16426 return true 16427 } 16428 16429 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16430 func (s *SockAddrLink) MarshalUnsafe(dst []byte) []byte { 16431 size := s.SizeBytes() 16432 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16433 return dst[size:] 16434 } 16435 16436 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16437 func (s *SockAddrLink) UnmarshalUnsafe(src []byte) []byte { 16438 size := s.SizeBytes() 16439 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16440 return src[size:] 16441 } 16442 16443 // CopyOutN implements marshal.Marshallable.CopyOutN. 16444 func (s *SockAddrLink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16445 // Construct a slice backed by dst's underlying memory. 16446 var buf []byte 16447 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16448 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16449 hdr.Len = s.SizeBytes() 16450 hdr.Cap = s.SizeBytes() 16451 16452 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16453 // Since we bypassed the compiler's escape analysis, indicate that s 16454 // must live until the use above. 16455 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16456 return length, err 16457 } 16458 16459 // CopyOut implements marshal.Marshallable.CopyOut. 16460 func (s *SockAddrLink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16461 return s.CopyOutN(cc, addr, s.SizeBytes()) 16462 } 16463 16464 // CopyIn implements marshal.Marshallable.CopyIn. 16465 func (s *SockAddrLink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16466 // Construct a slice backed by dst's underlying memory. 16467 var buf []byte 16468 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16469 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16470 hdr.Len = s.SizeBytes() 16471 hdr.Cap = s.SizeBytes() 16472 16473 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16474 // Since we bypassed the compiler's escape analysis, indicate that s 16475 // must live until the use above. 16476 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16477 return length, err 16478 } 16479 16480 // WriteTo implements io.WriterTo.WriteTo. 16481 func (s *SockAddrLink) WriteTo(writer io.Writer) (int64, error) { 16482 // Construct a slice backed by dst's underlying memory. 16483 var buf []byte 16484 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16485 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16486 hdr.Len = s.SizeBytes() 16487 hdr.Cap = s.SizeBytes() 16488 16489 length, err := writer.Write(buf) 16490 // Since we bypassed the compiler's escape analysis, indicate that s 16491 // must live until the use above. 16492 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16493 return int64(length), err 16494 } 16495 16496 // SizeBytes implements marshal.Marshallable.SizeBytes. 16497 func (s *SockAddrUnix) SizeBytes() int { 16498 return 2 + 16499 1*UnixPathMax 16500 } 16501 16502 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16503 func (s *SockAddrUnix) MarshalBytes(dst []byte) []byte { 16504 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16505 dst = dst[2:] 16506 for idx := 0; idx < UnixPathMax; idx++ { 16507 dst[0] = byte(s.Path[idx]) 16508 dst = dst[1:] 16509 } 16510 return dst 16511 } 16512 16513 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16514 func (s *SockAddrUnix) UnmarshalBytes(src []byte) []byte { 16515 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16516 src = src[2:] 16517 for idx := 0; idx < UnixPathMax; idx++ { 16518 s.Path[idx] = int8(src[0]) 16519 src = src[1:] 16520 } 16521 return src 16522 } 16523 16524 // Packed implements marshal.Marshallable.Packed. 16525 //go:nosplit 16526 func (s *SockAddrUnix) Packed() bool { 16527 return true 16528 } 16529 16530 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16531 func (s *SockAddrUnix) MarshalUnsafe(dst []byte) []byte { 16532 size := s.SizeBytes() 16533 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16534 return dst[size:] 16535 } 16536 16537 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16538 func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) []byte { 16539 size := s.SizeBytes() 16540 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16541 return src[size:] 16542 } 16543 16544 // CopyOutN implements marshal.Marshallable.CopyOutN. 16545 func (s *SockAddrUnix) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16546 // Construct a slice backed by dst's underlying memory. 16547 var buf []byte 16548 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16549 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16550 hdr.Len = s.SizeBytes() 16551 hdr.Cap = s.SizeBytes() 16552 16553 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16554 // Since we bypassed the compiler's escape analysis, indicate that s 16555 // must live until the use above. 16556 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16557 return length, err 16558 } 16559 16560 // CopyOut implements marshal.Marshallable.CopyOut. 16561 func (s *SockAddrUnix) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16562 return s.CopyOutN(cc, addr, s.SizeBytes()) 16563 } 16564 16565 // CopyIn implements marshal.Marshallable.CopyIn. 16566 func (s *SockAddrUnix) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16567 // Construct a slice backed by dst's underlying memory. 16568 var buf []byte 16569 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16570 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16571 hdr.Len = s.SizeBytes() 16572 hdr.Cap = s.SizeBytes() 16573 16574 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16575 // Since we bypassed the compiler's escape analysis, indicate that s 16576 // must live until the use above. 16577 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16578 return length, err 16579 } 16580 16581 // WriteTo implements io.WriterTo.WriteTo. 16582 func (s *SockAddrUnix) WriteTo(writer io.Writer) (int64, error) { 16583 // Construct a slice backed by dst's underlying memory. 16584 var buf []byte 16585 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16586 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16587 hdr.Len = s.SizeBytes() 16588 hdr.Cap = s.SizeBytes() 16589 16590 length, err := writer.Write(buf) 16591 // Since we bypassed the compiler's escape analysis, indicate that s 16592 // must live until the use above. 16593 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16594 return int64(length), err 16595 } 16596 16597 // SizeBytes implements marshal.Marshallable.SizeBytes. 16598 func (t *TCPInfo) SizeBytes() int { 16599 return 224 16600 } 16601 16602 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16603 func (t *TCPInfo) MarshalBytes(dst []byte) []byte { 16604 dst[0] = byte(t.State) 16605 dst = dst[1:] 16606 dst[0] = byte(t.CaState) 16607 dst = dst[1:] 16608 dst[0] = byte(t.Retransmits) 16609 dst = dst[1:] 16610 dst[0] = byte(t.Probes) 16611 dst = dst[1:] 16612 dst[0] = byte(t.Backoff) 16613 dst = dst[1:] 16614 dst[0] = byte(t.Options) 16615 dst = dst[1:] 16616 dst[0] = byte(t.WindowScale) 16617 dst = dst[1:] 16618 dst[0] = byte(t.DeliveryRateAppLimited) 16619 dst = dst[1:] 16620 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTO)) 16621 dst = dst[4:] 16622 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ATO)) 16623 dst = dst[4:] 16624 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndMss)) 16625 dst = dst[4:] 16626 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvMss)) 16627 dst = dst[4:] 16628 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Unacked)) 16629 dst = dst[4:] 16630 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Sacked)) 16631 dst = dst[4:] 16632 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Lost)) 16633 dst = dst[4:] 16634 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Retrans)) 16635 dst = dst[4:] 16636 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Fackets)) 16637 dst = dst[4:] 16638 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataSent)) 16639 dst = dst[4:] 16640 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckSent)) 16641 dst = dst[4:] 16642 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataRecv)) 16643 dst = dst[4:] 16644 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckRecv)) 16645 dst = dst[4:] 16646 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.PMTU)) 16647 dst = dst[4:] 16648 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSsthresh)) 16649 dst = dst[4:] 16650 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTT)) 16651 dst = dst[4:] 16652 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTTVar)) 16653 dst = dst[4:] 16654 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndSsthresh)) 16655 dst = dst[4:] 16656 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndCwnd)) 16657 dst = dst[4:] 16658 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Advmss)) 16659 dst = dst[4:] 16660 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Reordering)) 16661 dst = dst[4:] 16662 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvRTT)) 16663 dst = dst[4:] 16664 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSpace)) 16665 dst = dst[4:] 16666 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.TotalRetrans)) 16667 dst = dst[4:] 16668 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.PacingRate)) 16669 dst = dst[8:] 16670 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.MaxPacingRate)) 16671 dst = dst[8:] 16672 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesAcked)) 16673 dst = dst[8:] 16674 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesReceived)) 16675 dst = dst[8:] 16676 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsOut)) 16677 dst = dst[4:] 16678 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsIn)) 16679 dst = dst[4:] 16680 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.NotSentBytes)) 16681 dst = dst[4:] 16682 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.MinRTT)) 16683 dst = dst[4:] 16684 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsIn)) 16685 dst = dst[4:] 16686 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsOut)) 16687 dst = dst[4:] 16688 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.DeliveryRate)) 16689 dst = dst[8:] 16690 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BusyTime)) 16691 dst = dst[8:] 16692 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.RwndLimited)) 16693 dst = dst[8:] 16694 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.SndBufLimited)) 16695 dst = dst[8:] 16696 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Delivered)) 16697 dst = dst[4:] 16698 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DeliveredCE)) 16699 dst = dst[4:] 16700 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesSent)) 16701 dst = dst[8:] 16702 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesRetrans)) 16703 dst = dst[8:] 16704 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DSACKDups)) 16705 dst = dst[4:] 16706 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ReordSeen)) 16707 dst = dst[4:] 16708 return dst 16709 } 16710 16711 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16712 func (t *TCPInfo) UnmarshalBytes(src []byte) []byte { 16713 t.State = uint8(src[0]) 16714 src = src[1:] 16715 t.CaState = uint8(src[0]) 16716 src = src[1:] 16717 t.Retransmits = uint8(src[0]) 16718 src = src[1:] 16719 t.Probes = uint8(src[0]) 16720 src = src[1:] 16721 t.Backoff = uint8(src[0]) 16722 src = src[1:] 16723 t.Options = uint8(src[0]) 16724 src = src[1:] 16725 t.WindowScale = uint8(src[0]) 16726 src = src[1:] 16727 t.DeliveryRateAppLimited = uint8(src[0]) 16728 src = src[1:] 16729 t.RTO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16730 src = src[4:] 16731 t.ATO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16732 src = src[4:] 16733 t.SndMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16734 src = src[4:] 16735 t.RcvMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16736 src = src[4:] 16737 t.Unacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16738 src = src[4:] 16739 t.Sacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16740 src = src[4:] 16741 t.Lost = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16742 src = src[4:] 16743 t.Retrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16744 src = src[4:] 16745 t.Fackets = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16746 src = src[4:] 16747 t.LastDataSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16748 src = src[4:] 16749 t.LastAckSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16750 src = src[4:] 16751 t.LastDataRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16752 src = src[4:] 16753 t.LastAckRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16754 src = src[4:] 16755 t.PMTU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16756 src = src[4:] 16757 t.RcvSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16758 src = src[4:] 16759 t.RTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16760 src = src[4:] 16761 t.RTTVar = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16762 src = src[4:] 16763 t.SndSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16764 src = src[4:] 16765 t.SndCwnd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16766 src = src[4:] 16767 t.Advmss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16768 src = src[4:] 16769 t.Reordering = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16770 src = src[4:] 16771 t.RcvRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16772 src = src[4:] 16773 t.RcvSpace = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16774 src = src[4:] 16775 t.TotalRetrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16776 src = src[4:] 16777 t.PacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16778 src = src[8:] 16779 t.MaxPacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16780 src = src[8:] 16781 t.BytesAcked = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16782 src = src[8:] 16783 t.BytesReceived = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16784 src = src[8:] 16785 t.SegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16786 src = src[4:] 16787 t.SegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16788 src = src[4:] 16789 t.NotSentBytes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16790 src = src[4:] 16791 t.MinRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16792 src = src[4:] 16793 t.DataSegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16794 src = src[4:] 16795 t.DataSegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16796 src = src[4:] 16797 t.DeliveryRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16798 src = src[8:] 16799 t.BusyTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16800 src = src[8:] 16801 t.RwndLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16802 src = src[8:] 16803 t.SndBufLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16804 src = src[8:] 16805 t.Delivered = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16806 src = src[4:] 16807 t.DeliveredCE = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16808 src = src[4:] 16809 t.BytesSent = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16810 src = src[8:] 16811 t.BytesRetrans = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16812 src = src[8:] 16813 t.DSACKDups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16814 src = src[4:] 16815 t.ReordSeen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16816 src = src[4:] 16817 return src 16818 } 16819 16820 // Packed implements marshal.Marshallable.Packed. 16821 //go:nosplit 16822 func (t *TCPInfo) Packed() bool { 16823 return true 16824 } 16825 16826 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16827 func (t *TCPInfo) MarshalUnsafe(dst []byte) []byte { 16828 size := t.SizeBytes() 16829 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 16830 return dst[size:] 16831 } 16832 16833 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16834 func (t *TCPInfo) UnmarshalUnsafe(src []byte) []byte { 16835 size := t.SizeBytes() 16836 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 16837 return src[size:] 16838 } 16839 16840 // CopyOutN implements marshal.Marshallable.CopyOutN. 16841 func (t *TCPInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16842 // Construct a slice backed by dst's underlying memory. 16843 var buf []byte 16844 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16845 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16846 hdr.Len = t.SizeBytes() 16847 hdr.Cap = t.SizeBytes() 16848 16849 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16850 // Since we bypassed the compiler's escape analysis, indicate that t 16851 // must live until the use above. 16852 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16853 return length, err 16854 } 16855 16856 // CopyOut implements marshal.Marshallable.CopyOut. 16857 func (t *TCPInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16858 return t.CopyOutN(cc, addr, t.SizeBytes()) 16859 } 16860 16861 // CopyIn implements marshal.Marshallable.CopyIn. 16862 func (t *TCPInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16863 // Construct a slice backed by dst's underlying memory. 16864 var buf []byte 16865 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16866 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16867 hdr.Len = t.SizeBytes() 16868 hdr.Cap = t.SizeBytes() 16869 16870 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16871 // Since we bypassed the compiler's escape analysis, indicate that t 16872 // must live until the use above. 16873 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16874 return length, err 16875 } 16876 16877 // WriteTo implements io.WriterTo.WriteTo. 16878 func (t *TCPInfo) WriteTo(writer io.Writer) (int64, error) { 16879 // Construct a slice backed by dst's underlying memory. 16880 var buf []byte 16881 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16882 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16883 hdr.Len = t.SizeBytes() 16884 hdr.Cap = t.SizeBytes() 16885 16886 length, err := writer.Write(buf) 16887 // Since we bypassed the compiler's escape analysis, indicate that t 16888 // must live until the use above. 16889 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16890 return int64(length), err 16891 } 16892 16893 // SizeBytes implements marshal.Marshallable.SizeBytes. 16894 //go:nosplit 16895 func (c *ClockT) SizeBytes() int { 16896 return 8 16897 } 16898 16899 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16900 func (c *ClockT) MarshalBytes(dst []byte) []byte { 16901 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*c)) 16902 return dst[8:] 16903 } 16904 16905 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16906 func (c *ClockT) UnmarshalBytes(src []byte) []byte { 16907 *c = ClockT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 16908 return src[8:] 16909 } 16910 16911 // Packed implements marshal.Marshallable.Packed. 16912 //go:nosplit 16913 func (c *ClockT) Packed() bool { 16914 // Scalar newtypes are always packed. 16915 return true 16916 } 16917 16918 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16919 func (c *ClockT) MarshalUnsafe(dst []byte) []byte { 16920 size := c.SizeBytes() 16921 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 16922 return dst[size:] 16923 } 16924 16925 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16926 func (c *ClockT) UnmarshalUnsafe(src []byte) []byte { 16927 size := c.SizeBytes() 16928 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 16929 return src[size:] 16930 } 16931 16932 // CopyOutN implements marshal.Marshallable.CopyOutN. 16933 func (c *ClockT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16934 // Construct a slice backed by dst's underlying memory. 16935 var buf []byte 16936 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16937 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16938 hdr.Len = c.SizeBytes() 16939 hdr.Cap = c.SizeBytes() 16940 16941 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16942 // Since we bypassed the compiler's escape analysis, indicate that c 16943 // must live until the use above. 16944 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16945 return length, err 16946 } 16947 16948 // CopyOut implements marshal.Marshallable.CopyOut. 16949 func (c *ClockT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16950 return c.CopyOutN(cc, addr, c.SizeBytes()) 16951 } 16952 16953 // CopyIn implements marshal.Marshallable.CopyIn. 16954 func (c *ClockT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16955 // Construct a slice backed by dst's underlying memory. 16956 var buf []byte 16957 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16958 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16959 hdr.Len = c.SizeBytes() 16960 hdr.Cap = c.SizeBytes() 16961 16962 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16963 // Since we bypassed the compiler's escape analysis, indicate that c 16964 // must live until the use above. 16965 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16966 return length, err 16967 } 16968 16969 // WriteTo implements io.WriterTo.WriteTo. 16970 func (c *ClockT) WriteTo(writer io.Writer) (int64, error) { 16971 // Construct a slice backed by dst's underlying memory. 16972 var buf []byte 16973 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16974 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16975 hdr.Len = c.SizeBytes() 16976 hdr.Cap = c.SizeBytes() 16977 16978 length, err := writer.Write(buf) 16979 // Since we bypassed the compiler's escape analysis, indicate that c 16980 // must live until the use above. 16981 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16982 return int64(length), err 16983 } 16984 16985 // SizeBytes implements marshal.Marshallable.SizeBytes. 16986 func (i *ItimerVal) SizeBytes() int { 16987 return 0 + 16988 (*Timeval)(nil).SizeBytes() + 16989 (*Timeval)(nil).SizeBytes() 16990 } 16991 16992 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16993 func (i *ItimerVal) MarshalBytes(dst []byte) []byte { 16994 dst = i.Interval.MarshalUnsafe(dst) 16995 dst = i.Value.MarshalUnsafe(dst) 16996 return dst 16997 } 16998 16999 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17000 func (i *ItimerVal) UnmarshalBytes(src []byte) []byte { 17001 src = i.Interval.UnmarshalUnsafe(src) 17002 src = i.Value.UnmarshalUnsafe(src) 17003 return src 17004 } 17005 17006 // Packed implements marshal.Marshallable.Packed. 17007 //go:nosplit 17008 func (i *ItimerVal) Packed() bool { 17009 return i.Interval.Packed() && i.Value.Packed() 17010 } 17011 17012 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17013 func (i *ItimerVal) MarshalUnsafe(dst []byte) []byte { 17014 if i.Interval.Packed() && i.Value.Packed() { 17015 size := i.SizeBytes() 17016 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17017 return dst[size:] 17018 } 17019 // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes. 17020 return i.MarshalBytes(dst) 17021 } 17022 17023 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17024 func (i *ItimerVal) UnmarshalUnsafe(src []byte) []byte { 17025 if i.Interval.Packed() && i.Value.Packed() { 17026 size := i.SizeBytes() 17027 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17028 return src[size:] 17029 } 17030 // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17031 return i.UnmarshalBytes(src) 17032 } 17033 17034 // CopyOutN implements marshal.Marshallable.CopyOutN. 17035 func (i *ItimerVal) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17036 if !i.Interval.Packed() && i.Value.Packed() { 17037 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 17038 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17039 i.MarshalBytes(buf) // escapes: fallback. 17040 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17041 } 17042 17043 // Construct a slice backed by dst's underlying memory. 17044 var buf []byte 17045 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17046 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17047 hdr.Len = i.SizeBytes() 17048 hdr.Cap = i.SizeBytes() 17049 17050 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17051 // Since we bypassed the compiler's escape analysis, indicate that i 17052 // must live until the use above. 17053 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17054 return length, err 17055 } 17056 17057 // CopyOut implements marshal.Marshallable.CopyOut. 17058 func (i *ItimerVal) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17059 return i.CopyOutN(cc, addr, i.SizeBytes()) 17060 } 17061 17062 // CopyIn implements marshal.Marshallable.CopyIn. 17063 func (i *ItimerVal) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17064 if !i.Interval.Packed() && i.Value.Packed() { 17065 // Type ItimerVal doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17066 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17067 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17068 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17069 // partially unmarshalled struct. 17070 i.UnmarshalBytes(buf) // escapes: fallback. 17071 return length, err 17072 } 17073 17074 // Construct a slice backed by dst's underlying memory. 17075 var buf []byte 17076 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17077 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17078 hdr.Len = i.SizeBytes() 17079 hdr.Cap = i.SizeBytes() 17080 17081 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17082 // Since we bypassed the compiler's escape analysis, indicate that i 17083 // must live until the use above. 17084 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17085 return length, err 17086 } 17087 17088 // WriteTo implements io.WriterTo.WriteTo. 17089 func (i *ItimerVal) WriteTo(writer io.Writer) (int64, error) { 17090 if !i.Interval.Packed() && i.Value.Packed() { 17091 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 17092 buf := make([]byte, i.SizeBytes()) 17093 i.MarshalBytes(buf) 17094 length, err := writer.Write(buf) 17095 return int64(length), err 17096 } 17097 17098 // Construct a slice backed by dst's underlying memory. 17099 var buf []byte 17100 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17101 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17102 hdr.Len = i.SizeBytes() 17103 hdr.Cap = i.SizeBytes() 17104 17105 length, err := writer.Write(buf) 17106 // Since we bypassed the compiler's escape analysis, indicate that i 17107 // must live until the use above. 17108 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17109 return int64(length), err 17110 } 17111 17112 // SizeBytes implements marshal.Marshallable.SizeBytes. 17113 func (i *Itimerspec) SizeBytes() int { 17114 return 0 + 17115 (*Timespec)(nil).SizeBytes() + 17116 (*Timespec)(nil).SizeBytes() 17117 } 17118 17119 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17120 func (i *Itimerspec) MarshalBytes(dst []byte) []byte { 17121 dst = i.Interval.MarshalUnsafe(dst) 17122 dst = i.Value.MarshalUnsafe(dst) 17123 return dst 17124 } 17125 17126 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17127 func (i *Itimerspec) UnmarshalBytes(src []byte) []byte { 17128 src = i.Interval.UnmarshalUnsafe(src) 17129 src = i.Value.UnmarshalUnsafe(src) 17130 return src 17131 } 17132 17133 // Packed implements marshal.Marshallable.Packed. 17134 //go:nosplit 17135 func (i *Itimerspec) Packed() bool { 17136 return i.Interval.Packed() && i.Value.Packed() 17137 } 17138 17139 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17140 func (i *Itimerspec) MarshalUnsafe(dst []byte) []byte { 17141 if i.Interval.Packed() && i.Value.Packed() { 17142 size := i.SizeBytes() 17143 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17144 return dst[size:] 17145 } 17146 // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes. 17147 return i.MarshalBytes(dst) 17148 } 17149 17150 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17151 func (i *Itimerspec) UnmarshalUnsafe(src []byte) []byte { 17152 if i.Interval.Packed() && i.Value.Packed() { 17153 size := i.SizeBytes() 17154 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17155 return src[size:] 17156 } 17157 // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17158 return i.UnmarshalBytes(src) 17159 } 17160 17161 // CopyOutN implements marshal.Marshallable.CopyOutN. 17162 func (i *Itimerspec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17163 if !i.Interval.Packed() && i.Value.Packed() { 17164 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 17165 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17166 i.MarshalBytes(buf) // escapes: fallback. 17167 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17168 } 17169 17170 // Construct a slice backed by dst's underlying memory. 17171 var buf []byte 17172 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17173 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17174 hdr.Len = i.SizeBytes() 17175 hdr.Cap = i.SizeBytes() 17176 17177 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17178 // Since we bypassed the compiler's escape analysis, indicate that i 17179 // must live until the use above. 17180 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17181 return length, err 17182 } 17183 17184 // CopyOut implements marshal.Marshallable.CopyOut. 17185 func (i *Itimerspec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17186 return i.CopyOutN(cc, addr, i.SizeBytes()) 17187 } 17188 17189 // CopyIn implements marshal.Marshallable.CopyIn. 17190 func (i *Itimerspec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17191 if !i.Interval.Packed() && i.Value.Packed() { 17192 // Type Itimerspec doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17193 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17194 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17195 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17196 // partially unmarshalled struct. 17197 i.UnmarshalBytes(buf) // escapes: fallback. 17198 return length, err 17199 } 17200 17201 // Construct a slice backed by dst's underlying memory. 17202 var buf []byte 17203 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17204 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17205 hdr.Len = i.SizeBytes() 17206 hdr.Cap = i.SizeBytes() 17207 17208 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17209 // Since we bypassed the compiler's escape analysis, indicate that i 17210 // must live until the use above. 17211 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17212 return length, err 17213 } 17214 17215 // WriteTo implements io.WriterTo.WriteTo. 17216 func (i *Itimerspec) WriteTo(writer io.Writer) (int64, error) { 17217 if !i.Interval.Packed() && i.Value.Packed() { 17218 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 17219 buf := make([]byte, i.SizeBytes()) 17220 i.MarshalBytes(buf) 17221 length, err := writer.Write(buf) 17222 return int64(length), err 17223 } 17224 17225 // Construct a slice backed by dst's underlying memory. 17226 var buf []byte 17227 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17228 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17229 hdr.Len = i.SizeBytes() 17230 hdr.Cap = i.SizeBytes() 17231 17232 length, err := writer.Write(buf) 17233 // Since we bypassed the compiler's escape analysis, indicate that i 17234 // must live until the use above. 17235 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17236 return int64(length), err 17237 } 17238 17239 // SizeBytes implements marshal.Marshallable.SizeBytes. 17240 func (sxts *StatxTimestamp) SizeBytes() int { 17241 return 16 17242 } 17243 17244 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17245 func (sxts *StatxTimestamp) MarshalBytes(dst []byte) []byte { 17246 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sxts.Sec)) 17247 dst = dst[8:] 17248 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sxts.Nsec)) 17249 dst = dst[4:] 17250 // Padding: dst[:sizeof(int32)] ~= int32(0) 17251 dst = dst[4:] 17252 return dst 17253 } 17254 17255 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17256 func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) []byte { 17257 sxts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17258 src = src[8:] 17259 sxts.Nsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17260 src = src[4:] 17261 // Padding: var _ int32 ~= src[:sizeof(int32)] 17262 src = src[4:] 17263 return src 17264 } 17265 17266 // Packed implements marshal.Marshallable.Packed. 17267 //go:nosplit 17268 func (sxts *StatxTimestamp) Packed() bool { 17269 return true 17270 } 17271 17272 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17273 func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) []byte { 17274 size := sxts.SizeBytes() 17275 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(size)) 17276 return dst[size:] 17277 } 17278 17279 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17280 func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) []byte { 17281 size := sxts.SizeBytes() 17282 gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(size)) 17283 return src[size:] 17284 } 17285 17286 // CopyOutN implements marshal.Marshallable.CopyOutN. 17287 func (sxts *StatxTimestamp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17288 // Construct a slice backed by dst's underlying memory. 17289 var buf []byte 17290 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17291 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 17292 hdr.Len = sxts.SizeBytes() 17293 hdr.Cap = sxts.SizeBytes() 17294 17295 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17296 // Since we bypassed the compiler's escape analysis, indicate that sxts 17297 // must live until the use above. 17298 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 17299 return length, err 17300 } 17301 17302 // CopyOut implements marshal.Marshallable.CopyOut. 17303 func (sxts *StatxTimestamp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17304 return sxts.CopyOutN(cc, addr, sxts.SizeBytes()) 17305 } 17306 17307 // CopyIn implements marshal.Marshallable.CopyIn. 17308 func (sxts *StatxTimestamp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17309 // Construct a slice backed by dst's underlying memory. 17310 var buf []byte 17311 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17312 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 17313 hdr.Len = sxts.SizeBytes() 17314 hdr.Cap = sxts.SizeBytes() 17315 17316 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17317 // Since we bypassed the compiler's escape analysis, indicate that sxts 17318 // must live until the use above. 17319 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 17320 return length, err 17321 } 17322 17323 // WriteTo implements io.WriterTo.WriteTo. 17324 func (sxts *StatxTimestamp) WriteTo(writer io.Writer) (int64, error) { 17325 // Construct a slice backed by dst's underlying memory. 17326 var buf []byte 17327 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17328 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 17329 hdr.Len = sxts.SizeBytes() 17330 hdr.Cap = sxts.SizeBytes() 17331 17332 length, err := writer.Write(buf) 17333 // Since we bypassed the compiler's escape analysis, indicate that sxts 17334 // must live until the use above. 17335 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 17336 return int64(length), err 17337 } 17338 17339 // SizeBytes implements marshal.Marshallable.SizeBytes. 17340 //go:nosplit 17341 func (t *TimeT) SizeBytes() int { 17342 return 8 17343 } 17344 17345 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17346 func (t *TimeT) MarshalBytes(dst []byte) []byte { 17347 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*t)) 17348 return dst[8:] 17349 } 17350 17351 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17352 func (t *TimeT) UnmarshalBytes(src []byte) []byte { 17353 *t = TimeT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 17354 return src[8:] 17355 } 17356 17357 // Packed implements marshal.Marshallable.Packed. 17358 //go:nosplit 17359 func (t *TimeT) Packed() bool { 17360 // Scalar newtypes are always packed. 17361 return true 17362 } 17363 17364 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17365 func (t *TimeT) MarshalUnsafe(dst []byte) []byte { 17366 size := t.SizeBytes() 17367 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17368 return dst[size:] 17369 } 17370 17371 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17372 func (t *TimeT) UnmarshalUnsafe(src []byte) []byte { 17373 size := t.SizeBytes() 17374 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17375 return src[size:] 17376 } 17377 17378 // CopyOutN implements marshal.Marshallable.CopyOutN. 17379 func (t *TimeT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17380 // Construct a slice backed by dst's underlying memory. 17381 var buf []byte 17382 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17383 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17384 hdr.Len = t.SizeBytes() 17385 hdr.Cap = t.SizeBytes() 17386 17387 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17388 // Since we bypassed the compiler's escape analysis, indicate that t 17389 // must live until the use above. 17390 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17391 return length, err 17392 } 17393 17394 // CopyOut implements marshal.Marshallable.CopyOut. 17395 func (t *TimeT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17396 return t.CopyOutN(cc, addr, t.SizeBytes()) 17397 } 17398 17399 // CopyIn implements marshal.Marshallable.CopyIn. 17400 func (t *TimeT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17401 // Construct a slice backed by dst's underlying memory. 17402 var buf []byte 17403 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17404 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17405 hdr.Len = t.SizeBytes() 17406 hdr.Cap = t.SizeBytes() 17407 17408 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17409 // Since we bypassed the compiler's escape analysis, indicate that t 17410 // must live until the use above. 17411 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17412 return length, err 17413 } 17414 17415 // WriteTo implements io.WriterTo.WriteTo. 17416 func (t *TimeT) WriteTo(writer io.Writer) (int64, error) { 17417 // Construct a slice backed by dst's underlying memory. 17418 var buf []byte 17419 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17420 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17421 hdr.Len = t.SizeBytes() 17422 hdr.Cap = t.SizeBytes() 17423 17424 length, err := writer.Write(buf) 17425 // Since we bypassed the compiler's escape analysis, indicate that t 17426 // must live until the use above. 17427 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17428 return int64(length), err 17429 } 17430 17431 // SizeBytes implements marshal.Marshallable.SizeBytes. 17432 //go:nosplit 17433 func (t *TimerID) SizeBytes() int { 17434 return 4 17435 } 17436 17437 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17438 func (t *TimerID) MarshalBytes(dst []byte) []byte { 17439 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*t)) 17440 return dst[4:] 17441 } 17442 17443 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17444 func (t *TimerID) UnmarshalBytes(src []byte) []byte { 17445 *t = TimerID(int32(hostarch.ByteOrder.Uint32(src[:4]))) 17446 return src[4:] 17447 } 17448 17449 // Packed implements marshal.Marshallable.Packed. 17450 //go:nosplit 17451 func (t *TimerID) Packed() bool { 17452 // Scalar newtypes are always packed. 17453 return true 17454 } 17455 17456 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17457 func (t *TimerID) MarshalUnsafe(dst []byte) []byte { 17458 size := t.SizeBytes() 17459 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17460 return dst[size:] 17461 } 17462 17463 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17464 func (t *TimerID) UnmarshalUnsafe(src []byte) []byte { 17465 size := t.SizeBytes() 17466 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17467 return src[size:] 17468 } 17469 17470 // CopyOutN implements marshal.Marshallable.CopyOutN. 17471 func (t *TimerID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17472 // Construct a slice backed by dst's underlying memory. 17473 var buf []byte 17474 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17475 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17476 hdr.Len = t.SizeBytes() 17477 hdr.Cap = t.SizeBytes() 17478 17479 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17480 // Since we bypassed the compiler's escape analysis, indicate that t 17481 // must live until the use above. 17482 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17483 return length, err 17484 } 17485 17486 // CopyOut implements marshal.Marshallable.CopyOut. 17487 func (t *TimerID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17488 return t.CopyOutN(cc, addr, t.SizeBytes()) 17489 } 17490 17491 // CopyIn implements marshal.Marshallable.CopyIn. 17492 func (t *TimerID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17493 // Construct a slice backed by dst's underlying memory. 17494 var buf []byte 17495 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17496 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17497 hdr.Len = t.SizeBytes() 17498 hdr.Cap = t.SizeBytes() 17499 17500 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17501 // Since we bypassed the compiler's escape analysis, indicate that t 17502 // must live until the use above. 17503 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17504 return length, err 17505 } 17506 17507 // WriteTo implements io.WriterTo.WriteTo. 17508 func (t *TimerID) WriteTo(writer io.Writer) (int64, error) { 17509 // Construct a slice backed by dst's underlying memory. 17510 var buf []byte 17511 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17512 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17513 hdr.Len = t.SizeBytes() 17514 hdr.Cap = t.SizeBytes() 17515 17516 length, err := writer.Write(buf) 17517 // Since we bypassed the compiler's escape analysis, indicate that t 17518 // must live until the use above. 17519 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17520 return int64(length), err 17521 } 17522 17523 // SizeBytes implements marshal.Marshallable.SizeBytes. 17524 func (ts *Timespec) SizeBytes() int { 17525 return 16 17526 } 17527 17528 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17529 func (ts *Timespec) MarshalBytes(dst []byte) []byte { 17530 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Sec)) 17531 dst = dst[8:] 17532 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Nsec)) 17533 dst = dst[8:] 17534 return dst 17535 } 17536 17537 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17538 func (ts *Timespec) UnmarshalBytes(src []byte) []byte { 17539 ts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17540 src = src[8:] 17541 ts.Nsec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17542 src = src[8:] 17543 return src 17544 } 17545 17546 // Packed implements marshal.Marshallable.Packed. 17547 //go:nosplit 17548 func (ts *Timespec) Packed() bool { 17549 return true 17550 } 17551 17552 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17553 func (ts *Timespec) MarshalUnsafe(dst []byte) []byte { 17554 size := ts.SizeBytes() 17555 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(size)) 17556 return dst[size:] 17557 } 17558 17559 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17560 func (ts *Timespec) UnmarshalUnsafe(src []byte) []byte { 17561 size := ts.SizeBytes() 17562 gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(size)) 17563 return src[size:] 17564 } 17565 17566 // CopyOutN implements marshal.Marshallable.CopyOutN. 17567 func (ts *Timespec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17568 // Construct a slice backed by dst's underlying memory. 17569 var buf []byte 17570 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17571 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 17572 hdr.Len = ts.SizeBytes() 17573 hdr.Cap = ts.SizeBytes() 17574 17575 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17576 // Since we bypassed the compiler's escape analysis, indicate that ts 17577 // must live until the use above. 17578 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 17579 return length, err 17580 } 17581 17582 // CopyOut implements marshal.Marshallable.CopyOut. 17583 func (ts *Timespec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17584 return ts.CopyOutN(cc, addr, ts.SizeBytes()) 17585 } 17586 17587 // CopyIn implements marshal.Marshallable.CopyIn. 17588 func (ts *Timespec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17589 // Construct a slice backed by dst's underlying memory. 17590 var buf []byte 17591 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17592 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 17593 hdr.Len = ts.SizeBytes() 17594 hdr.Cap = ts.SizeBytes() 17595 17596 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17597 // Since we bypassed the compiler's escape analysis, indicate that ts 17598 // must live until the use above. 17599 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 17600 return length, err 17601 } 17602 17603 // WriteTo implements io.WriterTo.WriteTo. 17604 func (ts *Timespec) WriteTo(writer io.Writer) (int64, error) { 17605 // Construct a slice backed by dst's underlying memory. 17606 var buf []byte 17607 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17608 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 17609 hdr.Len = ts.SizeBytes() 17610 hdr.Cap = ts.SizeBytes() 17611 17612 length, err := writer.Write(buf) 17613 // Since we bypassed the compiler's escape analysis, indicate that ts 17614 // must live until the use above. 17615 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 17616 return int64(length), err 17617 } 17618 17619 // CopyTimespecSliceIn copies in a slice of Timespec objects from the task's memory. 17620 func CopyTimespecSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timespec) (int, error) { 17621 count := len(dst) 17622 if count == 0 { 17623 return 0, nil 17624 } 17625 size := (*Timespec)(nil).SizeBytes() 17626 17627 ptr := unsafe.Pointer(&dst) 17628 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17629 17630 // Construct a slice backed by dst's underlying memory. 17631 var buf []byte 17632 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17633 hdr.Data = uintptr(val) 17634 hdr.Len = size * count 17635 hdr.Cap = size * count 17636 17637 length, err := cc.CopyInBytes(addr, buf) 17638 // Since we bypassed the compiler's escape analysis, indicate that dst 17639 // must live until the use above. 17640 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 17641 return length, err 17642 } 17643 17644 // CopyTimespecSliceOut copies a slice of Timespec objects to the task's memory. 17645 func CopyTimespecSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timespec) (int, error) { 17646 count := len(src) 17647 if count == 0 { 17648 return 0, nil 17649 } 17650 size := (*Timespec)(nil).SizeBytes() 17651 17652 ptr := unsafe.Pointer(&src) 17653 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17654 17655 // Construct a slice backed by dst's underlying memory. 17656 var buf []byte 17657 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17658 hdr.Data = uintptr(val) 17659 hdr.Len = size * count 17660 hdr.Cap = size * count 17661 17662 length, err := cc.CopyOutBytes(addr, buf) 17663 // Since we bypassed the compiler's escape analysis, indicate that src 17664 // must live until the use above. 17665 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 17666 return length, err 17667 } 17668 17669 // MarshalUnsafeTimespecSlice is like Timespec.MarshalUnsafe, but for a []Timespec. 17670 func MarshalUnsafeTimespecSlice(src []Timespec, dst []byte) []byte { 17671 count := len(src) 17672 if count == 0 { 17673 return dst 17674 } 17675 17676 size := (*Timespec)(nil).SizeBytes() 17677 buf := dst[:size*count] 17678 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 17679 return dst[size*count:] 17680 } 17681 17682 // UnmarshalUnsafeTimespecSlice is like Timespec.UnmarshalUnsafe, but for a []Timespec. 17683 func UnmarshalUnsafeTimespecSlice(dst []Timespec, src []byte) []byte { 17684 count := len(dst) 17685 if count == 0 { 17686 return src 17687 } 17688 17689 size := (*Timespec)(nil).SizeBytes() 17690 buf := src[:size*count] 17691 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 17692 return src[size*count:] 17693 } 17694 17695 // SizeBytes implements marshal.Marshallable.SizeBytes. 17696 func (tv *Timeval) SizeBytes() int { 17697 return 16 17698 } 17699 17700 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17701 func (tv *Timeval) MarshalBytes(dst []byte) []byte { 17702 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Sec)) 17703 dst = dst[8:] 17704 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Usec)) 17705 dst = dst[8:] 17706 return dst 17707 } 17708 17709 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17710 func (tv *Timeval) UnmarshalBytes(src []byte) []byte { 17711 tv.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17712 src = src[8:] 17713 tv.Usec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17714 src = src[8:] 17715 return src 17716 } 17717 17718 // Packed implements marshal.Marshallable.Packed. 17719 //go:nosplit 17720 func (tv *Timeval) Packed() bool { 17721 return true 17722 } 17723 17724 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17725 func (tv *Timeval) MarshalUnsafe(dst []byte) []byte { 17726 size := tv.SizeBytes() 17727 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(size)) 17728 return dst[size:] 17729 } 17730 17731 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17732 func (tv *Timeval) UnmarshalUnsafe(src []byte) []byte { 17733 size := tv.SizeBytes() 17734 gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(size)) 17735 return src[size:] 17736 } 17737 17738 // CopyOutN implements marshal.Marshallable.CopyOutN. 17739 func (tv *Timeval) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17740 // Construct a slice backed by dst's underlying memory. 17741 var buf []byte 17742 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17743 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 17744 hdr.Len = tv.SizeBytes() 17745 hdr.Cap = tv.SizeBytes() 17746 17747 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17748 // Since we bypassed the compiler's escape analysis, indicate that tv 17749 // must live until the use above. 17750 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 17751 return length, err 17752 } 17753 17754 // CopyOut implements marshal.Marshallable.CopyOut. 17755 func (tv *Timeval) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17756 return tv.CopyOutN(cc, addr, tv.SizeBytes()) 17757 } 17758 17759 // CopyIn implements marshal.Marshallable.CopyIn. 17760 func (tv *Timeval) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17761 // Construct a slice backed by dst's underlying memory. 17762 var buf []byte 17763 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17764 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 17765 hdr.Len = tv.SizeBytes() 17766 hdr.Cap = tv.SizeBytes() 17767 17768 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17769 // Since we bypassed the compiler's escape analysis, indicate that tv 17770 // must live until the use above. 17771 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 17772 return length, err 17773 } 17774 17775 // WriteTo implements io.WriterTo.WriteTo. 17776 func (tv *Timeval) WriteTo(writer io.Writer) (int64, error) { 17777 // Construct a slice backed by dst's underlying memory. 17778 var buf []byte 17779 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17780 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 17781 hdr.Len = tv.SizeBytes() 17782 hdr.Cap = tv.SizeBytes() 17783 17784 length, err := writer.Write(buf) 17785 // Since we bypassed the compiler's escape analysis, indicate that tv 17786 // must live until the use above. 17787 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 17788 return int64(length), err 17789 } 17790 17791 // CopyTimevalSliceIn copies in a slice of Timeval objects from the task's memory. 17792 func CopyTimevalSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timeval) (int, error) { 17793 count := len(dst) 17794 if count == 0 { 17795 return 0, nil 17796 } 17797 size := (*Timeval)(nil).SizeBytes() 17798 17799 ptr := unsafe.Pointer(&dst) 17800 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17801 17802 // Construct a slice backed by dst's underlying memory. 17803 var buf []byte 17804 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17805 hdr.Data = uintptr(val) 17806 hdr.Len = size * count 17807 hdr.Cap = size * count 17808 17809 length, err := cc.CopyInBytes(addr, buf) 17810 // Since we bypassed the compiler's escape analysis, indicate that dst 17811 // must live until the use above. 17812 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 17813 return length, err 17814 } 17815 17816 // CopyTimevalSliceOut copies a slice of Timeval objects to the task's memory. 17817 func CopyTimevalSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timeval) (int, error) { 17818 count := len(src) 17819 if count == 0 { 17820 return 0, nil 17821 } 17822 size := (*Timeval)(nil).SizeBytes() 17823 17824 ptr := unsafe.Pointer(&src) 17825 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17826 17827 // Construct a slice backed by dst's underlying memory. 17828 var buf []byte 17829 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17830 hdr.Data = uintptr(val) 17831 hdr.Len = size * count 17832 hdr.Cap = size * count 17833 17834 length, err := cc.CopyOutBytes(addr, buf) 17835 // Since we bypassed the compiler's escape analysis, indicate that src 17836 // must live until the use above. 17837 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 17838 return length, err 17839 } 17840 17841 // MarshalUnsafeTimevalSlice is like Timeval.MarshalUnsafe, but for a []Timeval. 17842 func MarshalUnsafeTimevalSlice(src []Timeval, dst []byte) []byte { 17843 count := len(src) 17844 if count == 0 { 17845 return dst 17846 } 17847 17848 size := (*Timeval)(nil).SizeBytes() 17849 buf := dst[:size*count] 17850 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 17851 return dst[size*count:] 17852 } 17853 17854 // UnmarshalUnsafeTimevalSlice is like Timeval.UnmarshalUnsafe, but for a []Timeval. 17855 func UnmarshalUnsafeTimevalSlice(dst []Timeval, src []byte) []byte { 17856 count := len(dst) 17857 if count == 0 { 17858 return src 17859 } 17860 17861 size := (*Timeval)(nil).SizeBytes() 17862 buf := src[:size*count] 17863 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 17864 return src[size*count:] 17865 } 17866 17867 // SizeBytes implements marshal.Marshallable.SizeBytes. 17868 func (t *Tms) SizeBytes() int { 17869 return 0 + 17870 (*ClockT)(nil).SizeBytes() + 17871 (*ClockT)(nil).SizeBytes() + 17872 (*ClockT)(nil).SizeBytes() + 17873 (*ClockT)(nil).SizeBytes() 17874 } 17875 17876 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17877 func (t *Tms) MarshalBytes(dst []byte) []byte { 17878 dst = t.UTime.MarshalUnsafe(dst) 17879 dst = t.STime.MarshalUnsafe(dst) 17880 dst = t.CUTime.MarshalUnsafe(dst) 17881 dst = t.CSTime.MarshalUnsafe(dst) 17882 return dst 17883 } 17884 17885 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17886 func (t *Tms) UnmarshalBytes(src []byte) []byte { 17887 src = t.UTime.UnmarshalUnsafe(src) 17888 src = t.STime.UnmarshalUnsafe(src) 17889 src = t.CUTime.UnmarshalUnsafe(src) 17890 src = t.CSTime.UnmarshalUnsafe(src) 17891 return src 17892 } 17893 17894 // Packed implements marshal.Marshallable.Packed. 17895 //go:nosplit 17896 func (t *Tms) Packed() bool { 17897 return t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() 17898 } 17899 17900 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17901 func (t *Tms) MarshalUnsafe(dst []byte) []byte { 17902 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 17903 size := t.SizeBytes() 17904 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17905 return dst[size:] 17906 } 17907 // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes. 17908 return t.MarshalBytes(dst) 17909 } 17910 17911 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17912 func (t *Tms) UnmarshalUnsafe(src []byte) []byte { 17913 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 17914 size := t.SizeBytes() 17915 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17916 return src[size:] 17917 } 17918 // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17919 return t.UnmarshalBytes(src) 17920 } 17921 17922 // CopyOutN implements marshal.Marshallable.CopyOutN. 17923 func (t *Tms) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17924 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 17925 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 17926 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 17927 t.MarshalBytes(buf) // escapes: fallback. 17928 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17929 } 17930 17931 // Construct a slice backed by dst's underlying memory. 17932 var buf []byte 17933 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17934 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17935 hdr.Len = t.SizeBytes() 17936 hdr.Cap = t.SizeBytes() 17937 17938 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17939 // Since we bypassed the compiler's escape analysis, indicate that t 17940 // must live until the use above. 17941 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17942 return length, err 17943 } 17944 17945 // CopyOut implements marshal.Marshallable.CopyOut. 17946 func (t *Tms) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17947 return t.CopyOutN(cc, addr, t.SizeBytes()) 17948 } 17949 17950 // CopyIn implements marshal.Marshallable.CopyIn. 17951 func (t *Tms) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17952 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 17953 // Type Tms doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17954 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 17955 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17956 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17957 // partially unmarshalled struct. 17958 t.UnmarshalBytes(buf) // escapes: fallback. 17959 return length, err 17960 } 17961 17962 // Construct a slice backed by dst's underlying memory. 17963 var buf []byte 17964 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17965 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17966 hdr.Len = t.SizeBytes() 17967 hdr.Cap = t.SizeBytes() 17968 17969 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17970 // Since we bypassed the compiler's escape analysis, indicate that t 17971 // must live until the use above. 17972 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17973 return length, err 17974 } 17975 17976 // WriteTo implements io.WriterTo.WriteTo. 17977 func (t *Tms) WriteTo(writer io.Writer) (int64, error) { 17978 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 17979 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 17980 buf := make([]byte, t.SizeBytes()) 17981 t.MarshalBytes(buf) 17982 length, err := writer.Write(buf) 17983 return int64(length), err 17984 } 17985 17986 // Construct a slice backed by dst's underlying memory. 17987 var buf []byte 17988 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17989 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17990 hdr.Len = t.SizeBytes() 17991 hdr.Cap = t.SizeBytes() 17992 17993 length, err := writer.Write(buf) 17994 // Since we bypassed the compiler's escape analysis, indicate that t 17995 // must live until the use above. 17996 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17997 return int64(length), err 17998 } 17999 18000 // SizeBytes implements marshal.Marshallable.SizeBytes. 18001 func (u *Utime) SizeBytes() int { 18002 return 16 18003 } 18004 18005 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18006 func (u *Utime) MarshalBytes(dst []byte) []byte { 18007 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Actime)) 18008 dst = dst[8:] 18009 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Modtime)) 18010 dst = dst[8:] 18011 return dst 18012 } 18013 18014 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18015 func (u *Utime) UnmarshalBytes(src []byte) []byte { 18016 u.Actime = int64(hostarch.ByteOrder.Uint64(src[:8])) 18017 src = src[8:] 18018 u.Modtime = int64(hostarch.ByteOrder.Uint64(src[:8])) 18019 src = src[8:] 18020 return src 18021 } 18022 18023 // Packed implements marshal.Marshallable.Packed. 18024 //go:nosplit 18025 func (u *Utime) Packed() bool { 18026 return true 18027 } 18028 18029 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18030 func (u *Utime) MarshalUnsafe(dst []byte) []byte { 18031 size := u.SizeBytes() 18032 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 18033 return dst[size:] 18034 } 18035 18036 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18037 func (u *Utime) UnmarshalUnsafe(src []byte) []byte { 18038 size := u.SizeBytes() 18039 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 18040 return src[size:] 18041 } 18042 18043 // CopyOutN implements marshal.Marshallable.CopyOutN. 18044 func (u *Utime) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18045 // Construct a slice backed by dst's underlying memory. 18046 var buf []byte 18047 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18048 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18049 hdr.Len = u.SizeBytes() 18050 hdr.Cap = u.SizeBytes() 18051 18052 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18053 // Since we bypassed the compiler's escape analysis, indicate that u 18054 // must live until the use above. 18055 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18056 return length, err 18057 } 18058 18059 // CopyOut implements marshal.Marshallable.CopyOut. 18060 func (u *Utime) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18061 return u.CopyOutN(cc, addr, u.SizeBytes()) 18062 } 18063 18064 // CopyIn implements marshal.Marshallable.CopyIn. 18065 func (u *Utime) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18066 // Construct a slice backed by dst's underlying memory. 18067 var buf []byte 18068 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18069 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18070 hdr.Len = u.SizeBytes() 18071 hdr.Cap = u.SizeBytes() 18072 18073 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18074 // Since we bypassed the compiler's escape analysis, indicate that u 18075 // must live until the use above. 18076 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18077 return length, err 18078 } 18079 18080 // WriteTo implements io.WriterTo.WriteTo. 18081 func (u *Utime) WriteTo(writer io.Writer) (int64, error) { 18082 // Construct a slice backed by dst's underlying memory. 18083 var buf []byte 18084 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18085 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18086 hdr.Len = u.SizeBytes() 18087 hdr.Cap = u.SizeBytes() 18088 18089 length, err := writer.Write(buf) 18090 // Since we bypassed the compiler's escape analysis, indicate that u 18091 // must live until the use above. 18092 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18093 return int64(length), err 18094 } 18095 18096 // SizeBytes implements marshal.Marshallable.SizeBytes. 18097 func (t *Termios) SizeBytes() int { 18098 return 17 + 18099 1*NumControlCharacters 18100 } 18101 18102 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18103 func (t *Termios) MarshalBytes(dst []byte) []byte { 18104 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.InputFlags)) 18105 dst = dst[4:] 18106 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.OutputFlags)) 18107 dst = dst[4:] 18108 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ControlFlags)) 18109 dst = dst[4:] 18110 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LocalFlags)) 18111 dst = dst[4:] 18112 dst[0] = byte(t.LineDiscipline) 18113 dst = dst[1:] 18114 for idx := 0; idx < NumControlCharacters; idx++ { 18115 dst[0] = byte(t.ControlCharacters[idx]) 18116 dst = dst[1:] 18117 } 18118 return dst 18119 } 18120 18121 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18122 func (t *Termios) UnmarshalBytes(src []byte) []byte { 18123 t.InputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18124 src = src[4:] 18125 t.OutputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18126 src = src[4:] 18127 t.ControlFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18128 src = src[4:] 18129 t.LocalFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18130 src = src[4:] 18131 t.LineDiscipline = uint8(src[0]) 18132 src = src[1:] 18133 for idx := 0; idx < NumControlCharacters; idx++ { 18134 t.ControlCharacters[idx] = uint8(src[0]) 18135 src = src[1:] 18136 } 18137 return src 18138 } 18139 18140 // Packed implements marshal.Marshallable.Packed. 18141 //go:nosplit 18142 func (t *Termios) Packed() bool { 18143 return true 18144 } 18145 18146 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18147 func (t *Termios) MarshalUnsafe(dst []byte) []byte { 18148 size := t.SizeBytes() 18149 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18150 return dst[size:] 18151 } 18152 18153 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18154 func (t *Termios) UnmarshalUnsafe(src []byte) []byte { 18155 size := t.SizeBytes() 18156 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18157 return src[size:] 18158 } 18159 18160 // CopyOutN implements marshal.Marshallable.CopyOutN. 18161 func (t *Termios) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18162 // Construct a slice backed by dst's underlying memory. 18163 var buf []byte 18164 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18165 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18166 hdr.Len = t.SizeBytes() 18167 hdr.Cap = t.SizeBytes() 18168 18169 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18170 // Since we bypassed the compiler's escape analysis, indicate that t 18171 // must live until the use above. 18172 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18173 return length, err 18174 } 18175 18176 // CopyOut implements marshal.Marshallable.CopyOut. 18177 func (t *Termios) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18178 return t.CopyOutN(cc, addr, t.SizeBytes()) 18179 } 18180 18181 // CopyIn implements marshal.Marshallable.CopyIn. 18182 func (t *Termios) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18183 // Construct a slice backed by dst's underlying memory. 18184 var buf []byte 18185 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18186 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18187 hdr.Len = t.SizeBytes() 18188 hdr.Cap = t.SizeBytes() 18189 18190 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18191 // Since we bypassed the compiler's escape analysis, indicate that t 18192 // must live until the use above. 18193 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18194 return length, err 18195 } 18196 18197 // WriteTo implements io.WriterTo.WriteTo. 18198 func (t *Termios) WriteTo(writer io.Writer) (int64, error) { 18199 // Construct a slice backed by dst's underlying memory. 18200 var buf []byte 18201 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18202 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18203 hdr.Len = t.SizeBytes() 18204 hdr.Cap = t.SizeBytes() 18205 18206 length, err := writer.Write(buf) 18207 // Since we bypassed the compiler's escape analysis, indicate that t 18208 // must live until the use above. 18209 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18210 return int64(length), err 18211 } 18212 18213 // SizeBytes implements marshal.Marshallable.SizeBytes. 18214 func (w *WindowSize) SizeBytes() int { 18215 return 4 + 18216 1*4 18217 } 18218 18219 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18220 func (w *WindowSize) MarshalBytes(dst []byte) []byte { 18221 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Rows)) 18222 dst = dst[2:] 18223 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Cols)) 18224 dst = dst[2:] 18225 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 18226 dst = dst[1*(4):] 18227 return dst 18228 } 18229 18230 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18231 func (w *WindowSize) UnmarshalBytes(src []byte) []byte { 18232 w.Rows = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18233 src = src[2:] 18234 w.Cols = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18235 src = src[2:] 18236 // Padding: ~ copy([4]byte(w._), src[:sizeof(byte)*4]) 18237 src = src[1*(4):] 18238 return src 18239 } 18240 18241 // Packed implements marshal.Marshallable.Packed. 18242 //go:nosplit 18243 func (w *WindowSize) Packed() bool { 18244 return true 18245 } 18246 18247 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18248 func (w *WindowSize) MarshalUnsafe(dst []byte) []byte { 18249 size := w.SizeBytes() 18250 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 18251 return dst[size:] 18252 } 18253 18254 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18255 func (w *WindowSize) UnmarshalUnsafe(src []byte) []byte { 18256 size := w.SizeBytes() 18257 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 18258 return src[size:] 18259 } 18260 18261 // CopyOutN implements marshal.Marshallable.CopyOutN. 18262 func (w *WindowSize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18263 // Construct a slice backed by dst's underlying memory. 18264 var buf []byte 18265 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18266 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18267 hdr.Len = w.SizeBytes() 18268 hdr.Cap = w.SizeBytes() 18269 18270 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18271 // Since we bypassed the compiler's escape analysis, indicate that w 18272 // must live until the use above. 18273 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18274 return length, err 18275 } 18276 18277 // CopyOut implements marshal.Marshallable.CopyOut. 18278 func (w *WindowSize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18279 return w.CopyOutN(cc, addr, w.SizeBytes()) 18280 } 18281 18282 // CopyIn implements marshal.Marshallable.CopyIn. 18283 func (w *WindowSize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18284 // Construct a slice backed by dst's underlying memory. 18285 var buf []byte 18286 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18287 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18288 hdr.Len = w.SizeBytes() 18289 hdr.Cap = w.SizeBytes() 18290 18291 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18292 // Since we bypassed the compiler's escape analysis, indicate that w 18293 // must live until the use above. 18294 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18295 return length, err 18296 } 18297 18298 // WriteTo implements io.WriterTo.WriteTo. 18299 func (w *WindowSize) WriteTo(writer io.Writer) (int64, error) { 18300 // Construct a slice backed by dst's underlying memory. 18301 var buf []byte 18302 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18303 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18304 hdr.Len = w.SizeBytes() 18305 hdr.Cap = w.SizeBytes() 18306 18307 length, err := writer.Write(buf) 18308 // Since we bypassed the compiler's escape analysis, indicate that w 18309 // must live until the use above. 18310 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18311 return int64(length), err 18312 } 18313 18314 // SizeBytes implements marshal.Marshallable.SizeBytes. 18315 func (w *Winsize) SizeBytes() int { 18316 return 8 18317 } 18318 18319 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18320 func (w *Winsize) MarshalBytes(dst []byte) []byte { 18321 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Row)) 18322 dst = dst[2:] 18323 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Col)) 18324 dst = dst[2:] 18325 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Xpixel)) 18326 dst = dst[2:] 18327 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Ypixel)) 18328 dst = dst[2:] 18329 return dst 18330 } 18331 18332 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18333 func (w *Winsize) UnmarshalBytes(src []byte) []byte { 18334 w.Row = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18335 src = src[2:] 18336 w.Col = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18337 src = src[2:] 18338 w.Xpixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18339 src = src[2:] 18340 w.Ypixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18341 src = src[2:] 18342 return src 18343 } 18344 18345 // Packed implements marshal.Marshallable.Packed. 18346 //go:nosplit 18347 func (w *Winsize) Packed() bool { 18348 return true 18349 } 18350 18351 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18352 func (w *Winsize) MarshalUnsafe(dst []byte) []byte { 18353 size := w.SizeBytes() 18354 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 18355 return dst[size:] 18356 } 18357 18358 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18359 func (w *Winsize) UnmarshalUnsafe(src []byte) []byte { 18360 size := w.SizeBytes() 18361 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 18362 return src[size:] 18363 } 18364 18365 // CopyOutN implements marshal.Marshallable.CopyOutN. 18366 func (w *Winsize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18367 // Construct a slice backed by dst's underlying memory. 18368 var buf []byte 18369 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18370 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18371 hdr.Len = w.SizeBytes() 18372 hdr.Cap = w.SizeBytes() 18373 18374 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18375 // Since we bypassed the compiler's escape analysis, indicate that w 18376 // must live until the use above. 18377 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18378 return length, err 18379 } 18380 18381 // CopyOut implements marshal.Marshallable.CopyOut. 18382 func (w *Winsize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18383 return w.CopyOutN(cc, addr, w.SizeBytes()) 18384 } 18385 18386 // CopyIn implements marshal.Marshallable.CopyIn. 18387 func (w *Winsize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18388 // Construct a slice backed by dst's underlying memory. 18389 var buf []byte 18390 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18391 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18392 hdr.Len = w.SizeBytes() 18393 hdr.Cap = w.SizeBytes() 18394 18395 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18396 // Since we bypassed the compiler's escape analysis, indicate that w 18397 // must live until the use above. 18398 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18399 return length, err 18400 } 18401 18402 // WriteTo implements io.WriterTo.WriteTo. 18403 func (w *Winsize) WriteTo(writer io.Writer) (int64, error) { 18404 // Construct a slice backed by dst's underlying memory. 18405 var buf []byte 18406 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18407 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18408 hdr.Len = w.SizeBytes() 18409 hdr.Cap = w.SizeBytes() 18410 18411 length, err := writer.Write(buf) 18412 // Since we bypassed the compiler's escape analysis, indicate that w 18413 // must live until the use above. 18414 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18415 return int64(length), err 18416 } 18417 18418 // SizeBytes implements marshal.Marshallable.SizeBytes. 18419 func (u *UtsName) SizeBytes() int { 18420 return 0 + 18421 1*(UTSLen+1) + 18422 1*(UTSLen+1) + 18423 1*(UTSLen+1) + 18424 1*(UTSLen+1) + 18425 1*(UTSLen+1) + 18426 1*(UTSLen+1) 18427 } 18428 18429 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18430 func (u *UtsName) MarshalBytes(dst []byte) []byte { 18431 for idx := 0; idx < (UTSLen+1); idx++ { 18432 dst[0] = byte(u.Sysname[idx]) 18433 dst = dst[1:] 18434 } 18435 for idx := 0; idx < (UTSLen+1); idx++ { 18436 dst[0] = byte(u.Nodename[idx]) 18437 dst = dst[1:] 18438 } 18439 for idx := 0; idx < (UTSLen+1); idx++ { 18440 dst[0] = byte(u.Release[idx]) 18441 dst = dst[1:] 18442 } 18443 for idx := 0; idx < (UTSLen+1); idx++ { 18444 dst[0] = byte(u.Version[idx]) 18445 dst = dst[1:] 18446 } 18447 for idx := 0; idx < (UTSLen+1); idx++ { 18448 dst[0] = byte(u.Machine[idx]) 18449 dst = dst[1:] 18450 } 18451 for idx := 0; idx < (UTSLen+1); idx++ { 18452 dst[0] = byte(u.Domainname[idx]) 18453 dst = dst[1:] 18454 } 18455 return dst 18456 } 18457 18458 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18459 func (u *UtsName) UnmarshalBytes(src []byte) []byte { 18460 for idx := 0; idx < (UTSLen+1); idx++ { 18461 u.Sysname[idx] = src[0] 18462 src = src[1:] 18463 } 18464 for idx := 0; idx < (UTSLen+1); idx++ { 18465 u.Nodename[idx] = src[0] 18466 src = src[1:] 18467 } 18468 for idx := 0; idx < (UTSLen+1); idx++ { 18469 u.Release[idx] = src[0] 18470 src = src[1:] 18471 } 18472 for idx := 0; idx < (UTSLen+1); idx++ { 18473 u.Version[idx] = src[0] 18474 src = src[1:] 18475 } 18476 for idx := 0; idx < (UTSLen+1); idx++ { 18477 u.Machine[idx] = src[0] 18478 src = src[1:] 18479 } 18480 for idx := 0; idx < (UTSLen+1); idx++ { 18481 u.Domainname[idx] = src[0] 18482 src = src[1:] 18483 } 18484 return src 18485 } 18486 18487 // Packed implements marshal.Marshallable.Packed. 18488 //go:nosplit 18489 func (u *UtsName) Packed() bool { 18490 return true 18491 } 18492 18493 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18494 func (u *UtsName) MarshalUnsafe(dst []byte) []byte { 18495 size := u.SizeBytes() 18496 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 18497 return dst[size:] 18498 } 18499 18500 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18501 func (u *UtsName) UnmarshalUnsafe(src []byte) []byte { 18502 size := u.SizeBytes() 18503 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 18504 return src[size:] 18505 } 18506 18507 // CopyOutN implements marshal.Marshallable.CopyOutN. 18508 func (u *UtsName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18509 // Construct a slice backed by dst's underlying memory. 18510 var buf []byte 18511 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18512 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18513 hdr.Len = u.SizeBytes() 18514 hdr.Cap = u.SizeBytes() 18515 18516 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18517 // Since we bypassed the compiler's escape analysis, indicate that u 18518 // must live until the use above. 18519 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18520 return length, err 18521 } 18522 18523 // CopyOut implements marshal.Marshallable.CopyOut. 18524 func (u *UtsName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18525 return u.CopyOutN(cc, addr, u.SizeBytes()) 18526 } 18527 18528 // CopyIn implements marshal.Marshallable.CopyIn. 18529 func (u *UtsName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18530 // Construct a slice backed by dst's underlying memory. 18531 var buf []byte 18532 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18533 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18534 hdr.Len = u.SizeBytes() 18535 hdr.Cap = u.SizeBytes() 18536 18537 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18538 // Since we bypassed the compiler's escape analysis, indicate that u 18539 // must live until the use above. 18540 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18541 return length, err 18542 } 18543 18544 // WriteTo implements io.WriterTo.WriteTo. 18545 func (u *UtsName) WriteTo(writer io.Writer) (int64, error) { 18546 // Construct a slice backed by dst's underlying memory. 18547 var buf []byte 18548 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18549 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18550 hdr.Len = u.SizeBytes() 18551 hdr.Cap = u.SizeBytes() 18552 18553 length, err := writer.Write(buf) 18554 // Since we bypassed the compiler's escape analysis, indicate that u 18555 // must live until the use above. 18556 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18557 return int64(length), err 18558 } 18559