github.com/MerlinKodo/gvisor@v0.0.0-20231110090155-957f62ecf90e/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/MerlinKodo/gvisor/pkg/gohacks" 7 "github.com/MerlinKodo/gvisor/pkg/hostarch" 8 "github.com/MerlinKodo/gvisor/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 = (*CloneArgs)(nil) 22 var _ marshal.Marshallable = (*ControlMessageCredentials)(nil) 23 var _ marshal.Marshallable = (*ControlMessageHeader)(nil) 24 var _ marshal.Marshallable = (*ControlMessageIPPacketInfo)(nil) 25 var _ marshal.Marshallable = (*ControlMessageIPv6PacketInfo)(nil) 26 var _ marshal.Marshallable = (*ElfHeader64)(nil) 27 var _ marshal.Marshallable = (*ElfProg64)(nil) 28 var _ marshal.Marshallable = (*ElfSection64)(nil) 29 var _ marshal.Marshallable = (*ErrorName)(nil) 30 var _ marshal.Marshallable = (*EthtoolCmd)(nil) 31 var _ marshal.Marshallable = (*EthtoolGFeatures)(nil) 32 var _ marshal.Marshallable = (*EthtoolGetFeaturesBlock)(nil) 33 var _ marshal.Marshallable = (*ExtensionName)(nil) 34 var _ marshal.Marshallable = (*FOwnerEx)(nil) 35 var _ marshal.Marshallable = (*FUSEAccessIn)(nil) 36 var _ marshal.Marshallable = (*FUSEAttr)(nil) 37 var _ marshal.Marshallable = (*FUSEAttrOut)(nil) 38 var _ marshal.Marshallable = (*FUSECreateIn)(nil) 39 var _ marshal.Marshallable = (*FUSECreateMeta)(nil) 40 var _ marshal.Marshallable = (*FUSECreateOut)(nil) 41 var _ marshal.Marshallable = (*FUSEDirent)(nil) 42 var _ marshal.Marshallable = (*FUSEDirentMeta)(nil) 43 var _ marshal.Marshallable = (*FUSEDirents)(nil) 44 var _ marshal.Marshallable = (*FUSEEmptyIn)(nil) 45 var _ marshal.Marshallable = (*FUSEEntryOut)(nil) 46 var _ marshal.Marshallable = (*FUSEFallocateIn)(nil) 47 var _ marshal.Marshallable = (*FUSEFsyncIn)(nil) 48 var _ marshal.Marshallable = (*FUSEGetAttrIn)(nil) 49 var _ marshal.Marshallable = (*FUSEHeaderIn)(nil) 50 var _ marshal.Marshallable = (*FUSEHeaderOut)(nil) 51 var _ marshal.Marshallable = (*FUSEInitIn)(nil) 52 var _ marshal.Marshallable = (*FUSEInitOut)(nil) 53 var _ marshal.Marshallable = (*FUSELinkIn)(nil) 54 var _ marshal.Marshallable = (*FUSELookupIn)(nil) 55 var _ marshal.Marshallable = (*FUSEMkdirIn)(nil) 56 var _ marshal.Marshallable = (*FUSEMkdirMeta)(nil) 57 var _ marshal.Marshallable = (*FUSEMknodIn)(nil) 58 var _ marshal.Marshallable = (*FUSEMknodMeta)(nil) 59 var _ marshal.Marshallable = (*FUSEOpID)(nil) 60 var _ marshal.Marshallable = (*FUSEOpcode)(nil) 61 var _ marshal.Marshallable = (*FUSEOpenIn)(nil) 62 var _ marshal.Marshallable = (*FUSEOpenOut)(nil) 63 var _ marshal.Marshallable = (*FUSEReadIn)(nil) 64 var _ marshal.Marshallable = (*FUSEReleaseIn)(nil) 65 var _ marshal.Marshallable = (*FUSERenameIn)(nil) 66 var _ marshal.Marshallable = (*FUSERmDirIn)(nil) 67 var _ marshal.Marshallable = (*FUSESetAttrIn)(nil) 68 var _ marshal.Marshallable = (*FUSEStatfsOut)(nil) 69 var _ marshal.Marshallable = (*FUSESymlinkIn)(nil) 70 var _ marshal.Marshallable = (*FUSEUnlinkIn)(nil) 71 var _ marshal.Marshallable = (*FUSEWriteIn)(nil) 72 var _ marshal.Marshallable = (*FUSEWriteOut)(nil) 73 var _ marshal.Marshallable = (*FUSEWritePayloadIn)(nil) 74 var _ marshal.Marshallable = (*FileMode)(nil) 75 var _ marshal.Marshallable = (*Flock)(nil) 76 var _ marshal.Marshallable = (*ICMP6Filter)(nil) 77 var _ marshal.Marshallable = (*IFConf)(nil) 78 var _ marshal.Marshallable = (*IFReq)(nil) 79 var _ marshal.Marshallable = (*IOCallback)(nil) 80 var _ marshal.Marshallable = (*IOCqRingOffsets)(nil) 81 var _ marshal.Marshallable = (*IOEvent)(nil) 82 var _ marshal.Marshallable = (*IORingIndex)(nil) 83 var _ marshal.Marshallable = (*IORings)(nil) 84 var _ marshal.Marshallable = (*IOSqRingOffsets)(nil) 85 var _ marshal.Marshallable = (*IOUring)(nil) 86 var _ marshal.Marshallable = (*IOUringCqe)(nil) 87 var _ marshal.Marshallable = (*IOUringParams)(nil) 88 var _ marshal.Marshallable = (*IOUringSqe)(nil) 89 var _ marshal.Marshallable = (*IP6TEntry)(nil) 90 var _ marshal.Marshallable = (*IP6TIP)(nil) 91 var _ marshal.Marshallable = (*IP6TReplace)(nil) 92 var _ marshal.Marshallable = (*IPCPerm)(nil) 93 var _ marshal.Marshallable = (*IPTEntry)(nil) 94 var _ marshal.Marshallable = (*IPTGetEntries)(nil) 95 var _ marshal.Marshallable = (*IPTGetinfo)(nil) 96 var _ marshal.Marshallable = (*IPTIP)(nil) 97 var _ marshal.Marshallable = (*IPTOwnerInfo)(nil) 98 var _ marshal.Marshallable = (*IPTReplace)(nil) 99 var _ marshal.Marshallable = (*Inet6Addr)(nil) 100 var _ marshal.Marshallable = (*Inet6MulticastRequest)(nil) 101 var _ marshal.Marshallable = (*InetAddr)(nil) 102 var _ marshal.Marshallable = (*InetMulticastRequest)(nil) 103 var _ marshal.Marshallable = (*InetMulticastRequestWithNIC)(nil) 104 var _ marshal.Marshallable = (*InterfaceAddrMessage)(nil) 105 var _ marshal.Marshallable = (*InterfaceInfoMessage)(nil) 106 var _ marshal.Marshallable = (*ItimerVal)(nil) 107 var _ marshal.Marshallable = (*Itimerspec)(nil) 108 var _ marshal.Marshallable = (*KernelIP6TEntry)(nil) 109 var _ marshal.Marshallable = (*KernelIP6TGetEntries)(nil) 110 var _ marshal.Marshallable = (*KernelIPTEntry)(nil) 111 var _ marshal.Marshallable = (*KernelIPTGetEntries)(nil) 112 var _ marshal.Marshallable = (*Linger)(nil) 113 var _ marshal.Marshallable = (*MqAttr)(nil) 114 var _ marshal.Marshallable = (*MsgBuf)(nil) 115 var _ marshal.Marshallable = (*MsgInfo)(nil) 116 var _ marshal.Marshallable = (*MsqidDS)(nil) 117 var _ marshal.Marshallable = (*NFNATRange)(nil) 118 var _ marshal.Marshallable = (*NetlinkAttrHeader)(nil) 119 var _ marshal.Marshallable = (*NetlinkErrorMessage)(nil) 120 var _ marshal.Marshallable = (*NetlinkMessageHeader)(nil) 121 var _ marshal.Marshallable = (*NfNATIPV4MultiRangeCompat)(nil) 122 var _ marshal.Marshallable = (*NfNATIPV4Range)(nil) 123 var _ marshal.Marshallable = (*NumaPolicy)(nil) 124 var _ marshal.Marshallable = (*PollFD)(nil) 125 var _ marshal.Marshallable = (*RSeqCriticalSection)(nil) 126 var _ marshal.Marshallable = (*RobustListHead)(nil) 127 var _ marshal.Marshallable = (*RouteMessage)(nil) 128 var _ marshal.Marshallable = (*RtAttr)(nil) 129 var _ marshal.Marshallable = (*Rusage)(nil) 130 var _ marshal.Marshallable = (*SeccompData)(nil) 131 var _ marshal.Marshallable = (*SemInfo)(nil) 132 var _ marshal.Marshallable = (*Sembuf)(nil) 133 var _ marshal.Marshallable = (*ShmInfo)(nil) 134 var _ marshal.Marshallable = (*ShmParams)(nil) 135 var _ marshal.Marshallable = (*ShmidDS)(nil) 136 var _ marshal.Marshallable = (*SigAction)(nil) 137 var _ marshal.Marshallable = (*Sigevent)(nil) 138 var _ marshal.Marshallable = (*SignalInfo)(nil) 139 var _ marshal.Marshallable = (*SignalSet)(nil) 140 var _ marshal.Marshallable = (*SignalStack)(nil) 141 var _ marshal.Marshallable = (*SignalfdSiginfo)(nil) 142 var _ marshal.Marshallable = (*SockAddrInet)(nil) 143 var _ marshal.Marshallable = (*SockAddrInet6)(nil) 144 var _ marshal.Marshallable = (*SockAddrLink)(nil) 145 var _ marshal.Marshallable = (*SockAddrNetlink)(nil) 146 var _ marshal.Marshallable = (*SockAddrUnix)(nil) 147 var _ marshal.Marshallable = (*SockErrCMsgIPv4)(nil) 148 var _ marshal.Marshallable = (*SockErrCMsgIPv6)(nil) 149 var _ marshal.Marshallable = (*SockExtendedErr)(nil) 150 var _ marshal.Marshallable = (*Statfs)(nil) 151 var _ marshal.Marshallable = (*Statx)(nil) 152 var _ marshal.Marshallable = (*StatxTimestamp)(nil) 153 var _ marshal.Marshallable = (*Sysinfo)(nil) 154 var _ marshal.Marshallable = (*TCPInfo)(nil) 155 var _ marshal.Marshallable = (*TableName)(nil) 156 var _ marshal.Marshallable = (*Termios)(nil) 157 var _ marshal.Marshallable = (*TimeT)(nil) 158 var _ marshal.Marshallable = (*TimerID)(nil) 159 var _ marshal.Marshallable = (*Timespec)(nil) 160 var _ marshal.Marshallable = (*Timeval)(nil) 161 var _ marshal.Marshallable = (*Tms)(nil) 162 var _ marshal.Marshallable = (*Utime)(nil) 163 var _ marshal.Marshallable = (*UtsName)(nil) 164 var _ marshal.Marshallable = (*WindowSize)(nil) 165 var _ marshal.Marshallable = (*Winsize)(nil) 166 var _ marshal.Marshallable = (*XTCounters)(nil) 167 var _ marshal.Marshallable = (*XTEntryMatch)(nil) 168 var _ marshal.Marshallable = (*XTEntryTarget)(nil) 169 var _ marshal.Marshallable = (*XTErrorTarget)(nil) 170 var _ marshal.Marshallable = (*XTGetRevision)(nil) 171 var _ marshal.Marshallable = (*XTRedirectTarget)(nil) 172 var _ marshal.Marshallable = (*XTSNATTarget)(nil) 173 var _ marshal.Marshallable = (*XTStandardTarget)(nil) 174 var _ marshal.Marshallable = (*XTTCP)(nil) 175 var _ marshal.Marshallable = (*XTUDP)(nil) 176 177 // SizeBytes implements marshal.Marshallable.SizeBytes. 178 func (i *IOCallback) SizeBytes() int { 179 return 64 180 } 181 182 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 183 func (i *IOCallback) MarshalBytes(dst []byte) []byte { 184 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 185 dst = dst[8:] 186 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 187 dst = dst[4:] 188 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 189 dst = dst[4:] 190 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.OpCode)) 191 dst = dst[2:] 192 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.ReqPrio)) 193 dst = dst[2:] 194 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.FD)) 195 dst = dst[4:] 196 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Buf)) 197 dst = dst[8:] 198 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Bytes)) 199 dst = dst[8:] 200 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Offset)) 201 dst = dst[8:] 202 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Reserved2)) 203 dst = dst[8:] 204 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 205 dst = dst[4:] 206 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ResFD)) 207 dst = dst[4:] 208 return dst 209 } 210 211 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 212 func (i *IOCallback) UnmarshalBytes(src []byte) []byte { 213 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 214 src = src[8:] 215 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 216 src = src[4:] 217 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 218 src = src[4:] 219 i.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 220 src = src[2:] 221 i.ReqPrio = int16(hostarch.ByteOrder.Uint16(src[:2])) 222 src = src[2:] 223 i.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 224 src = src[4:] 225 i.Buf = uint64(hostarch.ByteOrder.Uint64(src[:8])) 226 src = src[8:] 227 i.Bytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 228 src = src[8:] 229 i.Offset = int64(hostarch.ByteOrder.Uint64(src[:8])) 230 src = src[8:] 231 i.Reserved2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 232 src = src[8:] 233 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 234 src = src[4:] 235 i.ResFD = int32(hostarch.ByteOrder.Uint32(src[:4])) 236 src = src[4:] 237 return src 238 } 239 240 // Packed implements marshal.Marshallable.Packed. 241 //go:nosplit 242 func (i *IOCallback) Packed() bool { 243 return true 244 } 245 246 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 247 func (i *IOCallback) MarshalUnsafe(dst []byte) []byte { 248 size := i.SizeBytes() 249 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 250 return dst[size:] 251 } 252 253 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 254 func (i *IOCallback) UnmarshalUnsafe(src []byte) []byte { 255 size := i.SizeBytes() 256 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 257 return src[size:] 258 } 259 260 // CopyOutN implements marshal.Marshallable.CopyOutN. 261 func (i *IOCallback) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 262 // Construct a slice backed by dst's underlying memory. 263 var buf []byte 264 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 265 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 266 hdr.Len = i.SizeBytes() 267 hdr.Cap = i.SizeBytes() 268 269 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 270 // Since we bypassed the compiler's escape analysis, indicate that i 271 // must live until the use above. 272 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 273 return length, err 274 } 275 276 // CopyOut implements marshal.Marshallable.CopyOut. 277 func (i *IOCallback) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 278 return i.CopyOutN(cc, addr, i.SizeBytes()) 279 } 280 281 // CopyInN implements marshal.Marshallable.CopyInN. 282 func (i *IOCallback) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 283 // Construct a slice backed by dst's underlying memory. 284 var buf []byte 285 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 286 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 287 hdr.Len = i.SizeBytes() 288 hdr.Cap = i.SizeBytes() 289 290 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 291 // Since we bypassed the compiler's escape analysis, indicate that i 292 // must live until the use above. 293 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 294 return length, err 295 } 296 297 // CopyIn implements marshal.Marshallable.CopyIn. 298 func (i *IOCallback) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 299 return i.CopyInN(cc, addr, i.SizeBytes()) 300 } 301 302 // WriteTo implements io.WriterTo.WriteTo. 303 func (i *IOCallback) WriteTo(writer io.Writer) (int64, error) { 304 // Construct a slice backed by dst's underlying memory. 305 var buf []byte 306 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 307 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 308 hdr.Len = i.SizeBytes() 309 hdr.Cap = i.SizeBytes() 310 311 length, err := writer.Write(buf) 312 // Since we bypassed the compiler's escape analysis, indicate that i 313 // must live until the use above. 314 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 315 return int64(length), err 316 } 317 318 // SizeBytes implements marshal.Marshallable.SizeBytes. 319 func (i *IOEvent) SizeBytes() int { 320 return 32 321 } 322 323 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 324 func (i *IOEvent) MarshalBytes(dst []byte) []byte { 325 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 326 dst = dst[8:] 327 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Obj)) 328 dst = dst[8:] 329 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result)) 330 dst = dst[8:] 331 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result2)) 332 dst = dst[8:] 333 return dst 334 } 335 336 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 337 func (i *IOEvent) UnmarshalBytes(src []byte) []byte { 338 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 339 src = src[8:] 340 i.Obj = uint64(hostarch.ByteOrder.Uint64(src[:8])) 341 src = src[8:] 342 i.Result = int64(hostarch.ByteOrder.Uint64(src[:8])) 343 src = src[8:] 344 i.Result2 = int64(hostarch.ByteOrder.Uint64(src[:8])) 345 src = src[8:] 346 return src 347 } 348 349 // Packed implements marshal.Marshallable.Packed. 350 //go:nosplit 351 func (i *IOEvent) Packed() bool { 352 return true 353 } 354 355 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 356 func (i *IOEvent) MarshalUnsafe(dst []byte) []byte { 357 size := i.SizeBytes() 358 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 359 return dst[size:] 360 } 361 362 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 363 func (i *IOEvent) UnmarshalUnsafe(src []byte) []byte { 364 size := i.SizeBytes() 365 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 366 return src[size:] 367 } 368 369 // CopyOutN implements marshal.Marshallable.CopyOutN. 370 func (i *IOEvent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 371 // Construct a slice backed by dst's underlying memory. 372 var buf []byte 373 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 374 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 375 hdr.Len = i.SizeBytes() 376 hdr.Cap = i.SizeBytes() 377 378 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 379 // Since we bypassed the compiler's escape analysis, indicate that i 380 // must live until the use above. 381 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 382 return length, err 383 } 384 385 // CopyOut implements marshal.Marshallable.CopyOut. 386 func (i *IOEvent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 387 return i.CopyOutN(cc, addr, i.SizeBytes()) 388 } 389 390 // CopyInN implements marshal.Marshallable.CopyInN. 391 func (i *IOEvent) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 392 // Construct a slice backed by dst's underlying memory. 393 var buf []byte 394 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 395 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 396 hdr.Len = i.SizeBytes() 397 hdr.Cap = i.SizeBytes() 398 399 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 400 // Since we bypassed the compiler's escape analysis, indicate that i 401 // must live until the use above. 402 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 403 return length, err 404 } 405 406 // CopyIn implements marshal.Marshallable.CopyIn. 407 func (i *IOEvent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 408 return i.CopyInN(cc, addr, i.SizeBytes()) 409 } 410 411 // WriteTo implements io.WriterTo.WriteTo. 412 func (i *IOEvent) WriteTo(writer io.Writer) (int64, error) { 413 // Construct a slice backed by dst's underlying memory. 414 var buf []byte 415 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 416 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 417 hdr.Len = i.SizeBytes() 418 hdr.Cap = i.SizeBytes() 419 420 length, err := writer.Write(buf) 421 // Since we bypassed the compiler's escape analysis, indicate that i 422 // must live until the use above. 423 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 424 return int64(length), err 425 } 426 427 // SizeBytes implements marshal.Marshallable.SizeBytes. 428 func (b *BPFInstruction) SizeBytes() int { 429 return 8 430 } 431 432 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 433 func (b *BPFInstruction) MarshalBytes(dst []byte) []byte { 434 hostarch.ByteOrder.PutUint16(dst[:2], uint16(b.OpCode)) 435 dst = dst[2:] 436 dst[0] = byte(b.JumpIfTrue) 437 dst = dst[1:] 438 dst[0] = byte(b.JumpIfFalse) 439 dst = dst[1:] 440 hostarch.ByteOrder.PutUint32(dst[:4], uint32(b.K)) 441 dst = dst[4:] 442 return dst 443 } 444 445 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 446 func (b *BPFInstruction) UnmarshalBytes(src []byte) []byte { 447 b.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 448 src = src[2:] 449 b.JumpIfTrue = uint8(src[0]) 450 src = src[1:] 451 b.JumpIfFalse = uint8(src[0]) 452 src = src[1:] 453 b.K = uint32(hostarch.ByteOrder.Uint32(src[:4])) 454 src = src[4:] 455 return src 456 } 457 458 // Packed implements marshal.Marshallable.Packed. 459 //go:nosplit 460 func (b *BPFInstruction) Packed() bool { 461 return true 462 } 463 464 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 465 func (b *BPFInstruction) MarshalUnsafe(dst []byte) []byte { 466 size := b.SizeBytes() 467 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size)) 468 return dst[size:] 469 } 470 471 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 472 func (b *BPFInstruction) UnmarshalUnsafe(src []byte) []byte { 473 size := b.SizeBytes() 474 gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size)) 475 return src[size:] 476 } 477 478 // CopyOutN implements marshal.Marshallable.CopyOutN. 479 func (b *BPFInstruction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 480 // Construct a slice backed by dst's underlying memory. 481 var buf []byte 482 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 483 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 484 hdr.Len = b.SizeBytes() 485 hdr.Cap = b.SizeBytes() 486 487 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 488 // Since we bypassed the compiler's escape analysis, indicate that b 489 // must live until the use above. 490 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 491 return length, err 492 } 493 494 // CopyOut implements marshal.Marshallable.CopyOut. 495 func (b *BPFInstruction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 496 return b.CopyOutN(cc, addr, b.SizeBytes()) 497 } 498 499 // CopyInN implements marshal.Marshallable.CopyInN. 500 func (b *BPFInstruction) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 501 // Construct a slice backed by dst's underlying memory. 502 var buf []byte 503 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 504 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 505 hdr.Len = b.SizeBytes() 506 hdr.Cap = b.SizeBytes() 507 508 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 509 // Since we bypassed the compiler's escape analysis, indicate that b 510 // must live until the use above. 511 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 512 return length, err 513 } 514 515 // CopyIn implements marshal.Marshallable.CopyIn. 516 func (b *BPFInstruction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 517 return b.CopyInN(cc, addr, b.SizeBytes()) 518 } 519 520 // WriteTo implements io.WriterTo.WriteTo. 521 func (b *BPFInstruction) WriteTo(writer io.Writer) (int64, error) { 522 // Construct a slice backed by dst's underlying memory. 523 var buf []byte 524 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 525 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 526 hdr.Len = b.SizeBytes() 527 hdr.Cap = b.SizeBytes() 528 529 length, err := writer.Write(buf) 530 // Since we bypassed the compiler's escape analysis, indicate that b 531 // must live until the use above. 532 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 533 return int64(length), err 534 } 535 536 // CopyBPFInstructionSliceIn copies in a slice of BPFInstruction objects from the task's memory. 537 func CopyBPFInstructionSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []BPFInstruction) (int, error) { 538 count := len(dst) 539 if count == 0 { 540 return 0, nil 541 } 542 size := (*BPFInstruction)(nil).SizeBytes() 543 544 ptr := unsafe.Pointer(&dst) 545 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 546 547 // Construct a slice backed by dst's underlying memory. 548 var buf []byte 549 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 550 hdr.Data = uintptr(val) 551 hdr.Len = size * count 552 hdr.Cap = size * count 553 554 length, err := cc.CopyInBytes(addr, buf) 555 // Since we bypassed the compiler's escape analysis, indicate that dst 556 // must live until the use above. 557 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 558 return length, err 559 } 560 561 // CopyBPFInstructionSliceOut copies a slice of BPFInstruction objects to the task's memory. 562 func CopyBPFInstructionSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []BPFInstruction) (int, error) { 563 count := len(src) 564 if count == 0 { 565 return 0, nil 566 } 567 size := (*BPFInstruction)(nil).SizeBytes() 568 569 ptr := unsafe.Pointer(&src) 570 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 571 572 // Construct a slice backed by dst's underlying memory. 573 var buf []byte 574 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 575 hdr.Data = uintptr(val) 576 hdr.Len = size * count 577 hdr.Cap = size * count 578 579 length, err := cc.CopyOutBytes(addr, buf) 580 // Since we bypassed the compiler's escape analysis, indicate that src 581 // must live until the use above. 582 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 583 return length, err 584 } 585 586 // MarshalUnsafeBPFInstructionSlice is like BPFInstruction.MarshalUnsafe, but for a []BPFInstruction. 587 func MarshalUnsafeBPFInstructionSlice(src []BPFInstruction, dst []byte) []byte { 588 count := len(src) 589 if count == 0 { 590 return dst 591 } 592 593 size := (*BPFInstruction)(nil).SizeBytes() 594 buf := dst[:size*count] 595 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 596 return dst[size*count:] 597 } 598 599 // UnmarshalUnsafeBPFInstructionSlice is like BPFInstruction.UnmarshalUnsafe, but for a []BPFInstruction. 600 func UnmarshalUnsafeBPFInstructionSlice(dst []BPFInstruction, src []byte) []byte { 601 count := len(dst) 602 if count == 0 { 603 return src 604 } 605 606 size := (*BPFInstruction)(nil).SizeBytes() 607 buf := src[:size*count] 608 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 609 return src[size*count:] 610 } 611 612 // SizeBytes implements marshal.Marshallable.SizeBytes. 613 func (c *CapUserData) SizeBytes() int { 614 return 12 615 } 616 617 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 618 func (c *CapUserData) MarshalBytes(dst []byte) []byte { 619 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Effective)) 620 dst = dst[4:] 621 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Permitted)) 622 dst = dst[4:] 623 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Inheritable)) 624 dst = dst[4:] 625 return dst 626 } 627 628 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 629 func (c *CapUserData) UnmarshalBytes(src []byte) []byte { 630 c.Effective = uint32(hostarch.ByteOrder.Uint32(src[:4])) 631 src = src[4:] 632 c.Permitted = uint32(hostarch.ByteOrder.Uint32(src[:4])) 633 src = src[4:] 634 c.Inheritable = uint32(hostarch.ByteOrder.Uint32(src[:4])) 635 src = src[4:] 636 return src 637 } 638 639 // Packed implements marshal.Marshallable.Packed. 640 //go:nosplit 641 func (c *CapUserData) Packed() bool { 642 return true 643 } 644 645 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 646 func (c *CapUserData) MarshalUnsafe(dst []byte) []byte { 647 size := c.SizeBytes() 648 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 649 return dst[size:] 650 } 651 652 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 653 func (c *CapUserData) UnmarshalUnsafe(src []byte) []byte { 654 size := c.SizeBytes() 655 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 656 return src[size:] 657 } 658 659 // CopyOutN implements marshal.Marshallable.CopyOutN. 660 func (c *CapUserData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 661 // Construct a slice backed by dst's underlying memory. 662 var buf []byte 663 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 664 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 665 hdr.Len = c.SizeBytes() 666 hdr.Cap = c.SizeBytes() 667 668 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 669 // Since we bypassed the compiler's escape analysis, indicate that c 670 // must live until the use above. 671 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 672 return length, err 673 } 674 675 // CopyOut implements marshal.Marshallable.CopyOut. 676 func (c *CapUserData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 677 return c.CopyOutN(cc, addr, c.SizeBytes()) 678 } 679 680 // CopyInN implements marshal.Marshallable.CopyInN. 681 func (c *CapUserData) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, 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 := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 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 length, err 694 } 695 696 // CopyIn implements marshal.Marshallable.CopyIn. 697 func (c *CapUserData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 698 return c.CopyInN(cc, addr, c.SizeBytes()) 699 } 700 701 // WriteTo implements io.WriterTo.WriteTo. 702 func (c *CapUserData) WriteTo(writer io.Writer) (int64, error) { 703 // Construct a slice backed by dst's underlying memory. 704 var buf []byte 705 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 706 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 707 hdr.Len = c.SizeBytes() 708 hdr.Cap = c.SizeBytes() 709 710 length, err := writer.Write(buf) 711 // Since we bypassed the compiler's escape analysis, indicate that c 712 // must live until the use above. 713 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 714 return int64(length), err 715 } 716 717 // CopyCapUserDataSliceIn copies in a slice of CapUserData objects from the task's memory. 718 func CopyCapUserDataSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []CapUserData) (int, error) { 719 count := len(dst) 720 if count == 0 { 721 return 0, nil 722 } 723 size := (*CapUserData)(nil).SizeBytes() 724 725 ptr := unsafe.Pointer(&dst) 726 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 727 728 // Construct a slice backed by dst's underlying memory. 729 var buf []byte 730 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 731 hdr.Data = uintptr(val) 732 hdr.Len = size * count 733 hdr.Cap = size * count 734 735 length, err := cc.CopyInBytes(addr, buf) 736 // Since we bypassed the compiler's escape analysis, indicate that dst 737 // must live until the use above. 738 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 739 return length, err 740 } 741 742 // CopyCapUserDataSliceOut copies a slice of CapUserData objects to the task's memory. 743 func CopyCapUserDataSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []CapUserData) (int, error) { 744 count := len(src) 745 if count == 0 { 746 return 0, nil 747 } 748 size := (*CapUserData)(nil).SizeBytes() 749 750 ptr := unsafe.Pointer(&src) 751 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 752 753 // Construct a slice backed by dst's underlying memory. 754 var buf []byte 755 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 756 hdr.Data = uintptr(val) 757 hdr.Len = size * count 758 hdr.Cap = size * count 759 760 length, err := cc.CopyOutBytes(addr, buf) 761 // Since we bypassed the compiler's escape analysis, indicate that src 762 // must live until the use above. 763 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 764 return length, err 765 } 766 767 // MarshalUnsafeCapUserDataSlice is like CapUserData.MarshalUnsafe, but for a []CapUserData. 768 func MarshalUnsafeCapUserDataSlice(src []CapUserData, dst []byte) []byte { 769 count := len(src) 770 if count == 0 { 771 return dst 772 } 773 774 size := (*CapUserData)(nil).SizeBytes() 775 buf := dst[:size*count] 776 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 777 return dst[size*count:] 778 } 779 780 // UnmarshalUnsafeCapUserDataSlice is like CapUserData.UnmarshalUnsafe, but for a []CapUserData. 781 func UnmarshalUnsafeCapUserDataSlice(dst []CapUserData, src []byte) []byte { 782 count := len(dst) 783 if count == 0 { 784 return src 785 } 786 787 size := (*CapUserData)(nil).SizeBytes() 788 buf := src[:size*count] 789 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 790 return src[size*count:] 791 } 792 793 // SizeBytes implements marshal.Marshallable.SizeBytes. 794 func (c *CapUserHeader) SizeBytes() int { 795 return 8 796 } 797 798 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 799 func (c *CapUserHeader) MarshalBytes(dst []byte) []byte { 800 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Version)) 801 dst = dst[4:] 802 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Pid)) 803 dst = dst[4:] 804 return dst 805 } 806 807 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 808 func (c *CapUserHeader) UnmarshalBytes(src []byte) []byte { 809 c.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 810 src = src[4:] 811 c.Pid = int32(hostarch.ByteOrder.Uint32(src[:4])) 812 src = src[4:] 813 return src 814 } 815 816 // Packed implements marshal.Marshallable.Packed. 817 //go:nosplit 818 func (c *CapUserHeader) Packed() bool { 819 return true 820 } 821 822 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 823 func (c *CapUserHeader) MarshalUnsafe(dst []byte) []byte { 824 size := c.SizeBytes() 825 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 826 return dst[size:] 827 } 828 829 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 830 func (c *CapUserHeader) UnmarshalUnsafe(src []byte) []byte { 831 size := c.SizeBytes() 832 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 833 return src[size:] 834 } 835 836 // CopyOutN implements marshal.Marshallable.CopyOutN. 837 func (c *CapUserHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (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.CopyOutBytes(addr, buf[:limit]) // 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 // CopyOut implements marshal.Marshallable.CopyOut. 853 func (c *CapUserHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 854 return c.CopyOutN(cc, addr, c.SizeBytes()) 855 } 856 857 // CopyInN implements marshal.Marshallable.CopyInN. 858 func (c *CapUserHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 859 // Construct a slice backed by dst's underlying memory. 860 var buf []byte 861 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 862 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 863 hdr.Len = c.SizeBytes() 864 hdr.Cap = c.SizeBytes() 865 866 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 867 // Since we bypassed the compiler's escape analysis, indicate that c 868 // must live until the use above. 869 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 870 return length, err 871 } 872 873 // CopyIn implements marshal.Marshallable.CopyIn. 874 func (c *CapUserHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 875 return c.CopyInN(cc, addr, c.SizeBytes()) 876 } 877 878 // WriteTo implements io.WriterTo.WriteTo. 879 func (c *CapUserHeader) WriteTo(writer io.Writer) (int64, error) { 880 // Construct a slice backed by dst's underlying memory. 881 var buf []byte 882 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 883 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 884 hdr.Len = c.SizeBytes() 885 hdr.Cap = c.SizeBytes() 886 887 length, err := writer.Write(buf) 888 // Since we bypassed the compiler's escape analysis, indicate that c 889 // must live until the use above. 890 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 891 return int64(length), err 892 } 893 894 // SizeBytes implements marshal.Marshallable.SizeBytes. 895 func (c *CloneArgs) SizeBytes() int { 896 return 88 897 } 898 899 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 900 func (c *CloneArgs) MarshalBytes(dst []byte) []byte { 901 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Flags)) 902 dst = dst[8:] 903 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Pidfd)) 904 dst = dst[8:] 905 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.ChildTID)) 906 dst = dst[8:] 907 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.ParentTID)) 908 dst = dst[8:] 909 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.ExitSignal)) 910 dst = dst[8:] 911 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Stack)) 912 dst = dst[8:] 913 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.StackSize)) 914 dst = dst[8:] 915 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.TLS)) 916 dst = dst[8:] 917 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.SetTID)) 918 dst = dst[8:] 919 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.SetTIDSize)) 920 dst = dst[8:] 921 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Cgroup)) 922 dst = dst[8:] 923 return dst 924 } 925 926 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 927 func (c *CloneArgs) UnmarshalBytes(src []byte) []byte { 928 c.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 929 src = src[8:] 930 c.Pidfd = uint64(hostarch.ByteOrder.Uint64(src[:8])) 931 src = src[8:] 932 c.ChildTID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 933 src = src[8:] 934 c.ParentTID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 935 src = src[8:] 936 c.ExitSignal = uint64(hostarch.ByteOrder.Uint64(src[:8])) 937 src = src[8:] 938 c.Stack = uint64(hostarch.ByteOrder.Uint64(src[:8])) 939 src = src[8:] 940 c.StackSize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 941 src = src[8:] 942 c.TLS = uint64(hostarch.ByteOrder.Uint64(src[:8])) 943 src = src[8:] 944 c.SetTID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 945 src = src[8:] 946 c.SetTIDSize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 947 src = src[8:] 948 c.Cgroup = uint64(hostarch.ByteOrder.Uint64(src[:8])) 949 src = src[8:] 950 return src 951 } 952 953 // Packed implements marshal.Marshallable.Packed. 954 //go:nosplit 955 func (c *CloneArgs) Packed() bool { 956 return true 957 } 958 959 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 960 func (c *CloneArgs) MarshalUnsafe(dst []byte) []byte { 961 size := c.SizeBytes() 962 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 963 return dst[size:] 964 } 965 966 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 967 func (c *CloneArgs) UnmarshalUnsafe(src []byte) []byte { 968 size := c.SizeBytes() 969 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 970 return src[size:] 971 } 972 973 // CopyOutN implements marshal.Marshallable.CopyOutN. 974 func (c *CloneArgs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 975 // Construct a slice backed by dst's underlying memory. 976 var buf []byte 977 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 978 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 979 hdr.Len = c.SizeBytes() 980 hdr.Cap = c.SizeBytes() 981 982 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 983 // Since we bypassed the compiler's escape analysis, indicate that c 984 // must live until the use above. 985 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 986 return length, err 987 } 988 989 // CopyOut implements marshal.Marshallable.CopyOut. 990 func (c *CloneArgs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 991 return c.CopyOutN(cc, addr, c.SizeBytes()) 992 } 993 994 // CopyInN implements marshal.Marshallable.CopyInN. 995 func (c *CloneArgs) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 996 // Construct a slice backed by dst's underlying memory. 997 var buf []byte 998 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 999 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 1000 hdr.Len = c.SizeBytes() 1001 hdr.Cap = c.SizeBytes() 1002 1003 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1004 // Since we bypassed the compiler's escape analysis, indicate that c 1005 // must live until the use above. 1006 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 1007 return length, err 1008 } 1009 1010 // CopyIn implements marshal.Marshallable.CopyIn. 1011 func (c *CloneArgs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1012 return c.CopyInN(cc, addr, c.SizeBytes()) 1013 } 1014 1015 // WriteTo implements io.WriterTo.WriteTo. 1016 func (c *CloneArgs) WriteTo(writer io.Writer) (int64, error) { 1017 // Construct a slice backed by dst's underlying memory. 1018 var buf []byte 1019 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1020 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 1021 hdr.Len = c.SizeBytes() 1022 hdr.Cap = c.SizeBytes() 1023 1024 length, err := writer.Write(buf) 1025 // Since we bypassed the compiler's escape analysis, indicate that c 1026 // must live until the use above. 1027 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 1028 return int64(length), err 1029 } 1030 1031 // SizeBytes implements marshal.Marshallable.SizeBytes. 1032 func (e *ElfHeader64) SizeBytes() int { 1033 return 48 + 1034 1*16 1035 } 1036 1037 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1038 func (e *ElfHeader64) MarshalBytes(dst []byte) []byte { 1039 for idx := 0; idx < 16; idx++ { 1040 dst[0] = byte(e.Ident[idx]) 1041 dst = dst[1:] 1042 } 1043 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Type)) 1044 dst = dst[2:] 1045 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Machine)) 1046 dst = dst[2:] 1047 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Version)) 1048 dst = dst[4:] 1049 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entry)) 1050 dst = dst[8:] 1051 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Phoff)) 1052 dst = dst[8:] 1053 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Shoff)) 1054 dst = dst[8:] 1055 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1056 dst = dst[4:] 1057 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Ehsize)) 1058 dst = dst[2:] 1059 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phentsize)) 1060 dst = dst[2:] 1061 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phnum)) 1062 dst = dst[2:] 1063 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shentsize)) 1064 dst = dst[2:] 1065 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shnum)) 1066 dst = dst[2:] 1067 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shstrndx)) 1068 dst = dst[2:] 1069 return dst 1070 } 1071 1072 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1073 func (e *ElfHeader64) UnmarshalBytes(src []byte) []byte { 1074 for idx := 0; idx < 16; idx++ { 1075 e.Ident[idx] = src[0] 1076 src = src[1:] 1077 } 1078 e.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1079 src = src[2:] 1080 e.Machine = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1081 src = src[2:] 1082 e.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1083 src = src[4:] 1084 e.Entry = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1085 src = src[8:] 1086 e.Phoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1087 src = src[8:] 1088 e.Shoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1089 src = src[8:] 1090 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1091 src = src[4:] 1092 e.Ehsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1093 src = src[2:] 1094 e.Phentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1095 src = src[2:] 1096 e.Phnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1097 src = src[2:] 1098 e.Shentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1099 src = src[2:] 1100 e.Shnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1101 src = src[2:] 1102 e.Shstrndx = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1103 src = src[2:] 1104 return src 1105 } 1106 1107 // Packed implements marshal.Marshallable.Packed. 1108 //go:nosplit 1109 func (e *ElfHeader64) Packed() bool { 1110 return true 1111 } 1112 1113 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1114 func (e *ElfHeader64) MarshalUnsafe(dst []byte) []byte { 1115 size := e.SizeBytes() 1116 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1117 return dst[size:] 1118 } 1119 1120 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1121 func (e *ElfHeader64) UnmarshalUnsafe(src []byte) []byte { 1122 size := e.SizeBytes() 1123 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1124 return src[size:] 1125 } 1126 1127 // CopyOutN implements marshal.Marshallable.CopyOutN. 1128 func (e *ElfHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1129 // Construct a slice backed by dst's underlying memory. 1130 var buf []byte 1131 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1132 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1133 hdr.Len = e.SizeBytes() 1134 hdr.Cap = e.SizeBytes() 1135 1136 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1137 // Since we bypassed the compiler's escape analysis, indicate that e 1138 // must live until the use above. 1139 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1140 return length, err 1141 } 1142 1143 // CopyOut implements marshal.Marshallable.CopyOut. 1144 func (e *ElfHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1145 return e.CopyOutN(cc, addr, e.SizeBytes()) 1146 } 1147 1148 // CopyInN implements marshal.Marshallable.CopyInN. 1149 func (e *ElfHeader64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1150 // Construct a slice backed by dst's underlying memory. 1151 var buf []byte 1152 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1153 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1154 hdr.Len = e.SizeBytes() 1155 hdr.Cap = e.SizeBytes() 1156 1157 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1158 // Since we bypassed the compiler's escape analysis, indicate that e 1159 // must live until the use above. 1160 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1161 return length, err 1162 } 1163 1164 // CopyIn implements marshal.Marshallable.CopyIn. 1165 func (e *ElfHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1166 return e.CopyInN(cc, addr, e.SizeBytes()) 1167 } 1168 1169 // WriteTo implements io.WriterTo.WriteTo. 1170 func (e *ElfHeader64) WriteTo(writer io.Writer) (int64, error) { 1171 // Construct a slice backed by dst's underlying memory. 1172 var buf []byte 1173 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1174 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1175 hdr.Len = e.SizeBytes() 1176 hdr.Cap = e.SizeBytes() 1177 1178 length, err := writer.Write(buf) 1179 // Since we bypassed the compiler's escape analysis, indicate that e 1180 // must live until the use above. 1181 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1182 return int64(length), err 1183 } 1184 1185 // SizeBytes implements marshal.Marshallable.SizeBytes. 1186 func (e *ElfProg64) SizeBytes() int { 1187 return 56 1188 } 1189 1190 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1191 func (e *ElfProg64) MarshalBytes(dst []byte) []byte { 1192 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1193 dst = dst[4:] 1194 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1195 dst = dst[4:] 1196 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1197 dst = dst[8:] 1198 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Vaddr)) 1199 dst = dst[8:] 1200 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Paddr)) 1201 dst = dst[8:] 1202 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Filesz)) 1203 dst = dst[8:] 1204 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Memsz)) 1205 dst = dst[8:] 1206 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Align)) 1207 dst = dst[8:] 1208 return dst 1209 } 1210 1211 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1212 func (e *ElfProg64) UnmarshalBytes(src []byte) []byte { 1213 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1214 src = src[4:] 1215 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1216 src = src[4:] 1217 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1218 src = src[8:] 1219 e.Vaddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1220 src = src[8:] 1221 e.Paddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1222 src = src[8:] 1223 e.Filesz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1224 src = src[8:] 1225 e.Memsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1226 src = src[8:] 1227 e.Align = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1228 src = src[8:] 1229 return src 1230 } 1231 1232 // Packed implements marshal.Marshallable.Packed. 1233 //go:nosplit 1234 func (e *ElfProg64) Packed() bool { 1235 return true 1236 } 1237 1238 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1239 func (e *ElfProg64) MarshalUnsafe(dst []byte) []byte { 1240 size := e.SizeBytes() 1241 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1242 return dst[size:] 1243 } 1244 1245 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1246 func (e *ElfProg64) UnmarshalUnsafe(src []byte) []byte { 1247 size := e.SizeBytes() 1248 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1249 return src[size:] 1250 } 1251 1252 // CopyOutN implements marshal.Marshallable.CopyOutN. 1253 func (e *ElfProg64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1254 // Construct a slice backed by dst's underlying memory. 1255 var buf []byte 1256 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1257 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1258 hdr.Len = e.SizeBytes() 1259 hdr.Cap = e.SizeBytes() 1260 1261 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1262 // Since we bypassed the compiler's escape analysis, indicate that e 1263 // must live until the use above. 1264 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1265 return length, err 1266 } 1267 1268 // CopyOut implements marshal.Marshallable.CopyOut. 1269 func (e *ElfProg64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1270 return e.CopyOutN(cc, addr, e.SizeBytes()) 1271 } 1272 1273 // CopyInN implements marshal.Marshallable.CopyInN. 1274 func (e *ElfProg64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1275 // Construct a slice backed by dst's underlying memory. 1276 var buf []byte 1277 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1278 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1279 hdr.Len = e.SizeBytes() 1280 hdr.Cap = e.SizeBytes() 1281 1282 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1283 // Since we bypassed the compiler's escape analysis, indicate that e 1284 // must live until the use above. 1285 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1286 return length, err 1287 } 1288 1289 // CopyIn implements marshal.Marshallable.CopyIn. 1290 func (e *ElfProg64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1291 return e.CopyInN(cc, addr, e.SizeBytes()) 1292 } 1293 1294 // WriteTo implements io.WriterTo.WriteTo. 1295 func (e *ElfProg64) WriteTo(writer io.Writer) (int64, error) { 1296 // Construct a slice backed by dst's underlying memory. 1297 var buf []byte 1298 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1299 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1300 hdr.Len = e.SizeBytes() 1301 hdr.Cap = e.SizeBytes() 1302 1303 length, err := writer.Write(buf) 1304 // Since we bypassed the compiler's escape analysis, indicate that e 1305 // must live until the use above. 1306 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1307 return int64(length), err 1308 } 1309 1310 // SizeBytes implements marshal.Marshallable.SizeBytes. 1311 func (e *ElfSection64) SizeBytes() int { 1312 return 64 1313 } 1314 1315 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1316 func (e *ElfSection64) MarshalBytes(dst []byte) []byte { 1317 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Name)) 1318 dst = dst[4:] 1319 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1320 dst = dst[4:] 1321 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Flags)) 1322 dst = dst[8:] 1323 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addr)) 1324 dst = dst[8:] 1325 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1326 dst = dst[8:] 1327 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Size)) 1328 dst = dst[8:] 1329 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Link)) 1330 dst = dst[4:] 1331 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Info)) 1332 dst = dst[4:] 1333 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addralign)) 1334 dst = dst[8:] 1335 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entsize)) 1336 dst = dst[8:] 1337 return dst 1338 } 1339 1340 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1341 func (e *ElfSection64) UnmarshalBytes(src []byte) []byte { 1342 e.Name = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1343 src = src[4:] 1344 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1345 src = src[4:] 1346 e.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1347 src = src[8:] 1348 e.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1349 src = src[8:] 1350 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1351 src = src[8:] 1352 e.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1353 src = src[8:] 1354 e.Link = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1355 src = src[4:] 1356 e.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1357 src = src[4:] 1358 e.Addralign = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1359 src = src[8:] 1360 e.Entsize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1361 src = src[8:] 1362 return src 1363 } 1364 1365 // Packed implements marshal.Marshallable.Packed. 1366 //go:nosplit 1367 func (e *ElfSection64) Packed() bool { 1368 return true 1369 } 1370 1371 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1372 func (e *ElfSection64) MarshalUnsafe(dst []byte) []byte { 1373 size := e.SizeBytes() 1374 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1375 return dst[size:] 1376 } 1377 1378 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1379 func (e *ElfSection64) UnmarshalUnsafe(src []byte) []byte { 1380 size := e.SizeBytes() 1381 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1382 return src[size:] 1383 } 1384 1385 // CopyOutN implements marshal.Marshallable.CopyOutN. 1386 func (e *ElfSection64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1387 // Construct a slice backed by dst's underlying memory. 1388 var buf []byte 1389 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1390 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1391 hdr.Len = e.SizeBytes() 1392 hdr.Cap = e.SizeBytes() 1393 1394 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1395 // Since we bypassed the compiler's escape analysis, indicate that e 1396 // must live until the use above. 1397 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1398 return length, err 1399 } 1400 1401 // CopyOut implements marshal.Marshallable.CopyOut. 1402 func (e *ElfSection64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1403 return e.CopyOutN(cc, addr, e.SizeBytes()) 1404 } 1405 1406 // CopyInN implements marshal.Marshallable.CopyInN. 1407 func (e *ElfSection64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1408 // Construct a slice backed by dst's underlying memory. 1409 var buf []byte 1410 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1411 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1412 hdr.Len = e.SizeBytes() 1413 hdr.Cap = e.SizeBytes() 1414 1415 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1416 // Since we bypassed the compiler's escape analysis, indicate that e 1417 // must live until the use above. 1418 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1419 return length, err 1420 } 1421 1422 // CopyIn implements marshal.Marshallable.CopyIn. 1423 func (e *ElfSection64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1424 return e.CopyInN(cc, addr, e.SizeBytes()) 1425 } 1426 1427 // WriteTo implements io.WriterTo.WriteTo. 1428 func (e *ElfSection64) WriteTo(writer io.Writer) (int64, error) { 1429 // Construct a slice backed by dst's underlying memory. 1430 var buf []byte 1431 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1432 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1433 hdr.Len = e.SizeBytes() 1434 hdr.Cap = e.SizeBytes() 1435 1436 length, err := writer.Write(buf) 1437 // Since we bypassed the compiler's escape analysis, indicate that e 1438 // must live until the use above. 1439 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1440 return int64(length), err 1441 } 1442 1443 // SizeBytes implements marshal.Marshallable.SizeBytes. 1444 func (s *SockErrCMsgIPv4) SizeBytes() int { 1445 return 0 + 1446 (*SockExtendedErr)(nil).SizeBytes() + 1447 (*SockAddrInet)(nil).SizeBytes() 1448 } 1449 1450 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1451 func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) []byte { 1452 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1453 dst = s.Offender.MarshalUnsafe(dst) 1454 return dst 1455 } 1456 1457 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1458 func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) []byte { 1459 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1460 src = s.Offender.UnmarshalUnsafe(src) 1461 return src 1462 } 1463 1464 // Packed implements marshal.Marshallable.Packed. 1465 //go:nosplit 1466 func (s *SockErrCMsgIPv4) Packed() bool { 1467 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1468 } 1469 1470 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1471 func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) []byte { 1472 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1473 size := s.SizeBytes() 1474 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1475 return dst[size:] 1476 } 1477 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes. 1478 return s.MarshalBytes(dst) 1479 } 1480 1481 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1482 func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) []byte { 1483 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1484 size := s.SizeBytes() 1485 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1486 return src[size:] 1487 } 1488 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1489 return s.UnmarshalBytes(src) 1490 } 1491 1492 // CopyOutN implements marshal.Marshallable.CopyOutN. 1493 func (s *SockErrCMsgIPv4) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1494 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1495 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1496 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1497 s.MarshalBytes(buf) // escapes: fallback. 1498 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1499 } 1500 1501 // Construct a slice backed by dst's underlying memory. 1502 var buf []byte 1503 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1504 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1505 hdr.Len = s.SizeBytes() 1506 hdr.Cap = s.SizeBytes() 1507 1508 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1509 // Since we bypassed the compiler's escape analysis, indicate that s 1510 // must live until the use above. 1511 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1512 return length, err 1513 } 1514 1515 // CopyOut implements marshal.Marshallable.CopyOut. 1516 func (s *SockErrCMsgIPv4) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1517 return s.CopyOutN(cc, addr, s.SizeBytes()) 1518 } 1519 1520 // CopyInN implements marshal.Marshallable.CopyInN. 1521 func (s *SockErrCMsgIPv4) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1522 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1523 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1524 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1525 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1526 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1527 // partially unmarshalled struct. 1528 s.UnmarshalBytes(buf) // escapes: fallback. 1529 return length, err 1530 } 1531 1532 // Construct a slice backed by dst's underlying memory. 1533 var buf []byte 1534 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1535 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1536 hdr.Len = s.SizeBytes() 1537 hdr.Cap = s.SizeBytes() 1538 1539 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1540 // Since we bypassed the compiler's escape analysis, indicate that s 1541 // must live until the use above. 1542 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1543 return length, err 1544 } 1545 1546 // CopyIn implements marshal.Marshallable.CopyIn. 1547 func (s *SockErrCMsgIPv4) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1548 return s.CopyInN(cc, addr, s.SizeBytes()) 1549 } 1550 1551 // WriteTo implements io.WriterTo.WriteTo. 1552 func (s *SockErrCMsgIPv4) WriteTo(writer io.Writer) (int64, error) { 1553 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1554 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1555 buf := make([]byte, s.SizeBytes()) 1556 s.MarshalBytes(buf) 1557 length, err := writer.Write(buf) 1558 return int64(length), err 1559 } 1560 1561 // Construct a slice backed by dst's underlying memory. 1562 var buf []byte 1563 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1564 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1565 hdr.Len = s.SizeBytes() 1566 hdr.Cap = s.SizeBytes() 1567 1568 length, err := writer.Write(buf) 1569 // Since we bypassed the compiler's escape analysis, indicate that s 1570 // must live until the use above. 1571 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1572 return int64(length), err 1573 } 1574 1575 // SizeBytes implements marshal.Marshallable.SizeBytes. 1576 func (s *SockErrCMsgIPv6) SizeBytes() int { 1577 return 0 + 1578 (*SockExtendedErr)(nil).SizeBytes() + 1579 (*SockAddrInet6)(nil).SizeBytes() 1580 } 1581 1582 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1583 func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) []byte { 1584 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1585 dst = s.Offender.MarshalUnsafe(dst) 1586 return dst 1587 } 1588 1589 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1590 func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) []byte { 1591 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1592 src = s.Offender.UnmarshalUnsafe(src) 1593 return src 1594 } 1595 1596 // Packed implements marshal.Marshallable.Packed. 1597 //go:nosplit 1598 func (s *SockErrCMsgIPv6) Packed() bool { 1599 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1600 } 1601 1602 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1603 func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) []byte { 1604 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1605 size := s.SizeBytes() 1606 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1607 return dst[size:] 1608 } 1609 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes. 1610 return s.MarshalBytes(dst) 1611 } 1612 1613 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1614 func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) []byte { 1615 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1616 size := s.SizeBytes() 1617 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1618 return src[size:] 1619 } 1620 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1621 return s.UnmarshalBytes(src) 1622 } 1623 1624 // CopyOutN implements marshal.Marshallable.CopyOutN. 1625 func (s *SockErrCMsgIPv6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1626 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1627 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1628 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1629 s.MarshalBytes(buf) // escapes: fallback. 1630 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1631 } 1632 1633 // Construct a slice backed by dst's underlying memory. 1634 var buf []byte 1635 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1636 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1637 hdr.Len = s.SizeBytes() 1638 hdr.Cap = s.SizeBytes() 1639 1640 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1641 // Since we bypassed the compiler's escape analysis, indicate that s 1642 // must live until the use above. 1643 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1644 return length, err 1645 } 1646 1647 // CopyOut implements marshal.Marshallable.CopyOut. 1648 func (s *SockErrCMsgIPv6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1649 return s.CopyOutN(cc, addr, s.SizeBytes()) 1650 } 1651 1652 // CopyInN implements marshal.Marshallable.CopyInN. 1653 func (s *SockErrCMsgIPv6) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1654 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1655 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1656 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1657 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1658 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1659 // partially unmarshalled struct. 1660 s.UnmarshalBytes(buf) // escapes: fallback. 1661 return length, err 1662 } 1663 1664 // Construct a slice backed by dst's underlying memory. 1665 var buf []byte 1666 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1667 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1668 hdr.Len = s.SizeBytes() 1669 hdr.Cap = s.SizeBytes() 1670 1671 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1672 // Since we bypassed the compiler's escape analysis, indicate that s 1673 // must live until the use above. 1674 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1675 return length, err 1676 } 1677 1678 // CopyIn implements marshal.Marshallable.CopyIn. 1679 func (s *SockErrCMsgIPv6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1680 return s.CopyInN(cc, addr, s.SizeBytes()) 1681 } 1682 1683 // WriteTo implements io.WriterTo.WriteTo. 1684 func (s *SockErrCMsgIPv6) WriteTo(writer io.Writer) (int64, error) { 1685 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1686 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1687 buf := make([]byte, s.SizeBytes()) 1688 s.MarshalBytes(buf) 1689 length, err := writer.Write(buf) 1690 return int64(length), err 1691 } 1692 1693 // Construct a slice backed by dst's underlying memory. 1694 var buf []byte 1695 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1696 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1697 hdr.Len = s.SizeBytes() 1698 hdr.Cap = s.SizeBytes() 1699 1700 length, err := writer.Write(buf) 1701 // Since we bypassed the compiler's escape analysis, indicate that s 1702 // must live until the use above. 1703 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1704 return int64(length), err 1705 } 1706 1707 // SizeBytes implements marshal.Marshallable.SizeBytes. 1708 func (s *SockExtendedErr) SizeBytes() int { 1709 return 16 1710 } 1711 1712 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1713 func (s *SockExtendedErr) MarshalBytes(dst []byte) []byte { 1714 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 1715 dst = dst[4:] 1716 dst[0] = byte(s.Origin) 1717 dst = dst[1:] 1718 dst[0] = byte(s.Type) 1719 dst = dst[1:] 1720 dst[0] = byte(s.Code) 1721 dst = dst[1:] 1722 dst[0] = byte(s.Pad) 1723 dst = dst[1:] 1724 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Info)) 1725 dst = dst[4:] 1726 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Data)) 1727 dst = dst[4:] 1728 return dst 1729 } 1730 1731 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1732 func (s *SockExtendedErr) UnmarshalBytes(src []byte) []byte { 1733 s.Errno = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1734 src = src[4:] 1735 s.Origin = uint8(src[0]) 1736 src = src[1:] 1737 s.Type = uint8(src[0]) 1738 src = src[1:] 1739 s.Code = uint8(src[0]) 1740 src = src[1:] 1741 s.Pad = uint8(src[0]) 1742 src = src[1:] 1743 s.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1744 src = src[4:] 1745 s.Data = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1746 src = src[4:] 1747 return src 1748 } 1749 1750 // Packed implements marshal.Marshallable.Packed. 1751 //go:nosplit 1752 func (s *SockExtendedErr) Packed() bool { 1753 return true 1754 } 1755 1756 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1757 func (s *SockExtendedErr) MarshalUnsafe(dst []byte) []byte { 1758 size := s.SizeBytes() 1759 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1760 return dst[size:] 1761 } 1762 1763 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1764 func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) []byte { 1765 size := s.SizeBytes() 1766 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1767 return src[size:] 1768 } 1769 1770 // CopyOutN implements marshal.Marshallable.CopyOutN. 1771 func (s *SockExtendedErr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1772 // Construct a slice backed by dst's underlying memory. 1773 var buf []byte 1774 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1775 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1776 hdr.Len = s.SizeBytes() 1777 hdr.Cap = s.SizeBytes() 1778 1779 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1780 // Since we bypassed the compiler's escape analysis, indicate that s 1781 // must live until the use above. 1782 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1783 return length, err 1784 } 1785 1786 // CopyOut implements marshal.Marshallable.CopyOut. 1787 func (s *SockExtendedErr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1788 return s.CopyOutN(cc, addr, s.SizeBytes()) 1789 } 1790 1791 // CopyInN implements marshal.Marshallable.CopyInN. 1792 func (s *SockExtendedErr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1793 // Construct a slice backed by dst's underlying memory. 1794 var buf []byte 1795 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1796 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1797 hdr.Len = s.SizeBytes() 1798 hdr.Cap = s.SizeBytes() 1799 1800 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1801 // Since we bypassed the compiler's escape analysis, indicate that s 1802 // must live until the use above. 1803 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1804 return length, err 1805 } 1806 1807 // CopyIn implements marshal.Marshallable.CopyIn. 1808 func (s *SockExtendedErr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1809 return s.CopyInN(cc, addr, s.SizeBytes()) 1810 } 1811 1812 // WriteTo implements io.WriterTo.WriteTo. 1813 func (s *SockExtendedErr) WriteTo(writer io.Writer) (int64, error) { 1814 // Construct a slice backed by dst's underlying memory. 1815 var buf []byte 1816 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1817 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1818 hdr.Len = s.SizeBytes() 1819 hdr.Cap = s.SizeBytes() 1820 1821 length, err := writer.Write(buf) 1822 // Since we bypassed the compiler's escape analysis, indicate that s 1823 // must live until the use above. 1824 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1825 return int64(length), err 1826 } 1827 1828 // SizeBytes implements marshal.Marshallable.SizeBytes. 1829 func (f *FOwnerEx) SizeBytes() int { 1830 return 8 1831 } 1832 1833 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1834 func (f *FOwnerEx) MarshalBytes(dst []byte) []byte { 1835 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 1836 dst = dst[4:] 1837 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1838 dst = dst[4:] 1839 return dst 1840 } 1841 1842 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1843 func (f *FOwnerEx) UnmarshalBytes(src []byte) []byte { 1844 f.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 1845 src = src[4:] 1846 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1847 src = src[4:] 1848 return src 1849 } 1850 1851 // Packed implements marshal.Marshallable.Packed. 1852 //go:nosplit 1853 func (f *FOwnerEx) Packed() bool { 1854 return true 1855 } 1856 1857 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1858 func (f *FOwnerEx) MarshalUnsafe(dst []byte) []byte { 1859 size := f.SizeBytes() 1860 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1861 return dst[size:] 1862 } 1863 1864 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1865 func (f *FOwnerEx) UnmarshalUnsafe(src []byte) []byte { 1866 size := f.SizeBytes() 1867 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1868 return src[size:] 1869 } 1870 1871 // CopyOutN implements marshal.Marshallable.CopyOutN. 1872 func (f *FOwnerEx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1873 // Construct a slice backed by dst's underlying memory. 1874 var buf []byte 1875 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1876 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1877 hdr.Len = f.SizeBytes() 1878 hdr.Cap = f.SizeBytes() 1879 1880 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1881 // Since we bypassed the compiler's escape analysis, indicate that f 1882 // must live until the use above. 1883 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1884 return length, err 1885 } 1886 1887 // CopyOut implements marshal.Marshallable.CopyOut. 1888 func (f *FOwnerEx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1889 return f.CopyOutN(cc, addr, f.SizeBytes()) 1890 } 1891 1892 // CopyInN implements marshal.Marshallable.CopyInN. 1893 func (f *FOwnerEx) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1894 // Construct a slice backed by dst's underlying memory. 1895 var buf []byte 1896 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1897 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1898 hdr.Len = f.SizeBytes() 1899 hdr.Cap = f.SizeBytes() 1900 1901 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1902 // Since we bypassed the compiler's escape analysis, indicate that f 1903 // must live until the use above. 1904 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1905 return length, err 1906 } 1907 1908 // CopyIn implements marshal.Marshallable.CopyIn. 1909 func (f *FOwnerEx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1910 return f.CopyInN(cc, addr, f.SizeBytes()) 1911 } 1912 1913 // WriteTo implements io.WriterTo.WriteTo. 1914 func (f *FOwnerEx) WriteTo(writer io.Writer) (int64, error) { 1915 // Construct a slice backed by dst's underlying memory. 1916 var buf []byte 1917 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1918 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1919 hdr.Len = f.SizeBytes() 1920 hdr.Cap = f.SizeBytes() 1921 1922 length, err := writer.Write(buf) 1923 // Since we bypassed the compiler's escape analysis, indicate that f 1924 // must live until the use above. 1925 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1926 return int64(length), err 1927 } 1928 1929 // SizeBytes implements marshal.Marshallable.SizeBytes. 1930 func (f *Flock) SizeBytes() int { 1931 return 24 + 1932 1*4 + 1933 1*4 1934 } 1935 1936 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1937 func (f *Flock) MarshalBytes(dst []byte) []byte { 1938 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Type)) 1939 dst = dst[2:] 1940 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Whence)) 1941 dst = dst[2:] 1942 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1943 dst = dst[1*(4):] 1944 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Start)) 1945 dst = dst[8:] 1946 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Len)) 1947 dst = dst[8:] 1948 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1949 dst = dst[4:] 1950 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1951 dst = dst[1*(4):] 1952 return dst 1953 } 1954 1955 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1956 func (f *Flock) UnmarshalBytes(src []byte) []byte { 1957 f.Type = int16(hostarch.ByteOrder.Uint16(src[:2])) 1958 src = src[2:] 1959 f.Whence = int16(hostarch.ByteOrder.Uint16(src[:2])) 1960 src = src[2:] 1961 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1962 src = src[1*(4):] 1963 f.Start = int64(hostarch.ByteOrder.Uint64(src[:8])) 1964 src = src[8:] 1965 f.Len = int64(hostarch.ByteOrder.Uint64(src[:8])) 1966 src = src[8:] 1967 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1968 src = src[4:] 1969 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1970 src = src[1*(4):] 1971 return src 1972 } 1973 1974 // Packed implements marshal.Marshallable.Packed. 1975 //go:nosplit 1976 func (f *Flock) Packed() bool { 1977 return true 1978 } 1979 1980 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1981 func (f *Flock) MarshalUnsafe(dst []byte) []byte { 1982 size := f.SizeBytes() 1983 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1984 return dst[size:] 1985 } 1986 1987 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1988 func (f *Flock) UnmarshalUnsafe(src []byte) []byte { 1989 size := f.SizeBytes() 1990 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1991 return src[size:] 1992 } 1993 1994 // CopyOutN implements marshal.Marshallable.CopyOutN. 1995 func (f *Flock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1996 // Construct a slice backed by dst's underlying memory. 1997 var buf []byte 1998 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1999 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2000 hdr.Len = f.SizeBytes() 2001 hdr.Cap = f.SizeBytes() 2002 2003 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2004 // Since we bypassed the compiler's escape analysis, indicate that f 2005 // must live until the use above. 2006 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2007 return length, err 2008 } 2009 2010 // CopyOut implements marshal.Marshallable.CopyOut. 2011 func (f *Flock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2012 return f.CopyOutN(cc, addr, f.SizeBytes()) 2013 } 2014 2015 // CopyInN implements marshal.Marshallable.CopyInN. 2016 func (f *Flock) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2017 // Construct a slice backed by dst's underlying memory. 2018 var buf []byte 2019 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2020 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2021 hdr.Len = f.SizeBytes() 2022 hdr.Cap = f.SizeBytes() 2023 2024 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2025 // Since we bypassed the compiler's escape analysis, indicate that f 2026 // must live until the use above. 2027 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2028 return length, err 2029 } 2030 2031 // CopyIn implements marshal.Marshallable.CopyIn. 2032 func (f *Flock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2033 return f.CopyInN(cc, addr, f.SizeBytes()) 2034 } 2035 2036 // WriteTo implements io.WriterTo.WriteTo. 2037 func (f *Flock) WriteTo(writer io.Writer) (int64, error) { 2038 // Construct a slice backed by dst's underlying memory. 2039 var buf []byte 2040 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2041 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2042 hdr.Len = f.SizeBytes() 2043 hdr.Cap = f.SizeBytes() 2044 2045 length, err := writer.Write(buf) 2046 // Since we bypassed the compiler's escape analysis, indicate that f 2047 // must live until the use above. 2048 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2049 return int64(length), err 2050 } 2051 2052 // SizeBytes implements marshal.Marshallable.SizeBytes. 2053 //go:nosplit 2054 func (m *FileMode) SizeBytes() int { 2055 return 2 2056 } 2057 2058 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2059 func (m *FileMode) MarshalBytes(dst []byte) []byte { 2060 hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m)) 2061 return dst[2:] 2062 } 2063 2064 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2065 func (m *FileMode) UnmarshalBytes(src []byte) []byte { 2066 *m = FileMode(uint16(hostarch.ByteOrder.Uint16(src[:2]))) 2067 return src[2:] 2068 } 2069 2070 // Packed implements marshal.Marshallable.Packed. 2071 //go:nosplit 2072 func (m *FileMode) Packed() bool { 2073 // Scalar newtypes are always packed. 2074 return true 2075 } 2076 2077 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2078 func (m *FileMode) MarshalUnsafe(dst []byte) []byte { 2079 size := m.SizeBytes() 2080 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 2081 return dst[size:] 2082 } 2083 2084 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2085 func (m *FileMode) UnmarshalUnsafe(src []byte) []byte { 2086 size := m.SizeBytes() 2087 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 2088 return src[size:] 2089 } 2090 2091 // CopyOutN implements marshal.Marshallable.CopyOutN. 2092 func (m *FileMode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2093 // Construct a slice backed by dst's underlying memory. 2094 var buf []byte 2095 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2096 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2097 hdr.Len = m.SizeBytes() 2098 hdr.Cap = m.SizeBytes() 2099 2100 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2101 // Since we bypassed the compiler's escape analysis, indicate that m 2102 // must live until the use above. 2103 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2104 return length, err 2105 } 2106 2107 // CopyOut implements marshal.Marshallable.CopyOut. 2108 func (m *FileMode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2109 return m.CopyOutN(cc, addr, m.SizeBytes()) 2110 } 2111 2112 // CopyInN implements marshal.Marshallable.CopyInN. 2113 func (m *FileMode) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2114 // Construct a slice backed by dst's underlying memory. 2115 var buf []byte 2116 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2117 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2118 hdr.Len = m.SizeBytes() 2119 hdr.Cap = m.SizeBytes() 2120 2121 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2122 // Since we bypassed the compiler's escape analysis, indicate that m 2123 // must live until the use above. 2124 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2125 return length, err 2126 } 2127 2128 // CopyIn implements marshal.Marshallable.CopyIn. 2129 func (m *FileMode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2130 return m.CopyInN(cc, addr, m.SizeBytes()) 2131 } 2132 2133 // WriteTo implements io.WriterTo.WriteTo. 2134 func (m *FileMode) WriteTo(writer io.Writer) (int64, error) { 2135 // Construct a slice backed by dst's underlying memory. 2136 var buf []byte 2137 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2138 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2139 hdr.Len = m.SizeBytes() 2140 hdr.Cap = m.SizeBytes() 2141 2142 length, err := writer.Write(buf) 2143 // Since we bypassed the compiler's escape analysis, indicate that m 2144 // must live until the use above. 2145 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2146 return int64(length), err 2147 } 2148 2149 // SizeBytes implements marshal.Marshallable.SizeBytes. 2150 func (s *Statx) SizeBytes() int { 2151 return 80 + 2152 (*StatxTimestamp)(nil).SizeBytes() + 2153 (*StatxTimestamp)(nil).SizeBytes() + 2154 (*StatxTimestamp)(nil).SizeBytes() + 2155 (*StatxTimestamp)(nil).SizeBytes() 2156 } 2157 2158 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2159 func (s *Statx) MarshalBytes(dst []byte) []byte { 2160 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask)) 2161 dst = dst[4:] 2162 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Blksize)) 2163 dst = dst[4:] 2164 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Attributes)) 2165 dst = dst[8:] 2166 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nlink)) 2167 dst = dst[4:] 2168 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 2169 dst = dst[4:] 2170 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.GID)) 2171 dst = dst[4:] 2172 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Mode)) 2173 dst = dst[2:] 2174 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 2175 dst = dst[2:] 2176 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino)) 2177 dst = dst[8:] 2178 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 2179 dst = dst[8:] 2180 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2181 dst = dst[8:] 2182 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.AttributesMask)) 2183 dst = dst[8:] 2184 dst = s.Atime.MarshalUnsafe(dst) 2185 dst = s.Btime.MarshalUnsafe(dst) 2186 dst = s.Ctime.MarshalUnsafe(dst) 2187 dst = s.Mtime.MarshalUnsafe(dst) 2188 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMajor)) 2189 dst = dst[4:] 2190 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMinor)) 2191 dst = dst[4:] 2192 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMajor)) 2193 dst = dst[4:] 2194 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMinor)) 2195 dst = dst[4:] 2196 return dst 2197 } 2198 2199 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2200 func (s *Statx) UnmarshalBytes(src []byte) []byte { 2201 s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2202 src = src[4:] 2203 s.Blksize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2204 src = src[4:] 2205 s.Attributes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2206 src = src[8:] 2207 s.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2208 src = src[4:] 2209 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2210 src = src[4:] 2211 s.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2212 src = src[4:] 2213 s.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 2214 src = src[2:] 2215 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 2216 src = src[2:] 2217 s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2218 src = src[8:] 2219 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2220 src = src[8:] 2221 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2222 src = src[8:] 2223 s.AttributesMask = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2224 src = src[8:] 2225 src = s.Atime.UnmarshalUnsafe(src) 2226 src = s.Btime.UnmarshalUnsafe(src) 2227 src = s.Ctime.UnmarshalUnsafe(src) 2228 src = s.Mtime.UnmarshalUnsafe(src) 2229 s.RdevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2230 src = src[4:] 2231 s.RdevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2232 src = src[4:] 2233 s.DevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2234 src = src[4:] 2235 s.DevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2236 src = src[4:] 2237 return src 2238 } 2239 2240 // Packed implements marshal.Marshallable.Packed. 2241 //go:nosplit 2242 func (s *Statx) Packed() bool { 2243 return s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() 2244 } 2245 2246 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2247 func (s *Statx) MarshalUnsafe(dst []byte) []byte { 2248 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2249 size := s.SizeBytes() 2250 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2251 return dst[size:] 2252 } 2253 // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes. 2254 return s.MarshalBytes(dst) 2255 } 2256 2257 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2258 func (s *Statx) UnmarshalUnsafe(src []byte) []byte { 2259 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2260 size := s.SizeBytes() 2261 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2262 return src[size:] 2263 } 2264 // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2265 return s.UnmarshalBytes(src) 2266 } 2267 2268 // CopyOutN implements marshal.Marshallable.CopyOutN. 2269 func (s *Statx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2270 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2271 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2272 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2273 s.MarshalBytes(buf) // escapes: fallback. 2274 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2275 } 2276 2277 // Construct a slice backed by dst's underlying memory. 2278 var buf []byte 2279 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2280 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2281 hdr.Len = s.SizeBytes() 2282 hdr.Cap = s.SizeBytes() 2283 2284 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2285 // Since we bypassed the compiler's escape analysis, indicate that s 2286 // must live until the use above. 2287 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2288 return length, err 2289 } 2290 2291 // CopyOut implements marshal.Marshallable.CopyOut. 2292 func (s *Statx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2293 return s.CopyOutN(cc, addr, s.SizeBytes()) 2294 } 2295 2296 // CopyInN implements marshal.Marshallable.CopyInN. 2297 func (s *Statx) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2298 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2299 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2300 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2301 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2302 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2303 // partially unmarshalled struct. 2304 s.UnmarshalBytes(buf) // escapes: fallback. 2305 return length, err 2306 } 2307 2308 // Construct a slice backed by dst's underlying memory. 2309 var buf []byte 2310 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2311 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2312 hdr.Len = s.SizeBytes() 2313 hdr.Cap = s.SizeBytes() 2314 2315 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2316 // Since we bypassed the compiler's escape analysis, indicate that s 2317 // must live until the use above. 2318 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2319 return length, err 2320 } 2321 2322 // CopyIn implements marshal.Marshallable.CopyIn. 2323 func (s *Statx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2324 return s.CopyInN(cc, addr, s.SizeBytes()) 2325 } 2326 2327 // WriteTo implements io.WriterTo.WriteTo. 2328 func (s *Statx) WriteTo(writer io.Writer) (int64, error) { 2329 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2330 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2331 buf := make([]byte, s.SizeBytes()) 2332 s.MarshalBytes(buf) 2333 length, err := writer.Write(buf) 2334 return int64(length), err 2335 } 2336 2337 // Construct a slice backed by dst's underlying memory. 2338 var buf []byte 2339 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2340 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2341 hdr.Len = s.SizeBytes() 2342 hdr.Cap = s.SizeBytes() 2343 2344 length, err := writer.Write(buf) 2345 // Since we bypassed the compiler's escape analysis, indicate that s 2346 // must live until the use above. 2347 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2348 return int64(length), err 2349 } 2350 2351 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2352 func (s *Statx) CheckedMarshal(dst []byte) ([]byte, bool) { 2353 if s.SizeBytes() > len(dst) { 2354 return dst, false 2355 } 2356 return s.MarshalUnsafe(dst), true 2357 } 2358 2359 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2360 func (s *Statx) CheckedUnmarshal(src []byte) ([]byte, bool) { 2361 if s.SizeBytes() > len(src) { 2362 return src, false 2363 } 2364 return s.UnmarshalUnsafe(src), true 2365 } 2366 2367 // CopyStatxSliceIn copies in a slice of Statx objects from the task's memory. 2368 func CopyStatxSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Statx) (int, error) { 2369 count := len(dst) 2370 if count == 0 { 2371 return 0, nil 2372 } 2373 size := (*Statx)(nil).SizeBytes() 2374 2375 if !dst[0].Packed() { 2376 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2377 buf := cc.CopyScratchBuffer(size * count) 2378 length, err := cc.CopyInBytes(addr, buf) 2379 2380 // Unmarshal as much as possible, even on error. First handle full objects. 2381 limit := length/size 2382 for idx := 0; idx < limit; idx++ { 2383 buf = dst[idx].UnmarshalBytes(buf) 2384 } 2385 2386 // Handle any final partial object. buf is guaranteed to be long enough for the 2387 // final element, but may not contain valid data for the entire range. This may 2388 // result in unmarshalling zero values for some parts of the object. 2389 if length%size != 0 { 2390 dst[limit].UnmarshalBytes(buf) 2391 } 2392 2393 return length, err 2394 } 2395 2396 ptr := unsafe.Pointer(&dst) 2397 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2398 2399 // Construct a slice backed by dst's underlying memory. 2400 var buf []byte 2401 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2402 hdr.Data = uintptr(val) 2403 hdr.Len = size * count 2404 hdr.Cap = size * count 2405 2406 length, err := cc.CopyInBytes(addr, buf) 2407 // Since we bypassed the compiler's escape analysis, indicate that dst 2408 // must live until the use above. 2409 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 2410 return length, err 2411 } 2412 2413 // CopyStatxSliceOut copies a slice of Statx objects to the task's memory. 2414 func CopyStatxSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Statx) (int, error) { 2415 count := len(src) 2416 if count == 0 { 2417 return 0, nil 2418 } 2419 size := (*Statx)(nil).SizeBytes() 2420 2421 if !src[0].Packed() { 2422 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2423 buf := cc.CopyScratchBuffer(size * count) 2424 curBuf := buf 2425 for idx := 0; idx < count; idx++ { 2426 curBuf = src[idx].MarshalBytes(curBuf) 2427 } 2428 return cc.CopyOutBytes(addr, buf) 2429 } 2430 2431 ptr := unsafe.Pointer(&src) 2432 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2433 2434 // Construct a slice backed by dst's underlying memory. 2435 var buf []byte 2436 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2437 hdr.Data = uintptr(val) 2438 hdr.Len = size * count 2439 hdr.Cap = size * count 2440 2441 length, err := cc.CopyOutBytes(addr, buf) 2442 // Since we bypassed the compiler's escape analysis, indicate that src 2443 // must live until the use above. 2444 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2445 return length, err 2446 } 2447 2448 // MarshalUnsafeStatxSlice is like Statx.MarshalUnsafe, but for a []Statx. 2449 func MarshalUnsafeStatxSlice(src []Statx, dst []byte) []byte { 2450 count := len(src) 2451 if count == 0 { 2452 return dst 2453 } 2454 2455 if !src[0].Packed() { 2456 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2457 for idx := 0; idx < count; idx++ { 2458 dst = src[idx].MarshalBytes(dst) 2459 } 2460 return dst 2461 } 2462 2463 size := (*Statx)(nil).SizeBytes() 2464 buf := dst[:size*count] 2465 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2466 return dst[size*count:] 2467 } 2468 2469 // UnmarshalUnsafeStatxSlice is like Statx.UnmarshalUnsafe, but for a []Statx. 2470 func UnmarshalUnsafeStatxSlice(dst []Statx, src []byte) []byte { 2471 count := len(dst) 2472 if count == 0 { 2473 return src 2474 } 2475 2476 if !dst[0].Packed() { 2477 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2478 for idx := 0; idx < count; idx++ { 2479 src = dst[idx].UnmarshalBytes(src) 2480 } 2481 return src 2482 } 2483 2484 size := (*Statx)(nil).SizeBytes() 2485 buf := src[:size*count] 2486 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2487 return src[size*count:] 2488 } 2489 2490 // SizeBytes implements marshal.Marshallable.SizeBytes. 2491 func (s *Statfs) SizeBytes() int { 2492 return 80 + 2493 4*2 + 2494 8*4 2495 } 2496 2497 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2498 func (s *Statfs) MarshalBytes(dst []byte) []byte { 2499 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type)) 2500 dst = dst[8:] 2501 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize)) 2502 dst = dst[8:] 2503 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2504 dst = dst[8:] 2505 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksFree)) 2506 dst = dst[8:] 2507 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksAvailable)) 2508 dst = dst[8:] 2509 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Files)) 2510 dst = dst[8:] 2511 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FilesFree)) 2512 dst = dst[8:] 2513 for idx := 0; idx < 2; idx++ { 2514 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FSID[idx])) 2515 dst = dst[4:] 2516 } 2517 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength)) 2518 dst = dst[8:] 2519 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FragmentSize)) 2520 dst = dst[8:] 2521 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 2522 dst = dst[8:] 2523 for idx := 0; idx < 4; idx++ { 2524 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Spare[idx])) 2525 dst = dst[8:] 2526 } 2527 return dst 2528 } 2529 2530 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2531 func (s *Statfs) UnmarshalBytes(src []byte) []byte { 2532 s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2533 src = src[8:] 2534 s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2535 src = src[8:] 2536 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2537 src = src[8:] 2538 s.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2539 src = src[8:] 2540 s.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2541 src = src[8:] 2542 s.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2543 src = src[8:] 2544 s.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2545 src = src[8:] 2546 for idx := 0; idx < 2; idx++ { 2547 s.FSID[idx] = int32(hostarch.ByteOrder.Uint32(src[:4])) 2548 src = src[4:] 2549 } 2550 s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2551 src = src[8:] 2552 s.FragmentSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2553 src = src[8:] 2554 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2555 src = src[8:] 2556 for idx := 0; idx < 4; idx++ { 2557 s.Spare[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2558 src = src[8:] 2559 } 2560 return src 2561 } 2562 2563 // Packed implements marshal.Marshallable.Packed. 2564 //go:nosplit 2565 func (s *Statfs) Packed() bool { 2566 return true 2567 } 2568 2569 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2570 func (s *Statfs) MarshalUnsafe(dst []byte) []byte { 2571 size := s.SizeBytes() 2572 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2573 return dst[size:] 2574 } 2575 2576 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2577 func (s *Statfs) UnmarshalUnsafe(src []byte) []byte { 2578 size := s.SizeBytes() 2579 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2580 return src[size:] 2581 } 2582 2583 // CopyOutN implements marshal.Marshallable.CopyOutN. 2584 func (s *Statfs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2585 // Construct a slice backed by dst's underlying memory. 2586 var buf []byte 2587 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2588 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2589 hdr.Len = s.SizeBytes() 2590 hdr.Cap = s.SizeBytes() 2591 2592 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2593 // Since we bypassed the compiler's escape analysis, indicate that s 2594 // must live until the use above. 2595 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2596 return length, err 2597 } 2598 2599 // CopyOut implements marshal.Marshallable.CopyOut. 2600 func (s *Statfs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2601 return s.CopyOutN(cc, addr, s.SizeBytes()) 2602 } 2603 2604 // CopyInN implements marshal.Marshallable.CopyInN. 2605 func (s *Statfs) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2606 // Construct a slice backed by dst's underlying memory. 2607 var buf []byte 2608 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2609 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2610 hdr.Len = s.SizeBytes() 2611 hdr.Cap = s.SizeBytes() 2612 2613 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2614 // Since we bypassed the compiler's escape analysis, indicate that s 2615 // must live until the use above. 2616 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2617 return length, err 2618 } 2619 2620 // CopyIn implements marshal.Marshallable.CopyIn. 2621 func (s *Statfs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2622 return s.CopyInN(cc, addr, s.SizeBytes()) 2623 } 2624 2625 // WriteTo implements io.WriterTo.WriteTo. 2626 func (s *Statfs) WriteTo(writer io.Writer) (int64, error) { 2627 // Construct a slice backed by dst's underlying memory. 2628 var buf []byte 2629 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2630 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2631 hdr.Len = s.SizeBytes() 2632 hdr.Cap = s.SizeBytes() 2633 2634 length, err := writer.Write(buf) 2635 // Since we bypassed the compiler's escape analysis, indicate that s 2636 // must live until the use above. 2637 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2638 return int64(length), err 2639 } 2640 2641 // Packed implements marshal.Marshallable.Packed. 2642 //go:nosplit 2643 func (s *CString) Packed() bool { 2644 // Type CString is dynamic so it might have slice/string headers. Hence, it is not packed. 2645 return false 2646 } 2647 2648 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2649 func (s *CString) MarshalUnsafe(dst []byte) []byte { 2650 // Type CString doesn't have a packed layout in memory, fallback to MarshalBytes. 2651 return s.MarshalBytes(dst) 2652 } 2653 2654 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2655 func (s *CString) UnmarshalUnsafe(src []byte) []byte { 2656 // Type CString doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2657 return s.UnmarshalBytes(src) 2658 } 2659 2660 // CopyOutN implements marshal.Marshallable.CopyOutN. 2661 //go:nosplit 2662 func (s *CString) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2663 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2664 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2665 s.MarshalBytes(buf) // escapes: fallback. 2666 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2667 } 2668 2669 // CopyOut implements marshal.Marshallable.CopyOut. 2670 func (s *CString) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2671 return s.CopyOutN(cc, addr, s.SizeBytes()) 2672 } 2673 2674 // CopyInN implements marshal.Marshallable.CopyInN. 2675 //go:nosplit 2676 func (s *CString) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2677 // Type CString doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2678 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2679 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2680 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2681 // partially unmarshalled struct. 2682 s.UnmarshalBytes(buf) // escapes: fallback. 2683 return length, err 2684 } 2685 2686 // CopyIn implements marshal.Marshallable.CopyIn. 2687 func (s *CString) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2688 return s.CopyInN(cc, addr, s.SizeBytes()) 2689 } 2690 2691 // WriteTo implements io.WriterTo.WriteTo. 2692 func (s *CString) WriteTo(writer io.Writer) (int64, error) { 2693 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2694 buf := make([]byte, s.SizeBytes()) 2695 s.MarshalBytes(buf) 2696 length, err := writer.Write(buf) 2697 return int64(length), err 2698 } 2699 2700 // SizeBytes implements marshal.Marshallable.SizeBytes. 2701 func (f *FUSEAccessIn) SizeBytes() int { 2702 return 8 2703 } 2704 2705 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2706 func (f *FUSEAccessIn) MarshalBytes(dst []byte) []byte { 2707 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mask)) 2708 dst = dst[4:] 2709 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2710 dst = dst[4:] 2711 return dst 2712 } 2713 2714 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2715 func (f *FUSEAccessIn) UnmarshalBytes(src []byte) []byte { 2716 f.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2717 src = src[4:] 2718 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2719 src = src[4:] 2720 return src 2721 } 2722 2723 // Packed implements marshal.Marshallable.Packed. 2724 //go:nosplit 2725 func (f *FUSEAccessIn) Packed() bool { 2726 return true 2727 } 2728 2729 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2730 func (f *FUSEAccessIn) MarshalUnsafe(dst []byte) []byte { 2731 size := f.SizeBytes() 2732 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2733 return dst[size:] 2734 } 2735 2736 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2737 func (f *FUSEAccessIn) UnmarshalUnsafe(src []byte) []byte { 2738 size := f.SizeBytes() 2739 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2740 return src[size:] 2741 } 2742 2743 // CopyOutN implements marshal.Marshallable.CopyOutN. 2744 func (f *FUSEAccessIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2745 // Construct a slice backed by dst's underlying memory. 2746 var buf []byte 2747 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2748 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2749 hdr.Len = f.SizeBytes() 2750 hdr.Cap = f.SizeBytes() 2751 2752 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2753 // Since we bypassed the compiler's escape analysis, indicate that f 2754 // must live until the use above. 2755 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2756 return length, err 2757 } 2758 2759 // CopyOut implements marshal.Marshallable.CopyOut. 2760 func (f *FUSEAccessIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2761 return f.CopyOutN(cc, addr, f.SizeBytes()) 2762 } 2763 2764 // CopyInN implements marshal.Marshallable.CopyInN. 2765 func (f *FUSEAccessIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2766 // Construct a slice backed by dst's underlying memory. 2767 var buf []byte 2768 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2769 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2770 hdr.Len = f.SizeBytes() 2771 hdr.Cap = f.SizeBytes() 2772 2773 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2774 // Since we bypassed the compiler's escape analysis, indicate that f 2775 // must live until the use above. 2776 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2777 return length, err 2778 } 2779 2780 // CopyIn implements marshal.Marshallable.CopyIn. 2781 func (f *FUSEAccessIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2782 return f.CopyInN(cc, addr, f.SizeBytes()) 2783 } 2784 2785 // WriteTo implements io.WriterTo.WriteTo. 2786 func (f *FUSEAccessIn) WriteTo(writer io.Writer) (int64, error) { 2787 // Construct a slice backed by dst's underlying memory. 2788 var buf []byte 2789 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2790 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2791 hdr.Len = f.SizeBytes() 2792 hdr.Cap = f.SizeBytes() 2793 2794 length, err := writer.Write(buf) 2795 // Since we bypassed the compiler's escape analysis, indicate that f 2796 // must live until the use above. 2797 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2798 return int64(length), err 2799 } 2800 2801 // SizeBytes implements marshal.Marshallable.SizeBytes. 2802 func (a *FUSEAttr) SizeBytes() int { 2803 return 88 2804 } 2805 2806 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2807 func (a *FUSEAttr) MarshalBytes(dst []byte) []byte { 2808 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ino)) 2809 dst = dst[8:] 2810 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Size)) 2811 dst = dst[8:] 2812 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Blocks)) 2813 dst = dst[8:] 2814 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Atime)) 2815 dst = dst[8:] 2816 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Mtime)) 2817 dst = dst[8:] 2818 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ctime)) 2819 dst = dst[8:] 2820 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.AtimeNsec)) 2821 dst = dst[4:] 2822 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.MtimeNsec)) 2823 dst = dst[4:] 2824 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.CtimeNsec)) 2825 dst = dst[4:] 2826 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Mode)) 2827 dst = dst[4:] 2828 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Nlink)) 2829 dst = dst[4:] 2830 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.UID)) 2831 dst = dst[4:] 2832 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.GID)) 2833 dst = dst[4:] 2834 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Rdev)) 2835 dst = dst[4:] 2836 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.BlkSize)) 2837 dst = dst[4:] 2838 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2839 dst = dst[4:] 2840 return dst 2841 } 2842 2843 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2844 func (a *FUSEAttr) UnmarshalBytes(src []byte) []byte { 2845 a.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2846 src = src[8:] 2847 a.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2848 src = src[8:] 2849 a.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2850 src = src[8:] 2851 a.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2852 src = src[8:] 2853 a.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2854 src = src[8:] 2855 a.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2856 src = src[8:] 2857 a.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2858 src = src[4:] 2859 a.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2860 src = src[4:] 2861 a.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2862 src = src[4:] 2863 a.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2864 src = src[4:] 2865 a.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2866 src = src[4:] 2867 a.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2868 src = src[4:] 2869 a.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2870 src = src[4:] 2871 a.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2872 src = src[4:] 2873 a.BlkSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2874 src = src[4:] 2875 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2876 src = src[4:] 2877 return src 2878 } 2879 2880 // Packed implements marshal.Marshallable.Packed. 2881 //go:nosplit 2882 func (a *FUSEAttr) Packed() bool { 2883 return true 2884 } 2885 2886 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2887 func (a *FUSEAttr) MarshalUnsafe(dst []byte) []byte { 2888 size := a.SizeBytes() 2889 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size)) 2890 return dst[size:] 2891 } 2892 2893 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2894 func (a *FUSEAttr) UnmarshalUnsafe(src []byte) []byte { 2895 size := a.SizeBytes() 2896 gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size)) 2897 return src[size:] 2898 } 2899 2900 // CopyOutN implements marshal.Marshallable.CopyOutN. 2901 func (a *FUSEAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2902 // Construct a slice backed by dst's underlying memory. 2903 var buf []byte 2904 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2905 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2906 hdr.Len = a.SizeBytes() 2907 hdr.Cap = a.SizeBytes() 2908 2909 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2910 // Since we bypassed the compiler's escape analysis, indicate that a 2911 // must live until the use above. 2912 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2913 return length, err 2914 } 2915 2916 // CopyOut implements marshal.Marshallable.CopyOut. 2917 func (a *FUSEAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2918 return a.CopyOutN(cc, addr, a.SizeBytes()) 2919 } 2920 2921 // CopyInN implements marshal.Marshallable.CopyInN. 2922 func (a *FUSEAttr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2923 // Construct a slice backed by dst's underlying memory. 2924 var buf []byte 2925 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2926 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2927 hdr.Len = a.SizeBytes() 2928 hdr.Cap = a.SizeBytes() 2929 2930 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2931 // Since we bypassed the compiler's escape analysis, indicate that a 2932 // must live until the use above. 2933 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2934 return length, err 2935 } 2936 2937 // CopyIn implements marshal.Marshallable.CopyIn. 2938 func (a *FUSEAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2939 return a.CopyInN(cc, addr, a.SizeBytes()) 2940 } 2941 2942 // WriteTo implements io.WriterTo.WriteTo. 2943 func (a *FUSEAttr) WriteTo(writer io.Writer) (int64, error) { 2944 // Construct a slice backed by dst's underlying memory. 2945 var buf []byte 2946 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2947 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2948 hdr.Len = a.SizeBytes() 2949 hdr.Cap = a.SizeBytes() 2950 2951 length, err := writer.Write(buf) 2952 // Since we bypassed the compiler's escape analysis, indicate that a 2953 // must live until the use above. 2954 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2955 return int64(length), err 2956 } 2957 2958 // SizeBytes implements marshal.Marshallable.SizeBytes. 2959 func (f *FUSEAttrOut) SizeBytes() int { 2960 return 16 + 2961 (*FUSEAttr)(nil).SizeBytes() 2962 } 2963 2964 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2965 func (f *FUSEAttrOut) MarshalBytes(dst []byte) []byte { 2966 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 2967 dst = dst[8:] 2968 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNsec)) 2969 dst = dst[4:] 2970 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2971 dst = dst[4:] 2972 dst = f.Attr.MarshalUnsafe(dst) 2973 return dst 2974 } 2975 2976 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2977 func (f *FUSEAttrOut) UnmarshalBytes(src []byte) []byte { 2978 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2979 src = src[8:] 2980 f.AttrValidNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2981 src = src[4:] 2982 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2983 src = src[4:] 2984 src = f.Attr.UnmarshalUnsafe(src) 2985 return src 2986 } 2987 2988 // Packed implements marshal.Marshallable.Packed. 2989 //go:nosplit 2990 func (f *FUSEAttrOut) Packed() bool { 2991 return f.Attr.Packed() 2992 } 2993 2994 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2995 func (f *FUSEAttrOut) MarshalUnsafe(dst []byte) []byte { 2996 if f.Attr.Packed() { 2997 size := f.SizeBytes() 2998 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2999 return dst[size:] 3000 } 3001 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3002 return f.MarshalBytes(dst) 3003 } 3004 3005 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3006 func (f *FUSEAttrOut) UnmarshalUnsafe(src []byte) []byte { 3007 if f.Attr.Packed() { 3008 size := f.SizeBytes() 3009 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3010 return src[size:] 3011 } 3012 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3013 return f.UnmarshalBytes(src) 3014 } 3015 3016 // CopyOutN implements marshal.Marshallable.CopyOutN. 3017 func (f *FUSEAttrOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3018 if !f.Attr.Packed() { 3019 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3020 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3021 f.MarshalBytes(buf) // escapes: fallback. 3022 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3023 } 3024 3025 // Construct a slice backed by dst's underlying memory. 3026 var buf []byte 3027 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3028 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3029 hdr.Len = f.SizeBytes() 3030 hdr.Cap = f.SizeBytes() 3031 3032 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3033 // Since we bypassed the compiler's escape analysis, indicate that f 3034 // must live until the use above. 3035 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3036 return length, err 3037 } 3038 3039 // CopyOut implements marshal.Marshallable.CopyOut. 3040 func (f *FUSEAttrOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3041 return f.CopyOutN(cc, addr, f.SizeBytes()) 3042 } 3043 3044 // CopyInN implements marshal.Marshallable.CopyInN. 3045 func (f *FUSEAttrOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3046 if !f.Attr.Packed() { 3047 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3048 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3049 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3050 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3051 // partially unmarshalled struct. 3052 f.UnmarshalBytes(buf) // escapes: fallback. 3053 return length, err 3054 } 3055 3056 // Construct a slice backed by dst's underlying memory. 3057 var buf []byte 3058 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3059 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3060 hdr.Len = f.SizeBytes() 3061 hdr.Cap = f.SizeBytes() 3062 3063 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3064 // Since we bypassed the compiler's escape analysis, indicate that f 3065 // must live until the use above. 3066 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3067 return length, err 3068 } 3069 3070 // CopyIn implements marshal.Marshallable.CopyIn. 3071 func (f *FUSEAttrOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3072 return f.CopyInN(cc, addr, f.SizeBytes()) 3073 } 3074 3075 // WriteTo implements io.WriterTo.WriteTo. 3076 func (f *FUSEAttrOut) WriteTo(writer io.Writer) (int64, error) { 3077 if !f.Attr.Packed() { 3078 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3079 buf := make([]byte, f.SizeBytes()) 3080 f.MarshalBytes(buf) 3081 length, err := writer.Write(buf) 3082 return int64(length), err 3083 } 3084 3085 // Construct a slice backed by dst's underlying memory. 3086 var buf []byte 3087 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3088 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3089 hdr.Len = f.SizeBytes() 3090 hdr.Cap = f.SizeBytes() 3091 3092 length, err := writer.Write(buf) 3093 // Since we bypassed the compiler's escape analysis, indicate that f 3094 // must live until the use above. 3095 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3096 return int64(length), err 3097 } 3098 3099 // Packed implements marshal.Marshallable.Packed. 3100 //go:nosplit 3101 func (r *FUSECreateIn) Packed() bool { 3102 // Type FUSECreateIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3103 return false 3104 } 3105 3106 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3107 func (r *FUSECreateIn) MarshalUnsafe(dst []byte) []byte { 3108 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3109 return r.MarshalBytes(dst) 3110 } 3111 3112 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3113 func (r *FUSECreateIn) UnmarshalUnsafe(src []byte) []byte { 3114 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3115 return r.UnmarshalBytes(src) 3116 } 3117 3118 // CopyOutN implements marshal.Marshallable.CopyOutN. 3119 //go:nosplit 3120 func (r *FUSECreateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3121 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3122 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3123 r.MarshalBytes(buf) // escapes: fallback. 3124 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3125 } 3126 3127 // CopyOut implements marshal.Marshallable.CopyOut. 3128 func (r *FUSECreateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3129 return r.CopyOutN(cc, addr, r.SizeBytes()) 3130 } 3131 3132 // CopyInN implements marshal.Marshallable.CopyInN. 3133 //go:nosplit 3134 func (r *FUSECreateIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3135 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3136 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3137 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3138 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3139 // partially unmarshalled struct. 3140 r.UnmarshalBytes(buf) // escapes: fallback. 3141 return length, err 3142 } 3143 3144 // CopyIn implements marshal.Marshallable.CopyIn. 3145 func (r *FUSECreateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3146 return r.CopyInN(cc, addr, r.SizeBytes()) 3147 } 3148 3149 // WriteTo implements io.WriterTo.WriteTo. 3150 func (r *FUSECreateIn) WriteTo(writer io.Writer) (int64, error) { 3151 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3152 buf := make([]byte, r.SizeBytes()) 3153 r.MarshalBytes(buf) 3154 length, err := writer.Write(buf) 3155 return int64(length), err 3156 } 3157 3158 // SizeBytes implements marshal.Marshallable.SizeBytes. 3159 func (f *FUSECreateMeta) SizeBytes() int { 3160 return 16 3161 } 3162 3163 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3164 func (f *FUSECreateMeta) MarshalBytes(dst []byte) []byte { 3165 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 3166 dst = dst[4:] 3167 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 3168 dst = dst[4:] 3169 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 3170 dst = dst[4:] 3171 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3172 dst = dst[4:] 3173 return dst 3174 } 3175 3176 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3177 func (f *FUSECreateMeta) UnmarshalBytes(src []byte) []byte { 3178 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3179 src = src[4:] 3180 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3181 src = src[4:] 3182 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3183 src = src[4:] 3184 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3185 src = src[4:] 3186 return src 3187 } 3188 3189 // Packed implements marshal.Marshallable.Packed. 3190 //go:nosplit 3191 func (f *FUSECreateMeta) Packed() bool { 3192 return true 3193 } 3194 3195 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3196 func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) []byte { 3197 size := f.SizeBytes() 3198 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3199 return dst[size:] 3200 } 3201 3202 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3203 func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) []byte { 3204 size := f.SizeBytes() 3205 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3206 return src[size:] 3207 } 3208 3209 // CopyOutN implements marshal.Marshallable.CopyOutN. 3210 func (f *FUSECreateMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3211 // Construct a slice backed by dst's underlying memory. 3212 var buf []byte 3213 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3214 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3215 hdr.Len = f.SizeBytes() 3216 hdr.Cap = f.SizeBytes() 3217 3218 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3219 // Since we bypassed the compiler's escape analysis, indicate that f 3220 // must live until the use above. 3221 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3222 return length, err 3223 } 3224 3225 // CopyOut implements marshal.Marshallable.CopyOut. 3226 func (f *FUSECreateMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3227 return f.CopyOutN(cc, addr, f.SizeBytes()) 3228 } 3229 3230 // CopyInN implements marshal.Marshallable.CopyInN. 3231 func (f *FUSECreateMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3232 // Construct a slice backed by dst's underlying memory. 3233 var buf []byte 3234 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3235 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3236 hdr.Len = f.SizeBytes() 3237 hdr.Cap = f.SizeBytes() 3238 3239 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3240 // Since we bypassed the compiler's escape analysis, indicate that f 3241 // must live until the use above. 3242 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3243 return length, err 3244 } 3245 3246 // CopyIn implements marshal.Marshallable.CopyIn. 3247 func (f *FUSECreateMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3248 return f.CopyInN(cc, addr, f.SizeBytes()) 3249 } 3250 3251 // WriteTo implements io.WriterTo.WriteTo. 3252 func (f *FUSECreateMeta) WriteTo(writer io.Writer) (int64, error) { 3253 // Construct a slice backed by dst's underlying memory. 3254 var buf []byte 3255 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3256 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3257 hdr.Len = f.SizeBytes() 3258 hdr.Cap = f.SizeBytes() 3259 3260 length, err := writer.Write(buf) 3261 // Since we bypassed the compiler's escape analysis, indicate that f 3262 // must live until the use above. 3263 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3264 return int64(length), err 3265 } 3266 3267 // SizeBytes implements marshal.Marshallable.SizeBytes. 3268 func (f *FUSECreateOut) SizeBytes() int { 3269 return 0 + 3270 (*FUSEEntryOut)(nil).SizeBytes() + 3271 (*FUSEOpenOut)(nil).SizeBytes() 3272 } 3273 3274 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3275 func (f *FUSECreateOut) MarshalBytes(dst []byte) []byte { 3276 dst = f.FUSEEntryOut.MarshalUnsafe(dst) 3277 dst = f.FUSEOpenOut.MarshalUnsafe(dst) 3278 return dst 3279 } 3280 3281 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3282 func (f *FUSECreateOut) UnmarshalBytes(src []byte) []byte { 3283 src = f.FUSEEntryOut.UnmarshalUnsafe(src) 3284 src = f.FUSEOpenOut.UnmarshalUnsafe(src) 3285 return src 3286 } 3287 3288 // Packed implements marshal.Marshallable.Packed. 3289 //go:nosplit 3290 func (f *FUSECreateOut) Packed() bool { 3291 return f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() 3292 } 3293 3294 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3295 func (f *FUSECreateOut) MarshalUnsafe(dst []byte) []byte { 3296 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3297 size := f.SizeBytes() 3298 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3299 return dst[size:] 3300 } 3301 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3302 return f.MarshalBytes(dst) 3303 } 3304 3305 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3306 func (f *FUSECreateOut) UnmarshalUnsafe(src []byte) []byte { 3307 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3308 size := f.SizeBytes() 3309 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3310 return src[size:] 3311 } 3312 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3313 return f.UnmarshalBytes(src) 3314 } 3315 3316 // CopyOutN implements marshal.Marshallable.CopyOutN. 3317 func (f *FUSECreateOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3318 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3319 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3320 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3321 f.MarshalBytes(buf) // escapes: fallback. 3322 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3323 } 3324 3325 // Construct a slice backed by dst's underlying memory. 3326 var buf []byte 3327 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3328 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3329 hdr.Len = f.SizeBytes() 3330 hdr.Cap = f.SizeBytes() 3331 3332 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3333 // Since we bypassed the compiler's escape analysis, indicate that f 3334 // must live until the use above. 3335 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3336 return length, err 3337 } 3338 3339 // CopyOut implements marshal.Marshallable.CopyOut. 3340 func (f *FUSECreateOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3341 return f.CopyOutN(cc, addr, f.SizeBytes()) 3342 } 3343 3344 // CopyInN implements marshal.Marshallable.CopyInN. 3345 func (f *FUSECreateOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3346 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3347 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3348 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3349 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3350 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3351 // partially unmarshalled struct. 3352 f.UnmarshalBytes(buf) // escapes: fallback. 3353 return length, err 3354 } 3355 3356 // Construct a slice backed by dst's underlying memory. 3357 var buf []byte 3358 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3359 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3360 hdr.Len = f.SizeBytes() 3361 hdr.Cap = f.SizeBytes() 3362 3363 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3364 // Since we bypassed the compiler's escape analysis, indicate that f 3365 // must live until the use above. 3366 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3367 return length, err 3368 } 3369 3370 // CopyIn implements marshal.Marshallable.CopyIn. 3371 func (f *FUSECreateOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3372 return f.CopyInN(cc, addr, f.SizeBytes()) 3373 } 3374 3375 // WriteTo implements io.WriterTo.WriteTo. 3376 func (f *FUSECreateOut) WriteTo(writer io.Writer) (int64, error) { 3377 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3378 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3379 buf := make([]byte, f.SizeBytes()) 3380 f.MarshalBytes(buf) 3381 length, err := writer.Write(buf) 3382 return int64(length), err 3383 } 3384 3385 // Construct a slice backed by dst's underlying memory. 3386 var buf []byte 3387 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3388 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3389 hdr.Len = f.SizeBytes() 3390 hdr.Cap = f.SizeBytes() 3391 3392 length, err := writer.Write(buf) 3393 // Since we bypassed the compiler's escape analysis, indicate that f 3394 // must live until the use above. 3395 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3396 return int64(length), err 3397 } 3398 3399 // Packed implements marshal.Marshallable.Packed. 3400 //go:nosplit 3401 func (r *FUSEDirent) Packed() bool { 3402 // Type FUSEDirent is dynamic so it might have slice/string headers. Hence, it is not packed. 3403 return false 3404 } 3405 3406 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3407 func (r *FUSEDirent) MarshalUnsafe(dst []byte) []byte { 3408 // Type FUSEDirent doesn't have a packed layout in memory, fallback to MarshalBytes. 3409 return r.MarshalBytes(dst) 3410 } 3411 3412 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3413 func (r *FUSEDirent) UnmarshalUnsafe(src []byte) []byte { 3414 // Type FUSEDirent doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3415 return r.UnmarshalBytes(src) 3416 } 3417 3418 // CopyOutN implements marshal.Marshallable.CopyOutN. 3419 //go:nosplit 3420 func (r *FUSEDirent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3421 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3422 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3423 r.MarshalBytes(buf) // escapes: fallback. 3424 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3425 } 3426 3427 // CopyOut implements marshal.Marshallable.CopyOut. 3428 func (r *FUSEDirent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3429 return r.CopyOutN(cc, addr, r.SizeBytes()) 3430 } 3431 3432 // CopyInN implements marshal.Marshallable.CopyInN. 3433 //go:nosplit 3434 func (r *FUSEDirent) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3435 // Type FUSEDirent doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3436 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3437 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3438 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3439 // partially unmarshalled struct. 3440 r.UnmarshalBytes(buf) // escapes: fallback. 3441 return length, err 3442 } 3443 3444 // CopyIn implements marshal.Marshallable.CopyIn. 3445 func (r *FUSEDirent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3446 return r.CopyInN(cc, addr, r.SizeBytes()) 3447 } 3448 3449 // WriteTo implements io.WriterTo.WriteTo. 3450 func (r *FUSEDirent) WriteTo(writer io.Writer) (int64, error) { 3451 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3452 buf := make([]byte, r.SizeBytes()) 3453 r.MarshalBytes(buf) 3454 length, err := writer.Write(buf) 3455 return int64(length), err 3456 } 3457 3458 // SizeBytes implements marshal.Marshallable.SizeBytes. 3459 func (f *FUSEDirentMeta) SizeBytes() int { 3460 return 24 3461 } 3462 3463 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3464 func (f *FUSEDirentMeta) MarshalBytes(dst []byte) []byte { 3465 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino)) 3466 dst = dst[8:] 3467 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Off)) 3468 dst = dst[8:] 3469 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLen)) 3470 dst = dst[4:] 3471 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 3472 dst = dst[4:] 3473 return dst 3474 } 3475 3476 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3477 func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) []byte { 3478 f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3479 src = src[8:] 3480 f.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3481 src = src[8:] 3482 f.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3483 src = src[4:] 3484 f.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3485 src = src[4:] 3486 return src 3487 } 3488 3489 // Packed implements marshal.Marshallable.Packed. 3490 //go:nosplit 3491 func (f *FUSEDirentMeta) Packed() bool { 3492 return true 3493 } 3494 3495 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3496 func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) []byte { 3497 size := f.SizeBytes() 3498 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3499 return dst[size:] 3500 } 3501 3502 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3503 func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) []byte { 3504 size := f.SizeBytes() 3505 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3506 return src[size:] 3507 } 3508 3509 // CopyOutN implements marshal.Marshallable.CopyOutN. 3510 func (f *FUSEDirentMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3511 // Construct a slice backed by dst's underlying memory. 3512 var buf []byte 3513 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3514 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3515 hdr.Len = f.SizeBytes() 3516 hdr.Cap = f.SizeBytes() 3517 3518 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3519 // Since we bypassed the compiler's escape analysis, indicate that f 3520 // must live until the use above. 3521 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3522 return length, err 3523 } 3524 3525 // CopyOut implements marshal.Marshallable.CopyOut. 3526 func (f *FUSEDirentMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3527 return f.CopyOutN(cc, addr, f.SizeBytes()) 3528 } 3529 3530 // CopyInN implements marshal.Marshallable.CopyInN. 3531 func (f *FUSEDirentMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3532 // Construct a slice backed by dst's underlying memory. 3533 var buf []byte 3534 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3535 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3536 hdr.Len = f.SizeBytes() 3537 hdr.Cap = f.SizeBytes() 3538 3539 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3540 // Since we bypassed the compiler's escape analysis, indicate that f 3541 // must live until the use above. 3542 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3543 return length, err 3544 } 3545 3546 // CopyIn implements marshal.Marshallable.CopyIn. 3547 func (f *FUSEDirentMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3548 return f.CopyInN(cc, addr, f.SizeBytes()) 3549 } 3550 3551 // WriteTo implements io.WriterTo.WriteTo. 3552 func (f *FUSEDirentMeta) WriteTo(writer io.Writer) (int64, error) { 3553 // Construct a slice backed by dst's underlying memory. 3554 var buf []byte 3555 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3556 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3557 hdr.Len = f.SizeBytes() 3558 hdr.Cap = f.SizeBytes() 3559 3560 length, err := writer.Write(buf) 3561 // Since we bypassed the compiler's escape analysis, indicate that f 3562 // must live until the use above. 3563 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3564 return int64(length), err 3565 } 3566 3567 // Packed implements marshal.Marshallable.Packed. 3568 //go:nosplit 3569 func (r *FUSEDirents) Packed() bool { 3570 // Type FUSEDirents is dynamic so it might have slice/string headers. Hence, it is not packed. 3571 return false 3572 } 3573 3574 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3575 func (r *FUSEDirents) MarshalUnsafe(dst []byte) []byte { 3576 // Type FUSEDirents doesn't have a packed layout in memory, fallback to MarshalBytes. 3577 return r.MarshalBytes(dst) 3578 } 3579 3580 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3581 func (r *FUSEDirents) UnmarshalUnsafe(src []byte) []byte { 3582 // Type FUSEDirents doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3583 return r.UnmarshalBytes(src) 3584 } 3585 3586 // CopyOutN implements marshal.Marshallable.CopyOutN. 3587 //go:nosplit 3588 func (r *FUSEDirents) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3589 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3590 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3591 r.MarshalBytes(buf) // escapes: fallback. 3592 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3593 } 3594 3595 // CopyOut implements marshal.Marshallable.CopyOut. 3596 func (r *FUSEDirents) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3597 return r.CopyOutN(cc, addr, r.SizeBytes()) 3598 } 3599 3600 // CopyInN implements marshal.Marshallable.CopyInN. 3601 //go:nosplit 3602 func (r *FUSEDirents) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3603 // Type FUSEDirents doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3604 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3605 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3606 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3607 // partially unmarshalled struct. 3608 r.UnmarshalBytes(buf) // escapes: fallback. 3609 return length, err 3610 } 3611 3612 // CopyIn implements marshal.Marshallable.CopyIn. 3613 func (r *FUSEDirents) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3614 return r.CopyInN(cc, addr, r.SizeBytes()) 3615 } 3616 3617 // WriteTo implements io.WriterTo.WriteTo. 3618 func (r *FUSEDirents) WriteTo(writer io.Writer) (int64, error) { 3619 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3620 buf := make([]byte, r.SizeBytes()) 3621 r.MarshalBytes(buf) 3622 length, err := writer.Write(buf) 3623 return int64(length), err 3624 } 3625 3626 // Packed implements marshal.Marshallable.Packed. 3627 //go:nosplit 3628 func (r *FUSEEmptyIn) Packed() bool { 3629 // Type FUSEEmptyIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3630 return false 3631 } 3632 3633 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3634 func (r *FUSEEmptyIn) MarshalUnsafe(dst []byte) []byte { 3635 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3636 return r.MarshalBytes(dst) 3637 } 3638 3639 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3640 func (r *FUSEEmptyIn) UnmarshalUnsafe(src []byte) []byte { 3641 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3642 return r.UnmarshalBytes(src) 3643 } 3644 3645 // CopyOutN implements marshal.Marshallable.CopyOutN. 3646 //go:nosplit 3647 func (r *FUSEEmptyIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3648 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3649 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3650 r.MarshalBytes(buf) // escapes: fallback. 3651 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3652 } 3653 3654 // CopyOut implements marshal.Marshallable.CopyOut. 3655 func (r *FUSEEmptyIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3656 return r.CopyOutN(cc, addr, r.SizeBytes()) 3657 } 3658 3659 // CopyInN implements marshal.Marshallable.CopyInN. 3660 //go:nosplit 3661 func (r *FUSEEmptyIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3662 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3663 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3664 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3665 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3666 // partially unmarshalled struct. 3667 r.UnmarshalBytes(buf) // escapes: fallback. 3668 return length, err 3669 } 3670 3671 // CopyIn implements marshal.Marshallable.CopyIn. 3672 func (r *FUSEEmptyIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3673 return r.CopyInN(cc, addr, r.SizeBytes()) 3674 } 3675 3676 // WriteTo implements io.WriterTo.WriteTo. 3677 func (r *FUSEEmptyIn) WriteTo(writer io.Writer) (int64, error) { 3678 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3679 buf := make([]byte, r.SizeBytes()) 3680 r.MarshalBytes(buf) 3681 length, err := writer.Write(buf) 3682 return int64(length), err 3683 } 3684 3685 // SizeBytes implements marshal.Marshallable.SizeBytes. 3686 func (f *FUSEEntryOut) SizeBytes() int { 3687 return 40 + 3688 (*FUSEAttr)(nil).SizeBytes() 3689 } 3690 3691 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3692 func (f *FUSEEntryOut) MarshalBytes(dst []byte) []byte { 3693 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3694 dst = dst[8:] 3695 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Generation)) 3696 dst = dst[8:] 3697 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.EntryValid)) 3698 dst = dst[8:] 3699 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 3700 dst = dst[8:] 3701 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.EntryValidNSec)) 3702 dst = dst[4:] 3703 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNSec)) 3704 dst = dst[4:] 3705 dst = f.Attr.MarshalUnsafe(dst) 3706 return dst 3707 } 3708 3709 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3710 func (f *FUSEEntryOut) UnmarshalBytes(src []byte) []byte { 3711 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3712 src = src[8:] 3713 f.Generation = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3714 src = src[8:] 3715 f.EntryValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3716 src = src[8:] 3717 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3718 src = src[8:] 3719 f.EntryValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3720 src = src[4:] 3721 f.AttrValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3722 src = src[4:] 3723 src = f.Attr.UnmarshalUnsafe(src) 3724 return src 3725 } 3726 3727 // Packed implements marshal.Marshallable.Packed. 3728 //go:nosplit 3729 func (f *FUSEEntryOut) Packed() bool { 3730 return f.Attr.Packed() 3731 } 3732 3733 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3734 func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) []byte { 3735 if f.Attr.Packed() { 3736 size := f.SizeBytes() 3737 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3738 return dst[size:] 3739 } 3740 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3741 return f.MarshalBytes(dst) 3742 } 3743 3744 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3745 func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) []byte { 3746 if f.Attr.Packed() { 3747 size := f.SizeBytes() 3748 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3749 return src[size:] 3750 } 3751 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3752 return f.UnmarshalBytes(src) 3753 } 3754 3755 // CopyOutN implements marshal.Marshallable.CopyOutN. 3756 func (f *FUSEEntryOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3757 if !f.Attr.Packed() { 3758 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3759 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3760 f.MarshalBytes(buf) // escapes: fallback. 3761 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3762 } 3763 3764 // Construct a slice backed by dst's underlying memory. 3765 var buf []byte 3766 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3767 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3768 hdr.Len = f.SizeBytes() 3769 hdr.Cap = f.SizeBytes() 3770 3771 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3772 // Since we bypassed the compiler's escape analysis, indicate that f 3773 // must live until the use above. 3774 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3775 return length, err 3776 } 3777 3778 // CopyOut implements marshal.Marshallable.CopyOut. 3779 func (f *FUSEEntryOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3780 return f.CopyOutN(cc, addr, f.SizeBytes()) 3781 } 3782 3783 // CopyInN implements marshal.Marshallable.CopyInN. 3784 func (f *FUSEEntryOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3785 if !f.Attr.Packed() { 3786 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3787 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3788 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3789 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3790 // partially unmarshalled struct. 3791 f.UnmarshalBytes(buf) // escapes: fallback. 3792 return length, err 3793 } 3794 3795 // Construct a slice backed by dst's underlying memory. 3796 var buf []byte 3797 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3798 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3799 hdr.Len = f.SizeBytes() 3800 hdr.Cap = f.SizeBytes() 3801 3802 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3803 // Since we bypassed the compiler's escape analysis, indicate that f 3804 // must live until the use above. 3805 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3806 return length, err 3807 } 3808 3809 // CopyIn implements marshal.Marshallable.CopyIn. 3810 func (f *FUSEEntryOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3811 return f.CopyInN(cc, addr, f.SizeBytes()) 3812 } 3813 3814 // WriteTo implements io.WriterTo.WriteTo. 3815 func (f *FUSEEntryOut) WriteTo(writer io.Writer) (int64, error) { 3816 if !f.Attr.Packed() { 3817 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3818 buf := make([]byte, f.SizeBytes()) 3819 f.MarshalBytes(buf) 3820 length, err := writer.Write(buf) 3821 return int64(length), err 3822 } 3823 3824 // Construct a slice backed by dst's underlying memory. 3825 var buf []byte 3826 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3827 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3828 hdr.Len = f.SizeBytes() 3829 hdr.Cap = f.SizeBytes() 3830 3831 length, err := writer.Write(buf) 3832 // Since we bypassed the compiler's escape analysis, indicate that f 3833 // must live until the use above. 3834 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3835 return int64(length), err 3836 } 3837 3838 // SizeBytes implements marshal.Marshallable.SizeBytes. 3839 func (f *FUSEFallocateIn) SizeBytes() int { 3840 return 32 3841 } 3842 3843 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3844 func (f *FUSEFallocateIn) MarshalBytes(dst []byte) []byte { 3845 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3846 dst = dst[8:] 3847 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 3848 dst = dst[8:] 3849 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Length)) 3850 dst = dst[8:] 3851 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 3852 dst = dst[4:] 3853 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3854 dst = dst[4:] 3855 return dst 3856 } 3857 3858 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3859 func (f *FUSEFallocateIn) UnmarshalBytes(src []byte) []byte { 3860 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3861 src = src[8:] 3862 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3863 src = src[8:] 3864 f.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3865 src = src[8:] 3866 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3867 src = src[4:] 3868 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3869 src = src[4:] 3870 return src 3871 } 3872 3873 // Packed implements marshal.Marshallable.Packed. 3874 //go:nosplit 3875 func (f *FUSEFallocateIn) Packed() bool { 3876 return true 3877 } 3878 3879 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3880 func (f *FUSEFallocateIn) MarshalUnsafe(dst []byte) []byte { 3881 size := f.SizeBytes() 3882 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3883 return dst[size:] 3884 } 3885 3886 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3887 func (f *FUSEFallocateIn) UnmarshalUnsafe(src []byte) []byte { 3888 size := f.SizeBytes() 3889 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3890 return src[size:] 3891 } 3892 3893 // CopyOutN implements marshal.Marshallable.CopyOutN. 3894 func (f *FUSEFallocateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3895 // Construct a slice backed by dst's underlying memory. 3896 var buf []byte 3897 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3898 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3899 hdr.Len = f.SizeBytes() 3900 hdr.Cap = f.SizeBytes() 3901 3902 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3903 // Since we bypassed the compiler's escape analysis, indicate that f 3904 // must live until the use above. 3905 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3906 return length, err 3907 } 3908 3909 // CopyOut implements marshal.Marshallable.CopyOut. 3910 func (f *FUSEFallocateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3911 return f.CopyOutN(cc, addr, f.SizeBytes()) 3912 } 3913 3914 // CopyInN implements marshal.Marshallable.CopyInN. 3915 func (f *FUSEFallocateIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3916 // Construct a slice backed by dst's underlying memory. 3917 var buf []byte 3918 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3919 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3920 hdr.Len = f.SizeBytes() 3921 hdr.Cap = f.SizeBytes() 3922 3923 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3924 // Since we bypassed the compiler's escape analysis, indicate that f 3925 // must live until the use above. 3926 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3927 return length, err 3928 } 3929 3930 // CopyIn implements marshal.Marshallable.CopyIn. 3931 func (f *FUSEFallocateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3932 return f.CopyInN(cc, addr, f.SizeBytes()) 3933 } 3934 3935 // WriteTo implements io.WriterTo.WriteTo. 3936 func (f *FUSEFallocateIn) WriteTo(writer io.Writer) (int64, error) { 3937 // Construct a slice backed by dst's underlying memory. 3938 var buf []byte 3939 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3940 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3941 hdr.Len = f.SizeBytes() 3942 hdr.Cap = f.SizeBytes() 3943 3944 length, err := writer.Write(buf) 3945 // Since we bypassed the compiler's escape analysis, indicate that f 3946 // must live until the use above. 3947 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3948 return int64(length), err 3949 } 3950 3951 // SizeBytes implements marshal.Marshallable.SizeBytes. 3952 func (f *FUSEFsyncIn) SizeBytes() int { 3953 return 16 3954 } 3955 3956 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3957 func (f *FUSEFsyncIn) MarshalBytes(dst []byte) []byte { 3958 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3959 dst = dst[8:] 3960 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FsyncFlags)) 3961 dst = dst[4:] 3962 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3963 dst = dst[4:] 3964 return dst 3965 } 3966 3967 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3968 func (f *FUSEFsyncIn) UnmarshalBytes(src []byte) []byte { 3969 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3970 src = src[8:] 3971 f.FsyncFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3972 src = src[4:] 3973 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3974 src = src[4:] 3975 return src 3976 } 3977 3978 // Packed implements marshal.Marshallable.Packed. 3979 //go:nosplit 3980 func (f *FUSEFsyncIn) Packed() bool { 3981 return true 3982 } 3983 3984 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3985 func (f *FUSEFsyncIn) MarshalUnsafe(dst []byte) []byte { 3986 size := f.SizeBytes() 3987 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3988 return dst[size:] 3989 } 3990 3991 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3992 func (f *FUSEFsyncIn) UnmarshalUnsafe(src []byte) []byte { 3993 size := f.SizeBytes() 3994 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3995 return src[size:] 3996 } 3997 3998 // CopyOutN implements marshal.Marshallable.CopyOutN. 3999 func (f *FUSEFsyncIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 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 := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 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 length, err 4012 } 4013 4014 // CopyOut implements marshal.Marshallable.CopyOut. 4015 func (f *FUSEFsyncIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4016 return f.CopyOutN(cc, addr, f.SizeBytes()) 4017 } 4018 4019 // CopyInN implements marshal.Marshallable.CopyInN. 4020 func (f *FUSEFsyncIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4021 // Construct a slice backed by dst's underlying memory. 4022 var buf []byte 4023 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4024 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4025 hdr.Len = f.SizeBytes() 4026 hdr.Cap = f.SizeBytes() 4027 4028 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4029 // Since we bypassed the compiler's escape analysis, indicate that f 4030 // must live until the use above. 4031 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4032 return length, err 4033 } 4034 4035 // CopyIn implements marshal.Marshallable.CopyIn. 4036 func (f *FUSEFsyncIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4037 return f.CopyInN(cc, addr, f.SizeBytes()) 4038 } 4039 4040 // WriteTo implements io.WriterTo.WriteTo. 4041 func (f *FUSEFsyncIn) WriteTo(writer io.Writer) (int64, error) { 4042 // Construct a slice backed by dst's underlying memory. 4043 var buf []byte 4044 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4045 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4046 hdr.Len = f.SizeBytes() 4047 hdr.Cap = f.SizeBytes() 4048 4049 length, err := writer.Write(buf) 4050 // Since we bypassed the compiler's escape analysis, indicate that f 4051 // must live until the use above. 4052 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4053 return int64(length), err 4054 } 4055 4056 // SizeBytes implements marshal.Marshallable.SizeBytes. 4057 func (f *FUSEGetAttrIn) SizeBytes() int { 4058 return 16 4059 } 4060 4061 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4062 func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) []byte { 4063 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GetAttrFlags)) 4064 dst = dst[4:] 4065 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4066 dst = dst[4:] 4067 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 4068 dst = dst[8:] 4069 return dst 4070 } 4071 4072 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4073 func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) []byte { 4074 f.GetAttrFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4075 src = src[4:] 4076 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4077 src = src[4:] 4078 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4079 src = src[8:] 4080 return src 4081 } 4082 4083 // Packed implements marshal.Marshallable.Packed. 4084 //go:nosplit 4085 func (f *FUSEGetAttrIn) Packed() bool { 4086 return true 4087 } 4088 4089 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4090 func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) []byte { 4091 size := f.SizeBytes() 4092 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4093 return dst[size:] 4094 } 4095 4096 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4097 func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) []byte { 4098 size := f.SizeBytes() 4099 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4100 return src[size:] 4101 } 4102 4103 // CopyOutN implements marshal.Marshallable.CopyOutN. 4104 func (f *FUSEGetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4105 // Construct a slice backed by dst's underlying memory. 4106 var buf []byte 4107 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4108 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4109 hdr.Len = f.SizeBytes() 4110 hdr.Cap = f.SizeBytes() 4111 4112 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4113 // Since we bypassed the compiler's escape analysis, indicate that f 4114 // must live until the use above. 4115 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4116 return length, err 4117 } 4118 4119 // CopyOut implements marshal.Marshallable.CopyOut. 4120 func (f *FUSEGetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4121 return f.CopyOutN(cc, addr, f.SizeBytes()) 4122 } 4123 4124 // CopyInN implements marshal.Marshallable.CopyInN. 4125 func (f *FUSEGetAttrIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4126 // Construct a slice backed by dst's underlying memory. 4127 var buf []byte 4128 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4129 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4130 hdr.Len = f.SizeBytes() 4131 hdr.Cap = f.SizeBytes() 4132 4133 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4134 // Since we bypassed the compiler's escape analysis, indicate that f 4135 // must live until the use above. 4136 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4137 return length, err 4138 } 4139 4140 // CopyIn implements marshal.Marshallable.CopyIn. 4141 func (f *FUSEGetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4142 return f.CopyInN(cc, addr, f.SizeBytes()) 4143 } 4144 4145 // WriteTo implements io.WriterTo.WriteTo. 4146 func (f *FUSEGetAttrIn) WriteTo(writer io.Writer) (int64, error) { 4147 // Construct a slice backed by dst's underlying memory. 4148 var buf []byte 4149 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4150 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4151 hdr.Len = f.SizeBytes() 4152 hdr.Cap = f.SizeBytes() 4153 4154 length, err := writer.Write(buf) 4155 // Since we bypassed the compiler's escape analysis, indicate that f 4156 // must live until the use above. 4157 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4158 return int64(length), err 4159 } 4160 4161 // SizeBytes implements marshal.Marshallable.SizeBytes. 4162 func (f *FUSEHeaderIn) SizeBytes() int { 4163 return 28 + 4164 (*FUSEOpcode)(nil).SizeBytes() + 4165 (*FUSEOpID)(nil).SizeBytes() 4166 } 4167 4168 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4169 func (f *FUSEHeaderIn) MarshalBytes(dst []byte) []byte { 4170 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 4171 dst = dst[4:] 4172 dst = f.Opcode.MarshalUnsafe(dst) 4173 dst = f.Unique.MarshalUnsafe(dst) 4174 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 4175 dst = dst[8:] 4176 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 4177 dst = dst[4:] 4178 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 4179 dst = dst[4:] 4180 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 4181 dst = dst[4:] 4182 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4183 dst = dst[4:] 4184 return dst 4185 } 4186 4187 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4188 func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) []byte { 4189 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4190 src = src[4:] 4191 src = f.Opcode.UnmarshalUnsafe(src) 4192 src = f.Unique.UnmarshalUnsafe(src) 4193 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4194 src = src[8:] 4195 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4196 src = src[4:] 4197 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4198 src = src[4:] 4199 f.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4200 src = src[4:] 4201 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4202 src = src[4:] 4203 return src 4204 } 4205 4206 // Packed implements marshal.Marshallable.Packed. 4207 //go:nosplit 4208 func (f *FUSEHeaderIn) Packed() bool { 4209 return f.Opcode.Packed() && f.Unique.Packed() 4210 } 4211 4212 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4213 func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) []byte { 4214 if f.Opcode.Packed() && f.Unique.Packed() { 4215 size := f.SizeBytes() 4216 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4217 return dst[size:] 4218 } 4219 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4220 return f.MarshalBytes(dst) 4221 } 4222 4223 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4224 func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) []byte { 4225 if f.Opcode.Packed() && f.Unique.Packed() { 4226 size := f.SizeBytes() 4227 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4228 return src[size:] 4229 } 4230 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4231 return f.UnmarshalBytes(src) 4232 } 4233 4234 // CopyOutN implements marshal.Marshallable.CopyOutN. 4235 func (f *FUSEHeaderIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4236 if !f.Opcode.Packed() && f.Unique.Packed() { 4237 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4238 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4239 f.MarshalBytes(buf) // escapes: fallback. 4240 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4241 } 4242 4243 // Construct a slice backed by dst's underlying memory. 4244 var buf []byte 4245 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4246 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4247 hdr.Len = f.SizeBytes() 4248 hdr.Cap = f.SizeBytes() 4249 4250 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4251 // Since we bypassed the compiler's escape analysis, indicate that f 4252 // must live until the use above. 4253 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4254 return length, err 4255 } 4256 4257 // CopyOut implements marshal.Marshallable.CopyOut. 4258 func (f *FUSEHeaderIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4259 return f.CopyOutN(cc, addr, f.SizeBytes()) 4260 } 4261 4262 // CopyInN implements marshal.Marshallable.CopyInN. 4263 func (f *FUSEHeaderIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4264 if !f.Opcode.Packed() && f.Unique.Packed() { 4265 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4266 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4267 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4268 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4269 // partially unmarshalled struct. 4270 f.UnmarshalBytes(buf) // escapes: fallback. 4271 return length, err 4272 } 4273 4274 // Construct a slice backed by dst's underlying memory. 4275 var buf []byte 4276 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4277 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4278 hdr.Len = f.SizeBytes() 4279 hdr.Cap = f.SizeBytes() 4280 4281 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4282 // Since we bypassed the compiler's escape analysis, indicate that f 4283 // must live until the use above. 4284 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4285 return length, err 4286 } 4287 4288 // CopyIn implements marshal.Marshallable.CopyIn. 4289 func (f *FUSEHeaderIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4290 return f.CopyInN(cc, addr, f.SizeBytes()) 4291 } 4292 4293 // WriteTo implements io.WriterTo.WriteTo. 4294 func (f *FUSEHeaderIn) WriteTo(writer io.Writer) (int64, error) { 4295 if !f.Opcode.Packed() && f.Unique.Packed() { 4296 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4297 buf := make([]byte, f.SizeBytes()) 4298 f.MarshalBytes(buf) 4299 length, err := writer.Write(buf) 4300 return int64(length), err 4301 } 4302 4303 // Construct a slice backed by dst's underlying memory. 4304 var buf []byte 4305 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4306 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4307 hdr.Len = f.SizeBytes() 4308 hdr.Cap = f.SizeBytes() 4309 4310 length, err := writer.Write(buf) 4311 // Since we bypassed the compiler's escape analysis, indicate that f 4312 // must live until the use above. 4313 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4314 return int64(length), err 4315 } 4316 4317 // SizeBytes implements marshal.Marshallable.SizeBytes. 4318 func (f *FUSEHeaderOut) SizeBytes() int { 4319 return 8 + 4320 (*FUSEOpID)(nil).SizeBytes() 4321 } 4322 4323 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4324 func (f *FUSEHeaderOut) MarshalBytes(dst []byte) []byte { 4325 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 4326 dst = dst[4:] 4327 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Error)) 4328 dst = dst[4:] 4329 dst = f.Unique.MarshalUnsafe(dst) 4330 return dst 4331 } 4332 4333 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4334 func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) []byte { 4335 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4336 src = src[4:] 4337 f.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 4338 src = src[4:] 4339 src = f.Unique.UnmarshalUnsafe(src) 4340 return src 4341 } 4342 4343 // Packed implements marshal.Marshallable.Packed. 4344 //go:nosplit 4345 func (f *FUSEHeaderOut) Packed() bool { 4346 return f.Unique.Packed() 4347 } 4348 4349 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4350 func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) []byte { 4351 if f.Unique.Packed() { 4352 size := f.SizeBytes() 4353 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4354 return dst[size:] 4355 } 4356 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes. 4357 return f.MarshalBytes(dst) 4358 } 4359 4360 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4361 func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) []byte { 4362 if f.Unique.Packed() { 4363 size := f.SizeBytes() 4364 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4365 return src[size:] 4366 } 4367 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4368 return f.UnmarshalBytes(src) 4369 } 4370 4371 // CopyOutN implements marshal.Marshallable.CopyOutN. 4372 func (f *FUSEHeaderOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4373 if !f.Unique.Packed() { 4374 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4375 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4376 f.MarshalBytes(buf) // escapes: fallback. 4377 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4378 } 4379 4380 // Construct a slice backed by dst's underlying memory. 4381 var buf []byte 4382 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4383 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4384 hdr.Len = f.SizeBytes() 4385 hdr.Cap = f.SizeBytes() 4386 4387 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4388 // Since we bypassed the compiler's escape analysis, indicate that f 4389 // must live until the use above. 4390 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4391 return length, err 4392 } 4393 4394 // CopyOut implements marshal.Marshallable.CopyOut. 4395 func (f *FUSEHeaderOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4396 return f.CopyOutN(cc, addr, f.SizeBytes()) 4397 } 4398 4399 // CopyInN implements marshal.Marshallable.CopyInN. 4400 func (f *FUSEHeaderOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4401 if !f.Unique.Packed() { 4402 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4403 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4404 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4405 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4406 // partially unmarshalled struct. 4407 f.UnmarshalBytes(buf) // escapes: fallback. 4408 return length, err 4409 } 4410 4411 // Construct a slice backed by dst's underlying memory. 4412 var buf []byte 4413 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4414 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4415 hdr.Len = f.SizeBytes() 4416 hdr.Cap = f.SizeBytes() 4417 4418 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4419 // Since we bypassed the compiler's escape analysis, indicate that f 4420 // must live until the use above. 4421 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4422 return length, err 4423 } 4424 4425 // CopyIn implements marshal.Marshallable.CopyIn. 4426 func (f *FUSEHeaderOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4427 return f.CopyInN(cc, addr, f.SizeBytes()) 4428 } 4429 4430 // WriteTo implements io.WriterTo.WriteTo. 4431 func (f *FUSEHeaderOut) WriteTo(writer io.Writer) (int64, error) { 4432 if !f.Unique.Packed() { 4433 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4434 buf := make([]byte, f.SizeBytes()) 4435 f.MarshalBytes(buf) 4436 length, err := writer.Write(buf) 4437 return int64(length), err 4438 } 4439 4440 // Construct a slice backed by dst's underlying memory. 4441 var buf []byte 4442 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4443 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4444 hdr.Len = f.SizeBytes() 4445 hdr.Cap = f.SizeBytes() 4446 4447 length, err := writer.Write(buf) 4448 // Since we bypassed the compiler's escape analysis, indicate that f 4449 // must live until the use above. 4450 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4451 return int64(length), err 4452 } 4453 4454 // SizeBytes implements marshal.Marshallable.SizeBytes. 4455 func (f *FUSEInitIn) SizeBytes() int { 4456 return 16 4457 } 4458 4459 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4460 func (f *FUSEInitIn) MarshalBytes(dst []byte) []byte { 4461 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4462 dst = dst[4:] 4463 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4464 dst = dst[4:] 4465 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4466 dst = dst[4:] 4467 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4468 dst = dst[4:] 4469 return dst 4470 } 4471 4472 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4473 func (f *FUSEInitIn) UnmarshalBytes(src []byte) []byte { 4474 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4475 src = src[4:] 4476 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4477 src = src[4:] 4478 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4479 src = src[4:] 4480 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4481 src = src[4:] 4482 return src 4483 } 4484 4485 // Packed implements marshal.Marshallable.Packed. 4486 //go:nosplit 4487 func (f *FUSEInitIn) Packed() bool { 4488 return true 4489 } 4490 4491 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4492 func (f *FUSEInitIn) MarshalUnsafe(dst []byte) []byte { 4493 size := f.SizeBytes() 4494 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4495 return dst[size:] 4496 } 4497 4498 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4499 func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) []byte { 4500 size := f.SizeBytes() 4501 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4502 return src[size:] 4503 } 4504 4505 // CopyOutN implements marshal.Marshallable.CopyOutN. 4506 func (f *FUSEInitIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4507 // Construct a slice backed by dst's underlying memory. 4508 var buf []byte 4509 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4510 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4511 hdr.Len = f.SizeBytes() 4512 hdr.Cap = f.SizeBytes() 4513 4514 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4515 // Since we bypassed the compiler's escape analysis, indicate that f 4516 // must live until the use above. 4517 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4518 return length, err 4519 } 4520 4521 // CopyOut implements marshal.Marshallable.CopyOut. 4522 func (f *FUSEInitIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4523 return f.CopyOutN(cc, addr, f.SizeBytes()) 4524 } 4525 4526 // CopyInN implements marshal.Marshallable.CopyInN. 4527 func (f *FUSEInitIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4528 // Construct a slice backed by dst's underlying memory. 4529 var buf []byte 4530 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4531 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4532 hdr.Len = f.SizeBytes() 4533 hdr.Cap = f.SizeBytes() 4534 4535 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4536 // Since we bypassed the compiler's escape analysis, indicate that f 4537 // must live until the use above. 4538 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4539 return length, err 4540 } 4541 4542 // CopyIn implements marshal.Marshallable.CopyIn. 4543 func (f *FUSEInitIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4544 return f.CopyInN(cc, addr, f.SizeBytes()) 4545 } 4546 4547 // WriteTo implements io.WriterTo.WriteTo. 4548 func (f *FUSEInitIn) WriteTo(writer io.Writer) (int64, error) { 4549 // Construct a slice backed by dst's underlying memory. 4550 var buf []byte 4551 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4552 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4553 hdr.Len = f.SizeBytes() 4554 hdr.Cap = f.SizeBytes() 4555 4556 length, err := writer.Write(buf) 4557 // Since we bypassed the compiler's escape analysis, indicate that f 4558 // must live until the use above. 4559 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4560 return int64(length), err 4561 } 4562 4563 // SizeBytes implements marshal.Marshallable.SizeBytes. 4564 func (f *FUSEInitOut) SizeBytes() int { 4565 return 32 + 4566 4*8 4567 } 4568 4569 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4570 func (f *FUSEInitOut) MarshalBytes(dst []byte) []byte { 4571 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4572 dst = dst[4:] 4573 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4574 dst = dst[4:] 4575 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4576 dst = dst[4:] 4577 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4578 dst = dst[4:] 4579 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxBackground)) 4580 dst = dst[2:] 4581 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.CongestionThreshold)) 4582 dst = dst[2:] 4583 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxWrite)) 4584 dst = dst[4:] 4585 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.TimeGran)) 4586 dst = dst[4:] 4587 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxPages)) 4588 dst = dst[2:] 4589 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 4590 dst = dst[2:] 4591 // Padding: dst[:sizeof(uint32)*8] ~= [8]uint32{0} 4592 dst = dst[4*(8):] 4593 return dst 4594 } 4595 4596 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4597 func (f *FUSEInitOut) UnmarshalBytes(src []byte) []byte { 4598 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4599 src = src[4:] 4600 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4601 src = src[4:] 4602 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4603 src = src[4:] 4604 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4605 src = src[4:] 4606 f.MaxBackground = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4607 src = src[2:] 4608 f.CongestionThreshold = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4609 src = src[2:] 4610 f.MaxWrite = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4611 src = src[4:] 4612 f.TimeGran = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4613 src = src[4:] 4614 f.MaxPages = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4615 src = src[2:] 4616 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 4617 src = src[2:] 4618 // Padding: ~ copy([8]uint32(f._), src[:sizeof(uint32)*8]) 4619 src = src[4*(8):] 4620 return src 4621 } 4622 4623 // Packed implements marshal.Marshallable.Packed. 4624 //go:nosplit 4625 func (f *FUSEInitOut) Packed() bool { 4626 return true 4627 } 4628 4629 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4630 func (f *FUSEInitOut) MarshalUnsafe(dst []byte) []byte { 4631 size := f.SizeBytes() 4632 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4633 return dst[size:] 4634 } 4635 4636 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4637 func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) []byte { 4638 size := f.SizeBytes() 4639 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4640 return src[size:] 4641 } 4642 4643 // CopyOutN implements marshal.Marshallable.CopyOutN. 4644 func (f *FUSEInitOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4645 // Construct a slice backed by dst's underlying memory. 4646 var buf []byte 4647 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4648 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4649 hdr.Len = f.SizeBytes() 4650 hdr.Cap = f.SizeBytes() 4651 4652 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4653 // Since we bypassed the compiler's escape analysis, indicate that f 4654 // must live until the use above. 4655 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4656 return length, err 4657 } 4658 4659 // CopyOut implements marshal.Marshallable.CopyOut. 4660 func (f *FUSEInitOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4661 return f.CopyOutN(cc, addr, f.SizeBytes()) 4662 } 4663 4664 // CopyInN implements marshal.Marshallable.CopyInN. 4665 func (f *FUSEInitOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4666 // Construct a slice backed by dst's underlying memory. 4667 var buf []byte 4668 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4669 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4670 hdr.Len = f.SizeBytes() 4671 hdr.Cap = f.SizeBytes() 4672 4673 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4674 // Since we bypassed the compiler's escape analysis, indicate that f 4675 // must live until the use above. 4676 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4677 return length, err 4678 } 4679 4680 // CopyIn implements marshal.Marshallable.CopyIn. 4681 func (f *FUSEInitOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4682 return f.CopyInN(cc, addr, f.SizeBytes()) 4683 } 4684 4685 // WriteTo implements io.WriterTo.WriteTo. 4686 func (f *FUSEInitOut) WriteTo(writer io.Writer) (int64, error) { 4687 // Construct a slice backed by dst's underlying memory. 4688 var buf []byte 4689 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4690 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4691 hdr.Len = f.SizeBytes() 4692 hdr.Cap = f.SizeBytes() 4693 4694 length, err := writer.Write(buf) 4695 // Since we bypassed the compiler's escape analysis, indicate that f 4696 // must live until the use above. 4697 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4698 return int64(length), err 4699 } 4700 4701 // Packed implements marshal.Marshallable.Packed. 4702 //go:nosplit 4703 func (r *FUSELinkIn) Packed() bool { 4704 // Type FUSELinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4705 return false 4706 } 4707 4708 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4709 func (r *FUSELinkIn) MarshalUnsafe(dst []byte) []byte { 4710 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4711 return r.MarshalBytes(dst) 4712 } 4713 4714 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4715 func (r *FUSELinkIn) UnmarshalUnsafe(src []byte) []byte { 4716 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4717 return r.UnmarshalBytes(src) 4718 } 4719 4720 // CopyOutN implements marshal.Marshallable.CopyOutN. 4721 //go:nosplit 4722 func (r *FUSELinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4723 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4724 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4725 r.MarshalBytes(buf) // escapes: fallback. 4726 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4727 } 4728 4729 // CopyOut implements marshal.Marshallable.CopyOut. 4730 func (r *FUSELinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4731 return r.CopyOutN(cc, addr, r.SizeBytes()) 4732 } 4733 4734 // CopyInN implements marshal.Marshallable.CopyInN. 4735 //go:nosplit 4736 func (r *FUSELinkIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4737 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4738 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4739 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4740 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4741 // partially unmarshalled struct. 4742 r.UnmarshalBytes(buf) // escapes: fallback. 4743 return length, err 4744 } 4745 4746 // CopyIn implements marshal.Marshallable.CopyIn. 4747 func (r *FUSELinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4748 return r.CopyInN(cc, addr, r.SizeBytes()) 4749 } 4750 4751 // WriteTo implements io.WriterTo.WriteTo. 4752 func (r *FUSELinkIn) WriteTo(writer io.Writer) (int64, error) { 4753 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4754 buf := make([]byte, r.SizeBytes()) 4755 r.MarshalBytes(buf) 4756 length, err := writer.Write(buf) 4757 return int64(length), err 4758 } 4759 4760 // Packed implements marshal.Marshallable.Packed. 4761 //go:nosplit 4762 func (r *FUSELookupIn) Packed() bool { 4763 // Type FUSELookupIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4764 return false 4765 } 4766 4767 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4768 func (r *FUSELookupIn) MarshalUnsafe(dst []byte) []byte { 4769 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4770 return r.MarshalBytes(dst) 4771 } 4772 4773 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4774 func (r *FUSELookupIn) UnmarshalUnsafe(src []byte) []byte { 4775 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4776 return r.UnmarshalBytes(src) 4777 } 4778 4779 // CopyOutN implements marshal.Marshallable.CopyOutN. 4780 //go:nosplit 4781 func (r *FUSELookupIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4782 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4783 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4784 r.MarshalBytes(buf) // escapes: fallback. 4785 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4786 } 4787 4788 // CopyOut implements marshal.Marshallable.CopyOut. 4789 func (r *FUSELookupIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4790 return r.CopyOutN(cc, addr, r.SizeBytes()) 4791 } 4792 4793 // CopyInN implements marshal.Marshallable.CopyInN. 4794 //go:nosplit 4795 func (r *FUSELookupIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4796 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4797 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4798 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4799 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4800 // partially unmarshalled struct. 4801 r.UnmarshalBytes(buf) // escapes: fallback. 4802 return length, err 4803 } 4804 4805 // CopyIn implements marshal.Marshallable.CopyIn. 4806 func (r *FUSELookupIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4807 return r.CopyInN(cc, addr, r.SizeBytes()) 4808 } 4809 4810 // WriteTo implements io.WriterTo.WriteTo. 4811 func (r *FUSELookupIn) WriteTo(writer io.Writer) (int64, error) { 4812 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4813 buf := make([]byte, r.SizeBytes()) 4814 r.MarshalBytes(buf) 4815 length, err := writer.Write(buf) 4816 return int64(length), err 4817 } 4818 4819 // Packed implements marshal.Marshallable.Packed. 4820 //go:nosplit 4821 func (r *FUSEMkdirIn) Packed() bool { 4822 // Type FUSEMkdirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4823 return false 4824 } 4825 4826 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4827 func (r *FUSEMkdirIn) MarshalUnsafe(dst []byte) []byte { 4828 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4829 return r.MarshalBytes(dst) 4830 } 4831 4832 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4833 func (r *FUSEMkdirIn) UnmarshalUnsafe(src []byte) []byte { 4834 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4835 return r.UnmarshalBytes(src) 4836 } 4837 4838 // CopyOutN implements marshal.Marshallable.CopyOutN. 4839 //go:nosplit 4840 func (r *FUSEMkdirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4841 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4842 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4843 r.MarshalBytes(buf) // escapes: fallback. 4844 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4845 } 4846 4847 // CopyOut implements marshal.Marshallable.CopyOut. 4848 func (r *FUSEMkdirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4849 return r.CopyOutN(cc, addr, r.SizeBytes()) 4850 } 4851 4852 // CopyInN implements marshal.Marshallable.CopyInN. 4853 //go:nosplit 4854 func (r *FUSEMkdirIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4855 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4856 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4857 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4858 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4859 // partially unmarshalled struct. 4860 r.UnmarshalBytes(buf) // escapes: fallback. 4861 return length, err 4862 } 4863 4864 // CopyIn implements marshal.Marshallable.CopyIn. 4865 func (r *FUSEMkdirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4866 return r.CopyInN(cc, addr, r.SizeBytes()) 4867 } 4868 4869 // WriteTo implements io.WriterTo.WriteTo. 4870 func (r *FUSEMkdirIn) WriteTo(writer io.Writer) (int64, error) { 4871 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4872 buf := make([]byte, r.SizeBytes()) 4873 r.MarshalBytes(buf) 4874 length, err := writer.Write(buf) 4875 return int64(length), err 4876 } 4877 4878 // SizeBytes implements marshal.Marshallable.SizeBytes. 4879 func (f *FUSEMkdirMeta) SizeBytes() int { 4880 return 8 4881 } 4882 4883 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4884 func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) []byte { 4885 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4886 dst = dst[4:] 4887 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4888 dst = dst[4:] 4889 return dst 4890 } 4891 4892 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4893 func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) []byte { 4894 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4895 src = src[4:] 4896 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4897 src = src[4:] 4898 return src 4899 } 4900 4901 // Packed implements marshal.Marshallable.Packed. 4902 //go:nosplit 4903 func (f *FUSEMkdirMeta) Packed() bool { 4904 return true 4905 } 4906 4907 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4908 func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) []byte { 4909 size := f.SizeBytes() 4910 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4911 return dst[size:] 4912 } 4913 4914 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4915 func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) []byte { 4916 size := f.SizeBytes() 4917 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4918 return src[size:] 4919 } 4920 4921 // CopyOutN implements marshal.Marshallable.CopyOutN. 4922 func (f *FUSEMkdirMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4923 // Construct a slice backed by dst's underlying memory. 4924 var buf []byte 4925 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4926 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4927 hdr.Len = f.SizeBytes() 4928 hdr.Cap = f.SizeBytes() 4929 4930 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4931 // Since we bypassed the compiler's escape analysis, indicate that f 4932 // must live until the use above. 4933 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4934 return length, err 4935 } 4936 4937 // CopyOut implements marshal.Marshallable.CopyOut. 4938 func (f *FUSEMkdirMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4939 return f.CopyOutN(cc, addr, f.SizeBytes()) 4940 } 4941 4942 // CopyInN implements marshal.Marshallable.CopyInN. 4943 func (f *FUSEMkdirMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4944 // Construct a slice backed by dst's underlying memory. 4945 var buf []byte 4946 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4947 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4948 hdr.Len = f.SizeBytes() 4949 hdr.Cap = f.SizeBytes() 4950 4951 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4952 // Since we bypassed the compiler's escape analysis, indicate that f 4953 // must live until the use above. 4954 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4955 return length, err 4956 } 4957 4958 // CopyIn implements marshal.Marshallable.CopyIn. 4959 func (f *FUSEMkdirMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4960 return f.CopyInN(cc, addr, f.SizeBytes()) 4961 } 4962 4963 // WriteTo implements io.WriterTo.WriteTo. 4964 func (f *FUSEMkdirMeta) 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 // Packed implements marshal.Marshallable.Packed. 4980 //go:nosplit 4981 func (r *FUSEMknodIn) Packed() bool { 4982 // Type FUSEMknodIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4983 return false 4984 } 4985 4986 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4987 func (r *FUSEMknodIn) MarshalUnsafe(dst []byte) []byte { 4988 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4989 return r.MarshalBytes(dst) 4990 } 4991 4992 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4993 func (r *FUSEMknodIn) UnmarshalUnsafe(src []byte) []byte { 4994 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4995 return r.UnmarshalBytes(src) 4996 } 4997 4998 // CopyOutN implements marshal.Marshallable.CopyOutN. 4999 //go:nosplit 5000 func (r *FUSEMknodIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5001 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5002 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5003 r.MarshalBytes(buf) // escapes: fallback. 5004 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5005 } 5006 5007 // CopyOut implements marshal.Marshallable.CopyOut. 5008 func (r *FUSEMknodIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5009 return r.CopyOutN(cc, addr, r.SizeBytes()) 5010 } 5011 5012 // CopyInN implements marshal.Marshallable.CopyInN. 5013 //go:nosplit 5014 func (r *FUSEMknodIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5015 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5016 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5017 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5018 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5019 // partially unmarshalled struct. 5020 r.UnmarshalBytes(buf) // escapes: fallback. 5021 return length, err 5022 } 5023 5024 // CopyIn implements marshal.Marshallable.CopyIn. 5025 func (r *FUSEMknodIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5026 return r.CopyInN(cc, addr, r.SizeBytes()) 5027 } 5028 5029 // WriteTo implements io.WriterTo.WriteTo. 5030 func (r *FUSEMknodIn) WriteTo(writer io.Writer) (int64, error) { 5031 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5032 buf := make([]byte, r.SizeBytes()) 5033 r.MarshalBytes(buf) 5034 length, err := writer.Write(buf) 5035 return int64(length), err 5036 } 5037 5038 // SizeBytes implements marshal.Marshallable.SizeBytes. 5039 func (f *FUSEMknodMeta) SizeBytes() int { 5040 return 16 5041 } 5042 5043 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5044 func (f *FUSEMknodMeta) MarshalBytes(dst []byte) []byte { 5045 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5046 dst = dst[4:] 5047 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev)) 5048 dst = dst[4:] 5049 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 5050 dst = dst[4:] 5051 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5052 dst = dst[4:] 5053 return dst 5054 } 5055 5056 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5057 func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) []byte { 5058 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5059 src = src[4:] 5060 f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5061 src = src[4:] 5062 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5063 src = src[4:] 5064 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5065 src = src[4:] 5066 return src 5067 } 5068 5069 // Packed implements marshal.Marshallable.Packed. 5070 //go:nosplit 5071 func (f *FUSEMknodMeta) Packed() bool { 5072 return true 5073 } 5074 5075 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5076 func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) []byte { 5077 size := f.SizeBytes() 5078 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5079 return dst[size:] 5080 } 5081 5082 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5083 func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) []byte { 5084 size := f.SizeBytes() 5085 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5086 return src[size:] 5087 } 5088 5089 // CopyOutN implements marshal.Marshallable.CopyOutN. 5090 func (f *FUSEMknodMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5091 // Construct a slice backed by dst's underlying memory. 5092 var buf []byte 5093 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5094 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5095 hdr.Len = f.SizeBytes() 5096 hdr.Cap = f.SizeBytes() 5097 5098 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5099 // Since we bypassed the compiler's escape analysis, indicate that f 5100 // must live until the use above. 5101 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5102 return length, err 5103 } 5104 5105 // CopyOut implements marshal.Marshallable.CopyOut. 5106 func (f *FUSEMknodMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5107 return f.CopyOutN(cc, addr, f.SizeBytes()) 5108 } 5109 5110 // CopyInN implements marshal.Marshallable.CopyInN. 5111 func (f *FUSEMknodMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5112 // Construct a slice backed by dst's underlying memory. 5113 var buf []byte 5114 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5115 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5116 hdr.Len = f.SizeBytes() 5117 hdr.Cap = f.SizeBytes() 5118 5119 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5120 // Since we bypassed the compiler's escape analysis, indicate that f 5121 // must live until the use above. 5122 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5123 return length, err 5124 } 5125 5126 // CopyIn implements marshal.Marshallable.CopyIn. 5127 func (f *FUSEMknodMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5128 return f.CopyInN(cc, addr, f.SizeBytes()) 5129 } 5130 5131 // WriteTo implements io.WriterTo.WriteTo. 5132 func (f *FUSEMknodMeta) WriteTo(writer io.Writer) (int64, error) { 5133 // Construct a slice backed by dst's underlying memory. 5134 var buf []byte 5135 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5136 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5137 hdr.Len = f.SizeBytes() 5138 hdr.Cap = f.SizeBytes() 5139 5140 length, err := writer.Write(buf) 5141 // Since we bypassed the compiler's escape analysis, indicate that f 5142 // must live until the use above. 5143 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5144 return int64(length), err 5145 } 5146 5147 // SizeBytes implements marshal.Marshallable.SizeBytes. 5148 //go:nosplit 5149 func (f *FUSEOpID) SizeBytes() int { 5150 return 8 5151 } 5152 5153 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5154 func (f *FUSEOpID) MarshalBytes(dst []byte) []byte { 5155 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f)) 5156 return dst[8:] 5157 } 5158 5159 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5160 func (f *FUSEOpID) UnmarshalBytes(src []byte) []byte { 5161 *f = FUSEOpID(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 5162 return src[8:] 5163 } 5164 5165 // Packed implements marshal.Marshallable.Packed. 5166 //go:nosplit 5167 func (f *FUSEOpID) Packed() bool { 5168 // Scalar newtypes are always packed. 5169 return true 5170 } 5171 5172 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5173 func (f *FUSEOpID) MarshalUnsafe(dst []byte) []byte { 5174 size := f.SizeBytes() 5175 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5176 return dst[size:] 5177 } 5178 5179 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5180 func (f *FUSEOpID) UnmarshalUnsafe(src []byte) []byte { 5181 size := f.SizeBytes() 5182 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5183 return src[size:] 5184 } 5185 5186 // CopyOutN implements marshal.Marshallable.CopyOutN. 5187 func (f *FUSEOpID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5188 // Construct a slice backed by dst's underlying memory. 5189 var buf []byte 5190 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5191 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5192 hdr.Len = f.SizeBytes() 5193 hdr.Cap = f.SizeBytes() 5194 5195 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5196 // Since we bypassed the compiler's escape analysis, indicate that f 5197 // must live until the use above. 5198 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5199 return length, err 5200 } 5201 5202 // CopyOut implements marshal.Marshallable.CopyOut. 5203 func (f *FUSEOpID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5204 return f.CopyOutN(cc, addr, f.SizeBytes()) 5205 } 5206 5207 // CopyInN implements marshal.Marshallable.CopyInN. 5208 func (f *FUSEOpID) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5209 // Construct a slice backed by dst's underlying memory. 5210 var buf []byte 5211 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5212 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5213 hdr.Len = f.SizeBytes() 5214 hdr.Cap = f.SizeBytes() 5215 5216 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5217 // Since we bypassed the compiler's escape analysis, indicate that f 5218 // must live until the use above. 5219 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5220 return length, err 5221 } 5222 5223 // CopyIn implements marshal.Marshallable.CopyIn. 5224 func (f *FUSEOpID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5225 return f.CopyInN(cc, addr, f.SizeBytes()) 5226 } 5227 5228 // WriteTo implements io.WriterTo.WriteTo. 5229 func (f *FUSEOpID) WriteTo(writer io.Writer) (int64, error) { 5230 // Construct a slice backed by dst's underlying memory. 5231 var buf []byte 5232 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5233 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5234 hdr.Len = f.SizeBytes() 5235 hdr.Cap = f.SizeBytes() 5236 5237 length, err := writer.Write(buf) 5238 // Since we bypassed the compiler's escape analysis, indicate that f 5239 // must live until the use above. 5240 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5241 return int64(length), err 5242 } 5243 5244 // SizeBytes implements marshal.Marshallable.SizeBytes. 5245 //go:nosplit 5246 func (f *FUSEOpcode) SizeBytes() int { 5247 return 4 5248 } 5249 5250 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5251 func (f *FUSEOpcode) MarshalBytes(dst []byte) []byte { 5252 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f)) 5253 return dst[4:] 5254 } 5255 5256 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5257 func (f *FUSEOpcode) UnmarshalBytes(src []byte) []byte { 5258 *f = FUSEOpcode(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 5259 return src[4:] 5260 } 5261 5262 // Packed implements marshal.Marshallable.Packed. 5263 //go:nosplit 5264 func (f *FUSEOpcode) Packed() bool { 5265 // Scalar newtypes are always packed. 5266 return true 5267 } 5268 5269 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5270 func (f *FUSEOpcode) MarshalUnsafe(dst []byte) []byte { 5271 size := f.SizeBytes() 5272 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5273 return dst[size:] 5274 } 5275 5276 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5277 func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) []byte { 5278 size := f.SizeBytes() 5279 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5280 return src[size:] 5281 } 5282 5283 // CopyOutN implements marshal.Marshallable.CopyOutN. 5284 func (f *FUSEOpcode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5285 // Construct a slice backed by dst's underlying memory. 5286 var buf []byte 5287 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5288 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5289 hdr.Len = f.SizeBytes() 5290 hdr.Cap = f.SizeBytes() 5291 5292 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5293 // Since we bypassed the compiler's escape analysis, indicate that f 5294 // must live until the use above. 5295 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5296 return length, err 5297 } 5298 5299 // CopyOut implements marshal.Marshallable.CopyOut. 5300 func (f *FUSEOpcode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5301 return f.CopyOutN(cc, addr, f.SizeBytes()) 5302 } 5303 5304 // CopyInN implements marshal.Marshallable.CopyInN. 5305 func (f *FUSEOpcode) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5306 // Construct a slice backed by dst's underlying memory. 5307 var buf []byte 5308 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5309 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5310 hdr.Len = f.SizeBytes() 5311 hdr.Cap = f.SizeBytes() 5312 5313 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5314 // Since we bypassed the compiler's escape analysis, indicate that f 5315 // must live until the use above. 5316 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5317 return length, err 5318 } 5319 5320 // CopyIn implements marshal.Marshallable.CopyIn. 5321 func (f *FUSEOpcode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5322 return f.CopyInN(cc, addr, f.SizeBytes()) 5323 } 5324 5325 // WriteTo implements io.WriterTo.WriteTo. 5326 func (f *FUSEOpcode) WriteTo(writer io.Writer) (int64, error) { 5327 // Construct a slice backed by dst's underlying memory. 5328 var buf []byte 5329 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5330 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5331 hdr.Len = f.SizeBytes() 5332 hdr.Cap = f.SizeBytes() 5333 5334 length, err := writer.Write(buf) 5335 // Since we bypassed the compiler's escape analysis, indicate that f 5336 // must live until the use above. 5337 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5338 return int64(length), err 5339 } 5340 5341 // SizeBytes implements marshal.Marshallable.SizeBytes. 5342 func (f *FUSEOpenIn) SizeBytes() int { 5343 return 8 5344 } 5345 5346 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5347 func (f *FUSEOpenIn) MarshalBytes(dst []byte) []byte { 5348 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5349 dst = dst[4:] 5350 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5351 dst = dst[4:] 5352 return dst 5353 } 5354 5355 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5356 func (f *FUSEOpenIn) UnmarshalBytes(src []byte) []byte { 5357 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5358 src = src[4:] 5359 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5360 src = src[4:] 5361 return src 5362 } 5363 5364 // Packed implements marshal.Marshallable.Packed. 5365 //go:nosplit 5366 func (f *FUSEOpenIn) Packed() bool { 5367 return true 5368 } 5369 5370 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5371 func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) []byte { 5372 size := f.SizeBytes() 5373 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5374 return dst[size:] 5375 } 5376 5377 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5378 func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) []byte { 5379 size := f.SizeBytes() 5380 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5381 return src[size:] 5382 } 5383 5384 // CopyOutN implements marshal.Marshallable.CopyOutN. 5385 func (f *FUSEOpenIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5386 // Construct a slice backed by dst's underlying memory. 5387 var buf []byte 5388 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5389 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5390 hdr.Len = f.SizeBytes() 5391 hdr.Cap = f.SizeBytes() 5392 5393 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5394 // Since we bypassed the compiler's escape analysis, indicate that f 5395 // must live until the use above. 5396 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5397 return length, err 5398 } 5399 5400 // CopyOut implements marshal.Marshallable.CopyOut. 5401 func (f *FUSEOpenIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5402 return f.CopyOutN(cc, addr, f.SizeBytes()) 5403 } 5404 5405 // CopyInN implements marshal.Marshallable.CopyInN. 5406 func (f *FUSEOpenIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5407 // Construct a slice backed by dst's underlying memory. 5408 var buf []byte 5409 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5410 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5411 hdr.Len = f.SizeBytes() 5412 hdr.Cap = f.SizeBytes() 5413 5414 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5415 // Since we bypassed the compiler's escape analysis, indicate that f 5416 // must live until the use above. 5417 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5418 return length, err 5419 } 5420 5421 // CopyIn implements marshal.Marshallable.CopyIn. 5422 func (f *FUSEOpenIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5423 return f.CopyInN(cc, addr, f.SizeBytes()) 5424 } 5425 5426 // WriteTo implements io.WriterTo.WriteTo. 5427 func (f *FUSEOpenIn) WriteTo(writer io.Writer) (int64, error) { 5428 // Construct a slice backed by dst's underlying memory. 5429 var buf []byte 5430 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5431 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5432 hdr.Len = f.SizeBytes() 5433 hdr.Cap = f.SizeBytes() 5434 5435 length, err := writer.Write(buf) 5436 // Since we bypassed the compiler's escape analysis, indicate that f 5437 // must live until the use above. 5438 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5439 return int64(length), err 5440 } 5441 5442 // SizeBytes implements marshal.Marshallable.SizeBytes. 5443 func (f *FUSEOpenOut) SizeBytes() int { 5444 return 16 5445 } 5446 5447 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5448 func (f *FUSEOpenOut) MarshalBytes(dst []byte) []byte { 5449 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5450 dst = dst[8:] 5451 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.OpenFlag)) 5452 dst = dst[4:] 5453 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5454 dst = dst[4:] 5455 return dst 5456 } 5457 5458 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5459 func (f *FUSEOpenOut) UnmarshalBytes(src []byte) []byte { 5460 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5461 src = src[8:] 5462 f.OpenFlag = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5463 src = src[4:] 5464 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5465 src = src[4:] 5466 return src 5467 } 5468 5469 // Packed implements marshal.Marshallable.Packed. 5470 //go:nosplit 5471 func (f *FUSEOpenOut) Packed() bool { 5472 return true 5473 } 5474 5475 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5476 func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) []byte { 5477 size := f.SizeBytes() 5478 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5479 return dst[size:] 5480 } 5481 5482 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5483 func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) []byte { 5484 size := f.SizeBytes() 5485 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5486 return src[size:] 5487 } 5488 5489 // CopyOutN implements marshal.Marshallable.CopyOutN. 5490 func (f *FUSEOpenOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5491 // Construct a slice backed by dst's underlying memory. 5492 var buf []byte 5493 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5494 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5495 hdr.Len = f.SizeBytes() 5496 hdr.Cap = f.SizeBytes() 5497 5498 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5499 // Since we bypassed the compiler's escape analysis, indicate that f 5500 // must live until the use above. 5501 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5502 return length, err 5503 } 5504 5505 // CopyOut implements marshal.Marshallable.CopyOut. 5506 func (f *FUSEOpenOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5507 return f.CopyOutN(cc, addr, f.SizeBytes()) 5508 } 5509 5510 // CopyInN implements marshal.Marshallable.CopyInN. 5511 func (f *FUSEOpenOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5512 // Construct a slice backed by dst's underlying memory. 5513 var buf []byte 5514 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5515 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5516 hdr.Len = f.SizeBytes() 5517 hdr.Cap = f.SizeBytes() 5518 5519 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5520 // Since we bypassed the compiler's escape analysis, indicate that f 5521 // must live until the use above. 5522 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5523 return length, err 5524 } 5525 5526 // CopyIn implements marshal.Marshallable.CopyIn. 5527 func (f *FUSEOpenOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5528 return f.CopyInN(cc, addr, f.SizeBytes()) 5529 } 5530 5531 // WriteTo implements io.WriterTo.WriteTo. 5532 func (f *FUSEOpenOut) WriteTo(writer io.Writer) (int64, error) { 5533 // Construct a slice backed by dst's underlying memory. 5534 var buf []byte 5535 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5536 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5537 hdr.Len = f.SizeBytes() 5538 hdr.Cap = f.SizeBytes() 5539 5540 length, err := writer.Write(buf) 5541 // Since we bypassed the compiler's escape analysis, indicate that f 5542 // must live until the use above. 5543 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5544 return int64(length), err 5545 } 5546 5547 // SizeBytes implements marshal.Marshallable.SizeBytes. 5548 func (f *FUSEReadIn) SizeBytes() int { 5549 return 40 5550 } 5551 5552 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5553 func (f *FUSEReadIn) MarshalBytes(dst []byte) []byte { 5554 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5555 dst = dst[8:] 5556 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5557 dst = dst[8:] 5558 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5559 dst = dst[4:] 5560 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReadFlags)) 5561 dst = dst[4:] 5562 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5563 dst = dst[8:] 5564 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5565 dst = dst[4:] 5566 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5567 dst = dst[4:] 5568 return dst 5569 } 5570 5571 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5572 func (f *FUSEReadIn) UnmarshalBytes(src []byte) []byte { 5573 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5574 src = src[8:] 5575 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5576 src = src[8:] 5577 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5578 src = src[4:] 5579 f.ReadFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5580 src = src[4:] 5581 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5582 src = src[8:] 5583 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5584 src = src[4:] 5585 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5586 src = src[4:] 5587 return src 5588 } 5589 5590 // Packed implements marshal.Marshallable.Packed. 5591 //go:nosplit 5592 func (f *FUSEReadIn) Packed() bool { 5593 return true 5594 } 5595 5596 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5597 func (f *FUSEReadIn) MarshalUnsafe(dst []byte) []byte { 5598 size := f.SizeBytes() 5599 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5600 return dst[size:] 5601 } 5602 5603 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5604 func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) []byte { 5605 size := f.SizeBytes() 5606 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5607 return src[size:] 5608 } 5609 5610 // CopyOutN implements marshal.Marshallable.CopyOutN. 5611 func (f *FUSEReadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5612 // Construct a slice backed by dst's underlying memory. 5613 var buf []byte 5614 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5615 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5616 hdr.Len = f.SizeBytes() 5617 hdr.Cap = f.SizeBytes() 5618 5619 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5620 // Since we bypassed the compiler's escape analysis, indicate that f 5621 // must live until the use above. 5622 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5623 return length, err 5624 } 5625 5626 // CopyOut implements marshal.Marshallable.CopyOut. 5627 func (f *FUSEReadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5628 return f.CopyOutN(cc, addr, f.SizeBytes()) 5629 } 5630 5631 // CopyInN implements marshal.Marshallable.CopyInN. 5632 func (f *FUSEReadIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5633 // Construct a slice backed by dst's underlying memory. 5634 var buf []byte 5635 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5636 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5637 hdr.Len = f.SizeBytes() 5638 hdr.Cap = f.SizeBytes() 5639 5640 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5641 // Since we bypassed the compiler's escape analysis, indicate that f 5642 // must live until the use above. 5643 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5644 return length, err 5645 } 5646 5647 // CopyIn implements marshal.Marshallable.CopyIn. 5648 func (f *FUSEReadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5649 return f.CopyInN(cc, addr, f.SizeBytes()) 5650 } 5651 5652 // WriteTo implements io.WriterTo.WriteTo. 5653 func (f *FUSEReadIn) WriteTo(writer io.Writer) (int64, error) { 5654 // Construct a slice backed by dst's underlying memory. 5655 var buf []byte 5656 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5657 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5658 hdr.Len = f.SizeBytes() 5659 hdr.Cap = f.SizeBytes() 5660 5661 length, err := writer.Write(buf) 5662 // Since we bypassed the compiler's escape analysis, indicate that f 5663 // must live until the use above. 5664 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5665 return int64(length), err 5666 } 5667 5668 // SizeBytes implements marshal.Marshallable.SizeBytes. 5669 func (f *FUSEReleaseIn) SizeBytes() int { 5670 return 24 5671 } 5672 5673 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5674 func (f *FUSEReleaseIn) MarshalBytes(dst []byte) []byte { 5675 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5676 dst = dst[8:] 5677 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5678 dst = dst[4:] 5679 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReleaseFlags)) 5680 dst = dst[4:] 5681 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5682 dst = dst[8:] 5683 return dst 5684 } 5685 5686 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5687 func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) []byte { 5688 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5689 src = src[8:] 5690 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5691 src = src[4:] 5692 f.ReleaseFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5693 src = src[4:] 5694 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5695 src = src[8:] 5696 return src 5697 } 5698 5699 // Packed implements marshal.Marshallable.Packed. 5700 //go:nosplit 5701 func (f *FUSEReleaseIn) Packed() bool { 5702 return true 5703 } 5704 5705 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5706 func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) []byte { 5707 size := f.SizeBytes() 5708 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5709 return dst[size:] 5710 } 5711 5712 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5713 func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) []byte { 5714 size := f.SizeBytes() 5715 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5716 return src[size:] 5717 } 5718 5719 // CopyOutN implements marshal.Marshallable.CopyOutN. 5720 func (f *FUSEReleaseIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5721 // Construct a slice backed by dst's underlying memory. 5722 var buf []byte 5723 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5724 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5725 hdr.Len = f.SizeBytes() 5726 hdr.Cap = f.SizeBytes() 5727 5728 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5729 // Since we bypassed the compiler's escape analysis, indicate that f 5730 // must live until the use above. 5731 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5732 return length, err 5733 } 5734 5735 // CopyOut implements marshal.Marshallable.CopyOut. 5736 func (f *FUSEReleaseIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5737 return f.CopyOutN(cc, addr, f.SizeBytes()) 5738 } 5739 5740 // CopyInN implements marshal.Marshallable.CopyInN. 5741 func (f *FUSEReleaseIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5742 // Construct a slice backed by dst's underlying memory. 5743 var buf []byte 5744 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5745 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5746 hdr.Len = f.SizeBytes() 5747 hdr.Cap = f.SizeBytes() 5748 5749 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5750 // Since we bypassed the compiler's escape analysis, indicate that f 5751 // must live until the use above. 5752 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5753 return length, err 5754 } 5755 5756 // CopyIn implements marshal.Marshallable.CopyIn. 5757 func (f *FUSEReleaseIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5758 return f.CopyInN(cc, addr, f.SizeBytes()) 5759 } 5760 5761 // WriteTo implements io.WriterTo.WriteTo. 5762 func (f *FUSEReleaseIn) WriteTo(writer io.Writer) (int64, error) { 5763 // Construct a slice backed by dst's underlying memory. 5764 var buf []byte 5765 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5766 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5767 hdr.Len = f.SizeBytes() 5768 hdr.Cap = f.SizeBytes() 5769 5770 length, err := writer.Write(buf) 5771 // Since we bypassed the compiler's escape analysis, indicate that f 5772 // must live until the use above. 5773 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5774 return int64(length), err 5775 } 5776 5777 // Packed implements marshal.Marshallable.Packed. 5778 //go:nosplit 5779 func (r *FUSERenameIn) Packed() bool { 5780 // Type FUSERenameIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5781 return false 5782 } 5783 5784 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5785 func (r *FUSERenameIn) MarshalUnsafe(dst []byte) []byte { 5786 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5787 return r.MarshalBytes(dst) 5788 } 5789 5790 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5791 func (r *FUSERenameIn) UnmarshalUnsafe(src []byte) []byte { 5792 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5793 return r.UnmarshalBytes(src) 5794 } 5795 5796 // CopyOutN implements marshal.Marshallable.CopyOutN. 5797 //go:nosplit 5798 func (r *FUSERenameIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5799 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5800 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5801 r.MarshalBytes(buf) // escapes: fallback. 5802 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5803 } 5804 5805 // CopyOut implements marshal.Marshallable.CopyOut. 5806 func (r *FUSERenameIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5807 return r.CopyOutN(cc, addr, r.SizeBytes()) 5808 } 5809 5810 // CopyInN implements marshal.Marshallable.CopyInN. 5811 //go:nosplit 5812 func (r *FUSERenameIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5813 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5814 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5815 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5816 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5817 // partially unmarshalled struct. 5818 r.UnmarshalBytes(buf) // escapes: fallback. 5819 return length, err 5820 } 5821 5822 // CopyIn implements marshal.Marshallable.CopyIn. 5823 func (r *FUSERenameIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5824 return r.CopyInN(cc, addr, r.SizeBytes()) 5825 } 5826 5827 // WriteTo implements io.WriterTo.WriteTo. 5828 func (r *FUSERenameIn) WriteTo(writer io.Writer) (int64, error) { 5829 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5830 buf := make([]byte, r.SizeBytes()) 5831 r.MarshalBytes(buf) 5832 length, err := writer.Write(buf) 5833 return int64(length), err 5834 } 5835 5836 // Packed implements marshal.Marshallable.Packed. 5837 //go:nosplit 5838 func (r *FUSERmDirIn) Packed() bool { 5839 // Type FUSERmDirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5840 return false 5841 } 5842 5843 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5844 func (r *FUSERmDirIn) MarshalUnsafe(dst []byte) []byte { 5845 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5846 return r.MarshalBytes(dst) 5847 } 5848 5849 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5850 func (r *FUSERmDirIn) UnmarshalUnsafe(src []byte) []byte { 5851 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5852 return r.UnmarshalBytes(src) 5853 } 5854 5855 // CopyOutN implements marshal.Marshallable.CopyOutN. 5856 //go:nosplit 5857 func (r *FUSERmDirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5858 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5859 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5860 r.MarshalBytes(buf) // escapes: fallback. 5861 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5862 } 5863 5864 // CopyOut implements marshal.Marshallable.CopyOut. 5865 func (r *FUSERmDirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5866 return r.CopyOutN(cc, addr, r.SizeBytes()) 5867 } 5868 5869 // CopyInN implements marshal.Marshallable.CopyInN. 5870 //go:nosplit 5871 func (r *FUSERmDirIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5872 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5873 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5874 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5875 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5876 // partially unmarshalled struct. 5877 r.UnmarshalBytes(buf) // escapes: fallback. 5878 return length, err 5879 } 5880 5881 // CopyIn implements marshal.Marshallable.CopyIn. 5882 func (r *FUSERmDirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5883 return r.CopyInN(cc, addr, r.SizeBytes()) 5884 } 5885 5886 // WriteTo implements io.WriterTo.WriteTo. 5887 func (r *FUSERmDirIn) WriteTo(writer io.Writer) (int64, error) { 5888 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5889 buf := make([]byte, r.SizeBytes()) 5890 r.MarshalBytes(buf) 5891 length, err := writer.Write(buf) 5892 return int64(length), err 5893 } 5894 5895 // SizeBytes implements marshal.Marshallable.SizeBytes. 5896 func (f *FUSESetAttrIn) SizeBytes() int { 5897 return 88 5898 } 5899 5900 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5901 func (f *FUSESetAttrIn) MarshalBytes(dst []byte) []byte { 5902 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Valid)) 5903 dst = dst[4:] 5904 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5905 dst = dst[4:] 5906 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5907 dst = dst[8:] 5908 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size)) 5909 dst = dst[8:] 5910 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5911 dst = dst[8:] 5912 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Atime)) 5913 dst = dst[8:] 5914 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mtime)) 5915 dst = dst[8:] 5916 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ctime)) 5917 dst = dst[8:] 5918 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AtimeNsec)) 5919 dst = dst[4:] 5920 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MtimeNsec)) 5921 dst = dst[4:] 5922 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.CtimeNsec)) 5923 dst = dst[4:] 5924 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5925 dst = dst[4:] 5926 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5927 dst = dst[4:] 5928 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 5929 dst = dst[4:] 5930 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 5931 dst = dst[4:] 5932 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5933 dst = dst[4:] 5934 return dst 5935 } 5936 5937 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5938 func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) []byte { 5939 f.Valid = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5940 src = src[4:] 5941 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5942 src = src[4:] 5943 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5944 src = src[8:] 5945 f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5946 src = src[8:] 5947 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5948 src = src[8:] 5949 f.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5950 src = src[8:] 5951 f.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5952 src = src[8:] 5953 f.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5954 src = src[8:] 5955 f.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5956 src = src[4:] 5957 f.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5958 src = src[4:] 5959 f.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5960 src = src[4:] 5961 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5962 src = src[4:] 5963 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5964 src = src[4:] 5965 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5966 src = src[4:] 5967 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5968 src = src[4:] 5969 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5970 src = src[4:] 5971 return src 5972 } 5973 5974 // Packed implements marshal.Marshallable.Packed. 5975 //go:nosplit 5976 func (f *FUSESetAttrIn) Packed() bool { 5977 return true 5978 } 5979 5980 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5981 func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) []byte { 5982 size := f.SizeBytes() 5983 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5984 return dst[size:] 5985 } 5986 5987 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5988 func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) []byte { 5989 size := f.SizeBytes() 5990 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5991 return src[size:] 5992 } 5993 5994 // CopyOutN implements marshal.Marshallable.CopyOutN. 5995 func (f *FUSESetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5996 // Construct a slice backed by dst's underlying memory. 5997 var buf []byte 5998 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5999 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6000 hdr.Len = f.SizeBytes() 6001 hdr.Cap = f.SizeBytes() 6002 6003 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6004 // Since we bypassed the compiler's escape analysis, indicate that f 6005 // must live until the use above. 6006 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6007 return length, err 6008 } 6009 6010 // CopyOut implements marshal.Marshallable.CopyOut. 6011 func (f *FUSESetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6012 return f.CopyOutN(cc, addr, f.SizeBytes()) 6013 } 6014 6015 // CopyInN implements marshal.Marshallable.CopyInN. 6016 func (f *FUSESetAttrIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6017 // Construct a slice backed by dst's underlying memory. 6018 var buf []byte 6019 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6020 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6021 hdr.Len = f.SizeBytes() 6022 hdr.Cap = f.SizeBytes() 6023 6024 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6025 // Since we bypassed the compiler's escape analysis, indicate that f 6026 // must live until the use above. 6027 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6028 return length, err 6029 } 6030 6031 // CopyIn implements marshal.Marshallable.CopyIn. 6032 func (f *FUSESetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6033 return f.CopyInN(cc, addr, f.SizeBytes()) 6034 } 6035 6036 // WriteTo implements io.WriterTo.WriteTo. 6037 func (f *FUSESetAttrIn) WriteTo(writer io.Writer) (int64, error) { 6038 // Construct a slice backed by dst's underlying memory. 6039 var buf []byte 6040 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6041 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6042 hdr.Len = f.SizeBytes() 6043 hdr.Cap = f.SizeBytes() 6044 6045 length, err := writer.Write(buf) 6046 // Since we bypassed the compiler's escape analysis, indicate that f 6047 // must live until the use above. 6048 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6049 return int64(length), err 6050 } 6051 6052 // SizeBytes implements marshal.Marshallable.SizeBytes. 6053 func (f *FUSEStatfsOut) SizeBytes() int { 6054 return 56 + 6055 4*6 6056 } 6057 6058 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6059 func (f *FUSEStatfsOut) MarshalBytes(dst []byte) []byte { 6060 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Blocks)) 6061 dst = dst[8:] 6062 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksFree)) 6063 dst = dst[8:] 6064 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksAvailable)) 6065 dst = dst[8:] 6066 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Files)) 6067 dst = dst[8:] 6068 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.FilesFree)) 6069 dst = dst[8:] 6070 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.BlockSize)) 6071 dst = dst[4:] 6072 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLength)) 6073 dst = dst[4:] 6074 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FragmentSize)) 6075 dst = dst[4:] 6076 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6077 dst = dst[4:] 6078 for idx := 0; idx < 6; idx++ { 6079 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Spare[idx])) 6080 dst = dst[4:] 6081 } 6082 return dst 6083 } 6084 6085 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6086 func (f *FUSEStatfsOut) UnmarshalBytes(src []byte) []byte { 6087 f.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6088 src = src[8:] 6089 f.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6090 src = src[8:] 6091 f.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6092 src = src[8:] 6093 f.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6094 src = src[8:] 6095 f.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6096 src = src[8:] 6097 f.BlockSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6098 src = src[4:] 6099 f.NameLength = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6100 src = src[4:] 6101 f.FragmentSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6102 src = src[4:] 6103 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6104 src = src[4:] 6105 for idx := 0; idx < 6; idx++ { 6106 f.Spare[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6107 src = src[4:] 6108 } 6109 return src 6110 } 6111 6112 // Packed implements marshal.Marshallable.Packed. 6113 //go:nosplit 6114 func (f *FUSEStatfsOut) Packed() bool { 6115 return true 6116 } 6117 6118 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6119 func (f *FUSEStatfsOut) MarshalUnsafe(dst []byte) []byte { 6120 size := f.SizeBytes() 6121 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6122 return dst[size:] 6123 } 6124 6125 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6126 func (f *FUSEStatfsOut) UnmarshalUnsafe(src []byte) []byte { 6127 size := f.SizeBytes() 6128 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6129 return src[size:] 6130 } 6131 6132 // CopyOutN implements marshal.Marshallable.CopyOutN. 6133 func (f *FUSEStatfsOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6134 // Construct a slice backed by dst's underlying memory. 6135 var buf []byte 6136 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6137 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6138 hdr.Len = f.SizeBytes() 6139 hdr.Cap = f.SizeBytes() 6140 6141 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6142 // Since we bypassed the compiler's escape analysis, indicate that f 6143 // must live until the use above. 6144 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6145 return length, err 6146 } 6147 6148 // CopyOut implements marshal.Marshallable.CopyOut. 6149 func (f *FUSEStatfsOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6150 return f.CopyOutN(cc, addr, f.SizeBytes()) 6151 } 6152 6153 // CopyInN implements marshal.Marshallable.CopyInN. 6154 func (f *FUSEStatfsOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6155 // Construct a slice backed by dst's underlying memory. 6156 var buf []byte 6157 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6158 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6159 hdr.Len = f.SizeBytes() 6160 hdr.Cap = f.SizeBytes() 6161 6162 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6163 // Since we bypassed the compiler's escape analysis, indicate that f 6164 // must live until the use above. 6165 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6166 return length, err 6167 } 6168 6169 // CopyIn implements marshal.Marshallable.CopyIn. 6170 func (f *FUSEStatfsOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6171 return f.CopyInN(cc, addr, f.SizeBytes()) 6172 } 6173 6174 // WriteTo implements io.WriterTo.WriteTo. 6175 func (f *FUSEStatfsOut) WriteTo(writer io.Writer) (int64, error) { 6176 // Construct a slice backed by dst's underlying memory. 6177 var buf []byte 6178 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6179 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6180 hdr.Len = f.SizeBytes() 6181 hdr.Cap = f.SizeBytes() 6182 6183 length, err := writer.Write(buf) 6184 // Since we bypassed the compiler's escape analysis, indicate that f 6185 // must live until the use above. 6186 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6187 return int64(length), err 6188 } 6189 6190 // Packed implements marshal.Marshallable.Packed. 6191 //go:nosplit 6192 func (r *FUSESymlinkIn) Packed() bool { 6193 // Type FUSESymlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6194 return false 6195 } 6196 6197 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6198 func (r *FUSESymlinkIn) MarshalUnsafe(dst []byte) []byte { 6199 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6200 return r.MarshalBytes(dst) 6201 } 6202 6203 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6204 func (r *FUSESymlinkIn) UnmarshalUnsafe(src []byte) []byte { 6205 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6206 return r.UnmarshalBytes(src) 6207 } 6208 6209 // CopyOutN implements marshal.Marshallable.CopyOutN. 6210 //go:nosplit 6211 func (r *FUSESymlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6212 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6213 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6214 r.MarshalBytes(buf) // escapes: fallback. 6215 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6216 } 6217 6218 // CopyOut implements marshal.Marshallable.CopyOut. 6219 func (r *FUSESymlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6220 return r.CopyOutN(cc, addr, r.SizeBytes()) 6221 } 6222 6223 // CopyInN implements marshal.Marshallable.CopyInN. 6224 //go:nosplit 6225 func (r *FUSESymlinkIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6226 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6227 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6228 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6229 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6230 // partially unmarshalled struct. 6231 r.UnmarshalBytes(buf) // escapes: fallback. 6232 return length, err 6233 } 6234 6235 // CopyIn implements marshal.Marshallable.CopyIn. 6236 func (r *FUSESymlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6237 return r.CopyInN(cc, addr, r.SizeBytes()) 6238 } 6239 6240 // WriteTo implements io.WriterTo.WriteTo. 6241 func (r *FUSESymlinkIn) WriteTo(writer io.Writer) (int64, error) { 6242 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6243 buf := make([]byte, r.SizeBytes()) 6244 r.MarshalBytes(buf) 6245 length, err := writer.Write(buf) 6246 return int64(length), err 6247 } 6248 6249 // Packed implements marshal.Marshallable.Packed. 6250 //go:nosplit 6251 func (r *FUSEUnlinkIn) Packed() bool { 6252 // Type FUSEUnlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6253 return false 6254 } 6255 6256 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6257 func (r *FUSEUnlinkIn) MarshalUnsafe(dst []byte) []byte { 6258 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6259 return r.MarshalBytes(dst) 6260 } 6261 6262 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6263 func (r *FUSEUnlinkIn) UnmarshalUnsafe(src []byte) []byte { 6264 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6265 return r.UnmarshalBytes(src) 6266 } 6267 6268 // CopyOutN implements marshal.Marshallable.CopyOutN. 6269 //go:nosplit 6270 func (r *FUSEUnlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6271 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6272 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6273 r.MarshalBytes(buf) // escapes: fallback. 6274 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6275 } 6276 6277 // CopyOut implements marshal.Marshallable.CopyOut. 6278 func (r *FUSEUnlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6279 return r.CopyOutN(cc, addr, r.SizeBytes()) 6280 } 6281 6282 // CopyInN implements marshal.Marshallable.CopyInN. 6283 //go:nosplit 6284 func (r *FUSEUnlinkIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6285 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6286 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6287 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6288 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6289 // partially unmarshalled struct. 6290 r.UnmarshalBytes(buf) // escapes: fallback. 6291 return length, err 6292 } 6293 6294 // CopyIn implements marshal.Marshallable.CopyIn. 6295 func (r *FUSEUnlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6296 return r.CopyInN(cc, addr, r.SizeBytes()) 6297 } 6298 6299 // WriteTo implements io.WriterTo.WriteTo. 6300 func (r *FUSEUnlinkIn) WriteTo(writer io.Writer) (int64, error) { 6301 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6302 buf := make([]byte, r.SizeBytes()) 6303 r.MarshalBytes(buf) 6304 length, err := writer.Write(buf) 6305 return int64(length), err 6306 } 6307 6308 // SizeBytes implements marshal.Marshallable.SizeBytes. 6309 func (f *FUSEWriteIn) SizeBytes() int { 6310 return 40 6311 } 6312 6313 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6314 func (f *FUSEWriteIn) MarshalBytes(dst []byte) []byte { 6315 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 6316 dst = dst[8:] 6317 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 6318 dst = dst[8:] 6319 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 6320 dst = dst[4:] 6321 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.WriteFlags)) 6322 dst = dst[4:] 6323 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 6324 dst = dst[8:] 6325 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 6326 dst = dst[4:] 6327 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6328 dst = dst[4:] 6329 return dst 6330 } 6331 6332 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6333 func (f *FUSEWriteIn) UnmarshalBytes(src []byte) []byte { 6334 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6335 src = src[8:] 6336 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6337 src = src[8:] 6338 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6339 src = src[4:] 6340 f.WriteFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6341 src = src[4:] 6342 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6343 src = src[8:] 6344 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6345 src = src[4:] 6346 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6347 src = src[4:] 6348 return src 6349 } 6350 6351 // Packed implements marshal.Marshallable.Packed. 6352 //go:nosplit 6353 func (f *FUSEWriteIn) Packed() bool { 6354 return true 6355 } 6356 6357 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6358 func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) []byte { 6359 size := f.SizeBytes() 6360 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6361 return dst[size:] 6362 } 6363 6364 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6365 func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) []byte { 6366 size := f.SizeBytes() 6367 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6368 return src[size:] 6369 } 6370 6371 // CopyOutN implements marshal.Marshallable.CopyOutN. 6372 func (f *FUSEWriteIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6373 // Construct a slice backed by dst's underlying memory. 6374 var buf []byte 6375 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6376 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6377 hdr.Len = f.SizeBytes() 6378 hdr.Cap = f.SizeBytes() 6379 6380 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6381 // Since we bypassed the compiler's escape analysis, indicate that f 6382 // must live until the use above. 6383 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6384 return length, err 6385 } 6386 6387 // CopyOut implements marshal.Marshallable.CopyOut. 6388 func (f *FUSEWriteIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6389 return f.CopyOutN(cc, addr, f.SizeBytes()) 6390 } 6391 6392 // CopyInN implements marshal.Marshallable.CopyInN. 6393 func (f *FUSEWriteIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6394 // Construct a slice backed by dst's underlying memory. 6395 var buf []byte 6396 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6397 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6398 hdr.Len = f.SizeBytes() 6399 hdr.Cap = f.SizeBytes() 6400 6401 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6402 // Since we bypassed the compiler's escape analysis, indicate that f 6403 // must live until the use above. 6404 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6405 return length, err 6406 } 6407 6408 // CopyIn implements marshal.Marshallable.CopyIn. 6409 func (f *FUSEWriteIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6410 return f.CopyInN(cc, addr, f.SizeBytes()) 6411 } 6412 6413 // WriteTo implements io.WriterTo.WriteTo. 6414 func (f *FUSEWriteIn) WriteTo(writer io.Writer) (int64, error) { 6415 // Construct a slice backed by dst's underlying memory. 6416 var buf []byte 6417 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6418 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6419 hdr.Len = f.SizeBytes() 6420 hdr.Cap = f.SizeBytes() 6421 6422 length, err := writer.Write(buf) 6423 // Since we bypassed the compiler's escape analysis, indicate that f 6424 // must live until the use above. 6425 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6426 return int64(length), err 6427 } 6428 6429 // SizeBytes implements marshal.Marshallable.SizeBytes. 6430 func (f *FUSEWriteOut) SizeBytes() int { 6431 return 8 6432 } 6433 6434 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6435 func (f *FUSEWriteOut) MarshalBytes(dst []byte) []byte { 6436 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 6437 dst = dst[4:] 6438 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6439 dst = dst[4:] 6440 return dst 6441 } 6442 6443 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6444 func (f *FUSEWriteOut) UnmarshalBytes(src []byte) []byte { 6445 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6446 src = src[4:] 6447 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6448 src = src[4:] 6449 return src 6450 } 6451 6452 // Packed implements marshal.Marshallable.Packed. 6453 //go:nosplit 6454 func (f *FUSEWriteOut) Packed() bool { 6455 return true 6456 } 6457 6458 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6459 func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) []byte { 6460 size := f.SizeBytes() 6461 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6462 return dst[size:] 6463 } 6464 6465 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6466 func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) []byte { 6467 size := f.SizeBytes() 6468 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6469 return src[size:] 6470 } 6471 6472 // CopyOutN implements marshal.Marshallable.CopyOutN. 6473 func (f *FUSEWriteOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6474 // Construct a slice backed by dst's underlying memory. 6475 var buf []byte 6476 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6477 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6478 hdr.Len = f.SizeBytes() 6479 hdr.Cap = f.SizeBytes() 6480 6481 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6482 // Since we bypassed the compiler's escape analysis, indicate that f 6483 // must live until the use above. 6484 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6485 return length, err 6486 } 6487 6488 // CopyOut implements marshal.Marshallable.CopyOut. 6489 func (f *FUSEWriteOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6490 return f.CopyOutN(cc, addr, f.SizeBytes()) 6491 } 6492 6493 // CopyInN implements marshal.Marshallable.CopyInN. 6494 func (f *FUSEWriteOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6495 // Construct a slice backed by dst's underlying memory. 6496 var buf []byte 6497 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6498 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6499 hdr.Len = f.SizeBytes() 6500 hdr.Cap = f.SizeBytes() 6501 6502 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6503 // Since we bypassed the compiler's escape analysis, indicate that f 6504 // must live until the use above. 6505 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6506 return length, err 6507 } 6508 6509 // CopyIn implements marshal.Marshallable.CopyIn. 6510 func (f *FUSEWriteOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6511 return f.CopyInN(cc, addr, f.SizeBytes()) 6512 } 6513 6514 // WriteTo implements io.WriterTo.WriteTo. 6515 func (f *FUSEWriteOut) WriteTo(writer io.Writer) (int64, error) { 6516 // Construct a slice backed by dst's underlying memory. 6517 var buf []byte 6518 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6519 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6520 hdr.Len = f.SizeBytes() 6521 hdr.Cap = f.SizeBytes() 6522 6523 length, err := writer.Write(buf) 6524 // Since we bypassed the compiler's escape analysis, indicate that f 6525 // must live until the use above. 6526 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6527 return int64(length), err 6528 } 6529 6530 // Packed implements marshal.Marshallable.Packed. 6531 //go:nosplit 6532 func (r *FUSEWritePayloadIn) Packed() bool { 6533 // Type FUSEWritePayloadIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6534 return false 6535 } 6536 6537 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6538 func (r *FUSEWritePayloadIn) MarshalUnsafe(dst []byte) []byte { 6539 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6540 return r.MarshalBytes(dst) 6541 } 6542 6543 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6544 func (r *FUSEWritePayloadIn) UnmarshalUnsafe(src []byte) []byte { 6545 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6546 return r.UnmarshalBytes(src) 6547 } 6548 6549 // CopyOutN implements marshal.Marshallable.CopyOutN. 6550 //go:nosplit 6551 func (r *FUSEWritePayloadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6552 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6553 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6554 r.MarshalBytes(buf) // escapes: fallback. 6555 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6556 } 6557 6558 // CopyOut implements marshal.Marshallable.CopyOut. 6559 func (r *FUSEWritePayloadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6560 return r.CopyOutN(cc, addr, r.SizeBytes()) 6561 } 6562 6563 // CopyInN implements marshal.Marshallable.CopyInN. 6564 //go:nosplit 6565 func (r *FUSEWritePayloadIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6566 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6567 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6568 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6569 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6570 // partially unmarshalled struct. 6571 r.UnmarshalBytes(buf) // escapes: fallback. 6572 return length, err 6573 } 6574 6575 // CopyIn implements marshal.Marshallable.CopyIn. 6576 func (r *FUSEWritePayloadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6577 return r.CopyInN(cc, addr, r.SizeBytes()) 6578 } 6579 6580 // WriteTo implements io.WriterTo.WriteTo. 6581 func (r *FUSEWritePayloadIn) WriteTo(writer io.Writer) (int64, error) { 6582 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6583 buf := make([]byte, r.SizeBytes()) 6584 r.MarshalBytes(buf) 6585 length, err := writer.Write(buf) 6586 return int64(length), err 6587 } 6588 6589 // SizeBytes implements marshal.Marshallable.SizeBytes. 6590 func (r *RobustListHead) SizeBytes() int { 6591 return 24 6592 } 6593 6594 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6595 func (r *RobustListHead) MarshalBytes(dst []byte) []byte { 6596 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.List)) 6597 dst = dst[8:] 6598 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.FutexOffset)) 6599 dst = dst[8:] 6600 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ListOpPending)) 6601 dst = dst[8:] 6602 return dst 6603 } 6604 6605 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6606 func (r *RobustListHead) UnmarshalBytes(src []byte) []byte { 6607 r.List = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6608 src = src[8:] 6609 r.FutexOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6610 src = src[8:] 6611 r.ListOpPending = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6612 src = src[8:] 6613 return src 6614 } 6615 6616 // Packed implements marshal.Marshallable.Packed. 6617 //go:nosplit 6618 func (r *RobustListHead) Packed() bool { 6619 return true 6620 } 6621 6622 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6623 func (r *RobustListHead) MarshalUnsafe(dst []byte) []byte { 6624 size := r.SizeBytes() 6625 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 6626 return dst[size:] 6627 } 6628 6629 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6630 func (r *RobustListHead) UnmarshalUnsafe(src []byte) []byte { 6631 size := r.SizeBytes() 6632 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 6633 return src[size:] 6634 } 6635 6636 // CopyOutN implements marshal.Marshallable.CopyOutN. 6637 func (r *RobustListHead) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6638 // Construct a slice backed by dst's underlying memory. 6639 var buf []byte 6640 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6641 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6642 hdr.Len = r.SizeBytes() 6643 hdr.Cap = r.SizeBytes() 6644 6645 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6646 // Since we bypassed the compiler's escape analysis, indicate that r 6647 // must live until the use above. 6648 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6649 return length, err 6650 } 6651 6652 // CopyOut implements marshal.Marshallable.CopyOut. 6653 func (r *RobustListHead) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6654 return r.CopyOutN(cc, addr, r.SizeBytes()) 6655 } 6656 6657 // CopyInN implements marshal.Marshallable.CopyInN. 6658 func (r *RobustListHead) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6659 // Construct a slice backed by dst's underlying memory. 6660 var buf []byte 6661 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6662 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6663 hdr.Len = r.SizeBytes() 6664 hdr.Cap = r.SizeBytes() 6665 6666 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6667 // Since we bypassed the compiler's escape analysis, indicate that r 6668 // must live until the use above. 6669 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6670 return length, err 6671 } 6672 6673 // CopyIn implements marshal.Marshallable.CopyIn. 6674 func (r *RobustListHead) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6675 return r.CopyInN(cc, addr, r.SizeBytes()) 6676 } 6677 6678 // WriteTo implements io.WriterTo.WriteTo. 6679 func (r *RobustListHead) WriteTo(writer io.Writer) (int64, error) { 6680 // Construct a slice backed by dst's underlying memory. 6681 var buf []byte 6682 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6683 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6684 hdr.Len = r.SizeBytes() 6685 hdr.Cap = r.SizeBytes() 6686 6687 length, err := writer.Write(buf) 6688 // Since we bypassed the compiler's escape analysis, indicate that r 6689 // must live until the use above. 6690 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6691 return int64(length), err 6692 } 6693 6694 // SizeBytes implements marshal.Marshallable.SizeBytes. 6695 func (i *IOCqRingOffsets) SizeBytes() int { 6696 return 40 6697 } 6698 6699 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6700 func (i *IOCqRingOffsets) MarshalBytes(dst []byte) []byte { 6701 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6702 dst = dst[4:] 6703 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6704 dst = dst[4:] 6705 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 6706 dst = dst[4:] 6707 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 6708 dst = dst[4:] 6709 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Overflow)) 6710 dst = dst[4:] 6711 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Cqes)) 6712 dst = dst[4:] 6713 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6714 dst = dst[4:] 6715 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 6716 dst = dst[4:] 6717 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 6718 dst = dst[8:] 6719 return dst 6720 } 6721 6722 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6723 func (i *IOCqRingOffsets) UnmarshalBytes(src []byte) []byte { 6724 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6725 src = src[4:] 6726 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6727 src = src[4:] 6728 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6729 src = src[4:] 6730 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6731 src = src[4:] 6732 i.Overflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6733 src = src[4:] 6734 i.Cqes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6735 src = src[4:] 6736 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6737 src = src[4:] 6738 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6739 src = src[4:] 6740 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6741 src = src[8:] 6742 return src 6743 } 6744 6745 // Packed implements marshal.Marshallable.Packed. 6746 //go:nosplit 6747 func (i *IOCqRingOffsets) Packed() bool { 6748 return true 6749 } 6750 6751 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6752 func (i *IOCqRingOffsets) MarshalUnsafe(dst []byte) []byte { 6753 size := i.SizeBytes() 6754 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6755 return dst[size:] 6756 } 6757 6758 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6759 func (i *IOCqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 6760 size := i.SizeBytes() 6761 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6762 return src[size:] 6763 } 6764 6765 // CopyOutN implements marshal.Marshallable.CopyOutN. 6766 func (i *IOCqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6767 // Construct a slice backed by dst's underlying memory. 6768 var buf []byte 6769 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6770 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6771 hdr.Len = i.SizeBytes() 6772 hdr.Cap = i.SizeBytes() 6773 6774 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6775 // Since we bypassed the compiler's escape analysis, indicate that i 6776 // must live until the use above. 6777 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6778 return length, err 6779 } 6780 6781 // CopyOut implements marshal.Marshallable.CopyOut. 6782 func (i *IOCqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6783 return i.CopyOutN(cc, addr, i.SizeBytes()) 6784 } 6785 6786 // CopyInN implements marshal.Marshallable.CopyInN. 6787 func (i *IOCqRingOffsets) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6788 // Construct a slice backed by dst's underlying memory. 6789 var buf []byte 6790 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6791 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6792 hdr.Len = i.SizeBytes() 6793 hdr.Cap = i.SizeBytes() 6794 6795 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6796 // Since we bypassed the compiler's escape analysis, indicate that i 6797 // must live until the use above. 6798 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6799 return length, err 6800 } 6801 6802 // CopyIn implements marshal.Marshallable.CopyIn. 6803 func (i *IOCqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6804 return i.CopyInN(cc, addr, i.SizeBytes()) 6805 } 6806 6807 // WriteTo implements io.WriterTo.WriteTo. 6808 func (i *IOCqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 6809 // Construct a slice backed by dst's underlying memory. 6810 var buf []byte 6811 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6812 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6813 hdr.Len = i.SizeBytes() 6814 hdr.Cap = i.SizeBytes() 6815 6816 length, err := writer.Write(buf) 6817 // Since we bypassed the compiler's escape analysis, indicate that i 6818 // must live until the use above. 6819 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6820 return int64(length), err 6821 } 6822 6823 // SizeBytes implements marshal.Marshallable.SizeBytes. 6824 //go:nosplit 6825 func (i *IORingIndex) SizeBytes() int { 6826 return 4 6827 } 6828 6829 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6830 func (i *IORingIndex) MarshalBytes(dst []byte) []byte { 6831 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i)) 6832 return dst[4:] 6833 } 6834 6835 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6836 func (i *IORingIndex) UnmarshalBytes(src []byte) []byte { 6837 *i = IORingIndex(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 6838 return src[4:] 6839 } 6840 6841 // Packed implements marshal.Marshallable.Packed. 6842 //go:nosplit 6843 func (i *IORingIndex) Packed() bool { 6844 // Scalar newtypes are always packed. 6845 return true 6846 } 6847 6848 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6849 func (i *IORingIndex) MarshalUnsafe(dst []byte) []byte { 6850 size := i.SizeBytes() 6851 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6852 return dst[size:] 6853 } 6854 6855 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6856 func (i *IORingIndex) UnmarshalUnsafe(src []byte) []byte { 6857 size := i.SizeBytes() 6858 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6859 return src[size:] 6860 } 6861 6862 // CopyOutN implements marshal.Marshallable.CopyOutN. 6863 func (i *IORingIndex) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6864 // Construct a slice backed by dst's underlying memory. 6865 var buf []byte 6866 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6867 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6868 hdr.Len = i.SizeBytes() 6869 hdr.Cap = i.SizeBytes() 6870 6871 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6872 // Since we bypassed the compiler's escape analysis, indicate that i 6873 // must live until the use above. 6874 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6875 return length, err 6876 } 6877 6878 // CopyOut implements marshal.Marshallable.CopyOut. 6879 func (i *IORingIndex) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6880 return i.CopyOutN(cc, addr, i.SizeBytes()) 6881 } 6882 6883 // CopyInN implements marshal.Marshallable.CopyInN. 6884 func (i *IORingIndex) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6885 // Construct a slice backed by dst's underlying memory. 6886 var buf []byte 6887 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6888 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6889 hdr.Len = i.SizeBytes() 6890 hdr.Cap = i.SizeBytes() 6891 6892 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6893 // Since we bypassed the compiler's escape analysis, indicate that i 6894 // must live until the use above. 6895 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6896 return length, err 6897 } 6898 6899 // CopyIn implements marshal.Marshallable.CopyIn. 6900 func (i *IORingIndex) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6901 return i.CopyInN(cc, addr, i.SizeBytes()) 6902 } 6903 6904 // WriteTo implements io.WriterTo.WriteTo. 6905 func (i *IORingIndex) WriteTo(writer io.Writer) (int64, error) { 6906 // Construct a slice backed by dst's underlying memory. 6907 var buf []byte 6908 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6909 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6910 hdr.Len = i.SizeBytes() 6911 hdr.Cap = i.SizeBytes() 6912 6913 length, err := writer.Write(buf) 6914 // Since we bypassed the compiler's escape analysis, indicate that i 6915 // must live until the use above. 6916 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6917 return int64(length), err 6918 } 6919 6920 // SizeBytes implements marshal.Marshallable.SizeBytes. 6921 func (i *IORings) SizeBytes() int { 6922 return 32 + 6923 (*IOUring)(nil).SizeBytes() + 6924 (*IOUring)(nil).SizeBytes() + 6925 1*32 6926 } 6927 6928 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6929 func (i *IORings) MarshalBytes(dst []byte) []byte { 6930 dst = i.Sq.MarshalUnsafe(dst) 6931 dst = i.Cq.MarshalUnsafe(dst) 6932 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingMask)) 6933 dst = dst[4:] 6934 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingMask)) 6935 dst = dst[4:] 6936 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingEntries)) 6937 dst = dst[4:] 6938 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingEntries)) 6939 dst = dst[4:] 6940 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqDropped)) 6941 dst = dst[4:] 6942 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqFlags)) 6943 dst = dst[4:] 6944 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.cqFlags)) 6945 dst = dst[4:] 6946 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqOverflow)) 6947 dst = dst[4:] 6948 // Padding: dst[:sizeof(byte)*32] ~= [32]byte{0} 6949 dst = dst[1*(32):] 6950 return dst 6951 } 6952 6953 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6954 func (i *IORings) UnmarshalBytes(src []byte) []byte { 6955 src = i.Sq.UnmarshalUnsafe(src) 6956 src = i.Cq.UnmarshalUnsafe(src) 6957 i.SqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6958 src = src[4:] 6959 i.CqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6960 src = src[4:] 6961 i.SqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6962 src = src[4:] 6963 i.CqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6964 src = src[4:] 6965 i.sqDropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6966 src = src[4:] 6967 i.sqFlags = int32(hostarch.ByteOrder.Uint32(src[:4])) 6968 src = src[4:] 6969 i.cqFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6970 src = src[4:] 6971 i.CqOverflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6972 src = src[4:] 6973 // Padding: ~ copy([32]byte(i._), src[:sizeof(byte)*32]) 6974 src = src[1*(32):] 6975 return src 6976 } 6977 6978 // Packed implements marshal.Marshallable.Packed. 6979 //go:nosplit 6980 func (i *IORings) Packed() bool { 6981 return i.Cq.Packed() && i.Sq.Packed() 6982 } 6983 6984 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6985 func (i *IORings) MarshalUnsafe(dst []byte) []byte { 6986 if i.Cq.Packed() && i.Sq.Packed() { 6987 size := i.SizeBytes() 6988 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6989 return dst[size:] 6990 } 6991 // Type IORings doesn't have a packed layout in memory, fallback to MarshalBytes. 6992 return i.MarshalBytes(dst) 6993 } 6994 6995 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6996 func (i *IORings) UnmarshalUnsafe(src []byte) []byte { 6997 if i.Cq.Packed() && i.Sq.Packed() { 6998 size := i.SizeBytes() 6999 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7000 return src[size:] 7001 } 7002 // Type IORings doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7003 return i.UnmarshalBytes(src) 7004 } 7005 7006 // CopyOutN implements marshal.Marshallable.CopyOutN. 7007 func (i *IORings) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7008 if !i.Cq.Packed() && i.Sq.Packed() { 7009 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 7010 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7011 i.MarshalBytes(buf) // escapes: fallback. 7012 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7013 } 7014 7015 // Construct a slice backed by dst's underlying memory. 7016 var buf []byte 7017 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7018 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7019 hdr.Len = i.SizeBytes() 7020 hdr.Cap = i.SizeBytes() 7021 7022 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7023 // Since we bypassed the compiler's escape analysis, indicate that i 7024 // must live until the use above. 7025 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7026 return length, err 7027 } 7028 7029 // CopyOut implements marshal.Marshallable.CopyOut. 7030 func (i *IORings) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7031 return i.CopyOutN(cc, addr, i.SizeBytes()) 7032 } 7033 7034 // CopyInN implements marshal.Marshallable.CopyInN. 7035 func (i *IORings) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7036 if !i.Cq.Packed() && i.Sq.Packed() { 7037 // Type IORings doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7038 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7039 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7040 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7041 // partially unmarshalled struct. 7042 i.UnmarshalBytes(buf) // escapes: fallback. 7043 return length, err 7044 } 7045 7046 // Construct a slice backed by dst's underlying memory. 7047 var buf []byte 7048 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7049 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7050 hdr.Len = i.SizeBytes() 7051 hdr.Cap = i.SizeBytes() 7052 7053 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7054 // Since we bypassed the compiler's escape analysis, indicate that i 7055 // must live until the use above. 7056 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7057 return length, err 7058 } 7059 7060 // CopyIn implements marshal.Marshallable.CopyIn. 7061 func (i *IORings) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7062 return i.CopyInN(cc, addr, i.SizeBytes()) 7063 } 7064 7065 // WriteTo implements io.WriterTo.WriteTo. 7066 func (i *IORings) WriteTo(writer io.Writer) (int64, error) { 7067 if !i.Cq.Packed() && i.Sq.Packed() { 7068 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 7069 buf := make([]byte, i.SizeBytes()) 7070 i.MarshalBytes(buf) 7071 length, err := writer.Write(buf) 7072 return int64(length), err 7073 } 7074 7075 // Construct a slice backed by dst's underlying memory. 7076 var buf []byte 7077 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7078 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7079 hdr.Len = i.SizeBytes() 7080 hdr.Cap = i.SizeBytes() 7081 7082 length, err := writer.Write(buf) 7083 // Since we bypassed the compiler's escape analysis, indicate that i 7084 // must live until the use above. 7085 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7086 return int64(length), err 7087 } 7088 7089 // SizeBytes implements marshal.Marshallable.SizeBytes. 7090 func (i *IOSqRingOffsets) SizeBytes() int { 7091 return 40 7092 } 7093 7094 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7095 func (i *IOSqRingOffsets) MarshalBytes(dst []byte) []byte { 7096 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 7097 dst = dst[4:] 7098 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 7099 dst = dst[4:] 7100 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 7101 dst = dst[4:] 7102 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 7103 dst = dst[4:] 7104 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7105 dst = dst[4:] 7106 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Dropped)) 7107 dst = dst[4:] 7108 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Array)) 7109 dst = dst[4:] 7110 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 7111 dst = dst[4:] 7112 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 7113 dst = dst[8:] 7114 return dst 7115 } 7116 7117 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7118 func (i *IOSqRingOffsets) UnmarshalBytes(src []byte) []byte { 7119 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7120 src = src[4:] 7121 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7122 src = src[4:] 7123 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7124 src = src[4:] 7125 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7126 src = src[4:] 7127 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7128 src = src[4:] 7129 i.Dropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7130 src = src[4:] 7131 i.Array = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7132 src = src[4:] 7133 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7134 src = src[4:] 7135 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7136 src = src[8:] 7137 return src 7138 } 7139 7140 // Packed implements marshal.Marshallable.Packed. 7141 //go:nosplit 7142 func (i *IOSqRingOffsets) Packed() bool { 7143 return true 7144 } 7145 7146 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7147 func (i *IOSqRingOffsets) MarshalUnsafe(dst []byte) []byte { 7148 size := i.SizeBytes() 7149 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7150 return dst[size:] 7151 } 7152 7153 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7154 func (i *IOSqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 7155 size := i.SizeBytes() 7156 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7157 return src[size:] 7158 } 7159 7160 // CopyOutN implements marshal.Marshallable.CopyOutN. 7161 func (i *IOSqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7162 // Construct a slice backed by dst's underlying memory. 7163 var buf []byte 7164 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7165 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7166 hdr.Len = i.SizeBytes() 7167 hdr.Cap = i.SizeBytes() 7168 7169 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7170 // Since we bypassed the compiler's escape analysis, indicate that i 7171 // must live until the use above. 7172 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7173 return length, err 7174 } 7175 7176 // CopyOut implements marshal.Marshallable.CopyOut. 7177 func (i *IOSqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7178 return i.CopyOutN(cc, addr, i.SizeBytes()) 7179 } 7180 7181 // CopyInN implements marshal.Marshallable.CopyInN. 7182 func (i *IOSqRingOffsets) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7183 // Construct a slice backed by dst's underlying memory. 7184 var buf []byte 7185 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7186 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7187 hdr.Len = i.SizeBytes() 7188 hdr.Cap = i.SizeBytes() 7189 7190 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7191 // Since we bypassed the compiler's escape analysis, indicate that i 7192 // must live until the use above. 7193 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7194 return length, err 7195 } 7196 7197 // CopyIn implements marshal.Marshallable.CopyIn. 7198 func (i *IOSqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7199 return i.CopyInN(cc, addr, i.SizeBytes()) 7200 } 7201 7202 // WriteTo implements io.WriterTo.WriteTo. 7203 func (i *IOSqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 7204 // Construct a slice backed by dst's underlying memory. 7205 var buf []byte 7206 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7207 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7208 hdr.Len = i.SizeBytes() 7209 hdr.Cap = i.SizeBytes() 7210 7211 length, err := writer.Write(buf) 7212 // Since we bypassed the compiler's escape analysis, indicate that i 7213 // must live until the use above. 7214 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7215 return int64(length), err 7216 } 7217 7218 // SizeBytes implements marshal.Marshallable.SizeBytes. 7219 func (i *IOUring) SizeBytes() int { 7220 return 8 + 7221 1*60 + 7222 1*60 7223 } 7224 7225 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7226 func (i *IOUring) MarshalBytes(dst []byte) []byte { 7227 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 7228 dst = dst[4:] 7229 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 7230 dst = dst[1*(60):] 7231 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 7232 dst = dst[4:] 7233 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 7234 dst = dst[1*(60):] 7235 return dst 7236 } 7237 7238 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7239 func (i *IOUring) UnmarshalBytes(src []byte) []byte { 7240 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7241 src = src[4:] 7242 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 7243 src = src[1*(60):] 7244 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7245 src = src[4:] 7246 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 7247 src = src[1*(60):] 7248 return src 7249 } 7250 7251 // Packed implements marshal.Marshallable.Packed. 7252 //go:nosplit 7253 func (i *IOUring) Packed() bool { 7254 return true 7255 } 7256 7257 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7258 func (i *IOUring) MarshalUnsafe(dst []byte) []byte { 7259 size := i.SizeBytes() 7260 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7261 return dst[size:] 7262 } 7263 7264 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7265 func (i *IOUring) UnmarshalUnsafe(src []byte) []byte { 7266 size := i.SizeBytes() 7267 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7268 return src[size:] 7269 } 7270 7271 // CopyOutN implements marshal.Marshallable.CopyOutN. 7272 func (i *IOUring) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7273 // Construct a slice backed by dst's underlying memory. 7274 var buf []byte 7275 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7276 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7277 hdr.Len = i.SizeBytes() 7278 hdr.Cap = i.SizeBytes() 7279 7280 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7281 // Since we bypassed the compiler's escape analysis, indicate that i 7282 // must live until the use above. 7283 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7284 return length, err 7285 } 7286 7287 // CopyOut implements marshal.Marshallable.CopyOut. 7288 func (i *IOUring) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7289 return i.CopyOutN(cc, addr, i.SizeBytes()) 7290 } 7291 7292 // CopyInN implements marshal.Marshallable.CopyInN. 7293 func (i *IOUring) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7294 // Construct a slice backed by dst's underlying memory. 7295 var buf []byte 7296 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7297 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7298 hdr.Len = i.SizeBytes() 7299 hdr.Cap = i.SizeBytes() 7300 7301 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7302 // Since we bypassed the compiler's escape analysis, indicate that i 7303 // must live until the use above. 7304 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7305 return length, err 7306 } 7307 7308 // CopyIn implements marshal.Marshallable.CopyIn. 7309 func (i *IOUring) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7310 return i.CopyInN(cc, addr, i.SizeBytes()) 7311 } 7312 7313 // WriteTo implements io.WriterTo.WriteTo. 7314 func (i *IOUring) WriteTo(writer io.Writer) (int64, error) { 7315 // Construct a slice backed by dst's underlying memory. 7316 var buf []byte 7317 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7318 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7319 hdr.Len = i.SizeBytes() 7320 hdr.Cap = i.SizeBytes() 7321 7322 length, err := writer.Write(buf) 7323 // Since we bypassed the compiler's escape analysis, indicate that i 7324 // must live until the use above. 7325 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7326 return int64(length), err 7327 } 7328 7329 // SizeBytes implements marshal.Marshallable.SizeBytes. 7330 func (i *IOUringCqe) SizeBytes() int { 7331 return 16 7332 } 7333 7334 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7335 func (i *IOUringCqe) MarshalBytes(dst []byte) []byte { 7336 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 7337 dst = dst[8:] 7338 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Res)) 7339 dst = dst[4:] 7340 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7341 dst = dst[4:] 7342 return dst 7343 } 7344 7345 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7346 func (i *IOUringCqe) UnmarshalBytes(src []byte) []byte { 7347 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7348 src = src[8:] 7349 i.Res = int32(hostarch.ByteOrder.Uint32(src[:4])) 7350 src = src[4:] 7351 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7352 src = src[4:] 7353 return src 7354 } 7355 7356 // Packed implements marshal.Marshallable.Packed. 7357 //go:nosplit 7358 func (i *IOUringCqe) Packed() bool { 7359 return true 7360 } 7361 7362 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7363 func (i *IOUringCqe) MarshalUnsafe(dst []byte) []byte { 7364 size := i.SizeBytes() 7365 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7366 return dst[size:] 7367 } 7368 7369 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7370 func (i *IOUringCqe) UnmarshalUnsafe(src []byte) []byte { 7371 size := i.SizeBytes() 7372 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7373 return src[size:] 7374 } 7375 7376 // CopyOutN implements marshal.Marshallable.CopyOutN. 7377 func (i *IOUringCqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7378 // Construct a slice backed by dst's underlying memory. 7379 var buf []byte 7380 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7381 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7382 hdr.Len = i.SizeBytes() 7383 hdr.Cap = i.SizeBytes() 7384 7385 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7386 // Since we bypassed the compiler's escape analysis, indicate that i 7387 // must live until the use above. 7388 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7389 return length, err 7390 } 7391 7392 // CopyOut implements marshal.Marshallable.CopyOut. 7393 func (i *IOUringCqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7394 return i.CopyOutN(cc, addr, i.SizeBytes()) 7395 } 7396 7397 // CopyInN implements marshal.Marshallable.CopyInN. 7398 func (i *IOUringCqe) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7399 // Construct a slice backed by dst's underlying memory. 7400 var buf []byte 7401 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7402 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7403 hdr.Len = i.SizeBytes() 7404 hdr.Cap = i.SizeBytes() 7405 7406 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7407 // Since we bypassed the compiler's escape analysis, indicate that i 7408 // must live until the use above. 7409 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7410 return length, err 7411 } 7412 7413 // CopyIn implements marshal.Marshallable.CopyIn. 7414 func (i *IOUringCqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7415 return i.CopyInN(cc, addr, i.SizeBytes()) 7416 } 7417 7418 // WriteTo implements io.WriterTo.WriteTo. 7419 func (i *IOUringCqe) WriteTo(writer io.Writer) (int64, error) { 7420 // Construct a slice backed by dst's underlying memory. 7421 var buf []byte 7422 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7423 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7424 hdr.Len = i.SizeBytes() 7425 hdr.Cap = i.SizeBytes() 7426 7427 length, err := writer.Write(buf) 7428 // Since we bypassed the compiler's escape analysis, indicate that i 7429 // must live until the use above. 7430 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7431 return int64(length), err 7432 } 7433 7434 // SizeBytes implements marshal.Marshallable.SizeBytes. 7435 func (i *IOUringParams) SizeBytes() int { 7436 return 28 + 7437 4*3 + 7438 (*IOSqRingOffsets)(nil).SizeBytes() + 7439 (*IOCqRingOffsets)(nil).SizeBytes() 7440 } 7441 7442 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7443 func (i *IOUringParams) MarshalBytes(dst []byte) []byte { 7444 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqEntries)) 7445 dst = dst[4:] 7446 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqEntries)) 7447 dst = dst[4:] 7448 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7449 dst = dst[4:] 7450 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadCPU)) 7451 dst = dst[4:] 7452 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadIdle)) 7453 dst = dst[4:] 7454 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Features)) 7455 dst = dst[4:] 7456 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.WqFd)) 7457 dst = dst[4:] 7458 for idx := 0; idx < 3; idx++ { 7459 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv[idx])) 7460 dst = dst[4:] 7461 } 7462 dst = i.SqOff.MarshalUnsafe(dst) 7463 dst = i.CqOff.MarshalUnsafe(dst) 7464 return dst 7465 } 7466 7467 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7468 func (i *IOUringParams) UnmarshalBytes(src []byte) []byte { 7469 i.SqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7470 src = src[4:] 7471 i.CqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7472 src = src[4:] 7473 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7474 src = src[4:] 7475 i.SqThreadCPU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7476 src = src[4:] 7477 i.SqThreadIdle = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7478 src = src[4:] 7479 i.Features = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7480 src = src[4:] 7481 i.WqFd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7482 src = src[4:] 7483 for idx := 0; idx < 3; idx++ { 7484 i.Resv[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7485 src = src[4:] 7486 } 7487 src = i.SqOff.UnmarshalUnsafe(src) 7488 src = i.CqOff.UnmarshalUnsafe(src) 7489 return src 7490 } 7491 7492 // Packed implements marshal.Marshallable.Packed. 7493 //go:nosplit 7494 func (i *IOUringParams) Packed() bool { 7495 return i.CqOff.Packed() && i.SqOff.Packed() 7496 } 7497 7498 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7499 func (i *IOUringParams) MarshalUnsafe(dst []byte) []byte { 7500 if i.CqOff.Packed() && i.SqOff.Packed() { 7501 size := i.SizeBytes() 7502 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7503 return dst[size:] 7504 } 7505 // Type IOUringParams doesn't have a packed layout in memory, fallback to MarshalBytes. 7506 return i.MarshalBytes(dst) 7507 } 7508 7509 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7510 func (i *IOUringParams) UnmarshalUnsafe(src []byte) []byte { 7511 if i.CqOff.Packed() && i.SqOff.Packed() { 7512 size := i.SizeBytes() 7513 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7514 return src[size:] 7515 } 7516 // Type IOUringParams doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7517 return i.UnmarshalBytes(src) 7518 } 7519 7520 // CopyOutN implements marshal.Marshallable.CopyOutN. 7521 func (i *IOUringParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7522 if !i.CqOff.Packed() && i.SqOff.Packed() { 7523 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7524 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7525 i.MarshalBytes(buf) // escapes: fallback. 7526 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7527 } 7528 7529 // Construct a slice backed by dst's underlying memory. 7530 var buf []byte 7531 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7532 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7533 hdr.Len = i.SizeBytes() 7534 hdr.Cap = i.SizeBytes() 7535 7536 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7537 // Since we bypassed the compiler's escape analysis, indicate that i 7538 // must live until the use above. 7539 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7540 return length, err 7541 } 7542 7543 // CopyOut implements marshal.Marshallable.CopyOut. 7544 func (i *IOUringParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7545 return i.CopyOutN(cc, addr, i.SizeBytes()) 7546 } 7547 7548 // CopyInN implements marshal.Marshallable.CopyInN. 7549 func (i *IOUringParams) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7550 if !i.CqOff.Packed() && i.SqOff.Packed() { 7551 // Type IOUringParams doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7552 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7553 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7554 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7555 // partially unmarshalled struct. 7556 i.UnmarshalBytes(buf) // escapes: fallback. 7557 return length, err 7558 } 7559 7560 // Construct a slice backed by dst's underlying memory. 7561 var buf []byte 7562 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7563 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7564 hdr.Len = i.SizeBytes() 7565 hdr.Cap = i.SizeBytes() 7566 7567 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7568 // Since we bypassed the compiler's escape analysis, indicate that i 7569 // must live until the use above. 7570 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7571 return length, err 7572 } 7573 7574 // CopyIn implements marshal.Marshallable.CopyIn. 7575 func (i *IOUringParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7576 return i.CopyInN(cc, addr, i.SizeBytes()) 7577 } 7578 7579 // WriteTo implements io.WriterTo.WriteTo. 7580 func (i *IOUringParams) WriteTo(writer io.Writer) (int64, error) { 7581 if !i.CqOff.Packed() && i.SqOff.Packed() { 7582 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7583 buf := make([]byte, i.SizeBytes()) 7584 i.MarshalBytes(buf) 7585 length, err := writer.Write(buf) 7586 return int64(length), err 7587 } 7588 7589 // Construct a slice backed by dst's underlying memory. 7590 var buf []byte 7591 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7592 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7593 hdr.Len = i.SizeBytes() 7594 hdr.Cap = i.SizeBytes() 7595 7596 length, err := writer.Write(buf) 7597 // Since we bypassed the compiler's escape analysis, indicate that i 7598 // must live until the use above. 7599 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7600 return int64(length), err 7601 } 7602 7603 // SizeBytes implements marshal.Marshallable.SizeBytes. 7604 func (i *IOUringSqe) SizeBytes() int { 7605 return 64 7606 } 7607 7608 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7609 func (i *IOUringSqe) MarshalBytes(dst []byte) []byte { 7610 dst[0] = byte(i.Opcode) 7611 dst = dst[1:] 7612 dst[0] = byte(i.Flags) 7613 dst = dst[1:] 7614 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.IoPrio)) 7615 dst = dst[2:] 7616 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Fd)) 7617 dst = dst[4:] 7618 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.OffOrAddrOrCmdOp)) 7619 dst = dst[8:] 7620 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.AddrOrSpliceOff)) 7621 dst = dst[8:] 7622 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 7623 dst = dst[4:] 7624 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.specialFlags)) 7625 dst = dst[4:] 7626 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 7627 dst = dst[8:] 7628 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.BufIndexOrGroup)) 7629 dst = dst[2:] 7630 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.personality)) 7631 dst = dst[2:] 7632 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.spliceFDOrFileIndex)) 7633 dst = dst[4:] 7634 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.addr3)) 7635 dst = dst[8:] 7636 // Padding: dst[:sizeof(uint64)] ~= uint64(0) 7637 dst = dst[8:] 7638 return dst 7639 } 7640 7641 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7642 func (i *IOUringSqe) UnmarshalBytes(src []byte) []byte { 7643 i.Opcode = uint8(src[0]) 7644 src = src[1:] 7645 i.Flags = uint8(src[0]) 7646 src = src[1:] 7647 i.IoPrio = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7648 src = src[2:] 7649 i.Fd = int32(hostarch.ByteOrder.Uint32(src[:4])) 7650 src = src[4:] 7651 i.OffOrAddrOrCmdOp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7652 src = src[8:] 7653 i.AddrOrSpliceOff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7654 src = src[8:] 7655 i.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7656 src = src[4:] 7657 i.specialFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7658 src = src[4:] 7659 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7660 src = src[8:] 7661 i.BufIndexOrGroup = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7662 src = src[2:] 7663 i.personality = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7664 src = src[2:] 7665 i.spliceFDOrFileIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 7666 src = src[4:] 7667 i.addr3 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7668 src = src[8:] 7669 // Padding: var _ uint64 ~= src[:sizeof(uint64)] 7670 src = src[8:] 7671 return src 7672 } 7673 7674 // Packed implements marshal.Marshallable.Packed. 7675 //go:nosplit 7676 func (i *IOUringSqe) Packed() bool { 7677 return true 7678 } 7679 7680 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7681 func (i *IOUringSqe) MarshalUnsafe(dst []byte) []byte { 7682 size := i.SizeBytes() 7683 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7684 return dst[size:] 7685 } 7686 7687 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7688 func (i *IOUringSqe) UnmarshalUnsafe(src []byte) []byte { 7689 size := i.SizeBytes() 7690 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7691 return src[size:] 7692 } 7693 7694 // CopyOutN implements marshal.Marshallable.CopyOutN. 7695 func (i *IOUringSqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7696 // Construct a slice backed by dst's underlying memory. 7697 var buf []byte 7698 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7699 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7700 hdr.Len = i.SizeBytes() 7701 hdr.Cap = i.SizeBytes() 7702 7703 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7704 // Since we bypassed the compiler's escape analysis, indicate that i 7705 // must live until the use above. 7706 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7707 return length, err 7708 } 7709 7710 // CopyOut implements marshal.Marshallable.CopyOut. 7711 func (i *IOUringSqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7712 return i.CopyOutN(cc, addr, i.SizeBytes()) 7713 } 7714 7715 // CopyInN implements marshal.Marshallable.CopyInN. 7716 func (i *IOUringSqe) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7717 // Construct a slice backed by dst's underlying memory. 7718 var buf []byte 7719 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7720 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7721 hdr.Len = i.SizeBytes() 7722 hdr.Cap = i.SizeBytes() 7723 7724 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7725 // Since we bypassed the compiler's escape analysis, indicate that i 7726 // must live until the use above. 7727 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7728 return length, err 7729 } 7730 7731 // CopyIn implements marshal.Marshallable.CopyIn. 7732 func (i *IOUringSqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7733 return i.CopyInN(cc, addr, i.SizeBytes()) 7734 } 7735 7736 // WriteTo implements io.WriterTo.WriteTo. 7737 func (i *IOUringSqe) WriteTo(writer io.Writer) (int64, error) { 7738 // Construct a slice backed by dst's underlying memory. 7739 var buf []byte 7740 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7741 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7742 hdr.Len = i.SizeBytes() 7743 hdr.Cap = i.SizeBytes() 7744 7745 length, err := writer.Write(buf) 7746 // Since we bypassed the compiler's escape analysis, indicate that i 7747 // must live until the use above. 7748 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7749 return int64(length), err 7750 } 7751 7752 // SizeBytes implements marshal.Marshallable.SizeBytes. 7753 func (i *IPCPerm) SizeBytes() int { 7754 return 48 7755 } 7756 7757 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7758 func (i *IPCPerm) MarshalBytes(dst []byte) []byte { 7759 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 7760 dst = dst[4:] 7761 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 7762 dst = dst[4:] 7763 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 7764 dst = dst[4:] 7765 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CUID)) 7766 dst = dst[4:] 7767 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CGID)) 7768 dst = dst[4:] 7769 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Mode)) 7770 dst = dst[2:] 7771 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7772 dst = dst[2:] 7773 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Seq)) 7774 dst = dst[2:] 7775 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7776 dst = dst[2:] 7777 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 7778 dst = dst[4:] 7779 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused1)) 7780 dst = dst[8:] 7781 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused2)) 7782 dst = dst[8:] 7783 return dst 7784 } 7785 7786 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7787 func (i *IPCPerm) UnmarshalBytes(src []byte) []byte { 7788 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7789 src = src[4:] 7790 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7791 src = src[4:] 7792 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7793 src = src[4:] 7794 i.CUID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7795 src = src[4:] 7796 i.CGID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7797 src = src[4:] 7798 i.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7799 src = src[2:] 7800 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7801 src = src[2:] 7802 i.Seq = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7803 src = src[2:] 7804 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7805 src = src[2:] 7806 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 7807 src = src[4:] 7808 i.unused1 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7809 src = src[8:] 7810 i.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7811 src = src[8:] 7812 return src 7813 } 7814 7815 // Packed implements marshal.Marshallable.Packed. 7816 //go:nosplit 7817 func (i *IPCPerm) Packed() bool { 7818 return true 7819 } 7820 7821 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7822 func (i *IPCPerm) MarshalUnsafe(dst []byte) []byte { 7823 size := i.SizeBytes() 7824 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7825 return dst[size:] 7826 } 7827 7828 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7829 func (i *IPCPerm) UnmarshalUnsafe(src []byte) []byte { 7830 size := i.SizeBytes() 7831 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7832 return src[size:] 7833 } 7834 7835 // CopyOutN implements marshal.Marshallable.CopyOutN. 7836 func (i *IPCPerm) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7837 // Construct a slice backed by dst's underlying memory. 7838 var buf []byte 7839 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7840 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7841 hdr.Len = i.SizeBytes() 7842 hdr.Cap = i.SizeBytes() 7843 7844 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7845 // Since we bypassed the compiler's escape analysis, indicate that i 7846 // must live until the use above. 7847 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7848 return length, err 7849 } 7850 7851 // CopyOut implements marshal.Marshallable.CopyOut. 7852 func (i *IPCPerm) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7853 return i.CopyOutN(cc, addr, i.SizeBytes()) 7854 } 7855 7856 // CopyInN implements marshal.Marshallable.CopyInN. 7857 func (i *IPCPerm) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7858 // Construct a slice backed by dst's underlying memory. 7859 var buf []byte 7860 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7861 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7862 hdr.Len = i.SizeBytes() 7863 hdr.Cap = i.SizeBytes() 7864 7865 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7866 // Since we bypassed the compiler's escape analysis, indicate that i 7867 // must live until the use above. 7868 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7869 return length, err 7870 } 7871 7872 // CopyIn implements marshal.Marshallable.CopyIn. 7873 func (i *IPCPerm) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7874 return i.CopyInN(cc, addr, i.SizeBytes()) 7875 } 7876 7877 // WriteTo implements io.WriterTo.WriteTo. 7878 func (i *IPCPerm) WriteTo(writer io.Writer) (int64, error) { 7879 // Construct a slice backed by dst's underlying memory. 7880 var buf []byte 7881 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7882 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7883 hdr.Len = i.SizeBytes() 7884 hdr.Cap = i.SizeBytes() 7885 7886 length, err := writer.Write(buf) 7887 // Since we bypassed the compiler's escape analysis, indicate that i 7888 // must live until the use above. 7889 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7890 return int64(length), err 7891 } 7892 7893 // SizeBytes implements marshal.Marshallable.SizeBytes. 7894 func (s *Sysinfo) SizeBytes() int { 7895 return 78 + 7896 8*3 + 7897 1*6 7898 } 7899 7900 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7901 func (s *Sysinfo) MarshalBytes(dst []byte) []byte { 7902 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Uptime)) 7903 dst = dst[8:] 7904 for idx := 0; idx < 3; idx++ { 7905 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Loads[idx])) 7906 dst = dst[8:] 7907 } 7908 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalRAM)) 7909 dst = dst[8:] 7910 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeRAM)) 7911 dst = dst[8:] 7912 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SharedRAM)) 7913 dst = dst[8:] 7914 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BufferRAM)) 7915 dst = dst[8:] 7916 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalSwap)) 7917 dst = dst[8:] 7918 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeSwap)) 7919 dst = dst[8:] 7920 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Procs)) 7921 dst = dst[2:] 7922 // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0} 7923 dst = dst[1*(6):] 7924 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalHigh)) 7925 dst = dst[8:] 7926 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeHigh)) 7927 dst = dst[8:] 7928 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Unit)) 7929 dst = dst[4:] 7930 return dst 7931 } 7932 7933 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7934 func (s *Sysinfo) UnmarshalBytes(src []byte) []byte { 7935 s.Uptime = int64(hostarch.ByteOrder.Uint64(src[:8])) 7936 src = src[8:] 7937 for idx := 0; idx < 3; idx++ { 7938 s.Loads[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7939 src = src[8:] 7940 } 7941 s.TotalRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7942 src = src[8:] 7943 s.FreeRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7944 src = src[8:] 7945 s.SharedRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7946 src = src[8:] 7947 s.BufferRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7948 src = src[8:] 7949 s.TotalSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7950 src = src[8:] 7951 s.FreeSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7952 src = src[8:] 7953 s.Procs = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7954 src = src[2:] 7955 // Padding: ~ copy([6]byte(s._), src[:sizeof(byte)*6]) 7956 src = src[1*(6):] 7957 s.TotalHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7958 src = src[8:] 7959 s.FreeHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7960 src = src[8:] 7961 s.Unit = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7962 src = src[4:] 7963 return src 7964 } 7965 7966 // Packed implements marshal.Marshallable.Packed. 7967 //go:nosplit 7968 func (s *Sysinfo) Packed() bool { 7969 return false 7970 } 7971 7972 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7973 func (s *Sysinfo) MarshalUnsafe(dst []byte) []byte { 7974 // Type Sysinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7975 return s.MarshalBytes(dst) 7976 } 7977 7978 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7979 func (s *Sysinfo) UnmarshalUnsafe(src []byte) []byte { 7980 // Type Sysinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7981 return s.UnmarshalBytes(src) 7982 } 7983 7984 // CopyOutN implements marshal.Marshallable.CopyOutN. 7985 func (s *Sysinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7986 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7987 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 7988 s.MarshalBytes(buf) // escapes: fallback. 7989 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7990 } 7991 7992 // CopyOut implements marshal.Marshallable.CopyOut. 7993 func (s *Sysinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7994 return s.CopyOutN(cc, addr, s.SizeBytes()) 7995 } 7996 7997 // CopyInN implements marshal.Marshallable.CopyInN. 7998 func (s *Sysinfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7999 // Type Sysinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8000 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 8001 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8002 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8003 // partially unmarshalled struct. 8004 s.UnmarshalBytes(buf) // escapes: fallback. 8005 return length, err 8006 } 8007 8008 // CopyIn implements marshal.Marshallable.CopyIn. 8009 func (s *Sysinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8010 return s.CopyInN(cc, addr, s.SizeBytes()) 8011 } 8012 8013 // WriteTo implements io.WriterTo.WriteTo. 8014 func (s *Sysinfo) WriteTo(writer io.Writer) (int64, error) { 8015 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8016 buf := make([]byte, s.SizeBytes()) 8017 s.MarshalBytes(buf) 8018 length, err := writer.Write(buf) 8019 return int64(length), err 8020 } 8021 8022 // SizeBytes implements marshal.Marshallable.SizeBytes. 8023 //go:nosplit 8024 func (n *NumaPolicy) SizeBytes() int { 8025 return 4 8026 } 8027 8028 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8029 func (n *NumaPolicy) MarshalBytes(dst []byte) []byte { 8030 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*n)) 8031 return dst[4:] 8032 } 8033 8034 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8035 func (n *NumaPolicy) UnmarshalBytes(src []byte) []byte { 8036 *n = NumaPolicy(int32(hostarch.ByteOrder.Uint32(src[:4]))) 8037 return src[4:] 8038 } 8039 8040 // Packed implements marshal.Marshallable.Packed. 8041 //go:nosplit 8042 func (n *NumaPolicy) Packed() bool { 8043 // Scalar newtypes are always packed. 8044 return true 8045 } 8046 8047 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8048 func (n *NumaPolicy) MarshalUnsafe(dst []byte) []byte { 8049 size := n.SizeBytes() 8050 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 8051 return dst[size:] 8052 } 8053 8054 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8055 func (n *NumaPolicy) UnmarshalUnsafe(src []byte) []byte { 8056 size := n.SizeBytes() 8057 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 8058 return src[size:] 8059 } 8060 8061 // CopyOutN implements marshal.Marshallable.CopyOutN. 8062 func (n *NumaPolicy) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8063 // Construct a slice backed by dst's underlying memory. 8064 var buf []byte 8065 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8066 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8067 hdr.Len = n.SizeBytes() 8068 hdr.Cap = n.SizeBytes() 8069 8070 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8071 // Since we bypassed the compiler's escape analysis, indicate that n 8072 // must live until the use above. 8073 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8074 return length, err 8075 } 8076 8077 // CopyOut implements marshal.Marshallable.CopyOut. 8078 func (n *NumaPolicy) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8079 return n.CopyOutN(cc, addr, n.SizeBytes()) 8080 } 8081 8082 // CopyInN implements marshal.Marshallable.CopyInN. 8083 func (n *NumaPolicy) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8084 // Construct a slice backed by dst's underlying memory. 8085 var buf []byte 8086 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8087 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8088 hdr.Len = n.SizeBytes() 8089 hdr.Cap = n.SizeBytes() 8090 8091 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8092 // Since we bypassed the compiler's escape analysis, indicate that n 8093 // must live until the use above. 8094 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8095 return length, err 8096 } 8097 8098 // CopyIn implements marshal.Marshallable.CopyIn. 8099 func (n *NumaPolicy) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8100 return n.CopyInN(cc, addr, n.SizeBytes()) 8101 } 8102 8103 // WriteTo implements io.WriterTo.WriteTo. 8104 func (n *NumaPolicy) WriteTo(writer io.Writer) (int64, error) { 8105 // Construct a slice backed by dst's underlying memory. 8106 var buf []byte 8107 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8108 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8109 hdr.Len = n.SizeBytes() 8110 hdr.Cap = n.SizeBytes() 8111 8112 length, err := writer.Write(buf) 8113 // Since we bypassed the compiler's escape analysis, indicate that n 8114 // must live until the use above. 8115 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8116 return int64(length), err 8117 } 8118 8119 // SizeBytes implements marshal.Marshallable.SizeBytes. 8120 func (m *MqAttr) SizeBytes() int { 8121 return 32 + 8122 8*4 8123 } 8124 8125 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8126 func (m *MqAttr) MarshalBytes(dst []byte) []byte { 8127 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqFlags)) 8128 dst = dst[8:] 8129 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMaxmsg)) 8130 dst = dst[8:] 8131 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMsgsize)) 8132 dst = dst[8:] 8133 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqCurmsgs)) 8134 dst = dst[8:] 8135 // Padding: dst[:sizeof(int64)*4] ~= [4]int64{0} 8136 dst = dst[8*(4):] 8137 return dst 8138 } 8139 8140 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8141 func (m *MqAttr) UnmarshalBytes(src []byte) []byte { 8142 m.MqFlags = int64(hostarch.ByteOrder.Uint64(src[:8])) 8143 src = src[8:] 8144 m.MqMaxmsg = int64(hostarch.ByteOrder.Uint64(src[:8])) 8145 src = src[8:] 8146 m.MqMsgsize = int64(hostarch.ByteOrder.Uint64(src[:8])) 8147 src = src[8:] 8148 m.MqCurmsgs = int64(hostarch.ByteOrder.Uint64(src[:8])) 8149 src = src[8:] 8150 // Padding: ~ copy([4]int64(m._), src[:sizeof(int64)*4]) 8151 src = src[8*(4):] 8152 return src 8153 } 8154 8155 // Packed implements marshal.Marshallable.Packed. 8156 //go:nosplit 8157 func (m *MqAttr) Packed() bool { 8158 return true 8159 } 8160 8161 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8162 func (m *MqAttr) MarshalUnsafe(dst []byte) []byte { 8163 size := m.SizeBytes() 8164 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 8165 return dst[size:] 8166 } 8167 8168 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8169 func (m *MqAttr) UnmarshalUnsafe(src []byte) []byte { 8170 size := m.SizeBytes() 8171 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 8172 return src[size:] 8173 } 8174 8175 // CopyOutN implements marshal.Marshallable.CopyOutN. 8176 func (m *MqAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8177 // Construct a slice backed by dst's underlying memory. 8178 var buf []byte 8179 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8180 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8181 hdr.Len = m.SizeBytes() 8182 hdr.Cap = m.SizeBytes() 8183 8184 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8185 // Since we bypassed the compiler's escape analysis, indicate that m 8186 // must live until the use above. 8187 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8188 return length, err 8189 } 8190 8191 // CopyOut implements marshal.Marshallable.CopyOut. 8192 func (m *MqAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8193 return m.CopyOutN(cc, addr, m.SizeBytes()) 8194 } 8195 8196 // CopyInN implements marshal.Marshallable.CopyInN. 8197 func (m *MqAttr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8198 // Construct a slice backed by dst's underlying memory. 8199 var buf []byte 8200 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8201 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8202 hdr.Len = m.SizeBytes() 8203 hdr.Cap = m.SizeBytes() 8204 8205 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8206 // Since we bypassed the compiler's escape analysis, indicate that m 8207 // must live until the use above. 8208 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8209 return length, err 8210 } 8211 8212 // CopyIn implements marshal.Marshallable.CopyIn. 8213 func (m *MqAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8214 return m.CopyInN(cc, addr, m.SizeBytes()) 8215 } 8216 8217 // WriteTo implements io.WriterTo.WriteTo. 8218 func (m *MqAttr) WriteTo(writer io.Writer) (int64, error) { 8219 // Construct a slice backed by dst's underlying memory. 8220 var buf []byte 8221 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8222 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8223 hdr.Len = m.SizeBytes() 8224 hdr.Cap = m.SizeBytes() 8225 8226 length, err := writer.Write(buf) 8227 // Since we bypassed the compiler's escape analysis, indicate that m 8228 // must live until the use above. 8229 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8230 return int64(length), err 8231 } 8232 8233 // Packed implements marshal.Marshallable.Packed. 8234 //go:nosplit 8235 func (b *MsgBuf) Packed() bool { 8236 // Type MsgBuf is dynamic so it might have slice/string headers. Hence, it is not packed. 8237 return false 8238 } 8239 8240 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8241 func (b *MsgBuf) MarshalUnsafe(dst []byte) []byte { 8242 // Type MsgBuf doesn't have a packed layout in memory, fallback to MarshalBytes. 8243 return b.MarshalBytes(dst) 8244 } 8245 8246 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8247 func (b *MsgBuf) UnmarshalUnsafe(src []byte) []byte { 8248 // Type MsgBuf doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8249 return b.UnmarshalBytes(src) 8250 } 8251 8252 // CopyOutN implements marshal.Marshallable.CopyOutN. 8253 //go:nosplit 8254 func (b *MsgBuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8255 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 8256 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 8257 b.MarshalBytes(buf) // escapes: fallback. 8258 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8259 } 8260 8261 // CopyOut implements marshal.Marshallable.CopyOut. 8262 func (b *MsgBuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8263 return b.CopyOutN(cc, addr, b.SizeBytes()) 8264 } 8265 8266 // CopyInN implements marshal.Marshallable.CopyInN. 8267 //go:nosplit 8268 func (b *MsgBuf) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8269 // Type MsgBuf doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8270 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 8271 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8272 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8273 // partially unmarshalled struct. 8274 b.UnmarshalBytes(buf) // escapes: fallback. 8275 return length, err 8276 } 8277 8278 // CopyIn implements marshal.Marshallable.CopyIn. 8279 func (b *MsgBuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8280 return b.CopyInN(cc, addr, b.SizeBytes()) 8281 } 8282 8283 // WriteTo implements io.WriterTo.WriteTo. 8284 func (b *MsgBuf) WriteTo(writer io.Writer) (int64, error) { 8285 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 8286 buf := make([]byte, b.SizeBytes()) 8287 b.MarshalBytes(buf) 8288 length, err := writer.Write(buf) 8289 return int64(length), err 8290 } 8291 8292 // SizeBytes implements marshal.Marshallable.SizeBytes. 8293 func (m *MsgInfo) SizeBytes() int { 8294 return 30 8295 } 8296 8297 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8298 func (m *MsgInfo) MarshalBytes(dst []byte) []byte { 8299 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgPool)) 8300 dst = dst[4:] 8301 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMap)) 8302 dst = dst[4:] 8303 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMax)) 8304 dst = dst[4:] 8305 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMnb)) 8306 dst = dst[4:] 8307 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMni)) 8308 dst = dst[4:] 8309 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgSsz)) 8310 dst = dst[4:] 8311 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgTql)) 8312 dst = dst[4:] 8313 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.MsgSeg)) 8314 dst = dst[2:] 8315 return dst 8316 } 8317 8318 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8319 func (m *MsgInfo) UnmarshalBytes(src []byte) []byte { 8320 m.MsgPool = int32(hostarch.ByteOrder.Uint32(src[:4])) 8321 src = src[4:] 8322 m.MsgMap = int32(hostarch.ByteOrder.Uint32(src[:4])) 8323 src = src[4:] 8324 m.MsgMax = int32(hostarch.ByteOrder.Uint32(src[:4])) 8325 src = src[4:] 8326 m.MsgMnb = int32(hostarch.ByteOrder.Uint32(src[:4])) 8327 src = src[4:] 8328 m.MsgMni = int32(hostarch.ByteOrder.Uint32(src[:4])) 8329 src = src[4:] 8330 m.MsgSsz = int32(hostarch.ByteOrder.Uint32(src[:4])) 8331 src = src[4:] 8332 m.MsgTql = int32(hostarch.ByteOrder.Uint32(src[:4])) 8333 src = src[4:] 8334 m.MsgSeg = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8335 src = src[2:] 8336 return src 8337 } 8338 8339 // Packed implements marshal.Marshallable.Packed. 8340 //go:nosplit 8341 func (m *MsgInfo) Packed() bool { 8342 return false 8343 } 8344 8345 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8346 func (m *MsgInfo) MarshalUnsafe(dst []byte) []byte { 8347 // Type MsgInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 8348 return m.MarshalBytes(dst) 8349 } 8350 8351 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8352 func (m *MsgInfo) UnmarshalUnsafe(src []byte) []byte { 8353 // Type MsgInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8354 return m.UnmarshalBytes(src) 8355 } 8356 8357 // CopyOutN implements marshal.Marshallable.CopyOutN. 8358 func (m *MsgInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8359 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8360 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8361 m.MarshalBytes(buf) // escapes: fallback. 8362 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8363 } 8364 8365 // CopyOut implements marshal.Marshallable.CopyOut. 8366 func (m *MsgInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8367 return m.CopyOutN(cc, addr, m.SizeBytes()) 8368 } 8369 8370 // CopyInN implements marshal.Marshallable.CopyInN. 8371 func (m *MsgInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8372 // Type MsgInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8373 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8374 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8375 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8376 // partially unmarshalled struct. 8377 m.UnmarshalBytes(buf) // escapes: fallback. 8378 return length, err 8379 } 8380 8381 // CopyIn implements marshal.Marshallable.CopyIn. 8382 func (m *MsgInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8383 return m.CopyInN(cc, addr, m.SizeBytes()) 8384 } 8385 8386 // WriteTo implements io.WriterTo.WriteTo. 8387 func (m *MsgInfo) WriteTo(writer io.Writer) (int64, error) { 8388 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8389 buf := make([]byte, m.SizeBytes()) 8390 m.MarshalBytes(buf) 8391 length, err := writer.Write(buf) 8392 return int64(length), err 8393 } 8394 8395 // SizeBytes implements marshal.Marshallable.SizeBytes. 8396 func (m *MsqidDS) SizeBytes() int { 8397 return 48 + 8398 (*IPCPerm)(nil).SizeBytes() + 8399 (*TimeT)(nil).SizeBytes() + 8400 (*TimeT)(nil).SizeBytes() + 8401 (*TimeT)(nil).SizeBytes() 8402 } 8403 8404 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8405 func (m *MsqidDS) MarshalBytes(dst []byte) []byte { 8406 dst = m.MsgPerm.MarshalUnsafe(dst) 8407 dst = m.MsgStime.MarshalUnsafe(dst) 8408 dst = m.MsgRtime.MarshalUnsafe(dst) 8409 dst = m.MsgCtime.MarshalUnsafe(dst) 8410 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgCbytes)) 8411 dst = dst[8:] 8412 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQnum)) 8413 dst = dst[8:] 8414 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQbytes)) 8415 dst = dst[8:] 8416 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLspid)) 8417 dst = dst[4:] 8418 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLrpid)) 8419 dst = dst[4:] 8420 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused4)) 8421 dst = dst[8:] 8422 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused5)) 8423 dst = dst[8:] 8424 return dst 8425 } 8426 8427 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8428 func (m *MsqidDS) UnmarshalBytes(src []byte) []byte { 8429 src = m.MsgPerm.UnmarshalUnsafe(src) 8430 src = m.MsgStime.UnmarshalUnsafe(src) 8431 src = m.MsgRtime.UnmarshalUnsafe(src) 8432 src = m.MsgCtime.UnmarshalUnsafe(src) 8433 m.MsgCbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8434 src = src[8:] 8435 m.MsgQnum = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8436 src = src[8:] 8437 m.MsgQbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8438 src = src[8:] 8439 m.MsgLspid = int32(hostarch.ByteOrder.Uint32(src[:4])) 8440 src = src[4:] 8441 m.MsgLrpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 8442 src = src[4:] 8443 m.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8444 src = src[8:] 8445 m.unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8446 src = src[8:] 8447 return src 8448 } 8449 8450 // Packed implements marshal.Marshallable.Packed. 8451 //go:nosplit 8452 func (m *MsqidDS) Packed() bool { 8453 return m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() 8454 } 8455 8456 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8457 func (m *MsqidDS) MarshalUnsafe(dst []byte) []byte { 8458 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8459 size := m.SizeBytes() 8460 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 8461 return dst[size:] 8462 } 8463 // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 8464 return m.MarshalBytes(dst) 8465 } 8466 8467 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8468 func (m *MsqidDS) UnmarshalUnsafe(src []byte) []byte { 8469 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8470 size := m.SizeBytes() 8471 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 8472 return src[size:] 8473 } 8474 // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8475 return m.UnmarshalBytes(src) 8476 } 8477 8478 // CopyOutN implements marshal.Marshallable.CopyOutN. 8479 func (m *MsqidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8480 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8481 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8482 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8483 m.MarshalBytes(buf) // escapes: fallback. 8484 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8485 } 8486 8487 // Construct a slice backed by dst's underlying memory. 8488 var buf []byte 8489 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8490 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8491 hdr.Len = m.SizeBytes() 8492 hdr.Cap = m.SizeBytes() 8493 8494 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8495 // Since we bypassed the compiler's escape analysis, indicate that m 8496 // must live until the use above. 8497 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8498 return length, err 8499 } 8500 8501 // CopyOut implements marshal.Marshallable.CopyOut. 8502 func (m *MsqidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8503 return m.CopyOutN(cc, addr, m.SizeBytes()) 8504 } 8505 8506 // CopyInN implements marshal.Marshallable.CopyInN. 8507 func (m *MsqidDS) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8508 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8509 // Type MsqidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8510 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8511 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8512 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8513 // partially unmarshalled struct. 8514 m.UnmarshalBytes(buf) // escapes: fallback. 8515 return length, err 8516 } 8517 8518 // Construct a slice backed by dst's underlying memory. 8519 var buf []byte 8520 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8521 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8522 hdr.Len = m.SizeBytes() 8523 hdr.Cap = m.SizeBytes() 8524 8525 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8526 // Since we bypassed the compiler's escape analysis, indicate that m 8527 // must live until the use above. 8528 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8529 return length, err 8530 } 8531 8532 // CopyIn implements marshal.Marshallable.CopyIn. 8533 func (m *MsqidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8534 return m.CopyInN(cc, addr, m.SizeBytes()) 8535 } 8536 8537 // WriteTo implements io.WriterTo.WriteTo. 8538 func (m *MsqidDS) WriteTo(writer io.Writer) (int64, error) { 8539 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8540 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8541 buf := make([]byte, m.SizeBytes()) 8542 m.MarshalBytes(buf) 8543 length, err := writer.Write(buf) 8544 return int64(length), err 8545 } 8546 8547 // Construct a slice backed by dst's underlying memory. 8548 var buf []byte 8549 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8550 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8551 hdr.Len = m.SizeBytes() 8552 hdr.Cap = m.SizeBytes() 8553 8554 length, err := writer.Write(buf) 8555 // Since we bypassed the compiler's escape analysis, indicate that m 8556 // must live until the use above. 8557 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8558 return int64(length), err 8559 } 8560 8561 // SizeBytes implements marshal.Marshallable.SizeBytes. 8562 //go:nosplit 8563 func (e *EthtoolCmd) SizeBytes() int { 8564 return 4 8565 } 8566 8567 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8568 func (e *EthtoolCmd) MarshalBytes(dst []byte) []byte { 8569 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*e)) 8570 return dst[4:] 8571 } 8572 8573 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8574 func (e *EthtoolCmd) UnmarshalBytes(src []byte) []byte { 8575 *e = EthtoolCmd(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 8576 return src[4:] 8577 } 8578 8579 // Packed implements marshal.Marshallable.Packed. 8580 //go:nosplit 8581 func (e *EthtoolCmd) Packed() bool { 8582 // Scalar newtypes are always packed. 8583 return true 8584 } 8585 8586 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8587 func (e *EthtoolCmd) MarshalUnsafe(dst []byte) []byte { 8588 size := e.SizeBytes() 8589 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8590 return dst[size:] 8591 } 8592 8593 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8594 func (e *EthtoolCmd) UnmarshalUnsafe(src []byte) []byte { 8595 size := e.SizeBytes() 8596 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8597 return src[size:] 8598 } 8599 8600 // CopyOutN implements marshal.Marshallable.CopyOutN. 8601 func (e *EthtoolCmd) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8602 // Construct a slice backed by dst's underlying memory. 8603 var buf []byte 8604 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8605 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8606 hdr.Len = e.SizeBytes() 8607 hdr.Cap = e.SizeBytes() 8608 8609 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8610 // Since we bypassed the compiler's escape analysis, indicate that e 8611 // must live until the use above. 8612 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8613 return length, err 8614 } 8615 8616 // CopyOut implements marshal.Marshallable.CopyOut. 8617 func (e *EthtoolCmd) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8618 return e.CopyOutN(cc, addr, e.SizeBytes()) 8619 } 8620 8621 // CopyInN implements marshal.Marshallable.CopyInN. 8622 func (e *EthtoolCmd) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8623 // Construct a slice backed by dst's underlying memory. 8624 var buf []byte 8625 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8626 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8627 hdr.Len = e.SizeBytes() 8628 hdr.Cap = e.SizeBytes() 8629 8630 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8631 // Since we bypassed the compiler's escape analysis, indicate that e 8632 // must live until the use above. 8633 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8634 return length, err 8635 } 8636 8637 // CopyIn implements marshal.Marshallable.CopyIn. 8638 func (e *EthtoolCmd) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8639 return e.CopyInN(cc, addr, e.SizeBytes()) 8640 } 8641 8642 // WriteTo implements io.WriterTo.WriteTo. 8643 func (e *EthtoolCmd) WriteTo(writer io.Writer) (int64, error) { 8644 // Construct a slice backed by dst's underlying memory. 8645 var buf []byte 8646 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8647 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8648 hdr.Len = e.SizeBytes() 8649 hdr.Cap = e.SizeBytes() 8650 8651 length, err := writer.Write(buf) 8652 // Since we bypassed the compiler's escape analysis, indicate that e 8653 // must live until the use above. 8654 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8655 return int64(length), err 8656 } 8657 8658 // SizeBytes implements marshal.Marshallable.SizeBytes. 8659 func (e *EthtoolGFeatures) SizeBytes() int { 8660 return 8 8661 } 8662 8663 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8664 func (e *EthtoolGFeatures) MarshalBytes(dst []byte) []byte { 8665 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Cmd)) 8666 dst = dst[4:] 8667 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Size)) 8668 dst = dst[4:] 8669 return dst 8670 } 8671 8672 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8673 func (e *EthtoolGFeatures) UnmarshalBytes(src []byte) []byte { 8674 e.Cmd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8675 src = src[4:] 8676 e.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8677 src = src[4:] 8678 return src 8679 } 8680 8681 // Packed implements marshal.Marshallable.Packed. 8682 //go:nosplit 8683 func (e *EthtoolGFeatures) Packed() bool { 8684 return true 8685 } 8686 8687 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8688 func (e *EthtoolGFeatures) MarshalUnsafe(dst []byte) []byte { 8689 size := e.SizeBytes() 8690 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8691 return dst[size:] 8692 } 8693 8694 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8695 func (e *EthtoolGFeatures) UnmarshalUnsafe(src []byte) []byte { 8696 size := e.SizeBytes() 8697 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8698 return src[size:] 8699 } 8700 8701 // CopyOutN implements marshal.Marshallable.CopyOutN. 8702 func (e *EthtoolGFeatures) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8703 // Construct a slice backed by dst's underlying memory. 8704 var buf []byte 8705 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8706 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8707 hdr.Len = e.SizeBytes() 8708 hdr.Cap = e.SizeBytes() 8709 8710 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8711 // Since we bypassed the compiler's escape analysis, indicate that e 8712 // must live until the use above. 8713 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8714 return length, err 8715 } 8716 8717 // CopyOut implements marshal.Marshallable.CopyOut. 8718 func (e *EthtoolGFeatures) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8719 return e.CopyOutN(cc, addr, e.SizeBytes()) 8720 } 8721 8722 // CopyInN implements marshal.Marshallable.CopyInN. 8723 func (e *EthtoolGFeatures) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8724 // Construct a slice backed by dst's underlying memory. 8725 var buf []byte 8726 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8727 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8728 hdr.Len = e.SizeBytes() 8729 hdr.Cap = e.SizeBytes() 8730 8731 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8732 // Since we bypassed the compiler's escape analysis, indicate that e 8733 // must live until the use above. 8734 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8735 return length, err 8736 } 8737 8738 // CopyIn implements marshal.Marshallable.CopyIn. 8739 func (e *EthtoolGFeatures) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8740 return e.CopyInN(cc, addr, e.SizeBytes()) 8741 } 8742 8743 // WriteTo implements io.WriterTo.WriteTo. 8744 func (e *EthtoolGFeatures) WriteTo(writer io.Writer) (int64, error) { 8745 // Construct a slice backed by dst's underlying memory. 8746 var buf []byte 8747 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8748 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8749 hdr.Len = e.SizeBytes() 8750 hdr.Cap = e.SizeBytes() 8751 8752 length, err := writer.Write(buf) 8753 // Since we bypassed the compiler's escape analysis, indicate that e 8754 // must live until the use above. 8755 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8756 return int64(length), err 8757 } 8758 8759 // SizeBytes implements marshal.Marshallable.SizeBytes. 8760 func (e *EthtoolGetFeaturesBlock) SizeBytes() int { 8761 return 16 8762 } 8763 8764 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8765 func (e *EthtoolGetFeaturesBlock) MarshalBytes(dst []byte) []byte { 8766 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Available)) 8767 dst = dst[4:] 8768 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Requested)) 8769 dst = dst[4:] 8770 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Active)) 8771 dst = dst[4:] 8772 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.NeverChanged)) 8773 dst = dst[4:] 8774 return dst 8775 } 8776 8777 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8778 func (e *EthtoolGetFeaturesBlock) UnmarshalBytes(src []byte) []byte { 8779 e.Available = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8780 src = src[4:] 8781 e.Requested = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8782 src = src[4:] 8783 e.Active = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8784 src = src[4:] 8785 e.NeverChanged = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8786 src = src[4:] 8787 return src 8788 } 8789 8790 // Packed implements marshal.Marshallable.Packed. 8791 //go:nosplit 8792 func (e *EthtoolGetFeaturesBlock) Packed() bool { 8793 return true 8794 } 8795 8796 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8797 func (e *EthtoolGetFeaturesBlock) MarshalUnsafe(dst []byte) []byte { 8798 size := e.SizeBytes() 8799 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8800 return dst[size:] 8801 } 8802 8803 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8804 func (e *EthtoolGetFeaturesBlock) UnmarshalUnsafe(src []byte) []byte { 8805 size := e.SizeBytes() 8806 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8807 return src[size:] 8808 } 8809 8810 // CopyOutN implements marshal.Marshallable.CopyOutN. 8811 func (e *EthtoolGetFeaturesBlock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8812 // Construct a slice backed by dst's underlying memory. 8813 var buf []byte 8814 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8815 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8816 hdr.Len = e.SizeBytes() 8817 hdr.Cap = e.SizeBytes() 8818 8819 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8820 // Since we bypassed the compiler's escape analysis, indicate that e 8821 // must live until the use above. 8822 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8823 return length, err 8824 } 8825 8826 // CopyOut implements marshal.Marshallable.CopyOut. 8827 func (e *EthtoolGetFeaturesBlock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8828 return e.CopyOutN(cc, addr, e.SizeBytes()) 8829 } 8830 8831 // CopyInN implements marshal.Marshallable.CopyInN. 8832 func (e *EthtoolGetFeaturesBlock) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8833 // Construct a slice backed by dst's underlying memory. 8834 var buf []byte 8835 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8836 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8837 hdr.Len = e.SizeBytes() 8838 hdr.Cap = e.SizeBytes() 8839 8840 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8841 // Since we bypassed the compiler's escape analysis, indicate that e 8842 // must live until the use above. 8843 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8844 return length, err 8845 } 8846 8847 // CopyIn implements marshal.Marshallable.CopyIn. 8848 func (e *EthtoolGetFeaturesBlock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8849 return e.CopyInN(cc, addr, e.SizeBytes()) 8850 } 8851 8852 // WriteTo implements io.WriterTo.WriteTo. 8853 func (e *EthtoolGetFeaturesBlock) WriteTo(writer io.Writer) (int64, error) { 8854 // Construct a slice backed by dst's underlying memory. 8855 var buf []byte 8856 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8857 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8858 hdr.Len = e.SizeBytes() 8859 hdr.Cap = e.SizeBytes() 8860 8861 length, err := writer.Write(buf) 8862 // Since we bypassed the compiler's escape analysis, indicate that e 8863 // must live until the use above. 8864 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8865 return int64(length), err 8866 } 8867 8868 // SizeBytes implements marshal.Marshallable.SizeBytes. 8869 func (i *IFConf) SizeBytes() int { 8870 return 12 + 8871 1*4 8872 } 8873 8874 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8875 func (i *IFConf) MarshalBytes(dst []byte) []byte { 8876 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 8877 dst = dst[4:] 8878 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 8879 dst = dst[1*(4):] 8880 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Ptr)) 8881 dst = dst[8:] 8882 return dst 8883 } 8884 8885 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8886 func (i *IFConf) UnmarshalBytes(src []byte) []byte { 8887 i.Len = int32(hostarch.ByteOrder.Uint32(src[:4])) 8888 src = src[4:] 8889 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 8890 src = src[1*(4):] 8891 i.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8892 src = src[8:] 8893 return src 8894 } 8895 8896 // Packed implements marshal.Marshallable.Packed. 8897 //go:nosplit 8898 func (i *IFConf) Packed() bool { 8899 return true 8900 } 8901 8902 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8903 func (i *IFConf) MarshalUnsafe(dst []byte) []byte { 8904 size := i.SizeBytes() 8905 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 8906 return dst[size:] 8907 } 8908 8909 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8910 func (i *IFConf) UnmarshalUnsafe(src []byte) []byte { 8911 size := i.SizeBytes() 8912 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 8913 return src[size:] 8914 } 8915 8916 // CopyOutN implements marshal.Marshallable.CopyOutN. 8917 func (i *IFConf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8918 // Construct a slice backed by dst's underlying memory. 8919 var buf []byte 8920 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8921 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8922 hdr.Len = i.SizeBytes() 8923 hdr.Cap = i.SizeBytes() 8924 8925 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8926 // Since we bypassed the compiler's escape analysis, indicate that i 8927 // must live until the use above. 8928 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8929 return length, err 8930 } 8931 8932 // CopyOut implements marshal.Marshallable.CopyOut. 8933 func (i *IFConf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8934 return i.CopyOutN(cc, addr, i.SizeBytes()) 8935 } 8936 8937 // CopyInN implements marshal.Marshallable.CopyInN. 8938 func (i *IFConf) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8939 // Construct a slice backed by dst's underlying memory. 8940 var buf []byte 8941 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8942 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8943 hdr.Len = i.SizeBytes() 8944 hdr.Cap = i.SizeBytes() 8945 8946 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8947 // Since we bypassed the compiler's escape analysis, indicate that i 8948 // must live until the use above. 8949 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8950 return length, err 8951 } 8952 8953 // CopyIn implements marshal.Marshallable.CopyIn. 8954 func (i *IFConf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8955 return i.CopyInN(cc, addr, i.SizeBytes()) 8956 } 8957 8958 // WriteTo implements io.WriterTo.WriteTo. 8959 func (i *IFConf) WriteTo(writer io.Writer) (int64, error) { 8960 // Construct a slice backed by dst's underlying memory. 8961 var buf []byte 8962 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8963 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8964 hdr.Len = i.SizeBytes() 8965 hdr.Cap = i.SizeBytes() 8966 8967 length, err := writer.Write(buf) 8968 // Since we bypassed the compiler's escape analysis, indicate that i 8969 // must live until the use above. 8970 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8971 return int64(length), err 8972 } 8973 8974 // SizeBytes implements marshal.Marshallable.SizeBytes. 8975 func (ifr *IFReq) SizeBytes() int { 8976 return 0 + 8977 1*IFNAMSIZ + 8978 1*24 8979 } 8980 8981 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8982 func (ifr *IFReq) MarshalBytes(dst []byte) []byte { 8983 for idx := 0; idx < IFNAMSIZ; idx++ { 8984 dst[0] = byte(ifr.IFName[idx]) 8985 dst = dst[1:] 8986 } 8987 for idx := 0; idx < 24; idx++ { 8988 dst[0] = byte(ifr.Data[idx]) 8989 dst = dst[1:] 8990 } 8991 return dst 8992 } 8993 8994 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8995 func (ifr *IFReq) UnmarshalBytes(src []byte) []byte { 8996 for idx := 0; idx < IFNAMSIZ; idx++ { 8997 ifr.IFName[idx] = src[0] 8998 src = src[1:] 8999 } 9000 for idx := 0; idx < 24; idx++ { 9001 ifr.Data[idx] = src[0] 9002 src = src[1:] 9003 } 9004 return src 9005 } 9006 9007 // Packed implements marshal.Marshallable.Packed. 9008 //go:nosplit 9009 func (ifr *IFReq) Packed() bool { 9010 return true 9011 } 9012 9013 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9014 func (ifr *IFReq) MarshalUnsafe(dst []byte) []byte { 9015 size := ifr.SizeBytes() 9016 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(size)) 9017 return dst[size:] 9018 } 9019 9020 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9021 func (ifr *IFReq) UnmarshalUnsafe(src []byte) []byte { 9022 size := ifr.SizeBytes() 9023 gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(size)) 9024 return src[size:] 9025 } 9026 9027 // CopyOutN implements marshal.Marshallable.CopyOutN. 9028 func (ifr *IFReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9029 // Construct a slice backed by dst's underlying memory. 9030 var buf []byte 9031 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9032 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 9033 hdr.Len = ifr.SizeBytes() 9034 hdr.Cap = ifr.SizeBytes() 9035 9036 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9037 // Since we bypassed the compiler's escape analysis, indicate that ifr 9038 // must live until the use above. 9039 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 9040 return length, err 9041 } 9042 9043 // CopyOut implements marshal.Marshallable.CopyOut. 9044 func (ifr *IFReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9045 return ifr.CopyOutN(cc, addr, ifr.SizeBytes()) 9046 } 9047 9048 // CopyInN implements marshal.Marshallable.CopyInN. 9049 func (ifr *IFReq) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9050 // Construct a slice backed by dst's underlying memory. 9051 var buf []byte 9052 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9053 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 9054 hdr.Len = ifr.SizeBytes() 9055 hdr.Cap = ifr.SizeBytes() 9056 9057 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9058 // Since we bypassed the compiler's escape analysis, indicate that ifr 9059 // must live until the use above. 9060 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 9061 return length, err 9062 } 9063 9064 // CopyIn implements marshal.Marshallable.CopyIn. 9065 func (ifr *IFReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9066 return ifr.CopyInN(cc, addr, ifr.SizeBytes()) 9067 } 9068 9069 // WriteTo implements io.WriterTo.WriteTo. 9070 func (ifr *IFReq) WriteTo(writer io.Writer) (int64, error) { 9071 // Construct a slice backed by dst's underlying memory. 9072 var buf []byte 9073 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9074 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 9075 hdr.Len = ifr.SizeBytes() 9076 hdr.Cap = ifr.SizeBytes() 9077 9078 length, err := writer.Write(buf) 9079 // Since we bypassed the compiler's escape analysis, indicate that ifr 9080 // must live until the use above. 9081 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 9082 return int64(length), err 9083 } 9084 9085 // SizeBytes implements marshal.Marshallable.SizeBytes. 9086 //go:nosplit 9087 func (en *ErrorName) SizeBytes() int { 9088 return 1 * XT_FUNCTION_MAXNAMELEN 9089 } 9090 9091 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9092 func (en *ErrorName) MarshalBytes(dst []byte) []byte { 9093 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 9094 dst[0] = byte(en[idx]) 9095 dst = dst[1:] 9096 } 9097 return dst 9098 } 9099 9100 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9101 func (en *ErrorName) UnmarshalBytes(src []byte) []byte { 9102 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 9103 en[idx] = src[0] 9104 src = src[1:] 9105 } 9106 return src 9107 } 9108 9109 // Packed implements marshal.Marshallable.Packed. 9110 //go:nosplit 9111 func (en *ErrorName) Packed() bool { 9112 // Array newtypes are always packed. 9113 return true 9114 } 9115 9116 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9117 func (en *ErrorName) MarshalUnsafe(dst []byte) []byte { 9118 size := en.SizeBytes() 9119 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 9120 return dst[size:] 9121 } 9122 9123 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9124 func (en *ErrorName) UnmarshalUnsafe(src []byte) []byte { 9125 size := en.SizeBytes() 9126 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 9127 return src[size:] 9128 } 9129 9130 // CopyOutN implements marshal.Marshallable.CopyOutN. 9131 func (en *ErrorName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9132 // Construct a slice backed by dst's underlying memory. 9133 var buf []byte 9134 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9135 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9136 hdr.Len = en.SizeBytes() 9137 hdr.Cap = en.SizeBytes() 9138 9139 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9140 // Since we bypassed the compiler's escape analysis, indicate that en 9141 // must live until the use above. 9142 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9143 return length, err 9144 } 9145 9146 // CopyOut implements marshal.Marshallable.CopyOut. 9147 func (en *ErrorName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9148 return en.CopyOutN(cc, addr, en.SizeBytes()) 9149 } 9150 9151 // CopyInN implements marshal.Marshallable.CopyInN. 9152 func (en *ErrorName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9153 // Construct a slice backed by dst's underlying memory. 9154 var buf []byte 9155 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9156 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9157 hdr.Len = en.SizeBytes() 9158 hdr.Cap = en.SizeBytes() 9159 9160 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9161 // Since we bypassed the compiler's escape analysis, indicate that en 9162 // must live until the use above. 9163 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9164 return length, err 9165 } 9166 9167 // CopyIn implements marshal.Marshallable.CopyIn. 9168 func (en *ErrorName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9169 return en.CopyInN(cc, addr, en.SizeBytes()) 9170 } 9171 9172 // WriteTo implements io.WriterTo.WriteTo. 9173 func (en *ErrorName) WriteTo(writer io.Writer) (int64, error) { 9174 // Construct a slice backed by dst's underlying memory. 9175 var buf []byte 9176 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9177 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9178 hdr.Len = en.SizeBytes() 9179 hdr.Cap = en.SizeBytes() 9180 9181 length, err := writer.Write(buf) 9182 // Since we bypassed the compiler's escape analysis, indicate that en 9183 // must live until the use above. 9184 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9185 return int64(length), err 9186 } 9187 9188 // SizeBytes implements marshal.Marshallable.SizeBytes. 9189 //go:nosplit 9190 func (en *ExtensionName) SizeBytes() int { 9191 return 1 * XT_EXTENSION_MAXNAMELEN 9192 } 9193 9194 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9195 func (en *ExtensionName) MarshalBytes(dst []byte) []byte { 9196 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 9197 dst[0] = byte(en[idx]) 9198 dst = dst[1:] 9199 } 9200 return dst 9201 } 9202 9203 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9204 func (en *ExtensionName) UnmarshalBytes(src []byte) []byte { 9205 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 9206 en[idx] = src[0] 9207 src = src[1:] 9208 } 9209 return src 9210 } 9211 9212 // Packed implements marshal.Marshallable.Packed. 9213 //go:nosplit 9214 func (en *ExtensionName) Packed() bool { 9215 // Array newtypes are always packed. 9216 return true 9217 } 9218 9219 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9220 func (en *ExtensionName) MarshalUnsafe(dst []byte) []byte { 9221 size := en.SizeBytes() 9222 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 9223 return dst[size:] 9224 } 9225 9226 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9227 func (en *ExtensionName) UnmarshalUnsafe(src []byte) []byte { 9228 size := en.SizeBytes() 9229 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 9230 return src[size:] 9231 } 9232 9233 // CopyOutN implements marshal.Marshallable.CopyOutN. 9234 func (en *ExtensionName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9235 // Construct a slice backed by dst's underlying memory. 9236 var buf []byte 9237 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9238 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9239 hdr.Len = en.SizeBytes() 9240 hdr.Cap = en.SizeBytes() 9241 9242 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9243 // Since we bypassed the compiler's escape analysis, indicate that en 9244 // must live until the use above. 9245 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9246 return length, err 9247 } 9248 9249 // CopyOut implements marshal.Marshallable.CopyOut. 9250 func (en *ExtensionName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9251 return en.CopyOutN(cc, addr, en.SizeBytes()) 9252 } 9253 9254 // CopyInN implements marshal.Marshallable.CopyInN. 9255 func (en *ExtensionName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9256 // Construct a slice backed by dst's underlying memory. 9257 var buf []byte 9258 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9259 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9260 hdr.Len = en.SizeBytes() 9261 hdr.Cap = en.SizeBytes() 9262 9263 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9264 // Since we bypassed the compiler's escape analysis, indicate that en 9265 // must live until the use above. 9266 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9267 return length, err 9268 } 9269 9270 // CopyIn implements marshal.Marshallable.CopyIn. 9271 func (en *ExtensionName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9272 return en.CopyInN(cc, addr, en.SizeBytes()) 9273 } 9274 9275 // WriteTo implements io.WriterTo.WriteTo. 9276 func (en *ExtensionName) WriteTo(writer io.Writer) (int64, error) { 9277 // Construct a slice backed by dst's underlying memory. 9278 var buf []byte 9279 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9280 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9281 hdr.Len = en.SizeBytes() 9282 hdr.Cap = en.SizeBytes() 9283 9284 length, err := writer.Write(buf) 9285 // Since we bypassed the compiler's escape analysis, indicate that en 9286 // must live until the use above. 9287 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9288 return int64(length), err 9289 } 9290 9291 // SizeBytes implements marshal.Marshallable.SizeBytes. 9292 func (i *IPTEntry) SizeBytes() int { 9293 return 12 + 9294 (*IPTIP)(nil).SizeBytes() + 9295 (*XTCounters)(nil).SizeBytes() 9296 } 9297 9298 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9299 func (i *IPTEntry) MarshalBytes(dst []byte) []byte { 9300 dst = i.IP.MarshalUnsafe(dst) 9301 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 9302 dst = dst[4:] 9303 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 9304 dst = dst[2:] 9305 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 9306 dst = dst[2:] 9307 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 9308 dst = dst[4:] 9309 dst = i.Counters.MarshalUnsafe(dst) 9310 return dst 9311 } 9312 9313 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9314 func (i *IPTEntry) UnmarshalBytes(src []byte) []byte { 9315 src = i.IP.UnmarshalUnsafe(src) 9316 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9317 src = src[4:] 9318 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9319 src = src[2:] 9320 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9321 src = src[2:] 9322 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9323 src = src[4:] 9324 src = i.Counters.UnmarshalUnsafe(src) 9325 return src 9326 } 9327 9328 // Packed implements marshal.Marshallable.Packed. 9329 //go:nosplit 9330 func (i *IPTEntry) Packed() bool { 9331 return i.Counters.Packed() && i.IP.Packed() 9332 } 9333 9334 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9335 func (i *IPTEntry) MarshalUnsafe(dst []byte) []byte { 9336 if i.Counters.Packed() && i.IP.Packed() { 9337 size := i.SizeBytes() 9338 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9339 return dst[size:] 9340 } 9341 // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 9342 return i.MarshalBytes(dst) 9343 } 9344 9345 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9346 func (i *IPTEntry) UnmarshalUnsafe(src []byte) []byte { 9347 if i.Counters.Packed() && i.IP.Packed() { 9348 size := i.SizeBytes() 9349 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9350 return src[size:] 9351 } 9352 // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9353 return i.UnmarshalBytes(src) 9354 } 9355 9356 // CopyOutN implements marshal.Marshallable.CopyOutN. 9357 func (i *IPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9358 if !i.Counters.Packed() && i.IP.Packed() { 9359 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9360 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9361 i.MarshalBytes(buf) // escapes: fallback. 9362 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9363 } 9364 9365 // Construct a slice backed by dst's underlying memory. 9366 var buf []byte 9367 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9368 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9369 hdr.Len = i.SizeBytes() 9370 hdr.Cap = i.SizeBytes() 9371 9372 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9373 // Since we bypassed the compiler's escape analysis, indicate that i 9374 // must live until the use above. 9375 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9376 return length, err 9377 } 9378 9379 // CopyOut implements marshal.Marshallable.CopyOut. 9380 func (i *IPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9381 return i.CopyOutN(cc, addr, i.SizeBytes()) 9382 } 9383 9384 // CopyInN implements marshal.Marshallable.CopyInN. 9385 func (i *IPTEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9386 if !i.Counters.Packed() && i.IP.Packed() { 9387 // Type IPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9388 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9389 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9390 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9391 // partially unmarshalled struct. 9392 i.UnmarshalBytes(buf) // escapes: fallback. 9393 return length, err 9394 } 9395 9396 // Construct a slice backed by dst's underlying memory. 9397 var buf []byte 9398 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9399 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9400 hdr.Len = i.SizeBytes() 9401 hdr.Cap = i.SizeBytes() 9402 9403 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9404 // Since we bypassed the compiler's escape analysis, indicate that i 9405 // must live until the use above. 9406 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9407 return length, err 9408 } 9409 9410 // CopyIn implements marshal.Marshallable.CopyIn. 9411 func (i *IPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9412 return i.CopyInN(cc, addr, i.SizeBytes()) 9413 } 9414 9415 // WriteTo implements io.WriterTo.WriteTo. 9416 func (i *IPTEntry) WriteTo(writer io.Writer) (int64, error) { 9417 if !i.Counters.Packed() && i.IP.Packed() { 9418 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9419 buf := make([]byte, i.SizeBytes()) 9420 i.MarshalBytes(buf) 9421 length, err := writer.Write(buf) 9422 return int64(length), err 9423 } 9424 9425 // Construct a slice backed by dst's underlying memory. 9426 var buf []byte 9427 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9428 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9429 hdr.Len = i.SizeBytes() 9430 hdr.Cap = i.SizeBytes() 9431 9432 length, err := writer.Write(buf) 9433 // Since we bypassed the compiler's escape analysis, indicate that i 9434 // must live until the use above. 9435 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9436 return int64(length), err 9437 } 9438 9439 // SizeBytes implements marshal.Marshallable.SizeBytes. 9440 func (i *IPTGetEntries) SizeBytes() int { 9441 return 4 + 9442 (*TableName)(nil).SizeBytes() + 9443 1*4 9444 } 9445 9446 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9447 func (i *IPTGetEntries) MarshalBytes(dst []byte) []byte { 9448 dst = i.Name.MarshalUnsafe(dst) 9449 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9450 dst = dst[4:] 9451 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 9452 dst = dst[1*(4):] 9453 return dst 9454 } 9455 9456 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9457 func (i *IPTGetEntries) UnmarshalBytes(src []byte) []byte { 9458 src = i.Name.UnmarshalUnsafe(src) 9459 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9460 src = src[4:] 9461 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 9462 src = src[1*(4):] 9463 return src 9464 } 9465 9466 // Packed implements marshal.Marshallable.Packed. 9467 //go:nosplit 9468 func (i *IPTGetEntries) Packed() bool { 9469 return i.Name.Packed() 9470 } 9471 9472 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9473 func (i *IPTGetEntries) MarshalUnsafe(dst []byte) []byte { 9474 if i.Name.Packed() { 9475 size := i.SizeBytes() 9476 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9477 return dst[size:] 9478 } 9479 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 9480 return i.MarshalBytes(dst) 9481 } 9482 9483 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9484 func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 9485 if i.Name.Packed() { 9486 size := i.SizeBytes() 9487 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9488 return src[size:] 9489 } 9490 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9491 return i.UnmarshalBytes(src) 9492 } 9493 9494 // CopyOutN implements marshal.Marshallable.CopyOutN. 9495 func (i *IPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9496 if !i.Name.Packed() { 9497 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9498 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9499 i.MarshalBytes(buf) // escapes: fallback. 9500 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9501 } 9502 9503 // Construct a slice backed by dst's underlying memory. 9504 var buf []byte 9505 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9506 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9507 hdr.Len = i.SizeBytes() 9508 hdr.Cap = i.SizeBytes() 9509 9510 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9511 // Since we bypassed the compiler's escape analysis, indicate that i 9512 // must live until the use above. 9513 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9514 return length, err 9515 } 9516 9517 // CopyOut implements marshal.Marshallable.CopyOut. 9518 func (i *IPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9519 return i.CopyOutN(cc, addr, i.SizeBytes()) 9520 } 9521 9522 // CopyInN implements marshal.Marshallable.CopyInN. 9523 func (i *IPTGetEntries) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9524 if !i.Name.Packed() { 9525 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9526 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9527 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9528 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9529 // partially unmarshalled struct. 9530 i.UnmarshalBytes(buf) // escapes: fallback. 9531 return length, err 9532 } 9533 9534 // Construct a slice backed by dst's underlying memory. 9535 var buf []byte 9536 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9537 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9538 hdr.Len = i.SizeBytes() 9539 hdr.Cap = i.SizeBytes() 9540 9541 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9542 // Since we bypassed the compiler's escape analysis, indicate that i 9543 // must live until the use above. 9544 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9545 return length, err 9546 } 9547 9548 // CopyIn implements marshal.Marshallable.CopyIn. 9549 func (i *IPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9550 return i.CopyInN(cc, addr, i.SizeBytes()) 9551 } 9552 9553 // WriteTo implements io.WriterTo.WriteTo. 9554 func (i *IPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 9555 if !i.Name.Packed() { 9556 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9557 buf := make([]byte, i.SizeBytes()) 9558 i.MarshalBytes(buf) 9559 length, err := writer.Write(buf) 9560 return int64(length), err 9561 } 9562 9563 // Construct a slice backed by dst's underlying memory. 9564 var buf []byte 9565 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9566 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9567 hdr.Len = i.SizeBytes() 9568 hdr.Cap = i.SizeBytes() 9569 9570 length, err := writer.Write(buf) 9571 // Since we bypassed the compiler's escape analysis, indicate that i 9572 // must live until the use above. 9573 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9574 return int64(length), err 9575 } 9576 9577 // SizeBytes implements marshal.Marshallable.SizeBytes. 9578 func (i *IPTGetinfo) SizeBytes() int { 9579 return 12 + 9580 (*TableName)(nil).SizeBytes() + 9581 4*NF_INET_NUMHOOKS + 9582 4*NF_INET_NUMHOOKS 9583 } 9584 9585 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9586 func (i *IPTGetinfo) MarshalBytes(dst []byte) []byte { 9587 dst = i.Name.MarshalUnsafe(dst) 9588 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9589 dst = dst[4:] 9590 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9591 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9592 dst = dst[4:] 9593 } 9594 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9595 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9596 dst = dst[4:] 9597 } 9598 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9599 dst = dst[4:] 9600 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9601 dst = dst[4:] 9602 return dst 9603 } 9604 9605 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9606 func (i *IPTGetinfo) UnmarshalBytes(src []byte) []byte { 9607 src = i.Name.UnmarshalUnsafe(src) 9608 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9609 src = src[4:] 9610 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9611 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9612 src = src[4:] 9613 } 9614 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9615 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9616 src = src[4:] 9617 } 9618 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9619 src = src[4:] 9620 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9621 src = src[4:] 9622 return src 9623 } 9624 9625 // Packed implements marshal.Marshallable.Packed. 9626 //go:nosplit 9627 func (i *IPTGetinfo) Packed() bool { 9628 return i.Name.Packed() 9629 } 9630 9631 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9632 func (i *IPTGetinfo) MarshalUnsafe(dst []byte) []byte { 9633 if i.Name.Packed() { 9634 size := i.SizeBytes() 9635 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9636 return dst[size:] 9637 } 9638 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9639 return i.MarshalBytes(dst) 9640 } 9641 9642 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9643 func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) []byte { 9644 if i.Name.Packed() { 9645 size := i.SizeBytes() 9646 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9647 return src[size:] 9648 } 9649 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9650 return i.UnmarshalBytes(src) 9651 } 9652 9653 // CopyOutN implements marshal.Marshallable.CopyOutN. 9654 func (i *IPTGetinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9655 if !i.Name.Packed() { 9656 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9657 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9658 i.MarshalBytes(buf) // escapes: fallback. 9659 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9660 } 9661 9662 // Construct a slice backed by dst's underlying memory. 9663 var buf []byte 9664 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9665 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9666 hdr.Len = i.SizeBytes() 9667 hdr.Cap = i.SizeBytes() 9668 9669 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9670 // Since we bypassed the compiler's escape analysis, indicate that i 9671 // must live until the use above. 9672 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9673 return length, err 9674 } 9675 9676 // CopyOut implements marshal.Marshallable.CopyOut. 9677 func (i *IPTGetinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9678 return i.CopyOutN(cc, addr, i.SizeBytes()) 9679 } 9680 9681 // CopyInN implements marshal.Marshallable.CopyInN. 9682 func (i *IPTGetinfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9683 if !i.Name.Packed() { 9684 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9685 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9686 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9687 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9688 // partially unmarshalled struct. 9689 i.UnmarshalBytes(buf) // escapes: fallback. 9690 return length, err 9691 } 9692 9693 // Construct a slice backed by dst's underlying memory. 9694 var buf []byte 9695 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9696 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9697 hdr.Len = i.SizeBytes() 9698 hdr.Cap = i.SizeBytes() 9699 9700 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9701 // Since we bypassed the compiler's escape analysis, indicate that i 9702 // must live until the use above. 9703 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9704 return length, err 9705 } 9706 9707 // CopyIn implements marshal.Marshallable.CopyIn. 9708 func (i *IPTGetinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9709 return i.CopyInN(cc, addr, i.SizeBytes()) 9710 } 9711 9712 // WriteTo implements io.WriterTo.WriteTo. 9713 func (i *IPTGetinfo) WriteTo(writer io.Writer) (int64, error) { 9714 if !i.Name.Packed() { 9715 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9716 buf := make([]byte, i.SizeBytes()) 9717 i.MarshalBytes(buf) 9718 length, err := writer.Write(buf) 9719 return int64(length), err 9720 } 9721 9722 // Construct a slice backed by dst's underlying memory. 9723 var buf []byte 9724 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9725 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9726 hdr.Len = i.SizeBytes() 9727 hdr.Cap = i.SizeBytes() 9728 9729 length, err := writer.Write(buf) 9730 // Since we bypassed the compiler's escape analysis, indicate that i 9731 // must live until the use above. 9732 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9733 return int64(length), err 9734 } 9735 9736 // SizeBytes implements marshal.Marshallable.SizeBytes. 9737 func (i *IPTIP) SizeBytes() int { 9738 return 4 + 9739 (*InetAddr)(nil).SizeBytes() + 9740 (*InetAddr)(nil).SizeBytes() + 9741 (*InetAddr)(nil).SizeBytes() + 9742 (*InetAddr)(nil).SizeBytes() + 9743 1*IFNAMSIZ + 9744 1*IFNAMSIZ + 9745 1*IFNAMSIZ + 9746 1*IFNAMSIZ 9747 } 9748 9749 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9750 func (i *IPTIP) MarshalBytes(dst []byte) []byte { 9751 dst = i.Src.MarshalUnsafe(dst) 9752 dst = i.Dst.MarshalUnsafe(dst) 9753 dst = i.SrcMask.MarshalUnsafe(dst) 9754 dst = i.DstMask.MarshalUnsafe(dst) 9755 for idx := 0; idx < IFNAMSIZ; idx++ { 9756 dst[0] = byte(i.InputInterface[idx]) 9757 dst = dst[1:] 9758 } 9759 for idx := 0; idx < IFNAMSIZ; idx++ { 9760 dst[0] = byte(i.OutputInterface[idx]) 9761 dst = dst[1:] 9762 } 9763 for idx := 0; idx < IFNAMSIZ; idx++ { 9764 dst[0] = byte(i.InputInterfaceMask[idx]) 9765 dst = dst[1:] 9766 } 9767 for idx := 0; idx < IFNAMSIZ; idx++ { 9768 dst[0] = byte(i.OutputInterfaceMask[idx]) 9769 dst = dst[1:] 9770 } 9771 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 9772 dst = dst[2:] 9773 dst[0] = byte(i.Flags) 9774 dst = dst[1:] 9775 dst[0] = byte(i.InverseFlags) 9776 dst = dst[1:] 9777 return dst 9778 } 9779 9780 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9781 func (i *IPTIP) UnmarshalBytes(src []byte) []byte { 9782 src = i.Src.UnmarshalUnsafe(src) 9783 src = i.Dst.UnmarshalUnsafe(src) 9784 src = i.SrcMask.UnmarshalUnsafe(src) 9785 src = i.DstMask.UnmarshalUnsafe(src) 9786 for idx := 0; idx < IFNAMSIZ; idx++ { 9787 i.InputInterface[idx] = src[0] 9788 src = src[1:] 9789 } 9790 for idx := 0; idx < IFNAMSIZ; idx++ { 9791 i.OutputInterface[idx] = src[0] 9792 src = src[1:] 9793 } 9794 for idx := 0; idx < IFNAMSIZ; idx++ { 9795 i.InputInterfaceMask[idx] = src[0] 9796 src = src[1:] 9797 } 9798 for idx := 0; idx < IFNAMSIZ; idx++ { 9799 i.OutputInterfaceMask[idx] = src[0] 9800 src = src[1:] 9801 } 9802 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9803 src = src[2:] 9804 i.Flags = uint8(src[0]) 9805 src = src[1:] 9806 i.InverseFlags = uint8(src[0]) 9807 src = src[1:] 9808 return src 9809 } 9810 9811 // Packed implements marshal.Marshallable.Packed. 9812 //go:nosplit 9813 func (i *IPTIP) Packed() bool { 9814 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 9815 } 9816 9817 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9818 func (i *IPTIP) MarshalUnsafe(dst []byte) []byte { 9819 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9820 size := i.SizeBytes() 9821 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9822 return dst[size:] 9823 } 9824 // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes. 9825 return i.MarshalBytes(dst) 9826 } 9827 9828 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9829 func (i *IPTIP) UnmarshalUnsafe(src []byte) []byte { 9830 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9831 size := i.SizeBytes() 9832 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9833 return src[size:] 9834 } 9835 // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9836 return i.UnmarshalBytes(src) 9837 } 9838 9839 // CopyOutN implements marshal.Marshallable.CopyOutN. 9840 func (i *IPTIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9841 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9842 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9843 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9844 i.MarshalBytes(buf) // escapes: fallback. 9845 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9846 } 9847 9848 // Construct a slice backed by dst's underlying memory. 9849 var buf []byte 9850 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9851 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9852 hdr.Len = i.SizeBytes() 9853 hdr.Cap = i.SizeBytes() 9854 9855 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9856 // Since we bypassed the compiler's escape analysis, indicate that i 9857 // must live until the use above. 9858 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9859 return length, err 9860 } 9861 9862 // CopyOut implements marshal.Marshallable.CopyOut. 9863 func (i *IPTIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9864 return i.CopyOutN(cc, addr, i.SizeBytes()) 9865 } 9866 9867 // CopyInN implements marshal.Marshallable.CopyInN. 9868 func (i *IPTIP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9869 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9870 // Type IPTIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9871 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9872 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9873 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9874 // partially unmarshalled struct. 9875 i.UnmarshalBytes(buf) // escapes: fallback. 9876 return length, err 9877 } 9878 9879 // Construct a slice backed by dst's underlying memory. 9880 var buf []byte 9881 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9882 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9883 hdr.Len = i.SizeBytes() 9884 hdr.Cap = i.SizeBytes() 9885 9886 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9887 // Since we bypassed the compiler's escape analysis, indicate that i 9888 // must live until the use above. 9889 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9890 return length, err 9891 } 9892 9893 // CopyIn implements marshal.Marshallable.CopyIn. 9894 func (i *IPTIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9895 return i.CopyInN(cc, addr, i.SizeBytes()) 9896 } 9897 9898 // WriteTo implements io.WriterTo.WriteTo. 9899 func (i *IPTIP) WriteTo(writer io.Writer) (int64, error) { 9900 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9901 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9902 buf := make([]byte, i.SizeBytes()) 9903 i.MarshalBytes(buf) 9904 length, err := writer.Write(buf) 9905 return int64(length), err 9906 } 9907 9908 // Construct a slice backed by dst's underlying memory. 9909 var buf []byte 9910 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9911 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9912 hdr.Len = i.SizeBytes() 9913 hdr.Cap = i.SizeBytes() 9914 9915 length, err := writer.Write(buf) 9916 // Since we bypassed the compiler's escape analysis, indicate that i 9917 // must live until the use above. 9918 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9919 return int64(length), err 9920 } 9921 9922 // SizeBytes implements marshal.Marshallable.SizeBytes. 9923 func (i *IPTOwnerInfo) SizeBytes() int { 9924 return 18 + 9925 1*16 9926 } 9927 9928 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9929 func (i *IPTOwnerInfo) MarshalBytes(dst []byte) []byte { 9930 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 9931 dst = dst[4:] 9932 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 9933 dst = dst[4:] 9934 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.PID)) 9935 dst = dst[4:] 9936 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SID)) 9937 dst = dst[4:] 9938 for idx := 0; idx < 16; idx++ { 9939 dst[0] = byte(i.Comm[idx]) 9940 dst = dst[1:] 9941 } 9942 dst[0] = byte(i.Match) 9943 dst = dst[1:] 9944 dst[0] = byte(i.Invert) 9945 dst = dst[1:] 9946 return dst 9947 } 9948 9949 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9950 func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) []byte { 9951 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9952 src = src[4:] 9953 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9954 src = src[4:] 9955 i.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9956 src = src[4:] 9957 i.SID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9958 src = src[4:] 9959 for idx := 0; idx < 16; idx++ { 9960 i.Comm[idx] = src[0] 9961 src = src[1:] 9962 } 9963 i.Match = uint8(src[0]) 9964 src = src[1:] 9965 i.Invert = uint8(src[0]) 9966 src = src[1:] 9967 return src 9968 } 9969 9970 // Packed implements marshal.Marshallable.Packed. 9971 //go:nosplit 9972 func (i *IPTOwnerInfo) Packed() bool { 9973 return false 9974 } 9975 9976 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9977 func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) []byte { 9978 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9979 return i.MarshalBytes(dst) 9980 } 9981 9982 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9983 func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) []byte { 9984 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9985 return i.UnmarshalBytes(src) 9986 } 9987 9988 // CopyOutN implements marshal.Marshallable.CopyOutN. 9989 func (i *IPTOwnerInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9990 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9991 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9992 i.MarshalBytes(buf) // escapes: fallback. 9993 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9994 } 9995 9996 // CopyOut implements marshal.Marshallable.CopyOut. 9997 func (i *IPTOwnerInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9998 return i.CopyOutN(cc, addr, i.SizeBytes()) 9999 } 10000 10001 // CopyInN implements marshal.Marshallable.CopyInN. 10002 func (i *IPTOwnerInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10003 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10004 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10005 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10006 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10007 // partially unmarshalled struct. 10008 i.UnmarshalBytes(buf) // escapes: fallback. 10009 return length, err 10010 } 10011 10012 // CopyIn implements marshal.Marshallable.CopyIn. 10013 func (i *IPTOwnerInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10014 return i.CopyInN(cc, addr, i.SizeBytes()) 10015 } 10016 10017 // WriteTo implements io.WriterTo.WriteTo. 10018 func (i *IPTOwnerInfo) WriteTo(writer io.Writer) (int64, error) { 10019 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 10020 buf := make([]byte, i.SizeBytes()) 10021 i.MarshalBytes(buf) 10022 length, err := writer.Write(buf) 10023 return int64(length), err 10024 } 10025 10026 // SizeBytes implements marshal.Marshallable.SizeBytes. 10027 func (i *IPTReplace) SizeBytes() int { 10028 return 24 + 10029 (*TableName)(nil).SizeBytes() + 10030 4*NF_INET_NUMHOOKS + 10031 4*NF_INET_NUMHOOKS 10032 } 10033 10034 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10035 func (i *IPTReplace) MarshalBytes(dst []byte) []byte { 10036 dst = i.Name.MarshalUnsafe(dst) 10037 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 10038 dst = dst[4:] 10039 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 10040 dst = dst[4:] 10041 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 10042 dst = dst[4:] 10043 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10044 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 10045 dst = dst[4:] 10046 } 10047 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10048 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 10049 dst = dst[4:] 10050 } 10051 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 10052 dst = dst[4:] 10053 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 10054 dst = dst[8:] 10055 return dst 10056 } 10057 10058 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10059 func (i *IPTReplace) UnmarshalBytes(src []byte) []byte { 10060 src = i.Name.UnmarshalUnsafe(src) 10061 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10062 src = src[4:] 10063 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10064 src = src[4:] 10065 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10066 src = src[4:] 10067 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10068 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10069 src = src[4:] 10070 } 10071 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10072 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10073 src = src[4:] 10074 } 10075 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10076 src = src[4:] 10077 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10078 src = src[8:] 10079 return src 10080 } 10081 10082 // Packed implements marshal.Marshallable.Packed. 10083 //go:nosplit 10084 func (i *IPTReplace) Packed() bool { 10085 return i.Name.Packed() 10086 } 10087 10088 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10089 func (i *IPTReplace) MarshalUnsafe(dst []byte) []byte { 10090 if i.Name.Packed() { 10091 size := i.SizeBytes() 10092 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 10093 return dst[size:] 10094 } 10095 // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 10096 return i.MarshalBytes(dst) 10097 } 10098 10099 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10100 func (i *IPTReplace) UnmarshalUnsafe(src []byte) []byte { 10101 if i.Name.Packed() { 10102 size := i.SizeBytes() 10103 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 10104 return src[size:] 10105 } 10106 // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10107 return i.UnmarshalBytes(src) 10108 } 10109 10110 // CopyOutN implements marshal.Marshallable.CopyOutN. 10111 func (i *IPTReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10112 if !i.Name.Packed() { 10113 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 10114 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10115 i.MarshalBytes(buf) // escapes: fallback. 10116 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10117 } 10118 10119 // Construct a slice backed by dst's underlying memory. 10120 var buf []byte 10121 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10122 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10123 hdr.Len = i.SizeBytes() 10124 hdr.Cap = i.SizeBytes() 10125 10126 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10127 // Since we bypassed the compiler's escape analysis, indicate that i 10128 // must live until the use above. 10129 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10130 return length, err 10131 } 10132 10133 // CopyOut implements marshal.Marshallable.CopyOut. 10134 func (i *IPTReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10135 return i.CopyOutN(cc, addr, i.SizeBytes()) 10136 } 10137 10138 // CopyInN implements marshal.Marshallable.CopyInN. 10139 func (i *IPTReplace) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10140 if !i.Name.Packed() { 10141 // Type IPTReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10142 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10143 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10144 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10145 // partially unmarshalled struct. 10146 i.UnmarshalBytes(buf) // escapes: fallback. 10147 return length, err 10148 } 10149 10150 // Construct a slice backed by dst's underlying memory. 10151 var buf []byte 10152 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10153 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10154 hdr.Len = i.SizeBytes() 10155 hdr.Cap = i.SizeBytes() 10156 10157 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10158 // Since we bypassed the compiler's escape analysis, indicate that i 10159 // must live until the use above. 10160 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10161 return length, err 10162 } 10163 10164 // CopyIn implements marshal.Marshallable.CopyIn. 10165 func (i *IPTReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10166 return i.CopyInN(cc, addr, i.SizeBytes()) 10167 } 10168 10169 // WriteTo implements io.WriterTo.WriteTo. 10170 func (i *IPTReplace) WriteTo(writer io.Writer) (int64, error) { 10171 if !i.Name.Packed() { 10172 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 10173 buf := make([]byte, i.SizeBytes()) 10174 i.MarshalBytes(buf) 10175 length, err := writer.Write(buf) 10176 return int64(length), err 10177 } 10178 10179 // Construct a slice backed by dst's underlying memory. 10180 var buf []byte 10181 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10182 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10183 hdr.Len = i.SizeBytes() 10184 hdr.Cap = i.SizeBytes() 10185 10186 length, err := writer.Write(buf) 10187 // Since we bypassed the compiler's escape analysis, indicate that i 10188 // must live until the use above. 10189 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10190 return int64(length), err 10191 } 10192 10193 // Packed implements marshal.Marshallable.Packed. 10194 //go:nosplit 10195 func (ke *KernelIPTEntry) Packed() bool { 10196 // Type KernelIPTEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 10197 return false 10198 } 10199 10200 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10201 func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) []byte { 10202 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 10203 return ke.MarshalBytes(dst) 10204 } 10205 10206 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10207 func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) []byte { 10208 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10209 return ke.UnmarshalBytes(src) 10210 } 10211 10212 // CopyOutN implements marshal.Marshallable.CopyOutN. 10213 //go:nosplit 10214 func (ke *KernelIPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10215 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 10216 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10217 ke.MarshalBytes(buf) // escapes: fallback. 10218 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10219 } 10220 10221 // CopyOut implements marshal.Marshallable.CopyOut. 10222 func (ke *KernelIPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10223 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 10224 } 10225 10226 // CopyInN implements marshal.Marshallable.CopyInN. 10227 //go:nosplit 10228 func (ke *KernelIPTEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10229 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10230 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10231 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10232 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10233 // partially unmarshalled struct. 10234 ke.UnmarshalBytes(buf) // escapes: fallback. 10235 return length, err 10236 } 10237 10238 // CopyIn implements marshal.Marshallable.CopyIn. 10239 func (ke *KernelIPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10240 return ke.CopyInN(cc, addr, ke.SizeBytes()) 10241 } 10242 10243 // WriteTo implements io.WriterTo.WriteTo. 10244 func (ke *KernelIPTEntry) WriteTo(writer io.Writer) (int64, error) { 10245 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 10246 buf := make([]byte, ke.SizeBytes()) 10247 ke.MarshalBytes(buf) 10248 length, err := writer.Write(buf) 10249 return int64(length), err 10250 } 10251 10252 // Packed implements marshal.Marshallable.Packed. 10253 //go:nosplit 10254 func (ke *KernelIPTGetEntries) Packed() bool { 10255 // Type KernelIPTGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 10256 return false 10257 } 10258 10259 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10260 func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) []byte { 10261 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 10262 return ke.MarshalBytes(dst) 10263 } 10264 10265 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10266 func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 10267 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10268 return ke.UnmarshalBytes(src) 10269 } 10270 10271 // CopyOutN implements marshal.Marshallable.CopyOutN. 10272 //go:nosplit 10273 func (ke *KernelIPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10274 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 10275 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10276 ke.MarshalBytes(buf) // escapes: fallback. 10277 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10278 } 10279 10280 // CopyOut implements marshal.Marshallable.CopyOut. 10281 func (ke *KernelIPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10282 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 10283 } 10284 10285 // CopyInN implements marshal.Marshallable.CopyInN. 10286 //go:nosplit 10287 func (ke *KernelIPTGetEntries) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10288 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10289 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10290 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10291 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10292 // partially unmarshalled struct. 10293 ke.UnmarshalBytes(buf) // escapes: fallback. 10294 return length, err 10295 } 10296 10297 // CopyIn implements marshal.Marshallable.CopyIn. 10298 func (ke *KernelIPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10299 return ke.CopyInN(cc, addr, ke.SizeBytes()) 10300 } 10301 10302 // WriteTo implements io.WriterTo.WriteTo. 10303 func (ke *KernelIPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 10304 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 10305 buf := make([]byte, ke.SizeBytes()) 10306 ke.MarshalBytes(buf) 10307 length, err := writer.Write(buf) 10308 return int64(length), err 10309 } 10310 10311 // SizeBytes implements marshal.Marshallable.SizeBytes. 10312 func (n *NfNATIPV4MultiRangeCompat) SizeBytes() int { 10313 return 4 + 10314 (*NfNATIPV4Range)(nil).SizeBytes() 10315 } 10316 10317 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10318 func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) []byte { 10319 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.RangeSize)) 10320 dst = dst[4:] 10321 dst = n.RangeIPV4.MarshalUnsafe(dst) 10322 return dst 10323 } 10324 10325 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10326 func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) []byte { 10327 n.RangeSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10328 src = src[4:] 10329 src = n.RangeIPV4.UnmarshalUnsafe(src) 10330 return src 10331 } 10332 10333 // Packed implements marshal.Marshallable.Packed. 10334 //go:nosplit 10335 func (n *NfNATIPV4MultiRangeCompat) Packed() bool { 10336 return n.RangeIPV4.Packed() 10337 } 10338 10339 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10340 func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) []byte { 10341 if n.RangeIPV4.Packed() { 10342 size := n.SizeBytes() 10343 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10344 return dst[size:] 10345 } 10346 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes. 10347 return n.MarshalBytes(dst) 10348 } 10349 10350 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10351 func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) []byte { 10352 if n.RangeIPV4.Packed() { 10353 size := n.SizeBytes() 10354 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10355 return src[size:] 10356 } 10357 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10358 return n.UnmarshalBytes(src) 10359 } 10360 10361 // CopyOutN implements marshal.Marshallable.CopyOutN. 10362 func (n *NfNATIPV4MultiRangeCompat) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10363 if !n.RangeIPV4.Packed() { 10364 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 10365 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10366 n.MarshalBytes(buf) // escapes: fallback. 10367 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10368 } 10369 10370 // Construct a slice backed by dst's underlying memory. 10371 var buf []byte 10372 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10373 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10374 hdr.Len = n.SizeBytes() 10375 hdr.Cap = n.SizeBytes() 10376 10377 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10378 // Since we bypassed the compiler's escape analysis, indicate that n 10379 // must live until the use above. 10380 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10381 return length, err 10382 } 10383 10384 // CopyOut implements marshal.Marshallable.CopyOut. 10385 func (n *NfNATIPV4MultiRangeCompat) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10386 return n.CopyOutN(cc, addr, n.SizeBytes()) 10387 } 10388 10389 // CopyInN implements marshal.Marshallable.CopyInN. 10390 func (n *NfNATIPV4MultiRangeCompat) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10391 if !n.RangeIPV4.Packed() { 10392 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10393 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10394 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10395 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10396 // partially unmarshalled struct. 10397 n.UnmarshalBytes(buf) // escapes: fallback. 10398 return length, err 10399 } 10400 10401 // Construct a slice backed by dst's underlying memory. 10402 var buf []byte 10403 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10404 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10405 hdr.Len = n.SizeBytes() 10406 hdr.Cap = n.SizeBytes() 10407 10408 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10409 // Since we bypassed the compiler's escape analysis, indicate that n 10410 // must live until the use above. 10411 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10412 return length, err 10413 } 10414 10415 // CopyIn implements marshal.Marshallable.CopyIn. 10416 func (n *NfNATIPV4MultiRangeCompat) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10417 return n.CopyInN(cc, addr, n.SizeBytes()) 10418 } 10419 10420 // WriteTo implements io.WriterTo.WriteTo. 10421 func (n *NfNATIPV4MultiRangeCompat) WriteTo(writer io.Writer) (int64, error) { 10422 if !n.RangeIPV4.Packed() { 10423 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 10424 buf := make([]byte, n.SizeBytes()) 10425 n.MarshalBytes(buf) 10426 length, err := writer.Write(buf) 10427 return int64(length), err 10428 } 10429 10430 // Construct a slice backed by dst's underlying memory. 10431 var buf []byte 10432 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10433 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10434 hdr.Len = n.SizeBytes() 10435 hdr.Cap = n.SizeBytes() 10436 10437 length, err := writer.Write(buf) 10438 // Since we bypassed the compiler's escape analysis, indicate that n 10439 // must live until the use above. 10440 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10441 return int64(length), err 10442 } 10443 10444 // SizeBytes implements marshal.Marshallable.SizeBytes. 10445 func (n *NfNATIPV4Range) SizeBytes() int { 10446 return 8 + 10447 1*4 + 10448 1*4 10449 } 10450 10451 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10452 func (n *NfNATIPV4Range) MarshalBytes(dst []byte) []byte { 10453 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 10454 dst = dst[4:] 10455 for idx := 0; idx < 4; idx++ { 10456 dst[0] = byte(n.MinIP[idx]) 10457 dst = dst[1:] 10458 } 10459 for idx := 0; idx < 4; idx++ { 10460 dst[0] = byte(n.MaxIP[idx]) 10461 dst = dst[1:] 10462 } 10463 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinPort)) 10464 dst = dst[2:] 10465 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxPort)) 10466 dst = dst[2:] 10467 return dst 10468 } 10469 10470 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10471 func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) []byte { 10472 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10473 src = src[4:] 10474 for idx := 0; idx < 4; idx++ { 10475 n.MinIP[idx] = src[0] 10476 src = src[1:] 10477 } 10478 for idx := 0; idx < 4; idx++ { 10479 n.MaxIP[idx] = src[0] 10480 src = src[1:] 10481 } 10482 n.MinPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10483 src = src[2:] 10484 n.MaxPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10485 src = src[2:] 10486 return src 10487 } 10488 10489 // Packed implements marshal.Marshallable.Packed. 10490 //go:nosplit 10491 func (n *NfNATIPV4Range) Packed() bool { 10492 return true 10493 } 10494 10495 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10496 func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) []byte { 10497 size := n.SizeBytes() 10498 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10499 return dst[size:] 10500 } 10501 10502 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10503 func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) []byte { 10504 size := n.SizeBytes() 10505 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10506 return src[size:] 10507 } 10508 10509 // CopyOutN implements marshal.Marshallable.CopyOutN. 10510 func (n *NfNATIPV4Range) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10511 // Construct a slice backed by dst's underlying memory. 10512 var buf []byte 10513 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10514 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10515 hdr.Len = n.SizeBytes() 10516 hdr.Cap = n.SizeBytes() 10517 10518 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10519 // Since we bypassed the compiler's escape analysis, indicate that n 10520 // must live until the use above. 10521 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10522 return length, err 10523 } 10524 10525 // CopyOut implements marshal.Marshallable.CopyOut. 10526 func (n *NfNATIPV4Range) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10527 return n.CopyOutN(cc, addr, n.SizeBytes()) 10528 } 10529 10530 // CopyInN implements marshal.Marshallable.CopyInN. 10531 func (n *NfNATIPV4Range) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10532 // Construct a slice backed by dst's underlying memory. 10533 var buf []byte 10534 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10535 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10536 hdr.Len = n.SizeBytes() 10537 hdr.Cap = n.SizeBytes() 10538 10539 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10540 // Since we bypassed the compiler's escape analysis, indicate that n 10541 // must live until the use above. 10542 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10543 return length, err 10544 } 10545 10546 // CopyIn implements marshal.Marshallable.CopyIn. 10547 func (n *NfNATIPV4Range) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10548 return n.CopyInN(cc, addr, n.SizeBytes()) 10549 } 10550 10551 // WriteTo implements io.WriterTo.WriteTo. 10552 func (n *NfNATIPV4Range) WriteTo(writer io.Writer) (int64, error) { 10553 // Construct a slice backed by dst's underlying memory. 10554 var buf []byte 10555 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10556 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10557 hdr.Len = n.SizeBytes() 10558 hdr.Cap = n.SizeBytes() 10559 10560 length, err := writer.Write(buf) 10561 // Since we bypassed the compiler's escape analysis, indicate that n 10562 // must live until the use above. 10563 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10564 return int64(length), err 10565 } 10566 10567 // SizeBytes implements marshal.Marshallable.SizeBytes. 10568 //go:nosplit 10569 func (tn *TableName) SizeBytes() int { 10570 return 1 * XT_TABLE_MAXNAMELEN 10571 } 10572 10573 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10574 func (tn *TableName) MarshalBytes(dst []byte) []byte { 10575 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 10576 dst[0] = byte(tn[idx]) 10577 dst = dst[1:] 10578 } 10579 return dst 10580 } 10581 10582 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10583 func (tn *TableName) UnmarshalBytes(src []byte) []byte { 10584 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 10585 tn[idx] = src[0] 10586 src = src[1:] 10587 } 10588 return src 10589 } 10590 10591 // Packed implements marshal.Marshallable.Packed. 10592 //go:nosplit 10593 func (tn *TableName) Packed() bool { 10594 // Array newtypes are always packed. 10595 return true 10596 } 10597 10598 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10599 func (tn *TableName) MarshalUnsafe(dst []byte) []byte { 10600 size := tn.SizeBytes() 10601 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(size)) 10602 return dst[size:] 10603 } 10604 10605 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10606 func (tn *TableName) UnmarshalUnsafe(src []byte) []byte { 10607 size := tn.SizeBytes() 10608 gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(size)) 10609 return src[size:] 10610 } 10611 10612 // CopyOutN implements marshal.Marshallable.CopyOutN. 10613 func (tn *TableName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10614 // Construct a slice backed by dst's underlying memory. 10615 var buf []byte 10616 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10617 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10618 hdr.Len = tn.SizeBytes() 10619 hdr.Cap = tn.SizeBytes() 10620 10621 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10622 // Since we bypassed the compiler's escape analysis, indicate that tn 10623 // must live until the use above. 10624 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10625 return length, err 10626 } 10627 10628 // CopyOut implements marshal.Marshallable.CopyOut. 10629 func (tn *TableName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10630 return tn.CopyOutN(cc, addr, tn.SizeBytes()) 10631 } 10632 10633 // CopyInN implements marshal.Marshallable.CopyInN. 10634 func (tn *TableName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10635 // Construct a slice backed by dst's underlying memory. 10636 var buf []byte 10637 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10638 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10639 hdr.Len = tn.SizeBytes() 10640 hdr.Cap = tn.SizeBytes() 10641 10642 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10643 // Since we bypassed the compiler's escape analysis, indicate that tn 10644 // must live until the use above. 10645 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10646 return length, err 10647 } 10648 10649 // CopyIn implements marshal.Marshallable.CopyIn. 10650 func (tn *TableName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10651 return tn.CopyInN(cc, addr, tn.SizeBytes()) 10652 } 10653 10654 // WriteTo implements io.WriterTo.WriteTo. 10655 func (tn *TableName) WriteTo(writer io.Writer) (int64, error) { 10656 // Construct a slice backed by dst's underlying memory. 10657 var buf []byte 10658 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10659 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10660 hdr.Len = tn.SizeBytes() 10661 hdr.Cap = tn.SizeBytes() 10662 10663 length, err := writer.Write(buf) 10664 // Since we bypassed the compiler's escape analysis, indicate that tn 10665 // must live until the use above. 10666 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10667 return int64(length), err 10668 } 10669 10670 // SizeBytes implements marshal.Marshallable.SizeBytes. 10671 func (x *XTCounters) SizeBytes() int { 10672 return 16 10673 } 10674 10675 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10676 func (x *XTCounters) MarshalBytes(dst []byte) []byte { 10677 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Pcnt)) 10678 dst = dst[8:] 10679 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Bcnt)) 10680 dst = dst[8:] 10681 return dst 10682 } 10683 10684 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10685 func (x *XTCounters) UnmarshalBytes(src []byte) []byte { 10686 x.Pcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10687 src = src[8:] 10688 x.Bcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10689 src = src[8:] 10690 return src 10691 } 10692 10693 // Packed implements marshal.Marshallable.Packed. 10694 //go:nosplit 10695 func (x *XTCounters) Packed() bool { 10696 return true 10697 } 10698 10699 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10700 func (x *XTCounters) MarshalUnsafe(dst []byte) []byte { 10701 size := x.SizeBytes() 10702 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10703 return dst[size:] 10704 } 10705 10706 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10707 func (x *XTCounters) UnmarshalUnsafe(src []byte) []byte { 10708 size := x.SizeBytes() 10709 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10710 return src[size:] 10711 } 10712 10713 // CopyOutN implements marshal.Marshallable.CopyOutN. 10714 func (x *XTCounters) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10715 // Construct a slice backed by dst's underlying memory. 10716 var buf []byte 10717 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10718 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10719 hdr.Len = x.SizeBytes() 10720 hdr.Cap = x.SizeBytes() 10721 10722 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10723 // Since we bypassed the compiler's escape analysis, indicate that x 10724 // must live until the use above. 10725 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10726 return length, err 10727 } 10728 10729 // CopyOut implements marshal.Marshallable.CopyOut. 10730 func (x *XTCounters) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10731 return x.CopyOutN(cc, addr, x.SizeBytes()) 10732 } 10733 10734 // CopyInN implements marshal.Marshallable.CopyInN. 10735 func (x *XTCounters) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10736 // Construct a slice backed by dst's underlying memory. 10737 var buf []byte 10738 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10739 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10740 hdr.Len = x.SizeBytes() 10741 hdr.Cap = x.SizeBytes() 10742 10743 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10744 // Since we bypassed the compiler's escape analysis, indicate that x 10745 // must live until the use above. 10746 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10747 return length, err 10748 } 10749 10750 // CopyIn implements marshal.Marshallable.CopyIn. 10751 func (x *XTCounters) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10752 return x.CopyInN(cc, addr, x.SizeBytes()) 10753 } 10754 10755 // WriteTo implements io.WriterTo.WriteTo. 10756 func (x *XTCounters) WriteTo(writer io.Writer) (int64, error) { 10757 // Construct a slice backed by dst's underlying memory. 10758 var buf []byte 10759 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10760 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10761 hdr.Len = x.SizeBytes() 10762 hdr.Cap = x.SizeBytes() 10763 10764 length, err := writer.Write(buf) 10765 // Since we bypassed the compiler's escape analysis, indicate that x 10766 // must live until the use above. 10767 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10768 return int64(length), err 10769 } 10770 10771 // SizeBytes implements marshal.Marshallable.SizeBytes. 10772 func (x *XTEntryMatch) SizeBytes() int { 10773 return 3 + 10774 (*ExtensionName)(nil).SizeBytes() 10775 } 10776 10777 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10778 func (x *XTEntryMatch) MarshalBytes(dst []byte) []byte { 10779 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.MatchSize)) 10780 dst = dst[2:] 10781 dst = x.Name.MarshalUnsafe(dst) 10782 dst[0] = byte(x.Revision) 10783 dst = dst[1:] 10784 return dst 10785 } 10786 10787 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10788 func (x *XTEntryMatch) UnmarshalBytes(src []byte) []byte { 10789 x.MatchSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10790 src = src[2:] 10791 src = x.Name.UnmarshalUnsafe(src) 10792 x.Revision = uint8(src[0]) 10793 src = src[1:] 10794 return src 10795 } 10796 10797 // Packed implements marshal.Marshallable.Packed. 10798 //go:nosplit 10799 func (x *XTEntryMatch) Packed() bool { 10800 return x.Name.Packed() 10801 } 10802 10803 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10804 func (x *XTEntryMatch) MarshalUnsafe(dst []byte) []byte { 10805 if x.Name.Packed() { 10806 size := x.SizeBytes() 10807 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10808 return dst[size:] 10809 } 10810 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes. 10811 return x.MarshalBytes(dst) 10812 } 10813 10814 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10815 func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) []byte { 10816 if x.Name.Packed() { 10817 size := x.SizeBytes() 10818 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10819 return src[size:] 10820 } 10821 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10822 return x.UnmarshalBytes(src) 10823 } 10824 10825 // CopyOutN implements marshal.Marshallable.CopyOutN. 10826 func (x *XTEntryMatch) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10827 if !x.Name.Packed() { 10828 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10829 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10830 x.MarshalBytes(buf) // escapes: fallback. 10831 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10832 } 10833 10834 // Construct a slice backed by dst's underlying memory. 10835 var buf []byte 10836 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10837 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10838 hdr.Len = x.SizeBytes() 10839 hdr.Cap = x.SizeBytes() 10840 10841 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10842 // Since we bypassed the compiler's escape analysis, indicate that x 10843 // must live until the use above. 10844 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10845 return length, err 10846 } 10847 10848 // CopyOut implements marshal.Marshallable.CopyOut. 10849 func (x *XTEntryMatch) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10850 return x.CopyOutN(cc, addr, x.SizeBytes()) 10851 } 10852 10853 // CopyInN implements marshal.Marshallable.CopyInN. 10854 func (x *XTEntryMatch) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10855 if !x.Name.Packed() { 10856 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10857 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10858 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10859 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10860 // partially unmarshalled struct. 10861 x.UnmarshalBytes(buf) // escapes: fallback. 10862 return length, err 10863 } 10864 10865 // Construct a slice backed by dst's underlying memory. 10866 var buf []byte 10867 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10868 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10869 hdr.Len = x.SizeBytes() 10870 hdr.Cap = x.SizeBytes() 10871 10872 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10873 // Since we bypassed the compiler's escape analysis, indicate that x 10874 // must live until the use above. 10875 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10876 return length, err 10877 } 10878 10879 // CopyIn implements marshal.Marshallable.CopyIn. 10880 func (x *XTEntryMatch) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10881 return x.CopyInN(cc, addr, x.SizeBytes()) 10882 } 10883 10884 // WriteTo implements io.WriterTo.WriteTo. 10885 func (x *XTEntryMatch) WriteTo(writer io.Writer) (int64, error) { 10886 if !x.Name.Packed() { 10887 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10888 buf := make([]byte, x.SizeBytes()) 10889 x.MarshalBytes(buf) 10890 length, err := writer.Write(buf) 10891 return int64(length), err 10892 } 10893 10894 // Construct a slice backed by dst's underlying memory. 10895 var buf []byte 10896 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10897 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10898 hdr.Len = x.SizeBytes() 10899 hdr.Cap = x.SizeBytes() 10900 10901 length, err := writer.Write(buf) 10902 // Since we bypassed the compiler's escape analysis, indicate that x 10903 // must live until the use above. 10904 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10905 return int64(length), err 10906 } 10907 10908 // SizeBytes implements marshal.Marshallable.SizeBytes. 10909 func (x *XTEntryTarget) SizeBytes() int { 10910 return 3 + 10911 (*ExtensionName)(nil).SizeBytes() 10912 } 10913 10914 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10915 func (x *XTEntryTarget) MarshalBytes(dst []byte) []byte { 10916 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.TargetSize)) 10917 dst = dst[2:] 10918 dst = x.Name.MarshalUnsafe(dst) 10919 dst[0] = byte(x.Revision) 10920 dst = dst[1:] 10921 return dst 10922 } 10923 10924 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10925 func (x *XTEntryTarget) UnmarshalBytes(src []byte) []byte { 10926 x.TargetSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10927 src = src[2:] 10928 src = x.Name.UnmarshalUnsafe(src) 10929 x.Revision = uint8(src[0]) 10930 src = src[1:] 10931 return src 10932 } 10933 10934 // Packed implements marshal.Marshallable.Packed. 10935 //go:nosplit 10936 func (x *XTEntryTarget) Packed() bool { 10937 return x.Name.Packed() 10938 } 10939 10940 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10941 func (x *XTEntryTarget) MarshalUnsafe(dst []byte) []byte { 10942 if x.Name.Packed() { 10943 size := x.SizeBytes() 10944 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10945 return dst[size:] 10946 } 10947 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10948 return x.MarshalBytes(dst) 10949 } 10950 10951 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10952 func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) []byte { 10953 if x.Name.Packed() { 10954 size := x.SizeBytes() 10955 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10956 return src[size:] 10957 } 10958 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10959 return x.UnmarshalBytes(src) 10960 } 10961 10962 // CopyOutN implements marshal.Marshallable.CopyOutN. 10963 func (x *XTEntryTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10964 if !x.Name.Packed() { 10965 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10966 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10967 x.MarshalBytes(buf) // escapes: fallback. 10968 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10969 } 10970 10971 // Construct a slice backed by dst's underlying memory. 10972 var buf []byte 10973 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10974 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10975 hdr.Len = x.SizeBytes() 10976 hdr.Cap = x.SizeBytes() 10977 10978 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10979 // Since we bypassed the compiler's escape analysis, indicate that x 10980 // must live until the use above. 10981 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10982 return length, err 10983 } 10984 10985 // CopyOut implements marshal.Marshallable.CopyOut. 10986 func (x *XTEntryTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10987 return x.CopyOutN(cc, addr, x.SizeBytes()) 10988 } 10989 10990 // CopyInN implements marshal.Marshallable.CopyInN. 10991 func (x *XTEntryTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10992 if !x.Name.Packed() { 10993 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10994 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10995 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10996 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10997 // partially unmarshalled struct. 10998 x.UnmarshalBytes(buf) // escapes: fallback. 10999 return length, err 11000 } 11001 11002 // Construct a slice backed by dst's underlying memory. 11003 var buf []byte 11004 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11005 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11006 hdr.Len = x.SizeBytes() 11007 hdr.Cap = x.SizeBytes() 11008 11009 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11010 // Since we bypassed the compiler's escape analysis, indicate that x 11011 // must live until the use above. 11012 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11013 return length, err 11014 } 11015 11016 // CopyIn implements marshal.Marshallable.CopyIn. 11017 func (x *XTEntryTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11018 return x.CopyInN(cc, addr, x.SizeBytes()) 11019 } 11020 11021 // WriteTo implements io.WriterTo.WriteTo. 11022 func (x *XTEntryTarget) WriteTo(writer io.Writer) (int64, error) { 11023 if !x.Name.Packed() { 11024 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11025 buf := make([]byte, x.SizeBytes()) 11026 x.MarshalBytes(buf) 11027 length, err := writer.Write(buf) 11028 return int64(length), err 11029 } 11030 11031 // Construct a slice backed by dst's underlying memory. 11032 var buf []byte 11033 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11034 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11035 hdr.Len = x.SizeBytes() 11036 hdr.Cap = x.SizeBytes() 11037 11038 length, err := writer.Write(buf) 11039 // Since we bypassed the compiler's escape analysis, indicate that x 11040 // must live until the use above. 11041 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11042 return int64(length), err 11043 } 11044 11045 // SizeBytes implements marshal.Marshallable.SizeBytes. 11046 func (x *XTErrorTarget) SizeBytes() int { 11047 return 0 + 11048 (*XTEntryTarget)(nil).SizeBytes() + 11049 (*ErrorName)(nil).SizeBytes() + 11050 1*2 11051 } 11052 11053 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11054 func (x *XTErrorTarget) MarshalBytes(dst []byte) []byte { 11055 dst = x.Target.MarshalUnsafe(dst) 11056 dst = x.Name.MarshalUnsafe(dst) 11057 // Padding: dst[:sizeof(byte)*2] ~= [2]byte{0} 11058 dst = dst[1*(2):] 11059 return dst 11060 } 11061 11062 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11063 func (x *XTErrorTarget) UnmarshalBytes(src []byte) []byte { 11064 src = x.Target.UnmarshalUnsafe(src) 11065 src = x.Name.UnmarshalUnsafe(src) 11066 // Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2]) 11067 src = src[1*(2):] 11068 return src 11069 } 11070 11071 // Packed implements marshal.Marshallable.Packed. 11072 //go:nosplit 11073 func (x *XTErrorTarget) Packed() bool { 11074 return x.Name.Packed() && x.Target.Packed() 11075 } 11076 11077 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11078 func (x *XTErrorTarget) MarshalUnsafe(dst []byte) []byte { 11079 if x.Name.Packed() && x.Target.Packed() { 11080 size := x.SizeBytes() 11081 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11082 return dst[size:] 11083 } 11084 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11085 return x.MarshalBytes(dst) 11086 } 11087 11088 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11089 func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) []byte { 11090 if x.Name.Packed() && x.Target.Packed() { 11091 size := x.SizeBytes() 11092 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11093 return src[size:] 11094 } 11095 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11096 return x.UnmarshalBytes(src) 11097 } 11098 11099 // CopyOutN implements marshal.Marshallable.CopyOutN. 11100 func (x *XTErrorTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11101 if !x.Name.Packed() && x.Target.Packed() { 11102 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11103 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11104 x.MarshalBytes(buf) // escapes: fallback. 11105 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11106 } 11107 11108 // Construct a slice backed by dst's underlying memory. 11109 var buf []byte 11110 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11111 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11112 hdr.Len = x.SizeBytes() 11113 hdr.Cap = x.SizeBytes() 11114 11115 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11116 // Since we bypassed the compiler's escape analysis, indicate that x 11117 // must live until the use above. 11118 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11119 return length, err 11120 } 11121 11122 // CopyOut implements marshal.Marshallable.CopyOut. 11123 func (x *XTErrorTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11124 return x.CopyOutN(cc, addr, x.SizeBytes()) 11125 } 11126 11127 // CopyInN implements marshal.Marshallable.CopyInN. 11128 func (x *XTErrorTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11129 if !x.Name.Packed() && x.Target.Packed() { 11130 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11131 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11132 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11133 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11134 // partially unmarshalled struct. 11135 x.UnmarshalBytes(buf) // escapes: fallback. 11136 return length, err 11137 } 11138 11139 // Construct a slice backed by dst's underlying memory. 11140 var buf []byte 11141 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11142 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11143 hdr.Len = x.SizeBytes() 11144 hdr.Cap = x.SizeBytes() 11145 11146 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11147 // Since we bypassed the compiler's escape analysis, indicate that x 11148 // must live until the use above. 11149 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11150 return length, err 11151 } 11152 11153 // CopyIn implements marshal.Marshallable.CopyIn. 11154 func (x *XTErrorTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11155 return x.CopyInN(cc, addr, x.SizeBytes()) 11156 } 11157 11158 // WriteTo implements io.WriterTo.WriteTo. 11159 func (x *XTErrorTarget) WriteTo(writer io.Writer) (int64, error) { 11160 if !x.Name.Packed() && x.Target.Packed() { 11161 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11162 buf := make([]byte, x.SizeBytes()) 11163 x.MarshalBytes(buf) 11164 length, err := writer.Write(buf) 11165 return int64(length), err 11166 } 11167 11168 // Construct a slice backed by dst's underlying memory. 11169 var buf []byte 11170 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11171 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11172 hdr.Len = x.SizeBytes() 11173 hdr.Cap = x.SizeBytes() 11174 11175 length, err := writer.Write(buf) 11176 // Since we bypassed the compiler's escape analysis, indicate that x 11177 // must live until the use above. 11178 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11179 return int64(length), err 11180 } 11181 11182 // SizeBytes implements marshal.Marshallable.SizeBytes. 11183 func (x *XTGetRevision) SizeBytes() int { 11184 return 1 + 11185 (*ExtensionName)(nil).SizeBytes() 11186 } 11187 11188 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11189 func (x *XTGetRevision) MarshalBytes(dst []byte) []byte { 11190 dst = x.Name.MarshalUnsafe(dst) 11191 dst[0] = byte(x.Revision) 11192 dst = dst[1:] 11193 return dst 11194 } 11195 11196 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11197 func (x *XTGetRevision) UnmarshalBytes(src []byte) []byte { 11198 src = x.Name.UnmarshalUnsafe(src) 11199 x.Revision = uint8(src[0]) 11200 src = src[1:] 11201 return src 11202 } 11203 11204 // Packed implements marshal.Marshallable.Packed. 11205 //go:nosplit 11206 func (x *XTGetRevision) Packed() bool { 11207 return x.Name.Packed() 11208 } 11209 11210 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11211 func (x *XTGetRevision) MarshalUnsafe(dst []byte) []byte { 11212 if x.Name.Packed() { 11213 size := x.SizeBytes() 11214 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11215 return dst[size:] 11216 } 11217 // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes. 11218 return x.MarshalBytes(dst) 11219 } 11220 11221 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11222 func (x *XTGetRevision) UnmarshalUnsafe(src []byte) []byte { 11223 if x.Name.Packed() { 11224 size := x.SizeBytes() 11225 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11226 return src[size:] 11227 } 11228 // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11229 return x.UnmarshalBytes(src) 11230 } 11231 11232 // CopyOutN implements marshal.Marshallable.CopyOutN. 11233 func (x *XTGetRevision) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11234 if !x.Name.Packed() { 11235 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 11236 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11237 x.MarshalBytes(buf) // escapes: fallback. 11238 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11239 } 11240 11241 // Construct a slice backed by dst's underlying memory. 11242 var buf []byte 11243 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11244 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11245 hdr.Len = x.SizeBytes() 11246 hdr.Cap = x.SizeBytes() 11247 11248 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11249 // Since we bypassed the compiler's escape analysis, indicate that x 11250 // must live until the use above. 11251 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11252 return length, err 11253 } 11254 11255 // CopyOut implements marshal.Marshallable.CopyOut. 11256 func (x *XTGetRevision) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11257 return x.CopyOutN(cc, addr, x.SizeBytes()) 11258 } 11259 11260 // CopyInN implements marshal.Marshallable.CopyInN. 11261 func (x *XTGetRevision) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11262 if !x.Name.Packed() { 11263 // Type XTGetRevision doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11264 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11265 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11266 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11267 // partially unmarshalled struct. 11268 x.UnmarshalBytes(buf) // escapes: fallback. 11269 return length, err 11270 } 11271 11272 // Construct a slice backed by dst's underlying memory. 11273 var buf []byte 11274 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11275 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11276 hdr.Len = x.SizeBytes() 11277 hdr.Cap = x.SizeBytes() 11278 11279 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11280 // Since we bypassed the compiler's escape analysis, indicate that x 11281 // must live until the use above. 11282 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11283 return length, err 11284 } 11285 11286 // CopyIn implements marshal.Marshallable.CopyIn. 11287 func (x *XTGetRevision) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11288 return x.CopyInN(cc, addr, x.SizeBytes()) 11289 } 11290 11291 // WriteTo implements io.WriterTo.WriteTo. 11292 func (x *XTGetRevision) WriteTo(writer io.Writer) (int64, error) { 11293 if !x.Name.Packed() { 11294 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 11295 buf := make([]byte, x.SizeBytes()) 11296 x.MarshalBytes(buf) 11297 length, err := writer.Write(buf) 11298 return int64(length), err 11299 } 11300 11301 // Construct a slice backed by dst's underlying memory. 11302 var buf []byte 11303 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11304 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11305 hdr.Len = x.SizeBytes() 11306 hdr.Cap = x.SizeBytes() 11307 11308 length, err := writer.Write(buf) 11309 // Since we bypassed the compiler's escape analysis, indicate that x 11310 // must live until the use above. 11311 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11312 return int64(length), err 11313 } 11314 11315 // SizeBytes implements marshal.Marshallable.SizeBytes. 11316 func (x *XTRedirectTarget) SizeBytes() int { 11317 return 0 + 11318 (*XTEntryTarget)(nil).SizeBytes() + 11319 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 11320 1*4 11321 } 11322 11323 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11324 func (x *XTRedirectTarget) MarshalBytes(dst []byte) []byte { 11325 dst = x.Target.MarshalUnsafe(dst) 11326 dst = x.NfRange.MarshalUnsafe(dst) 11327 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11328 dst = dst[1*(4):] 11329 return dst 11330 } 11331 11332 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11333 func (x *XTRedirectTarget) UnmarshalBytes(src []byte) []byte { 11334 src = x.Target.UnmarshalUnsafe(src) 11335 src = x.NfRange.UnmarshalUnsafe(src) 11336 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 11337 src = src[1*(4):] 11338 return src 11339 } 11340 11341 // Packed implements marshal.Marshallable.Packed. 11342 //go:nosplit 11343 func (x *XTRedirectTarget) Packed() bool { 11344 return x.NfRange.Packed() && x.Target.Packed() 11345 } 11346 11347 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11348 func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) []byte { 11349 if x.NfRange.Packed() && x.Target.Packed() { 11350 size := x.SizeBytes() 11351 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11352 return dst[size:] 11353 } 11354 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11355 return x.MarshalBytes(dst) 11356 } 11357 11358 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11359 func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) []byte { 11360 if x.NfRange.Packed() && x.Target.Packed() { 11361 size := x.SizeBytes() 11362 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11363 return src[size:] 11364 } 11365 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11366 return x.UnmarshalBytes(src) 11367 } 11368 11369 // CopyOutN implements marshal.Marshallable.CopyOutN. 11370 func (x *XTRedirectTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11371 if !x.NfRange.Packed() && x.Target.Packed() { 11372 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11373 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11374 x.MarshalBytes(buf) // escapes: fallback. 11375 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11376 } 11377 11378 // Construct a slice backed by dst's underlying memory. 11379 var buf []byte 11380 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11381 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11382 hdr.Len = x.SizeBytes() 11383 hdr.Cap = x.SizeBytes() 11384 11385 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11386 // Since we bypassed the compiler's escape analysis, indicate that x 11387 // must live until the use above. 11388 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11389 return length, err 11390 } 11391 11392 // CopyOut implements marshal.Marshallable.CopyOut. 11393 func (x *XTRedirectTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11394 return x.CopyOutN(cc, addr, x.SizeBytes()) 11395 } 11396 11397 // CopyInN implements marshal.Marshallable.CopyInN. 11398 func (x *XTRedirectTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11399 if !x.NfRange.Packed() && x.Target.Packed() { 11400 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11401 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11402 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11403 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11404 // partially unmarshalled struct. 11405 x.UnmarshalBytes(buf) // escapes: fallback. 11406 return length, err 11407 } 11408 11409 // Construct a slice backed by dst's underlying memory. 11410 var buf []byte 11411 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11412 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11413 hdr.Len = x.SizeBytes() 11414 hdr.Cap = x.SizeBytes() 11415 11416 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11417 // Since we bypassed the compiler's escape analysis, indicate that x 11418 // must live until the use above. 11419 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11420 return length, err 11421 } 11422 11423 // CopyIn implements marshal.Marshallable.CopyIn. 11424 func (x *XTRedirectTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11425 return x.CopyInN(cc, addr, x.SizeBytes()) 11426 } 11427 11428 // WriteTo implements io.WriterTo.WriteTo. 11429 func (x *XTRedirectTarget) WriteTo(writer io.Writer) (int64, error) { 11430 if !x.NfRange.Packed() && x.Target.Packed() { 11431 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11432 buf := make([]byte, x.SizeBytes()) 11433 x.MarshalBytes(buf) 11434 length, err := writer.Write(buf) 11435 return int64(length), err 11436 } 11437 11438 // Construct a slice backed by dst's underlying memory. 11439 var buf []byte 11440 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11441 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11442 hdr.Len = x.SizeBytes() 11443 hdr.Cap = x.SizeBytes() 11444 11445 length, err := writer.Write(buf) 11446 // Since we bypassed the compiler's escape analysis, indicate that x 11447 // must live until the use above. 11448 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11449 return int64(length), err 11450 } 11451 11452 // SizeBytes implements marshal.Marshallable.SizeBytes. 11453 func (x *XTSNATTarget) SizeBytes() int { 11454 return 0 + 11455 (*XTEntryTarget)(nil).SizeBytes() + 11456 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 11457 1*4 11458 } 11459 11460 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11461 func (x *XTSNATTarget) MarshalBytes(dst []byte) []byte { 11462 dst = x.Target.MarshalUnsafe(dst) 11463 dst = x.NfRange.MarshalUnsafe(dst) 11464 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11465 dst = dst[1*(4):] 11466 return dst 11467 } 11468 11469 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11470 func (x *XTSNATTarget) UnmarshalBytes(src []byte) []byte { 11471 src = x.Target.UnmarshalUnsafe(src) 11472 src = x.NfRange.UnmarshalUnsafe(src) 11473 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 11474 src = src[1*(4):] 11475 return src 11476 } 11477 11478 // Packed implements marshal.Marshallable.Packed. 11479 //go:nosplit 11480 func (x *XTSNATTarget) Packed() bool { 11481 return x.NfRange.Packed() && x.Target.Packed() 11482 } 11483 11484 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11485 func (x *XTSNATTarget) MarshalUnsafe(dst []byte) []byte { 11486 if x.NfRange.Packed() && x.Target.Packed() { 11487 size := x.SizeBytes() 11488 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11489 return dst[size:] 11490 } 11491 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11492 return x.MarshalBytes(dst) 11493 } 11494 11495 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11496 func (x *XTSNATTarget) UnmarshalUnsafe(src []byte) []byte { 11497 if x.NfRange.Packed() && x.Target.Packed() { 11498 size := x.SizeBytes() 11499 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11500 return src[size:] 11501 } 11502 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11503 return x.UnmarshalBytes(src) 11504 } 11505 11506 // CopyOutN implements marshal.Marshallable.CopyOutN. 11507 func (x *XTSNATTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11508 if !x.NfRange.Packed() && x.Target.Packed() { 11509 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11510 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11511 x.MarshalBytes(buf) // escapes: fallback. 11512 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11513 } 11514 11515 // Construct a slice backed by dst's underlying memory. 11516 var buf []byte 11517 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11518 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11519 hdr.Len = x.SizeBytes() 11520 hdr.Cap = x.SizeBytes() 11521 11522 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11523 // Since we bypassed the compiler's escape analysis, indicate that x 11524 // must live until the use above. 11525 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11526 return length, err 11527 } 11528 11529 // CopyOut implements marshal.Marshallable.CopyOut. 11530 func (x *XTSNATTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11531 return x.CopyOutN(cc, addr, x.SizeBytes()) 11532 } 11533 11534 // CopyInN implements marshal.Marshallable.CopyInN. 11535 func (x *XTSNATTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11536 if !x.NfRange.Packed() && x.Target.Packed() { 11537 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11538 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11539 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11540 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11541 // partially unmarshalled struct. 11542 x.UnmarshalBytes(buf) // escapes: fallback. 11543 return length, err 11544 } 11545 11546 // Construct a slice backed by dst's underlying memory. 11547 var buf []byte 11548 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11549 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11550 hdr.Len = x.SizeBytes() 11551 hdr.Cap = x.SizeBytes() 11552 11553 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11554 // Since we bypassed the compiler's escape analysis, indicate that x 11555 // must live until the use above. 11556 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11557 return length, err 11558 } 11559 11560 // CopyIn implements marshal.Marshallable.CopyIn. 11561 func (x *XTSNATTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11562 return x.CopyInN(cc, addr, x.SizeBytes()) 11563 } 11564 11565 // WriteTo implements io.WriterTo.WriteTo. 11566 func (x *XTSNATTarget) WriteTo(writer io.Writer) (int64, error) { 11567 if !x.NfRange.Packed() && x.Target.Packed() { 11568 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11569 buf := make([]byte, x.SizeBytes()) 11570 x.MarshalBytes(buf) 11571 length, err := writer.Write(buf) 11572 return int64(length), err 11573 } 11574 11575 // Construct a slice backed by dst's underlying memory. 11576 var buf []byte 11577 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11578 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11579 hdr.Len = x.SizeBytes() 11580 hdr.Cap = x.SizeBytes() 11581 11582 length, err := writer.Write(buf) 11583 // Since we bypassed the compiler's escape analysis, indicate that x 11584 // must live until the use above. 11585 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11586 return int64(length), err 11587 } 11588 11589 // SizeBytes implements marshal.Marshallable.SizeBytes. 11590 func (x *XTStandardTarget) SizeBytes() int { 11591 return 4 + 11592 (*XTEntryTarget)(nil).SizeBytes() + 11593 1*4 11594 } 11595 11596 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11597 func (x *XTStandardTarget) MarshalBytes(dst []byte) []byte { 11598 dst = x.Target.MarshalUnsafe(dst) 11599 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.Verdict)) 11600 dst = dst[4:] 11601 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11602 dst = dst[1*(4):] 11603 return dst 11604 } 11605 11606 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11607 func (x *XTStandardTarget) UnmarshalBytes(src []byte) []byte { 11608 src = x.Target.UnmarshalUnsafe(src) 11609 x.Verdict = int32(hostarch.ByteOrder.Uint32(src[:4])) 11610 src = src[4:] 11611 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 11612 src = src[1*(4):] 11613 return src 11614 } 11615 11616 // Packed implements marshal.Marshallable.Packed. 11617 //go:nosplit 11618 func (x *XTStandardTarget) Packed() bool { 11619 return x.Target.Packed() 11620 } 11621 11622 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11623 func (x *XTStandardTarget) MarshalUnsafe(dst []byte) []byte { 11624 if x.Target.Packed() { 11625 size := x.SizeBytes() 11626 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11627 return dst[size:] 11628 } 11629 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11630 return x.MarshalBytes(dst) 11631 } 11632 11633 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11634 func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) []byte { 11635 if x.Target.Packed() { 11636 size := x.SizeBytes() 11637 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11638 return src[size:] 11639 } 11640 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11641 return x.UnmarshalBytes(src) 11642 } 11643 11644 // CopyOutN implements marshal.Marshallable.CopyOutN. 11645 func (x *XTStandardTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11646 if !x.Target.Packed() { 11647 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11648 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11649 x.MarshalBytes(buf) // escapes: fallback. 11650 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11651 } 11652 11653 // Construct a slice backed by dst's underlying memory. 11654 var buf []byte 11655 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11656 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11657 hdr.Len = x.SizeBytes() 11658 hdr.Cap = x.SizeBytes() 11659 11660 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11661 // Since we bypassed the compiler's escape analysis, indicate that x 11662 // must live until the use above. 11663 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11664 return length, err 11665 } 11666 11667 // CopyOut implements marshal.Marshallable.CopyOut. 11668 func (x *XTStandardTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11669 return x.CopyOutN(cc, addr, x.SizeBytes()) 11670 } 11671 11672 // CopyInN implements marshal.Marshallable.CopyInN. 11673 func (x *XTStandardTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11674 if !x.Target.Packed() { 11675 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11676 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11677 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11678 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11679 // partially unmarshalled struct. 11680 x.UnmarshalBytes(buf) // escapes: fallback. 11681 return length, err 11682 } 11683 11684 // Construct a slice backed by dst's underlying memory. 11685 var buf []byte 11686 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11687 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11688 hdr.Len = x.SizeBytes() 11689 hdr.Cap = x.SizeBytes() 11690 11691 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11692 // Since we bypassed the compiler's escape analysis, indicate that x 11693 // must live until the use above. 11694 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11695 return length, err 11696 } 11697 11698 // CopyIn implements marshal.Marshallable.CopyIn. 11699 func (x *XTStandardTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11700 return x.CopyInN(cc, addr, x.SizeBytes()) 11701 } 11702 11703 // WriteTo implements io.WriterTo.WriteTo. 11704 func (x *XTStandardTarget) WriteTo(writer io.Writer) (int64, error) { 11705 if !x.Target.Packed() { 11706 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11707 buf := make([]byte, x.SizeBytes()) 11708 x.MarshalBytes(buf) 11709 length, err := writer.Write(buf) 11710 return int64(length), err 11711 } 11712 11713 // Construct a slice backed by dst's underlying memory. 11714 var buf []byte 11715 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11716 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11717 hdr.Len = x.SizeBytes() 11718 hdr.Cap = x.SizeBytes() 11719 11720 length, err := writer.Write(buf) 11721 // Since we bypassed the compiler's escape analysis, indicate that x 11722 // must live until the use above. 11723 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11724 return int64(length), err 11725 } 11726 11727 // SizeBytes implements marshal.Marshallable.SizeBytes. 11728 func (x *XTTCP) SizeBytes() int { 11729 return 12 11730 } 11731 11732 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11733 func (x *XTTCP) MarshalBytes(dst []byte) []byte { 11734 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 11735 dst = dst[2:] 11736 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 11737 dst = dst[2:] 11738 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 11739 dst = dst[2:] 11740 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 11741 dst = dst[2:] 11742 dst[0] = byte(x.Option) 11743 dst = dst[1:] 11744 dst[0] = byte(x.FlagMask) 11745 dst = dst[1:] 11746 dst[0] = byte(x.FlagCompare) 11747 dst = dst[1:] 11748 dst[0] = byte(x.InverseFlags) 11749 dst = dst[1:] 11750 return dst 11751 } 11752 11753 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11754 func (x *XTTCP) UnmarshalBytes(src []byte) []byte { 11755 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11756 src = src[2:] 11757 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11758 src = src[2:] 11759 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11760 src = src[2:] 11761 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11762 src = src[2:] 11763 x.Option = uint8(src[0]) 11764 src = src[1:] 11765 x.FlagMask = uint8(src[0]) 11766 src = src[1:] 11767 x.FlagCompare = uint8(src[0]) 11768 src = src[1:] 11769 x.InverseFlags = uint8(src[0]) 11770 src = src[1:] 11771 return src 11772 } 11773 11774 // Packed implements marshal.Marshallable.Packed. 11775 //go:nosplit 11776 func (x *XTTCP) Packed() bool { 11777 return true 11778 } 11779 11780 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11781 func (x *XTTCP) MarshalUnsafe(dst []byte) []byte { 11782 size := x.SizeBytes() 11783 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11784 return dst[size:] 11785 } 11786 11787 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11788 func (x *XTTCP) UnmarshalUnsafe(src []byte) []byte { 11789 size := x.SizeBytes() 11790 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11791 return src[size:] 11792 } 11793 11794 // CopyOutN implements marshal.Marshallable.CopyOutN. 11795 func (x *XTTCP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11796 // Construct a slice backed by dst's underlying memory. 11797 var buf []byte 11798 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11799 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11800 hdr.Len = x.SizeBytes() 11801 hdr.Cap = x.SizeBytes() 11802 11803 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11804 // Since we bypassed the compiler's escape analysis, indicate that x 11805 // must live until the use above. 11806 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11807 return length, err 11808 } 11809 11810 // CopyOut implements marshal.Marshallable.CopyOut. 11811 func (x *XTTCP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11812 return x.CopyOutN(cc, addr, x.SizeBytes()) 11813 } 11814 11815 // CopyInN implements marshal.Marshallable.CopyInN. 11816 func (x *XTTCP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11817 // Construct a slice backed by dst's underlying memory. 11818 var buf []byte 11819 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11820 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11821 hdr.Len = x.SizeBytes() 11822 hdr.Cap = x.SizeBytes() 11823 11824 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11825 // Since we bypassed the compiler's escape analysis, indicate that x 11826 // must live until the use above. 11827 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11828 return length, err 11829 } 11830 11831 // CopyIn implements marshal.Marshallable.CopyIn. 11832 func (x *XTTCP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11833 return x.CopyInN(cc, addr, x.SizeBytes()) 11834 } 11835 11836 // WriteTo implements io.WriterTo.WriteTo. 11837 func (x *XTTCP) WriteTo(writer io.Writer) (int64, error) { 11838 // Construct a slice backed by dst's underlying memory. 11839 var buf []byte 11840 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11841 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11842 hdr.Len = x.SizeBytes() 11843 hdr.Cap = x.SizeBytes() 11844 11845 length, err := writer.Write(buf) 11846 // Since we bypassed the compiler's escape analysis, indicate that x 11847 // must live until the use above. 11848 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11849 return int64(length), err 11850 } 11851 11852 // SizeBytes implements marshal.Marshallable.SizeBytes. 11853 func (x *XTUDP) SizeBytes() int { 11854 return 10 11855 } 11856 11857 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11858 func (x *XTUDP) MarshalBytes(dst []byte) []byte { 11859 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 11860 dst = dst[2:] 11861 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 11862 dst = dst[2:] 11863 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 11864 dst = dst[2:] 11865 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 11866 dst = dst[2:] 11867 dst[0] = byte(x.InverseFlags) 11868 dst = dst[1:] 11869 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 11870 dst = dst[1:] 11871 return dst 11872 } 11873 11874 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11875 func (x *XTUDP) UnmarshalBytes(src []byte) []byte { 11876 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11877 src = src[2:] 11878 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11879 src = src[2:] 11880 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11881 src = src[2:] 11882 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11883 src = src[2:] 11884 x.InverseFlags = uint8(src[0]) 11885 src = src[1:] 11886 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 11887 src = src[1:] 11888 return src 11889 } 11890 11891 // Packed implements marshal.Marshallable.Packed. 11892 //go:nosplit 11893 func (x *XTUDP) Packed() bool { 11894 return true 11895 } 11896 11897 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11898 func (x *XTUDP) MarshalUnsafe(dst []byte) []byte { 11899 size := x.SizeBytes() 11900 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11901 return dst[size:] 11902 } 11903 11904 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11905 func (x *XTUDP) UnmarshalUnsafe(src []byte) []byte { 11906 size := x.SizeBytes() 11907 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11908 return src[size:] 11909 } 11910 11911 // CopyOutN implements marshal.Marshallable.CopyOutN. 11912 func (x *XTUDP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11913 // Construct a slice backed by dst's underlying memory. 11914 var buf []byte 11915 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11916 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11917 hdr.Len = x.SizeBytes() 11918 hdr.Cap = x.SizeBytes() 11919 11920 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11921 // Since we bypassed the compiler's escape analysis, indicate that x 11922 // must live until the use above. 11923 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11924 return length, err 11925 } 11926 11927 // CopyOut implements marshal.Marshallable.CopyOut. 11928 func (x *XTUDP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11929 return x.CopyOutN(cc, addr, x.SizeBytes()) 11930 } 11931 11932 // CopyInN implements marshal.Marshallable.CopyInN. 11933 func (x *XTUDP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11934 // Construct a slice backed by dst's underlying memory. 11935 var buf []byte 11936 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11937 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11938 hdr.Len = x.SizeBytes() 11939 hdr.Cap = x.SizeBytes() 11940 11941 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11942 // Since we bypassed the compiler's escape analysis, indicate that x 11943 // must live until the use above. 11944 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11945 return length, err 11946 } 11947 11948 // CopyIn implements marshal.Marshallable.CopyIn. 11949 func (x *XTUDP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11950 return x.CopyInN(cc, addr, x.SizeBytes()) 11951 } 11952 11953 // WriteTo implements io.WriterTo.WriteTo. 11954 func (x *XTUDP) WriteTo(writer io.Writer) (int64, error) { 11955 // Construct a slice backed by dst's underlying memory. 11956 var buf []byte 11957 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11958 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11959 hdr.Len = x.SizeBytes() 11960 hdr.Cap = x.SizeBytes() 11961 11962 length, err := writer.Write(buf) 11963 // Since we bypassed the compiler's escape analysis, indicate that x 11964 // must live until the use above. 11965 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11966 return int64(length), err 11967 } 11968 11969 // SizeBytes implements marshal.Marshallable.SizeBytes. 11970 func (i *IP6TEntry) SizeBytes() int { 11971 return 12 + 11972 (*IP6TIP)(nil).SizeBytes() + 11973 1*4 + 11974 (*XTCounters)(nil).SizeBytes() 11975 } 11976 11977 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11978 func (i *IP6TEntry) MarshalBytes(dst []byte) []byte { 11979 dst = i.IPv6.MarshalUnsafe(dst) 11980 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 11981 dst = dst[4:] 11982 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 11983 dst = dst[2:] 11984 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 11985 dst = dst[2:] 11986 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 11987 dst = dst[4:] 11988 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11989 dst = dst[1*(4):] 11990 dst = i.Counters.MarshalUnsafe(dst) 11991 return dst 11992 } 11993 11994 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11995 func (i *IP6TEntry) UnmarshalBytes(src []byte) []byte { 11996 src = i.IPv6.UnmarshalUnsafe(src) 11997 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11998 src = src[4:] 11999 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12000 src = src[2:] 12001 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12002 src = src[2:] 12003 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12004 src = src[4:] 12005 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 12006 src = src[1*(4):] 12007 src = i.Counters.UnmarshalUnsafe(src) 12008 return src 12009 } 12010 12011 // Packed implements marshal.Marshallable.Packed. 12012 //go:nosplit 12013 func (i *IP6TEntry) Packed() bool { 12014 return i.Counters.Packed() && i.IPv6.Packed() 12015 } 12016 12017 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12018 func (i *IP6TEntry) MarshalUnsafe(dst []byte) []byte { 12019 if i.Counters.Packed() && i.IPv6.Packed() { 12020 size := i.SizeBytes() 12021 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12022 return dst[size:] 12023 } 12024 // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 12025 return i.MarshalBytes(dst) 12026 } 12027 12028 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12029 func (i *IP6TEntry) UnmarshalUnsafe(src []byte) []byte { 12030 if i.Counters.Packed() && i.IPv6.Packed() { 12031 size := i.SizeBytes() 12032 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12033 return src[size:] 12034 } 12035 // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12036 return i.UnmarshalBytes(src) 12037 } 12038 12039 // CopyOutN implements marshal.Marshallable.CopyOutN. 12040 func (i *IP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12041 if !i.Counters.Packed() && i.IPv6.Packed() { 12042 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 12043 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12044 i.MarshalBytes(buf) // escapes: fallback. 12045 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12046 } 12047 12048 // Construct a slice backed by dst's underlying memory. 12049 var buf []byte 12050 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12051 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12052 hdr.Len = i.SizeBytes() 12053 hdr.Cap = i.SizeBytes() 12054 12055 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12056 // Since we bypassed the compiler's escape analysis, indicate that i 12057 // must live until the use above. 12058 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12059 return length, err 12060 } 12061 12062 // CopyOut implements marshal.Marshallable.CopyOut. 12063 func (i *IP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12064 return i.CopyOutN(cc, addr, i.SizeBytes()) 12065 } 12066 12067 // CopyInN implements marshal.Marshallable.CopyInN. 12068 func (i *IP6TEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12069 if !i.Counters.Packed() && i.IPv6.Packed() { 12070 // Type IP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12071 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12072 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12073 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12074 // partially unmarshalled struct. 12075 i.UnmarshalBytes(buf) // escapes: fallback. 12076 return length, err 12077 } 12078 12079 // Construct a slice backed by dst's underlying memory. 12080 var buf []byte 12081 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12082 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12083 hdr.Len = i.SizeBytes() 12084 hdr.Cap = i.SizeBytes() 12085 12086 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12087 // Since we bypassed the compiler's escape analysis, indicate that i 12088 // must live until the use above. 12089 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12090 return length, err 12091 } 12092 12093 // CopyIn implements marshal.Marshallable.CopyIn. 12094 func (i *IP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12095 return i.CopyInN(cc, addr, i.SizeBytes()) 12096 } 12097 12098 // WriteTo implements io.WriterTo.WriteTo. 12099 func (i *IP6TEntry) WriteTo(writer io.Writer) (int64, error) { 12100 if !i.Counters.Packed() && i.IPv6.Packed() { 12101 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 12102 buf := make([]byte, i.SizeBytes()) 12103 i.MarshalBytes(buf) 12104 length, err := writer.Write(buf) 12105 return int64(length), err 12106 } 12107 12108 // Construct a slice backed by dst's underlying memory. 12109 var buf []byte 12110 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12111 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12112 hdr.Len = i.SizeBytes() 12113 hdr.Cap = i.SizeBytes() 12114 12115 length, err := writer.Write(buf) 12116 // Since we bypassed the compiler's escape analysis, indicate that i 12117 // must live until the use above. 12118 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12119 return int64(length), err 12120 } 12121 12122 // SizeBytes implements marshal.Marshallable.SizeBytes. 12123 func (i *IP6TIP) SizeBytes() int { 12124 return 5 + 12125 (*Inet6Addr)(nil).SizeBytes() + 12126 (*Inet6Addr)(nil).SizeBytes() + 12127 (*Inet6Addr)(nil).SizeBytes() + 12128 (*Inet6Addr)(nil).SizeBytes() + 12129 1*IFNAMSIZ + 12130 1*IFNAMSIZ + 12131 1*IFNAMSIZ + 12132 1*IFNAMSIZ + 12133 1*3 12134 } 12135 12136 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12137 func (i *IP6TIP) MarshalBytes(dst []byte) []byte { 12138 dst = i.Src.MarshalUnsafe(dst) 12139 dst = i.Dst.MarshalUnsafe(dst) 12140 dst = i.SrcMask.MarshalUnsafe(dst) 12141 dst = i.DstMask.MarshalUnsafe(dst) 12142 for idx := 0; idx < IFNAMSIZ; idx++ { 12143 dst[0] = byte(i.InputInterface[idx]) 12144 dst = dst[1:] 12145 } 12146 for idx := 0; idx < IFNAMSIZ; idx++ { 12147 dst[0] = byte(i.OutputInterface[idx]) 12148 dst = dst[1:] 12149 } 12150 for idx := 0; idx < IFNAMSIZ; idx++ { 12151 dst[0] = byte(i.InputInterfaceMask[idx]) 12152 dst = dst[1:] 12153 } 12154 for idx := 0; idx < IFNAMSIZ; idx++ { 12155 dst[0] = byte(i.OutputInterfaceMask[idx]) 12156 dst = dst[1:] 12157 } 12158 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 12159 dst = dst[2:] 12160 dst[0] = byte(i.TOS) 12161 dst = dst[1:] 12162 dst[0] = byte(i.Flags) 12163 dst = dst[1:] 12164 dst[0] = byte(i.InverseFlags) 12165 dst = dst[1:] 12166 // Padding: dst[:sizeof(byte)*3] ~= [3]byte{0} 12167 dst = dst[1*(3):] 12168 return dst 12169 } 12170 12171 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12172 func (i *IP6TIP) UnmarshalBytes(src []byte) []byte { 12173 src = i.Src.UnmarshalUnsafe(src) 12174 src = i.Dst.UnmarshalUnsafe(src) 12175 src = i.SrcMask.UnmarshalUnsafe(src) 12176 src = i.DstMask.UnmarshalUnsafe(src) 12177 for idx := 0; idx < IFNAMSIZ; idx++ { 12178 i.InputInterface[idx] = src[0] 12179 src = src[1:] 12180 } 12181 for idx := 0; idx < IFNAMSIZ; idx++ { 12182 i.OutputInterface[idx] = src[0] 12183 src = src[1:] 12184 } 12185 for idx := 0; idx < IFNAMSIZ; idx++ { 12186 i.InputInterfaceMask[idx] = src[0] 12187 src = src[1:] 12188 } 12189 for idx := 0; idx < IFNAMSIZ; idx++ { 12190 i.OutputInterfaceMask[idx] = src[0] 12191 src = src[1:] 12192 } 12193 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12194 src = src[2:] 12195 i.TOS = uint8(src[0]) 12196 src = src[1:] 12197 i.Flags = uint8(src[0]) 12198 src = src[1:] 12199 i.InverseFlags = uint8(src[0]) 12200 src = src[1:] 12201 // Padding: ~ copy([3]byte(i._), src[:sizeof(byte)*3]) 12202 src = src[1*(3):] 12203 return src 12204 } 12205 12206 // Packed implements marshal.Marshallable.Packed. 12207 //go:nosplit 12208 func (i *IP6TIP) Packed() bool { 12209 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 12210 } 12211 12212 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12213 func (i *IP6TIP) MarshalUnsafe(dst []byte) []byte { 12214 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12215 size := i.SizeBytes() 12216 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12217 return dst[size:] 12218 } 12219 // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes. 12220 return i.MarshalBytes(dst) 12221 } 12222 12223 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12224 func (i *IP6TIP) UnmarshalUnsafe(src []byte) []byte { 12225 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12226 size := i.SizeBytes() 12227 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12228 return src[size:] 12229 } 12230 // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12231 return i.UnmarshalBytes(src) 12232 } 12233 12234 // CopyOutN implements marshal.Marshallable.CopyOutN. 12235 func (i *IP6TIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12236 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12237 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 12238 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12239 i.MarshalBytes(buf) // escapes: fallback. 12240 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12241 } 12242 12243 // Construct a slice backed by dst's underlying memory. 12244 var buf []byte 12245 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12246 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12247 hdr.Len = i.SizeBytes() 12248 hdr.Cap = i.SizeBytes() 12249 12250 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12251 // Since we bypassed the compiler's escape analysis, indicate that i 12252 // must live until the use above. 12253 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12254 return length, err 12255 } 12256 12257 // CopyOut implements marshal.Marshallable.CopyOut. 12258 func (i *IP6TIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12259 return i.CopyOutN(cc, addr, i.SizeBytes()) 12260 } 12261 12262 // CopyInN implements marshal.Marshallable.CopyInN. 12263 func (i *IP6TIP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12264 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12265 // Type IP6TIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12266 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12267 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12268 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12269 // partially unmarshalled struct. 12270 i.UnmarshalBytes(buf) // escapes: fallback. 12271 return length, err 12272 } 12273 12274 // Construct a slice backed by dst's underlying memory. 12275 var buf []byte 12276 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12277 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12278 hdr.Len = i.SizeBytes() 12279 hdr.Cap = i.SizeBytes() 12280 12281 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12282 // Since we bypassed the compiler's escape analysis, indicate that i 12283 // must live until the use above. 12284 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12285 return length, err 12286 } 12287 12288 // CopyIn implements marshal.Marshallable.CopyIn. 12289 func (i *IP6TIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12290 return i.CopyInN(cc, addr, i.SizeBytes()) 12291 } 12292 12293 // WriteTo implements io.WriterTo.WriteTo. 12294 func (i *IP6TIP) WriteTo(writer io.Writer) (int64, error) { 12295 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12296 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 12297 buf := make([]byte, i.SizeBytes()) 12298 i.MarshalBytes(buf) 12299 length, err := writer.Write(buf) 12300 return int64(length), err 12301 } 12302 12303 // Construct a slice backed by dst's underlying memory. 12304 var buf []byte 12305 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12306 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12307 hdr.Len = i.SizeBytes() 12308 hdr.Cap = i.SizeBytes() 12309 12310 length, err := writer.Write(buf) 12311 // Since we bypassed the compiler's escape analysis, indicate that i 12312 // must live until the use above. 12313 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12314 return int64(length), err 12315 } 12316 12317 // SizeBytes implements marshal.Marshallable.SizeBytes. 12318 func (i *IP6TReplace) SizeBytes() int { 12319 return 24 + 12320 (*TableName)(nil).SizeBytes() + 12321 4*NF_INET_NUMHOOKS + 12322 4*NF_INET_NUMHOOKS 12323 } 12324 12325 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12326 func (i *IP6TReplace) MarshalBytes(dst []byte) []byte { 12327 dst = i.Name.MarshalUnsafe(dst) 12328 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 12329 dst = dst[4:] 12330 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 12331 dst = dst[4:] 12332 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 12333 dst = dst[4:] 12334 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12335 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 12336 dst = dst[4:] 12337 } 12338 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12339 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 12340 dst = dst[4:] 12341 } 12342 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 12343 dst = dst[4:] 12344 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 12345 dst = dst[8:] 12346 return dst 12347 } 12348 12349 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12350 func (i *IP6TReplace) UnmarshalBytes(src []byte) []byte { 12351 src = i.Name.UnmarshalUnsafe(src) 12352 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12353 src = src[4:] 12354 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12355 src = src[4:] 12356 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12357 src = src[4:] 12358 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12359 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12360 src = src[4:] 12361 } 12362 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12363 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12364 src = src[4:] 12365 } 12366 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12367 src = src[4:] 12368 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12369 src = src[8:] 12370 return src 12371 } 12372 12373 // Packed implements marshal.Marshallable.Packed. 12374 //go:nosplit 12375 func (i *IP6TReplace) Packed() bool { 12376 return i.Name.Packed() 12377 } 12378 12379 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12380 func (i *IP6TReplace) MarshalUnsafe(dst []byte) []byte { 12381 if i.Name.Packed() { 12382 size := i.SizeBytes() 12383 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12384 return dst[size:] 12385 } 12386 // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 12387 return i.MarshalBytes(dst) 12388 } 12389 12390 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12391 func (i *IP6TReplace) UnmarshalUnsafe(src []byte) []byte { 12392 if i.Name.Packed() { 12393 size := i.SizeBytes() 12394 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12395 return src[size:] 12396 } 12397 // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12398 return i.UnmarshalBytes(src) 12399 } 12400 12401 // CopyOutN implements marshal.Marshallable.CopyOutN. 12402 func (i *IP6TReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12403 if !i.Name.Packed() { 12404 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 12405 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12406 i.MarshalBytes(buf) // escapes: fallback. 12407 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12408 } 12409 12410 // Construct a slice backed by dst's underlying memory. 12411 var buf []byte 12412 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12413 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12414 hdr.Len = i.SizeBytes() 12415 hdr.Cap = i.SizeBytes() 12416 12417 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12418 // Since we bypassed the compiler's escape analysis, indicate that i 12419 // must live until the use above. 12420 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12421 return length, err 12422 } 12423 12424 // CopyOut implements marshal.Marshallable.CopyOut. 12425 func (i *IP6TReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12426 return i.CopyOutN(cc, addr, i.SizeBytes()) 12427 } 12428 12429 // CopyInN implements marshal.Marshallable.CopyInN. 12430 func (i *IP6TReplace) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12431 if !i.Name.Packed() { 12432 // Type IP6TReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12433 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12434 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12435 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12436 // partially unmarshalled struct. 12437 i.UnmarshalBytes(buf) // escapes: fallback. 12438 return length, err 12439 } 12440 12441 // Construct a slice backed by dst's underlying memory. 12442 var buf []byte 12443 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12444 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12445 hdr.Len = i.SizeBytes() 12446 hdr.Cap = i.SizeBytes() 12447 12448 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12449 // Since we bypassed the compiler's escape analysis, indicate that i 12450 // must live until the use above. 12451 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12452 return length, err 12453 } 12454 12455 // CopyIn implements marshal.Marshallable.CopyIn. 12456 func (i *IP6TReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12457 return i.CopyInN(cc, addr, i.SizeBytes()) 12458 } 12459 12460 // WriteTo implements io.WriterTo.WriteTo. 12461 func (i *IP6TReplace) WriteTo(writer io.Writer) (int64, error) { 12462 if !i.Name.Packed() { 12463 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 12464 buf := make([]byte, i.SizeBytes()) 12465 i.MarshalBytes(buf) 12466 length, err := writer.Write(buf) 12467 return int64(length), err 12468 } 12469 12470 // Construct a slice backed by dst's underlying memory. 12471 var buf []byte 12472 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12473 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12474 hdr.Len = i.SizeBytes() 12475 hdr.Cap = i.SizeBytes() 12476 12477 length, err := writer.Write(buf) 12478 // Since we bypassed the compiler's escape analysis, indicate that i 12479 // must live until the use above. 12480 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12481 return int64(length), err 12482 } 12483 12484 // Packed implements marshal.Marshallable.Packed. 12485 //go:nosplit 12486 func (ke *KernelIP6TEntry) Packed() bool { 12487 // Type KernelIP6TEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 12488 return false 12489 } 12490 12491 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12492 func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) []byte { 12493 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 12494 return ke.MarshalBytes(dst) 12495 } 12496 12497 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12498 func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) []byte { 12499 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12500 return ke.UnmarshalBytes(src) 12501 } 12502 12503 // CopyOutN implements marshal.Marshallable.CopyOutN. 12504 //go:nosplit 12505 func (ke *KernelIP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12506 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 12507 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 12508 ke.MarshalBytes(buf) // escapes: fallback. 12509 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12510 } 12511 12512 // CopyOut implements marshal.Marshallable.CopyOut. 12513 func (ke *KernelIP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12514 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 12515 } 12516 12517 // CopyInN implements marshal.Marshallable.CopyInN. 12518 //go:nosplit 12519 func (ke *KernelIP6TEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12520 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12521 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 12522 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12523 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12524 // partially unmarshalled struct. 12525 ke.UnmarshalBytes(buf) // escapes: fallback. 12526 return length, err 12527 } 12528 12529 // CopyIn implements marshal.Marshallable.CopyIn. 12530 func (ke *KernelIP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12531 return ke.CopyInN(cc, addr, ke.SizeBytes()) 12532 } 12533 12534 // WriteTo implements io.WriterTo.WriteTo. 12535 func (ke *KernelIP6TEntry) WriteTo(writer io.Writer) (int64, error) { 12536 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 12537 buf := make([]byte, ke.SizeBytes()) 12538 ke.MarshalBytes(buf) 12539 length, err := writer.Write(buf) 12540 return int64(length), err 12541 } 12542 12543 // Packed implements marshal.Marshallable.Packed. 12544 //go:nosplit 12545 func (ke *KernelIP6TGetEntries) Packed() bool { 12546 // Type KernelIP6TGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 12547 return false 12548 } 12549 12550 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12551 func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) []byte { 12552 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 12553 return ke.MarshalBytes(dst) 12554 } 12555 12556 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12557 func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) []byte { 12558 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12559 return ke.UnmarshalBytes(src) 12560 } 12561 12562 // CopyOutN implements marshal.Marshallable.CopyOutN. 12563 //go:nosplit 12564 func (ke *KernelIP6TGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12565 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 12566 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 12567 ke.MarshalBytes(buf) // escapes: fallback. 12568 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12569 } 12570 12571 // CopyOut implements marshal.Marshallable.CopyOut. 12572 func (ke *KernelIP6TGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12573 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 12574 } 12575 12576 // CopyInN implements marshal.Marshallable.CopyInN. 12577 //go:nosplit 12578 func (ke *KernelIP6TGetEntries) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12579 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12580 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 12581 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12582 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12583 // partially unmarshalled struct. 12584 ke.UnmarshalBytes(buf) // escapes: fallback. 12585 return length, err 12586 } 12587 12588 // CopyIn implements marshal.Marshallable.CopyIn. 12589 func (ke *KernelIP6TGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12590 return ke.CopyInN(cc, addr, ke.SizeBytes()) 12591 } 12592 12593 // WriteTo implements io.WriterTo.WriteTo. 12594 func (ke *KernelIP6TGetEntries) WriteTo(writer io.Writer) (int64, error) { 12595 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 12596 buf := make([]byte, ke.SizeBytes()) 12597 ke.MarshalBytes(buf) 12598 length, err := writer.Write(buf) 12599 return int64(length), err 12600 } 12601 12602 // SizeBytes implements marshal.Marshallable.SizeBytes. 12603 func (n *NFNATRange) SizeBytes() int { 12604 return 8 + 12605 (*Inet6Addr)(nil).SizeBytes() + 12606 (*Inet6Addr)(nil).SizeBytes() 12607 } 12608 12609 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12610 func (n *NFNATRange) MarshalBytes(dst []byte) []byte { 12611 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 12612 dst = dst[4:] 12613 dst = n.MinAddr.MarshalUnsafe(dst) 12614 dst = n.MaxAddr.MarshalUnsafe(dst) 12615 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto)) 12616 dst = dst[2:] 12617 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto)) 12618 dst = dst[2:] 12619 return dst 12620 } 12621 12622 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12623 func (n *NFNATRange) UnmarshalBytes(src []byte) []byte { 12624 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12625 src = src[4:] 12626 src = n.MinAddr.UnmarshalUnsafe(src) 12627 src = n.MaxAddr.UnmarshalUnsafe(src) 12628 n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12629 src = src[2:] 12630 n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12631 src = src[2:] 12632 return src 12633 } 12634 12635 // Packed implements marshal.Marshallable.Packed. 12636 //go:nosplit 12637 func (n *NFNATRange) Packed() bool { 12638 return n.MaxAddr.Packed() && n.MinAddr.Packed() 12639 } 12640 12641 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12642 func (n *NFNATRange) MarshalUnsafe(dst []byte) []byte { 12643 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 12644 size := n.SizeBytes() 12645 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12646 return dst[size:] 12647 } 12648 // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes. 12649 return n.MarshalBytes(dst) 12650 } 12651 12652 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12653 func (n *NFNATRange) UnmarshalUnsafe(src []byte) []byte { 12654 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 12655 size := n.SizeBytes() 12656 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12657 return src[size:] 12658 } 12659 // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12660 return n.UnmarshalBytes(src) 12661 } 12662 12663 // CopyOutN implements marshal.Marshallable.CopyOutN. 12664 func (n *NFNATRange) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12665 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12666 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 12667 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12668 n.MarshalBytes(buf) // escapes: fallback. 12669 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12670 } 12671 12672 // Construct a slice backed by dst's underlying memory. 12673 var buf []byte 12674 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12675 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12676 hdr.Len = n.SizeBytes() 12677 hdr.Cap = n.SizeBytes() 12678 12679 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12680 // Since we bypassed the compiler's escape analysis, indicate that n 12681 // must live until the use above. 12682 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12683 return length, err 12684 } 12685 12686 // CopyOut implements marshal.Marshallable.CopyOut. 12687 func (n *NFNATRange) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12688 return n.CopyOutN(cc, addr, n.SizeBytes()) 12689 } 12690 12691 // CopyInN implements marshal.Marshallable.CopyInN. 12692 func (n *NFNATRange) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12693 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12694 // Type NFNATRange doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12695 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12696 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12697 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12698 // partially unmarshalled struct. 12699 n.UnmarshalBytes(buf) // escapes: fallback. 12700 return length, err 12701 } 12702 12703 // Construct a slice backed by dst's underlying memory. 12704 var buf []byte 12705 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12706 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12707 hdr.Len = n.SizeBytes() 12708 hdr.Cap = n.SizeBytes() 12709 12710 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12711 // Since we bypassed the compiler's escape analysis, indicate that n 12712 // must live until the use above. 12713 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12714 return length, err 12715 } 12716 12717 // CopyIn implements marshal.Marshallable.CopyIn. 12718 func (n *NFNATRange) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12719 return n.CopyInN(cc, addr, n.SizeBytes()) 12720 } 12721 12722 // WriteTo implements io.WriterTo.WriteTo. 12723 func (n *NFNATRange) WriteTo(writer io.Writer) (int64, error) { 12724 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12725 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 12726 buf := make([]byte, n.SizeBytes()) 12727 n.MarshalBytes(buf) 12728 length, err := writer.Write(buf) 12729 return int64(length), err 12730 } 12731 12732 // Construct a slice backed by dst's underlying memory. 12733 var buf []byte 12734 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12735 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12736 hdr.Len = n.SizeBytes() 12737 hdr.Cap = n.SizeBytes() 12738 12739 length, err := writer.Write(buf) 12740 // Since we bypassed the compiler's escape analysis, indicate that n 12741 // must live until the use above. 12742 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12743 return int64(length), err 12744 } 12745 12746 // SizeBytes implements marshal.Marshallable.SizeBytes. 12747 func (n *NetlinkAttrHeader) SizeBytes() int { 12748 return 4 12749 } 12750 12751 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12752 func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) []byte { 12753 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Length)) 12754 dst = dst[2:] 12755 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 12756 dst = dst[2:] 12757 return dst 12758 } 12759 12760 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12761 func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) []byte { 12762 n.Length = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12763 src = src[2:] 12764 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12765 src = src[2:] 12766 return src 12767 } 12768 12769 // Packed implements marshal.Marshallable.Packed. 12770 //go:nosplit 12771 func (n *NetlinkAttrHeader) Packed() bool { 12772 return true 12773 } 12774 12775 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12776 func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) []byte { 12777 size := n.SizeBytes() 12778 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12779 return dst[size:] 12780 } 12781 12782 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12783 func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) []byte { 12784 size := n.SizeBytes() 12785 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12786 return src[size:] 12787 } 12788 12789 // CopyOutN implements marshal.Marshallable.CopyOutN. 12790 func (n *NetlinkAttrHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12791 // Construct a slice backed by dst's underlying memory. 12792 var buf []byte 12793 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12794 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12795 hdr.Len = n.SizeBytes() 12796 hdr.Cap = n.SizeBytes() 12797 12798 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12799 // Since we bypassed the compiler's escape analysis, indicate that n 12800 // must live until the use above. 12801 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12802 return length, err 12803 } 12804 12805 // CopyOut implements marshal.Marshallable.CopyOut. 12806 func (n *NetlinkAttrHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12807 return n.CopyOutN(cc, addr, n.SizeBytes()) 12808 } 12809 12810 // CopyInN implements marshal.Marshallable.CopyInN. 12811 func (n *NetlinkAttrHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12812 // Construct a slice backed by dst's underlying memory. 12813 var buf []byte 12814 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12815 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12816 hdr.Len = n.SizeBytes() 12817 hdr.Cap = n.SizeBytes() 12818 12819 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12820 // Since we bypassed the compiler's escape analysis, indicate that n 12821 // must live until the use above. 12822 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12823 return length, err 12824 } 12825 12826 // CopyIn implements marshal.Marshallable.CopyIn. 12827 func (n *NetlinkAttrHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12828 return n.CopyInN(cc, addr, n.SizeBytes()) 12829 } 12830 12831 // WriteTo implements io.WriterTo.WriteTo. 12832 func (n *NetlinkAttrHeader) WriteTo(writer io.Writer) (int64, error) { 12833 // Construct a slice backed by dst's underlying memory. 12834 var buf []byte 12835 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12836 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12837 hdr.Len = n.SizeBytes() 12838 hdr.Cap = n.SizeBytes() 12839 12840 length, err := writer.Write(buf) 12841 // Since we bypassed the compiler's escape analysis, indicate that n 12842 // must live until the use above. 12843 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12844 return int64(length), err 12845 } 12846 12847 // SizeBytes implements marshal.Marshallable.SizeBytes. 12848 func (n *NetlinkErrorMessage) SizeBytes() int { 12849 return 4 + 12850 (*NetlinkMessageHeader)(nil).SizeBytes() 12851 } 12852 12853 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12854 func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) []byte { 12855 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Error)) 12856 dst = dst[4:] 12857 dst = n.Header.MarshalUnsafe(dst) 12858 return dst 12859 } 12860 12861 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12862 func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) []byte { 12863 n.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 12864 src = src[4:] 12865 src = n.Header.UnmarshalUnsafe(src) 12866 return src 12867 } 12868 12869 // Packed implements marshal.Marshallable.Packed. 12870 //go:nosplit 12871 func (n *NetlinkErrorMessage) Packed() bool { 12872 return n.Header.Packed() 12873 } 12874 12875 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12876 func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) []byte { 12877 if n.Header.Packed() { 12878 size := n.SizeBytes() 12879 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12880 return dst[size:] 12881 } 12882 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes. 12883 return n.MarshalBytes(dst) 12884 } 12885 12886 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12887 func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) []byte { 12888 if n.Header.Packed() { 12889 size := n.SizeBytes() 12890 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12891 return src[size:] 12892 } 12893 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12894 return n.UnmarshalBytes(src) 12895 } 12896 12897 // CopyOutN implements marshal.Marshallable.CopyOutN. 12898 func (n *NetlinkErrorMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12899 if !n.Header.Packed() { 12900 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 12901 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12902 n.MarshalBytes(buf) // escapes: fallback. 12903 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12904 } 12905 12906 // Construct a slice backed by dst's underlying memory. 12907 var buf []byte 12908 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12909 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12910 hdr.Len = n.SizeBytes() 12911 hdr.Cap = n.SizeBytes() 12912 12913 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12914 // Since we bypassed the compiler's escape analysis, indicate that n 12915 // must live until the use above. 12916 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12917 return length, err 12918 } 12919 12920 // CopyOut implements marshal.Marshallable.CopyOut. 12921 func (n *NetlinkErrorMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12922 return n.CopyOutN(cc, addr, n.SizeBytes()) 12923 } 12924 12925 // CopyInN implements marshal.Marshallable.CopyInN. 12926 func (n *NetlinkErrorMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12927 if !n.Header.Packed() { 12928 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12929 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12930 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12931 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12932 // partially unmarshalled struct. 12933 n.UnmarshalBytes(buf) // escapes: fallback. 12934 return length, err 12935 } 12936 12937 // Construct a slice backed by dst's underlying memory. 12938 var buf []byte 12939 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12940 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12941 hdr.Len = n.SizeBytes() 12942 hdr.Cap = n.SizeBytes() 12943 12944 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12945 // Since we bypassed the compiler's escape analysis, indicate that n 12946 // must live until the use above. 12947 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12948 return length, err 12949 } 12950 12951 // CopyIn implements marshal.Marshallable.CopyIn. 12952 func (n *NetlinkErrorMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12953 return n.CopyInN(cc, addr, n.SizeBytes()) 12954 } 12955 12956 // WriteTo implements io.WriterTo.WriteTo. 12957 func (n *NetlinkErrorMessage) WriteTo(writer io.Writer) (int64, error) { 12958 if !n.Header.Packed() { 12959 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 12960 buf := make([]byte, n.SizeBytes()) 12961 n.MarshalBytes(buf) 12962 length, err := writer.Write(buf) 12963 return int64(length), err 12964 } 12965 12966 // Construct a slice backed by dst's underlying memory. 12967 var buf []byte 12968 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12969 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12970 hdr.Len = n.SizeBytes() 12971 hdr.Cap = n.SizeBytes() 12972 12973 length, err := writer.Write(buf) 12974 // Since we bypassed the compiler's escape analysis, indicate that n 12975 // must live until the use above. 12976 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12977 return int64(length), err 12978 } 12979 12980 // SizeBytes implements marshal.Marshallable.SizeBytes. 12981 func (n *NetlinkMessageHeader) SizeBytes() int { 12982 return 16 12983 } 12984 12985 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12986 func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) []byte { 12987 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Length)) 12988 dst = dst[4:] 12989 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 12990 dst = dst[2:] 12991 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Flags)) 12992 dst = dst[2:] 12993 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Seq)) 12994 dst = dst[4:] 12995 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.PortID)) 12996 dst = dst[4:] 12997 return dst 12998 } 12999 13000 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13001 func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) []byte { 13002 n.Length = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13003 src = src[4:] 13004 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13005 src = src[2:] 13006 n.Flags = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13007 src = src[2:] 13008 n.Seq = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13009 src = src[4:] 13010 n.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13011 src = src[4:] 13012 return src 13013 } 13014 13015 // Packed implements marshal.Marshallable.Packed. 13016 //go:nosplit 13017 func (n *NetlinkMessageHeader) Packed() bool { 13018 return true 13019 } 13020 13021 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13022 func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) []byte { 13023 size := n.SizeBytes() 13024 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 13025 return dst[size:] 13026 } 13027 13028 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13029 func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) []byte { 13030 size := n.SizeBytes() 13031 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 13032 return src[size:] 13033 } 13034 13035 // CopyOutN implements marshal.Marshallable.CopyOutN. 13036 func (n *NetlinkMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13037 // Construct a slice backed by dst's underlying memory. 13038 var buf []byte 13039 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13040 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13041 hdr.Len = n.SizeBytes() 13042 hdr.Cap = n.SizeBytes() 13043 13044 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13045 // Since we bypassed the compiler's escape analysis, indicate that n 13046 // must live until the use above. 13047 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13048 return length, err 13049 } 13050 13051 // CopyOut implements marshal.Marshallable.CopyOut. 13052 func (n *NetlinkMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13053 return n.CopyOutN(cc, addr, n.SizeBytes()) 13054 } 13055 13056 // CopyInN implements marshal.Marshallable.CopyInN. 13057 func (n *NetlinkMessageHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13058 // Construct a slice backed by dst's underlying memory. 13059 var buf []byte 13060 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13061 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13062 hdr.Len = n.SizeBytes() 13063 hdr.Cap = n.SizeBytes() 13064 13065 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13066 // Since we bypassed the compiler's escape analysis, indicate that n 13067 // must live until the use above. 13068 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13069 return length, err 13070 } 13071 13072 // CopyIn implements marshal.Marshallable.CopyIn. 13073 func (n *NetlinkMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13074 return n.CopyInN(cc, addr, n.SizeBytes()) 13075 } 13076 13077 // WriteTo implements io.WriterTo.WriteTo. 13078 func (n *NetlinkMessageHeader) WriteTo(writer io.Writer) (int64, error) { 13079 // Construct a slice backed by dst's underlying memory. 13080 var buf []byte 13081 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13082 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13083 hdr.Len = n.SizeBytes() 13084 hdr.Cap = n.SizeBytes() 13085 13086 length, err := writer.Write(buf) 13087 // Since we bypassed the compiler's escape analysis, indicate that n 13088 // must live until the use above. 13089 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13090 return int64(length), err 13091 } 13092 13093 // SizeBytes implements marshal.Marshallable.SizeBytes. 13094 func (s *SockAddrNetlink) SizeBytes() int { 13095 return 12 13096 } 13097 13098 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13099 func (s *SockAddrNetlink) MarshalBytes(dst []byte) []byte { 13100 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 13101 dst = dst[2:] 13102 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 13103 dst = dst[2:] 13104 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PortID)) 13105 dst = dst[4:] 13106 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Groups)) 13107 dst = dst[4:] 13108 return dst 13109 } 13110 13111 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13112 func (s *SockAddrNetlink) UnmarshalBytes(src []byte) []byte { 13113 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13114 src = src[2:] 13115 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 13116 src = src[2:] 13117 s.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13118 src = src[4:] 13119 s.Groups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13120 src = src[4:] 13121 return src 13122 } 13123 13124 // Packed implements marshal.Marshallable.Packed. 13125 //go:nosplit 13126 func (s *SockAddrNetlink) Packed() bool { 13127 return true 13128 } 13129 13130 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13131 func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) []byte { 13132 size := s.SizeBytes() 13133 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13134 return dst[size:] 13135 } 13136 13137 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13138 func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) []byte { 13139 size := s.SizeBytes() 13140 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13141 return src[size:] 13142 } 13143 13144 // CopyOutN implements marshal.Marshallable.CopyOutN. 13145 func (s *SockAddrNetlink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13146 // Construct a slice backed by dst's underlying memory. 13147 var buf []byte 13148 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13149 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13150 hdr.Len = s.SizeBytes() 13151 hdr.Cap = s.SizeBytes() 13152 13153 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13154 // Since we bypassed the compiler's escape analysis, indicate that s 13155 // must live until the use above. 13156 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13157 return length, err 13158 } 13159 13160 // CopyOut implements marshal.Marshallable.CopyOut. 13161 func (s *SockAddrNetlink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13162 return s.CopyOutN(cc, addr, s.SizeBytes()) 13163 } 13164 13165 // CopyInN implements marshal.Marshallable.CopyInN. 13166 func (s *SockAddrNetlink) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13167 // Construct a slice backed by dst's underlying memory. 13168 var buf []byte 13169 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13170 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13171 hdr.Len = s.SizeBytes() 13172 hdr.Cap = s.SizeBytes() 13173 13174 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13175 // Since we bypassed the compiler's escape analysis, indicate that s 13176 // must live until the use above. 13177 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13178 return length, err 13179 } 13180 13181 // CopyIn implements marshal.Marshallable.CopyIn. 13182 func (s *SockAddrNetlink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13183 return s.CopyInN(cc, addr, s.SizeBytes()) 13184 } 13185 13186 // WriteTo implements io.WriterTo.WriteTo. 13187 func (s *SockAddrNetlink) WriteTo(writer io.Writer) (int64, error) { 13188 // Construct a slice backed by dst's underlying memory. 13189 var buf []byte 13190 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13191 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13192 hdr.Len = s.SizeBytes() 13193 hdr.Cap = s.SizeBytes() 13194 13195 length, err := writer.Write(buf) 13196 // Since we bypassed the compiler's escape analysis, indicate that s 13197 // must live until the use above. 13198 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13199 return int64(length), err 13200 } 13201 13202 // SizeBytes implements marshal.Marshallable.SizeBytes. 13203 func (i *InterfaceAddrMessage) SizeBytes() int { 13204 return 8 13205 } 13206 13207 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13208 func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) []byte { 13209 dst[0] = byte(i.Family) 13210 dst = dst[1:] 13211 dst[0] = byte(i.PrefixLen) 13212 dst = dst[1:] 13213 dst[0] = byte(i.Flags) 13214 dst = dst[1:] 13215 dst[0] = byte(i.Scope) 13216 dst = dst[1:] 13217 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 13218 dst = dst[4:] 13219 return dst 13220 } 13221 13222 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13223 func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) []byte { 13224 i.Family = uint8(src[0]) 13225 src = src[1:] 13226 i.PrefixLen = uint8(src[0]) 13227 src = src[1:] 13228 i.Flags = uint8(src[0]) 13229 src = src[1:] 13230 i.Scope = uint8(src[0]) 13231 src = src[1:] 13232 i.Index = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13233 src = src[4:] 13234 return src 13235 } 13236 13237 // Packed implements marshal.Marshallable.Packed. 13238 //go:nosplit 13239 func (i *InterfaceAddrMessage) Packed() bool { 13240 return true 13241 } 13242 13243 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13244 func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) []byte { 13245 size := i.SizeBytes() 13246 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 13247 return dst[size:] 13248 } 13249 13250 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13251 func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) []byte { 13252 size := i.SizeBytes() 13253 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 13254 return src[size:] 13255 } 13256 13257 // CopyOutN implements marshal.Marshallable.CopyOutN. 13258 func (i *InterfaceAddrMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13259 // Construct a slice backed by dst's underlying memory. 13260 var buf []byte 13261 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13262 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13263 hdr.Len = i.SizeBytes() 13264 hdr.Cap = i.SizeBytes() 13265 13266 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13267 // Since we bypassed the compiler's escape analysis, indicate that i 13268 // must live until the use above. 13269 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13270 return length, err 13271 } 13272 13273 // CopyOut implements marshal.Marshallable.CopyOut. 13274 func (i *InterfaceAddrMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13275 return i.CopyOutN(cc, addr, i.SizeBytes()) 13276 } 13277 13278 // CopyInN implements marshal.Marshallable.CopyInN. 13279 func (i *InterfaceAddrMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13280 // Construct a slice backed by dst's underlying memory. 13281 var buf []byte 13282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13284 hdr.Len = i.SizeBytes() 13285 hdr.Cap = i.SizeBytes() 13286 13287 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13288 // Since we bypassed the compiler's escape analysis, indicate that i 13289 // must live until the use above. 13290 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13291 return length, err 13292 } 13293 13294 // CopyIn implements marshal.Marshallable.CopyIn. 13295 func (i *InterfaceAddrMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13296 return i.CopyInN(cc, addr, i.SizeBytes()) 13297 } 13298 13299 // WriteTo implements io.WriterTo.WriteTo. 13300 func (i *InterfaceAddrMessage) WriteTo(writer io.Writer) (int64, error) { 13301 // Construct a slice backed by dst's underlying memory. 13302 var buf []byte 13303 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13304 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13305 hdr.Len = i.SizeBytes() 13306 hdr.Cap = i.SizeBytes() 13307 13308 length, err := writer.Write(buf) 13309 // Since we bypassed the compiler's escape analysis, indicate that i 13310 // must live until the use above. 13311 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13312 return int64(length), err 13313 } 13314 13315 // SizeBytes implements marshal.Marshallable.SizeBytes. 13316 func (i *InterfaceInfoMessage) SizeBytes() int { 13317 return 16 13318 } 13319 13320 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13321 func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) []byte { 13322 dst[0] = byte(i.Family) 13323 dst = dst[1:] 13324 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 13325 dst = dst[1:] 13326 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Type)) 13327 dst = dst[2:] 13328 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 13329 dst = dst[4:] 13330 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 13331 dst = dst[4:] 13332 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Change)) 13333 dst = dst[4:] 13334 return dst 13335 } 13336 13337 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13338 func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) []byte { 13339 i.Family = uint8(src[0]) 13340 src = src[1:] 13341 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 13342 src = src[1:] 13343 i.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13344 src = src[2:] 13345 i.Index = int32(hostarch.ByteOrder.Uint32(src[:4])) 13346 src = src[4:] 13347 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13348 src = src[4:] 13349 i.Change = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13350 src = src[4:] 13351 return src 13352 } 13353 13354 // Packed implements marshal.Marshallable.Packed. 13355 //go:nosplit 13356 func (i *InterfaceInfoMessage) Packed() bool { 13357 return true 13358 } 13359 13360 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13361 func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) []byte { 13362 size := i.SizeBytes() 13363 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 13364 return dst[size:] 13365 } 13366 13367 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13368 func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) []byte { 13369 size := i.SizeBytes() 13370 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 13371 return src[size:] 13372 } 13373 13374 // CopyOutN implements marshal.Marshallable.CopyOutN. 13375 func (i *InterfaceInfoMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13376 // Construct a slice backed by dst's underlying memory. 13377 var buf []byte 13378 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13379 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13380 hdr.Len = i.SizeBytes() 13381 hdr.Cap = i.SizeBytes() 13382 13383 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13384 // Since we bypassed the compiler's escape analysis, indicate that i 13385 // must live until the use above. 13386 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13387 return length, err 13388 } 13389 13390 // CopyOut implements marshal.Marshallable.CopyOut. 13391 func (i *InterfaceInfoMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13392 return i.CopyOutN(cc, addr, i.SizeBytes()) 13393 } 13394 13395 // CopyInN implements marshal.Marshallable.CopyInN. 13396 func (i *InterfaceInfoMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13397 // Construct a slice backed by dst's underlying memory. 13398 var buf []byte 13399 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13400 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13401 hdr.Len = i.SizeBytes() 13402 hdr.Cap = i.SizeBytes() 13403 13404 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13405 // Since we bypassed the compiler's escape analysis, indicate that i 13406 // must live until the use above. 13407 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13408 return length, err 13409 } 13410 13411 // CopyIn implements marshal.Marshallable.CopyIn. 13412 func (i *InterfaceInfoMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13413 return i.CopyInN(cc, addr, i.SizeBytes()) 13414 } 13415 13416 // WriteTo implements io.WriterTo.WriteTo. 13417 func (i *InterfaceInfoMessage) WriteTo(writer io.Writer) (int64, error) { 13418 // Construct a slice backed by dst's underlying memory. 13419 var buf []byte 13420 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13421 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13422 hdr.Len = i.SizeBytes() 13423 hdr.Cap = i.SizeBytes() 13424 13425 length, err := writer.Write(buf) 13426 // Since we bypassed the compiler's escape analysis, indicate that i 13427 // must live until the use above. 13428 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13429 return int64(length), err 13430 } 13431 13432 // SizeBytes implements marshal.Marshallable.SizeBytes. 13433 func (r *RouteMessage) SizeBytes() int { 13434 return 12 13435 } 13436 13437 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13438 func (r *RouteMessage) MarshalBytes(dst []byte) []byte { 13439 dst[0] = byte(r.Family) 13440 dst = dst[1:] 13441 dst[0] = byte(r.DstLen) 13442 dst = dst[1:] 13443 dst[0] = byte(r.SrcLen) 13444 dst = dst[1:] 13445 dst[0] = byte(r.TOS) 13446 dst = dst[1:] 13447 dst[0] = byte(r.Table) 13448 dst = dst[1:] 13449 dst[0] = byte(r.Protocol) 13450 dst = dst[1:] 13451 dst[0] = byte(r.Scope) 13452 dst = dst[1:] 13453 dst[0] = byte(r.Type) 13454 dst = dst[1:] 13455 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 13456 dst = dst[4:] 13457 return dst 13458 } 13459 13460 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13461 func (r *RouteMessage) UnmarshalBytes(src []byte) []byte { 13462 r.Family = uint8(src[0]) 13463 src = src[1:] 13464 r.DstLen = uint8(src[0]) 13465 src = src[1:] 13466 r.SrcLen = uint8(src[0]) 13467 src = src[1:] 13468 r.TOS = uint8(src[0]) 13469 src = src[1:] 13470 r.Table = uint8(src[0]) 13471 src = src[1:] 13472 r.Protocol = uint8(src[0]) 13473 src = src[1:] 13474 r.Scope = uint8(src[0]) 13475 src = src[1:] 13476 r.Type = uint8(src[0]) 13477 src = src[1:] 13478 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13479 src = src[4:] 13480 return src 13481 } 13482 13483 // Packed implements marshal.Marshallable.Packed. 13484 //go:nosplit 13485 func (r *RouteMessage) Packed() bool { 13486 return true 13487 } 13488 13489 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13490 func (r *RouteMessage) MarshalUnsafe(dst []byte) []byte { 13491 size := r.SizeBytes() 13492 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13493 return dst[size:] 13494 } 13495 13496 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13497 func (r *RouteMessage) UnmarshalUnsafe(src []byte) []byte { 13498 size := r.SizeBytes() 13499 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13500 return src[size:] 13501 } 13502 13503 // CopyOutN implements marshal.Marshallable.CopyOutN. 13504 func (r *RouteMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13505 // Construct a slice backed by dst's underlying memory. 13506 var buf []byte 13507 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13508 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13509 hdr.Len = r.SizeBytes() 13510 hdr.Cap = r.SizeBytes() 13511 13512 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13513 // Since we bypassed the compiler's escape analysis, indicate that r 13514 // must live until the use above. 13515 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13516 return length, err 13517 } 13518 13519 // CopyOut implements marshal.Marshallable.CopyOut. 13520 func (r *RouteMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13521 return r.CopyOutN(cc, addr, r.SizeBytes()) 13522 } 13523 13524 // CopyInN implements marshal.Marshallable.CopyInN. 13525 func (r *RouteMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13526 // Construct a slice backed by dst's underlying memory. 13527 var buf []byte 13528 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13529 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13530 hdr.Len = r.SizeBytes() 13531 hdr.Cap = r.SizeBytes() 13532 13533 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13534 // Since we bypassed the compiler's escape analysis, indicate that r 13535 // must live until the use above. 13536 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13537 return length, err 13538 } 13539 13540 // CopyIn implements marshal.Marshallable.CopyIn. 13541 func (r *RouteMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13542 return r.CopyInN(cc, addr, r.SizeBytes()) 13543 } 13544 13545 // WriteTo implements io.WriterTo.WriteTo. 13546 func (r *RouteMessage) WriteTo(writer io.Writer) (int64, error) { 13547 // Construct a slice backed by dst's underlying memory. 13548 var buf []byte 13549 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13550 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13551 hdr.Len = r.SizeBytes() 13552 hdr.Cap = r.SizeBytes() 13553 13554 length, err := writer.Write(buf) 13555 // Since we bypassed the compiler's escape analysis, indicate that r 13556 // must live until the use above. 13557 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13558 return int64(length), err 13559 } 13560 13561 // SizeBytes implements marshal.Marshallable.SizeBytes. 13562 func (r *RtAttr) SizeBytes() int { 13563 return 4 13564 } 13565 13566 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13567 func (r *RtAttr) MarshalBytes(dst []byte) []byte { 13568 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Len)) 13569 dst = dst[2:] 13570 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Type)) 13571 dst = dst[2:] 13572 return dst 13573 } 13574 13575 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13576 func (r *RtAttr) UnmarshalBytes(src []byte) []byte { 13577 r.Len = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13578 src = src[2:] 13579 r.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13580 src = src[2:] 13581 return src 13582 } 13583 13584 // Packed implements marshal.Marshallable.Packed. 13585 //go:nosplit 13586 func (r *RtAttr) Packed() bool { 13587 return true 13588 } 13589 13590 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13591 func (r *RtAttr) MarshalUnsafe(dst []byte) []byte { 13592 size := r.SizeBytes() 13593 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13594 return dst[size:] 13595 } 13596 13597 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13598 func (r *RtAttr) UnmarshalUnsafe(src []byte) []byte { 13599 size := r.SizeBytes() 13600 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13601 return src[size:] 13602 } 13603 13604 // CopyOutN implements marshal.Marshallable.CopyOutN. 13605 func (r *RtAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13606 // Construct a slice backed by dst's underlying memory. 13607 var buf []byte 13608 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13609 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13610 hdr.Len = r.SizeBytes() 13611 hdr.Cap = r.SizeBytes() 13612 13613 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13614 // Since we bypassed the compiler's escape analysis, indicate that r 13615 // must live until the use above. 13616 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13617 return length, err 13618 } 13619 13620 // CopyOut implements marshal.Marshallable.CopyOut. 13621 func (r *RtAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13622 return r.CopyOutN(cc, addr, r.SizeBytes()) 13623 } 13624 13625 // CopyInN implements marshal.Marshallable.CopyInN. 13626 func (r *RtAttr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13627 // Construct a slice backed by dst's underlying memory. 13628 var buf []byte 13629 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13630 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13631 hdr.Len = r.SizeBytes() 13632 hdr.Cap = r.SizeBytes() 13633 13634 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13635 // Since we bypassed the compiler's escape analysis, indicate that r 13636 // must live until the use above. 13637 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13638 return length, err 13639 } 13640 13641 // CopyIn implements marshal.Marshallable.CopyIn. 13642 func (r *RtAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13643 return r.CopyInN(cc, addr, r.SizeBytes()) 13644 } 13645 13646 // WriteTo implements io.WriterTo.WriteTo. 13647 func (r *RtAttr) WriteTo(writer io.Writer) (int64, error) { 13648 // Construct a slice backed by dst's underlying memory. 13649 var buf []byte 13650 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13651 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13652 hdr.Len = r.SizeBytes() 13653 hdr.Cap = r.SizeBytes() 13654 13655 length, err := writer.Write(buf) 13656 // Since we bypassed the compiler's escape analysis, indicate that r 13657 // must live until the use above. 13658 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13659 return int64(length), err 13660 } 13661 13662 // SizeBytes implements marshal.Marshallable.SizeBytes. 13663 func (p *PollFD) SizeBytes() int { 13664 return 8 13665 } 13666 13667 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13668 func (p *PollFD) MarshalBytes(dst []byte) []byte { 13669 hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.FD)) 13670 dst = dst[4:] 13671 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.Events)) 13672 dst = dst[2:] 13673 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.REvents)) 13674 dst = dst[2:] 13675 return dst 13676 } 13677 13678 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13679 func (p *PollFD) UnmarshalBytes(src []byte) []byte { 13680 p.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 13681 src = src[4:] 13682 p.Events = int16(hostarch.ByteOrder.Uint16(src[:2])) 13683 src = src[2:] 13684 p.REvents = int16(hostarch.ByteOrder.Uint16(src[:2])) 13685 src = src[2:] 13686 return src 13687 } 13688 13689 // Packed implements marshal.Marshallable.Packed. 13690 //go:nosplit 13691 func (p *PollFD) Packed() bool { 13692 return true 13693 } 13694 13695 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13696 func (p *PollFD) MarshalUnsafe(dst []byte) []byte { 13697 size := p.SizeBytes() 13698 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size)) 13699 return dst[size:] 13700 } 13701 13702 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13703 func (p *PollFD) UnmarshalUnsafe(src []byte) []byte { 13704 size := p.SizeBytes() 13705 gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size)) 13706 return src[size:] 13707 } 13708 13709 // CopyOutN implements marshal.Marshallable.CopyOutN. 13710 func (p *PollFD) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13711 // Construct a slice backed by dst's underlying memory. 13712 var buf []byte 13713 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13714 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13715 hdr.Len = p.SizeBytes() 13716 hdr.Cap = p.SizeBytes() 13717 13718 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13719 // Since we bypassed the compiler's escape analysis, indicate that p 13720 // must live until the use above. 13721 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13722 return length, err 13723 } 13724 13725 // CopyOut implements marshal.Marshallable.CopyOut. 13726 func (p *PollFD) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13727 return p.CopyOutN(cc, addr, p.SizeBytes()) 13728 } 13729 13730 // CopyInN implements marshal.Marshallable.CopyInN. 13731 func (p *PollFD) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13732 // Construct a slice backed by dst's underlying memory. 13733 var buf []byte 13734 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13735 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13736 hdr.Len = p.SizeBytes() 13737 hdr.Cap = p.SizeBytes() 13738 13739 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13740 // Since we bypassed the compiler's escape analysis, indicate that p 13741 // must live until the use above. 13742 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13743 return length, err 13744 } 13745 13746 // CopyIn implements marshal.Marshallable.CopyIn. 13747 func (p *PollFD) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13748 return p.CopyInN(cc, addr, p.SizeBytes()) 13749 } 13750 13751 // WriteTo implements io.WriterTo.WriteTo. 13752 func (p *PollFD) WriteTo(writer io.Writer) (int64, error) { 13753 // Construct a slice backed by dst's underlying memory. 13754 var buf []byte 13755 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13756 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13757 hdr.Len = p.SizeBytes() 13758 hdr.Cap = p.SizeBytes() 13759 13760 length, err := writer.Write(buf) 13761 // Since we bypassed the compiler's escape analysis, indicate that p 13762 // must live until the use above. 13763 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13764 return int64(length), err 13765 } 13766 13767 // CopyPollFDSliceIn copies in a slice of PollFD objects from the task's memory. 13768 func CopyPollFDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []PollFD) (int, error) { 13769 count := len(dst) 13770 if count == 0 { 13771 return 0, nil 13772 } 13773 size := (*PollFD)(nil).SizeBytes() 13774 13775 ptr := unsafe.Pointer(&dst) 13776 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13777 13778 // Construct a slice backed by dst's underlying memory. 13779 var buf []byte 13780 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13781 hdr.Data = uintptr(val) 13782 hdr.Len = size * count 13783 hdr.Cap = size * count 13784 13785 length, err := cc.CopyInBytes(addr, buf) 13786 // Since we bypassed the compiler's escape analysis, indicate that dst 13787 // must live until the use above. 13788 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 13789 return length, err 13790 } 13791 13792 // CopyPollFDSliceOut copies a slice of PollFD objects to the task's memory. 13793 func CopyPollFDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []PollFD) (int, error) { 13794 count := len(src) 13795 if count == 0 { 13796 return 0, nil 13797 } 13798 size := (*PollFD)(nil).SizeBytes() 13799 13800 ptr := unsafe.Pointer(&src) 13801 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13802 13803 // Construct a slice backed by dst's underlying memory. 13804 var buf []byte 13805 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13806 hdr.Data = uintptr(val) 13807 hdr.Len = size * count 13808 hdr.Cap = size * count 13809 13810 length, err := cc.CopyOutBytes(addr, buf) 13811 // Since we bypassed the compiler's escape analysis, indicate that src 13812 // must live until the use above. 13813 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 13814 return length, err 13815 } 13816 13817 // MarshalUnsafePollFDSlice is like PollFD.MarshalUnsafe, but for a []PollFD. 13818 func MarshalUnsafePollFDSlice(src []PollFD, dst []byte) []byte { 13819 count := len(src) 13820 if count == 0 { 13821 return dst 13822 } 13823 13824 size := (*PollFD)(nil).SizeBytes() 13825 buf := dst[:size*count] 13826 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 13827 return dst[size*count:] 13828 } 13829 13830 // UnmarshalUnsafePollFDSlice is like PollFD.UnmarshalUnsafe, but for a []PollFD. 13831 func UnmarshalUnsafePollFDSlice(dst []PollFD, src []byte) []byte { 13832 count := len(dst) 13833 if count == 0 { 13834 return src 13835 } 13836 13837 size := (*PollFD)(nil).SizeBytes() 13838 buf := src[:size*count] 13839 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 13840 return src[size*count:] 13841 } 13842 13843 // SizeBytes implements marshal.Marshallable.SizeBytes. 13844 func (r *RSeqCriticalSection) SizeBytes() int { 13845 return 32 13846 } 13847 13848 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13849 func (r *RSeqCriticalSection) MarshalBytes(dst []byte) []byte { 13850 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Version)) 13851 dst = dst[4:] 13852 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 13853 dst = dst[4:] 13854 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Start)) 13855 dst = dst[8:] 13856 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.PostCommitOffset)) 13857 dst = dst[8:] 13858 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Abort)) 13859 dst = dst[8:] 13860 return dst 13861 } 13862 13863 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13864 func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) []byte { 13865 r.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13866 src = src[4:] 13867 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13868 src = src[4:] 13869 r.Start = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13870 src = src[8:] 13871 r.PostCommitOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13872 src = src[8:] 13873 r.Abort = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13874 src = src[8:] 13875 return src 13876 } 13877 13878 // Packed implements marshal.Marshallable.Packed. 13879 //go:nosplit 13880 func (r *RSeqCriticalSection) Packed() bool { 13881 return true 13882 } 13883 13884 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13885 func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) []byte { 13886 size := r.SizeBytes() 13887 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13888 return dst[size:] 13889 } 13890 13891 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13892 func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) []byte { 13893 size := r.SizeBytes() 13894 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13895 return src[size:] 13896 } 13897 13898 // CopyOutN implements marshal.Marshallable.CopyOutN. 13899 func (r *RSeqCriticalSection) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13900 // Construct a slice backed by dst's underlying memory. 13901 var buf []byte 13902 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13903 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13904 hdr.Len = r.SizeBytes() 13905 hdr.Cap = r.SizeBytes() 13906 13907 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13908 // Since we bypassed the compiler's escape analysis, indicate that r 13909 // must live until the use above. 13910 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13911 return length, err 13912 } 13913 13914 // CopyOut implements marshal.Marshallable.CopyOut. 13915 func (r *RSeqCriticalSection) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13916 return r.CopyOutN(cc, addr, r.SizeBytes()) 13917 } 13918 13919 // CopyInN implements marshal.Marshallable.CopyInN. 13920 func (r *RSeqCriticalSection) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13921 // Construct a slice backed by dst's underlying memory. 13922 var buf []byte 13923 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13924 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13925 hdr.Len = r.SizeBytes() 13926 hdr.Cap = r.SizeBytes() 13927 13928 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13929 // Since we bypassed the compiler's escape analysis, indicate that r 13930 // must live until the use above. 13931 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13932 return length, err 13933 } 13934 13935 // CopyIn implements marshal.Marshallable.CopyIn. 13936 func (r *RSeqCriticalSection) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13937 return r.CopyInN(cc, addr, r.SizeBytes()) 13938 } 13939 13940 // WriteTo implements io.WriterTo.WriteTo. 13941 func (r *RSeqCriticalSection) WriteTo(writer io.Writer) (int64, error) { 13942 // Construct a slice backed by dst's underlying memory. 13943 var buf []byte 13944 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13945 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13946 hdr.Len = r.SizeBytes() 13947 hdr.Cap = r.SizeBytes() 13948 13949 length, err := writer.Write(buf) 13950 // Since we bypassed the compiler's escape analysis, indicate that r 13951 // must live until the use above. 13952 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13953 return int64(length), err 13954 } 13955 13956 // SizeBytes implements marshal.Marshallable.SizeBytes. 13957 func (r *Rusage) SizeBytes() int { 13958 return 112 + 13959 (*Timeval)(nil).SizeBytes() + 13960 (*Timeval)(nil).SizeBytes() 13961 } 13962 13963 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13964 func (r *Rusage) MarshalBytes(dst []byte) []byte { 13965 dst = r.UTime.MarshalUnsafe(dst) 13966 dst = r.STime.MarshalUnsafe(dst) 13967 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MaxRSS)) 13968 dst = dst[8:] 13969 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IXRSS)) 13970 dst = dst[8:] 13971 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IDRSS)) 13972 dst = dst[8:] 13973 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ISRSS)) 13974 dst = dst[8:] 13975 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MinFlt)) 13976 dst = dst[8:] 13977 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MajFlt)) 13978 dst = dst[8:] 13979 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSwap)) 13980 dst = dst[8:] 13981 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.InBlock)) 13982 dst = dst[8:] 13983 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.OuBlock)) 13984 dst = dst[8:] 13985 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgSnd)) 13986 dst = dst[8:] 13987 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgRcv)) 13988 dst = dst[8:] 13989 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSignals)) 13990 dst = dst[8:] 13991 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NVCSw)) 13992 dst = dst[8:] 13993 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NIvCSw)) 13994 dst = dst[8:] 13995 return dst 13996 } 13997 13998 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13999 func (r *Rusage) UnmarshalBytes(src []byte) []byte { 14000 src = r.UTime.UnmarshalUnsafe(src) 14001 src = r.STime.UnmarshalUnsafe(src) 14002 r.MaxRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14003 src = src[8:] 14004 r.IXRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14005 src = src[8:] 14006 r.IDRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14007 src = src[8:] 14008 r.ISRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14009 src = src[8:] 14010 r.MinFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 14011 src = src[8:] 14012 r.MajFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 14013 src = src[8:] 14014 r.NSwap = int64(hostarch.ByteOrder.Uint64(src[:8])) 14015 src = src[8:] 14016 r.InBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 14017 src = src[8:] 14018 r.OuBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 14019 src = src[8:] 14020 r.MsgSnd = int64(hostarch.ByteOrder.Uint64(src[:8])) 14021 src = src[8:] 14022 r.MsgRcv = int64(hostarch.ByteOrder.Uint64(src[:8])) 14023 src = src[8:] 14024 r.NSignals = int64(hostarch.ByteOrder.Uint64(src[:8])) 14025 src = src[8:] 14026 r.NVCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 14027 src = src[8:] 14028 r.NIvCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 14029 src = src[8:] 14030 return src 14031 } 14032 14033 // Packed implements marshal.Marshallable.Packed. 14034 //go:nosplit 14035 func (r *Rusage) Packed() bool { 14036 return r.STime.Packed() && r.UTime.Packed() 14037 } 14038 14039 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14040 func (r *Rusage) MarshalUnsafe(dst []byte) []byte { 14041 if r.STime.Packed() && r.UTime.Packed() { 14042 size := r.SizeBytes() 14043 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 14044 return dst[size:] 14045 } 14046 // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes. 14047 return r.MarshalBytes(dst) 14048 } 14049 14050 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14051 func (r *Rusage) UnmarshalUnsafe(src []byte) []byte { 14052 if r.STime.Packed() && r.UTime.Packed() { 14053 size := r.SizeBytes() 14054 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 14055 return src[size:] 14056 } 14057 // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14058 return r.UnmarshalBytes(src) 14059 } 14060 14061 // CopyOutN implements marshal.Marshallable.CopyOutN. 14062 func (r *Rusage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14063 if !r.STime.Packed() && r.UTime.Packed() { 14064 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 14065 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 14066 r.MarshalBytes(buf) // escapes: fallback. 14067 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14068 } 14069 14070 // Construct a slice backed by dst's underlying memory. 14071 var buf []byte 14072 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14073 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14074 hdr.Len = r.SizeBytes() 14075 hdr.Cap = r.SizeBytes() 14076 14077 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14078 // Since we bypassed the compiler's escape analysis, indicate that r 14079 // must live until the use above. 14080 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14081 return length, err 14082 } 14083 14084 // CopyOut implements marshal.Marshallable.CopyOut. 14085 func (r *Rusage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14086 return r.CopyOutN(cc, addr, r.SizeBytes()) 14087 } 14088 14089 // CopyInN implements marshal.Marshallable.CopyInN. 14090 func (r *Rusage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14091 if !r.STime.Packed() && r.UTime.Packed() { 14092 // Type Rusage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14093 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 14094 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14095 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14096 // partially unmarshalled struct. 14097 r.UnmarshalBytes(buf) // escapes: fallback. 14098 return length, err 14099 } 14100 14101 // Construct a slice backed by dst's underlying memory. 14102 var buf []byte 14103 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14104 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14105 hdr.Len = r.SizeBytes() 14106 hdr.Cap = r.SizeBytes() 14107 14108 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14109 // Since we bypassed the compiler's escape analysis, indicate that r 14110 // must live until the use above. 14111 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14112 return length, err 14113 } 14114 14115 // CopyIn implements marshal.Marshallable.CopyIn. 14116 func (r *Rusage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14117 return r.CopyInN(cc, addr, r.SizeBytes()) 14118 } 14119 14120 // WriteTo implements io.WriterTo.WriteTo. 14121 func (r *Rusage) WriteTo(writer io.Writer) (int64, error) { 14122 if !r.STime.Packed() && r.UTime.Packed() { 14123 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 14124 buf := make([]byte, r.SizeBytes()) 14125 r.MarshalBytes(buf) 14126 length, err := writer.Write(buf) 14127 return int64(length), err 14128 } 14129 14130 // Construct a slice backed by dst's underlying memory. 14131 var buf []byte 14132 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14133 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14134 hdr.Len = r.SizeBytes() 14135 hdr.Cap = r.SizeBytes() 14136 14137 length, err := writer.Write(buf) 14138 // Since we bypassed the compiler's escape analysis, indicate that r 14139 // must live until the use above. 14140 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14141 return int64(length), err 14142 } 14143 14144 // SizeBytes implements marshal.Marshallable.SizeBytes. 14145 func (s *SeccompData) SizeBytes() int { 14146 return 16 + 14147 8*6 14148 } 14149 14150 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14151 func (s *SeccompData) MarshalBytes(dst []byte) []byte { 14152 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nr)) 14153 dst = dst[4:] 14154 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Arch)) 14155 dst = dst[4:] 14156 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.InstructionPointer)) 14157 dst = dst[8:] 14158 for idx := 0; idx < 6; idx++ { 14159 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Args[idx])) 14160 dst = dst[8:] 14161 } 14162 return dst 14163 } 14164 14165 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14166 func (s *SeccompData) UnmarshalBytes(src []byte) []byte { 14167 s.Nr = int32(hostarch.ByteOrder.Uint32(src[:4])) 14168 src = src[4:] 14169 s.Arch = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14170 src = src[4:] 14171 s.InstructionPointer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14172 src = src[8:] 14173 for idx := 0; idx < 6; idx++ { 14174 s.Args[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14175 src = src[8:] 14176 } 14177 return src 14178 } 14179 14180 // Packed implements marshal.Marshallable.Packed. 14181 //go:nosplit 14182 func (s *SeccompData) Packed() bool { 14183 return true 14184 } 14185 14186 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14187 func (s *SeccompData) MarshalUnsafe(dst []byte) []byte { 14188 size := s.SizeBytes() 14189 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14190 return dst[size:] 14191 } 14192 14193 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14194 func (s *SeccompData) UnmarshalUnsafe(src []byte) []byte { 14195 size := s.SizeBytes() 14196 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14197 return src[size:] 14198 } 14199 14200 // CopyOutN implements marshal.Marshallable.CopyOutN. 14201 func (s *SeccompData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14202 // Construct a slice backed by dst's underlying memory. 14203 var buf []byte 14204 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14205 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14206 hdr.Len = s.SizeBytes() 14207 hdr.Cap = s.SizeBytes() 14208 14209 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14210 // Since we bypassed the compiler's escape analysis, indicate that s 14211 // must live until the use above. 14212 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14213 return length, err 14214 } 14215 14216 // CopyOut implements marshal.Marshallable.CopyOut. 14217 func (s *SeccompData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14218 return s.CopyOutN(cc, addr, s.SizeBytes()) 14219 } 14220 14221 // CopyInN implements marshal.Marshallable.CopyInN. 14222 func (s *SeccompData) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14223 // Construct a slice backed by dst's underlying memory. 14224 var buf []byte 14225 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14226 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14227 hdr.Len = s.SizeBytes() 14228 hdr.Cap = s.SizeBytes() 14229 14230 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14231 // Since we bypassed the compiler's escape analysis, indicate that s 14232 // must live until the use above. 14233 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14234 return length, err 14235 } 14236 14237 // CopyIn implements marshal.Marshallable.CopyIn. 14238 func (s *SeccompData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14239 return s.CopyInN(cc, addr, s.SizeBytes()) 14240 } 14241 14242 // WriteTo implements io.WriterTo.WriteTo. 14243 func (s *SeccompData) WriteTo(writer io.Writer) (int64, error) { 14244 // Construct a slice backed by dst's underlying memory. 14245 var buf []byte 14246 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14247 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14248 hdr.Len = s.SizeBytes() 14249 hdr.Cap = s.SizeBytes() 14250 14251 length, err := writer.Write(buf) 14252 // Since we bypassed the compiler's escape analysis, indicate that s 14253 // must live until the use above. 14254 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14255 return int64(length), err 14256 } 14257 14258 // SizeBytes implements marshal.Marshallable.SizeBytes. 14259 func (s *SemInfo) SizeBytes() int { 14260 return 40 14261 } 14262 14263 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14264 func (s *SemInfo) MarshalBytes(dst []byte) []byte { 14265 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMap)) 14266 dst = dst[4:] 14267 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMni)) 14268 dst = dst[4:] 14269 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMns)) 14270 dst = dst[4:] 14271 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMnu)) 14272 dst = dst[4:] 14273 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMsl)) 14274 dst = dst[4:] 14275 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemOpm)) 14276 dst = dst[4:] 14277 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUme)) 14278 dst = dst[4:] 14279 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUsz)) 14280 dst = dst[4:] 14281 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemVmx)) 14282 dst = dst[4:] 14283 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemAem)) 14284 dst = dst[4:] 14285 return dst 14286 } 14287 14288 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14289 func (s *SemInfo) UnmarshalBytes(src []byte) []byte { 14290 s.SemMap = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14291 src = src[4:] 14292 s.SemMni = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14293 src = src[4:] 14294 s.SemMns = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14295 src = src[4:] 14296 s.SemMnu = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14297 src = src[4:] 14298 s.SemMsl = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14299 src = src[4:] 14300 s.SemOpm = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14301 src = src[4:] 14302 s.SemUme = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14303 src = src[4:] 14304 s.SemUsz = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14305 src = src[4:] 14306 s.SemVmx = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14307 src = src[4:] 14308 s.SemAem = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14309 src = src[4:] 14310 return src 14311 } 14312 14313 // Packed implements marshal.Marshallable.Packed. 14314 //go:nosplit 14315 func (s *SemInfo) Packed() bool { 14316 return true 14317 } 14318 14319 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14320 func (s *SemInfo) MarshalUnsafe(dst []byte) []byte { 14321 size := s.SizeBytes() 14322 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14323 return dst[size:] 14324 } 14325 14326 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14327 func (s *SemInfo) UnmarshalUnsafe(src []byte) []byte { 14328 size := s.SizeBytes() 14329 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14330 return src[size:] 14331 } 14332 14333 // CopyOutN implements marshal.Marshallable.CopyOutN. 14334 func (s *SemInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14335 // Construct a slice backed by dst's underlying memory. 14336 var buf []byte 14337 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14338 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14339 hdr.Len = s.SizeBytes() 14340 hdr.Cap = s.SizeBytes() 14341 14342 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14343 // Since we bypassed the compiler's escape analysis, indicate that s 14344 // must live until the use above. 14345 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14346 return length, err 14347 } 14348 14349 // CopyOut implements marshal.Marshallable.CopyOut. 14350 func (s *SemInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14351 return s.CopyOutN(cc, addr, s.SizeBytes()) 14352 } 14353 14354 // CopyInN implements marshal.Marshallable.CopyInN. 14355 func (s *SemInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14356 // Construct a slice backed by dst's underlying memory. 14357 var buf []byte 14358 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14359 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14360 hdr.Len = s.SizeBytes() 14361 hdr.Cap = s.SizeBytes() 14362 14363 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14364 // Since we bypassed the compiler's escape analysis, indicate that s 14365 // must live until the use above. 14366 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14367 return length, err 14368 } 14369 14370 // CopyIn implements marshal.Marshallable.CopyIn. 14371 func (s *SemInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14372 return s.CopyInN(cc, addr, s.SizeBytes()) 14373 } 14374 14375 // WriteTo implements io.WriterTo.WriteTo. 14376 func (s *SemInfo) WriteTo(writer io.Writer) (int64, error) { 14377 // Construct a slice backed by dst's underlying memory. 14378 var buf []byte 14379 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14380 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14381 hdr.Len = s.SizeBytes() 14382 hdr.Cap = s.SizeBytes() 14383 14384 length, err := writer.Write(buf) 14385 // Since we bypassed the compiler's escape analysis, indicate that s 14386 // must live until the use above. 14387 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14388 return int64(length), err 14389 } 14390 14391 // SizeBytes implements marshal.Marshallable.SizeBytes. 14392 func (s *Sembuf) SizeBytes() int { 14393 return 6 14394 } 14395 14396 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14397 func (s *Sembuf) MarshalBytes(dst []byte) []byte { 14398 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemNum)) 14399 dst = dst[2:] 14400 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemOp)) 14401 dst = dst[2:] 14402 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemFlg)) 14403 dst = dst[2:] 14404 return dst 14405 } 14406 14407 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14408 func (s *Sembuf) UnmarshalBytes(src []byte) []byte { 14409 s.SemNum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14410 src = src[2:] 14411 s.SemOp = int16(hostarch.ByteOrder.Uint16(src[:2])) 14412 src = src[2:] 14413 s.SemFlg = int16(hostarch.ByteOrder.Uint16(src[:2])) 14414 src = src[2:] 14415 return src 14416 } 14417 14418 // Packed implements marshal.Marshallable.Packed. 14419 //go:nosplit 14420 func (s *Sembuf) Packed() bool { 14421 return true 14422 } 14423 14424 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14425 func (s *Sembuf) MarshalUnsafe(dst []byte) []byte { 14426 size := s.SizeBytes() 14427 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14428 return dst[size:] 14429 } 14430 14431 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14432 func (s *Sembuf) UnmarshalUnsafe(src []byte) []byte { 14433 size := s.SizeBytes() 14434 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14435 return src[size:] 14436 } 14437 14438 // CopyOutN implements marshal.Marshallable.CopyOutN. 14439 func (s *Sembuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14440 // Construct a slice backed by dst's underlying memory. 14441 var buf []byte 14442 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14443 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14444 hdr.Len = s.SizeBytes() 14445 hdr.Cap = s.SizeBytes() 14446 14447 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14448 // Since we bypassed the compiler's escape analysis, indicate that s 14449 // must live until the use above. 14450 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14451 return length, err 14452 } 14453 14454 // CopyOut implements marshal.Marshallable.CopyOut. 14455 func (s *Sembuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14456 return s.CopyOutN(cc, addr, s.SizeBytes()) 14457 } 14458 14459 // CopyInN implements marshal.Marshallable.CopyInN. 14460 func (s *Sembuf) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14461 // Construct a slice backed by dst's underlying memory. 14462 var buf []byte 14463 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14464 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14465 hdr.Len = s.SizeBytes() 14466 hdr.Cap = s.SizeBytes() 14467 14468 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14469 // Since we bypassed the compiler's escape analysis, indicate that s 14470 // must live until the use above. 14471 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14472 return length, err 14473 } 14474 14475 // CopyIn implements marshal.Marshallable.CopyIn. 14476 func (s *Sembuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14477 return s.CopyInN(cc, addr, s.SizeBytes()) 14478 } 14479 14480 // WriteTo implements io.WriterTo.WriteTo. 14481 func (s *Sembuf) WriteTo(writer io.Writer) (int64, error) { 14482 // Construct a slice backed by dst's underlying memory. 14483 var buf []byte 14484 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14485 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14486 hdr.Len = s.SizeBytes() 14487 hdr.Cap = s.SizeBytes() 14488 14489 length, err := writer.Write(buf) 14490 // Since we bypassed the compiler's escape analysis, indicate that s 14491 // must live until the use above. 14492 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14493 return int64(length), err 14494 } 14495 14496 // CopySembufSliceIn copies in a slice of Sembuf objects from the task's memory. 14497 func CopySembufSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Sembuf) (int, error) { 14498 count := len(dst) 14499 if count == 0 { 14500 return 0, nil 14501 } 14502 size := (*Sembuf)(nil).SizeBytes() 14503 14504 ptr := unsafe.Pointer(&dst) 14505 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 14506 14507 // Construct a slice backed by dst's underlying memory. 14508 var buf []byte 14509 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14510 hdr.Data = uintptr(val) 14511 hdr.Len = size * count 14512 hdr.Cap = size * count 14513 14514 length, err := cc.CopyInBytes(addr, buf) 14515 // Since we bypassed the compiler's escape analysis, indicate that dst 14516 // must live until the use above. 14517 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 14518 return length, err 14519 } 14520 14521 // CopySembufSliceOut copies a slice of Sembuf objects to the task's memory. 14522 func CopySembufSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Sembuf) (int, error) { 14523 count := len(src) 14524 if count == 0 { 14525 return 0, nil 14526 } 14527 size := (*Sembuf)(nil).SizeBytes() 14528 14529 ptr := unsafe.Pointer(&src) 14530 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 14531 14532 // Construct a slice backed by dst's underlying memory. 14533 var buf []byte 14534 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14535 hdr.Data = uintptr(val) 14536 hdr.Len = size * count 14537 hdr.Cap = size * count 14538 14539 length, err := cc.CopyOutBytes(addr, buf) 14540 // Since we bypassed the compiler's escape analysis, indicate that src 14541 // must live until the use above. 14542 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 14543 return length, err 14544 } 14545 14546 // MarshalUnsafeSembufSlice is like Sembuf.MarshalUnsafe, but for a []Sembuf. 14547 func MarshalUnsafeSembufSlice(src []Sembuf, dst []byte) []byte { 14548 count := len(src) 14549 if count == 0 { 14550 return dst 14551 } 14552 14553 size := (*Sembuf)(nil).SizeBytes() 14554 buf := dst[:size*count] 14555 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 14556 return dst[size*count:] 14557 } 14558 14559 // UnmarshalUnsafeSembufSlice is like Sembuf.UnmarshalUnsafe, but for a []Sembuf. 14560 func UnmarshalUnsafeSembufSlice(dst []Sembuf, src []byte) []byte { 14561 count := len(dst) 14562 if count == 0 { 14563 return src 14564 } 14565 14566 size := (*Sembuf)(nil).SizeBytes() 14567 buf := src[:size*count] 14568 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 14569 return src[size*count:] 14570 } 14571 14572 // SizeBytes implements marshal.Marshallable.SizeBytes. 14573 func (s *ShmInfo) SizeBytes() int { 14574 return 44 + 14575 1*4 14576 } 14577 14578 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14579 func (s *ShmInfo) MarshalBytes(dst []byte) []byte { 14580 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UsedIDs)) 14581 dst = dst[4:] 14582 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 14583 dst = dst[1*(4):] 14584 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmTot)) 14585 dst = dst[8:] 14586 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmRss)) 14587 dst = dst[8:] 14588 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSwp)) 14589 dst = dst[8:] 14590 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapAttempts)) 14591 dst = dst[8:] 14592 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapSuccesses)) 14593 dst = dst[8:] 14594 return dst 14595 } 14596 14597 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14598 func (s *ShmInfo) UnmarshalBytes(src []byte) []byte { 14599 s.UsedIDs = int32(hostarch.ByteOrder.Uint32(src[:4])) 14600 src = src[4:] 14601 // Padding: ~ copy([4]byte(s._), src[:sizeof(byte)*4]) 14602 src = src[1*(4):] 14603 s.ShmTot = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14604 src = src[8:] 14605 s.ShmRss = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14606 src = src[8:] 14607 s.ShmSwp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14608 src = src[8:] 14609 s.SwapAttempts = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14610 src = src[8:] 14611 s.SwapSuccesses = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14612 src = src[8:] 14613 return src 14614 } 14615 14616 // Packed implements marshal.Marshallable.Packed. 14617 //go:nosplit 14618 func (s *ShmInfo) Packed() bool { 14619 return true 14620 } 14621 14622 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14623 func (s *ShmInfo) MarshalUnsafe(dst []byte) []byte { 14624 size := s.SizeBytes() 14625 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14626 return dst[size:] 14627 } 14628 14629 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14630 func (s *ShmInfo) UnmarshalUnsafe(src []byte) []byte { 14631 size := s.SizeBytes() 14632 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14633 return src[size:] 14634 } 14635 14636 // CopyOutN implements marshal.Marshallable.CopyOutN. 14637 func (s *ShmInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14638 // Construct a slice backed by dst's underlying memory. 14639 var buf []byte 14640 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14641 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14642 hdr.Len = s.SizeBytes() 14643 hdr.Cap = s.SizeBytes() 14644 14645 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14646 // Since we bypassed the compiler's escape analysis, indicate that s 14647 // must live until the use above. 14648 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14649 return length, err 14650 } 14651 14652 // CopyOut implements marshal.Marshallable.CopyOut. 14653 func (s *ShmInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14654 return s.CopyOutN(cc, addr, s.SizeBytes()) 14655 } 14656 14657 // CopyInN implements marshal.Marshallable.CopyInN. 14658 func (s *ShmInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14659 // Construct a slice backed by dst's underlying memory. 14660 var buf []byte 14661 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14662 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14663 hdr.Len = s.SizeBytes() 14664 hdr.Cap = s.SizeBytes() 14665 14666 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14667 // Since we bypassed the compiler's escape analysis, indicate that s 14668 // must live until the use above. 14669 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14670 return length, err 14671 } 14672 14673 // CopyIn implements marshal.Marshallable.CopyIn. 14674 func (s *ShmInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14675 return s.CopyInN(cc, addr, s.SizeBytes()) 14676 } 14677 14678 // WriteTo implements io.WriterTo.WriteTo. 14679 func (s *ShmInfo) WriteTo(writer io.Writer) (int64, error) { 14680 // Construct a slice backed by dst's underlying memory. 14681 var buf []byte 14682 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14683 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14684 hdr.Len = s.SizeBytes() 14685 hdr.Cap = s.SizeBytes() 14686 14687 length, err := writer.Write(buf) 14688 // Since we bypassed the compiler's escape analysis, indicate that s 14689 // must live until the use above. 14690 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14691 return int64(length), err 14692 } 14693 14694 // SizeBytes implements marshal.Marshallable.SizeBytes. 14695 func (s *ShmParams) SizeBytes() int { 14696 return 40 14697 } 14698 14699 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14700 func (s *ShmParams) MarshalBytes(dst []byte) []byte { 14701 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMax)) 14702 dst = dst[8:] 14703 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMin)) 14704 dst = dst[8:] 14705 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMni)) 14706 dst = dst[8:] 14707 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSeg)) 14708 dst = dst[8:] 14709 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmAll)) 14710 dst = dst[8:] 14711 return dst 14712 } 14713 14714 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14715 func (s *ShmParams) UnmarshalBytes(src []byte) []byte { 14716 s.ShmMax = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14717 src = src[8:] 14718 s.ShmMin = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14719 src = src[8:] 14720 s.ShmMni = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14721 src = src[8:] 14722 s.ShmSeg = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14723 src = src[8:] 14724 s.ShmAll = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14725 src = src[8:] 14726 return src 14727 } 14728 14729 // Packed implements marshal.Marshallable.Packed. 14730 //go:nosplit 14731 func (s *ShmParams) Packed() bool { 14732 return true 14733 } 14734 14735 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14736 func (s *ShmParams) MarshalUnsafe(dst []byte) []byte { 14737 size := s.SizeBytes() 14738 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14739 return dst[size:] 14740 } 14741 14742 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14743 func (s *ShmParams) UnmarshalUnsafe(src []byte) []byte { 14744 size := s.SizeBytes() 14745 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14746 return src[size:] 14747 } 14748 14749 // CopyOutN implements marshal.Marshallable.CopyOutN. 14750 func (s *ShmParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14751 // Construct a slice backed by dst's underlying memory. 14752 var buf []byte 14753 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14754 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14755 hdr.Len = s.SizeBytes() 14756 hdr.Cap = s.SizeBytes() 14757 14758 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14759 // Since we bypassed the compiler's escape analysis, indicate that s 14760 // must live until the use above. 14761 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14762 return length, err 14763 } 14764 14765 // CopyOut implements marshal.Marshallable.CopyOut. 14766 func (s *ShmParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14767 return s.CopyOutN(cc, addr, s.SizeBytes()) 14768 } 14769 14770 // CopyInN implements marshal.Marshallable.CopyInN. 14771 func (s *ShmParams) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14772 // Construct a slice backed by dst's underlying memory. 14773 var buf []byte 14774 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14775 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14776 hdr.Len = s.SizeBytes() 14777 hdr.Cap = s.SizeBytes() 14778 14779 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14780 // Since we bypassed the compiler's escape analysis, indicate that s 14781 // must live until the use above. 14782 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14783 return length, err 14784 } 14785 14786 // CopyIn implements marshal.Marshallable.CopyIn. 14787 func (s *ShmParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14788 return s.CopyInN(cc, addr, s.SizeBytes()) 14789 } 14790 14791 // WriteTo implements io.WriterTo.WriteTo. 14792 func (s *ShmParams) WriteTo(writer io.Writer) (int64, error) { 14793 // Construct a slice backed by dst's underlying memory. 14794 var buf []byte 14795 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14796 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14797 hdr.Len = s.SizeBytes() 14798 hdr.Cap = s.SizeBytes() 14799 14800 length, err := writer.Write(buf) 14801 // Since we bypassed the compiler's escape analysis, indicate that s 14802 // must live until the use above. 14803 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14804 return int64(length), err 14805 } 14806 14807 // SizeBytes implements marshal.Marshallable.SizeBytes. 14808 func (s *ShmidDS) SizeBytes() int { 14809 return 40 + 14810 (*IPCPerm)(nil).SizeBytes() + 14811 (*TimeT)(nil).SizeBytes() + 14812 (*TimeT)(nil).SizeBytes() + 14813 (*TimeT)(nil).SizeBytes() 14814 } 14815 14816 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14817 func (s *ShmidDS) MarshalBytes(dst []byte) []byte { 14818 dst = s.ShmPerm.MarshalUnsafe(dst) 14819 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSegsz)) 14820 dst = dst[8:] 14821 dst = s.ShmAtime.MarshalUnsafe(dst) 14822 dst = s.ShmDtime.MarshalUnsafe(dst) 14823 dst = s.ShmCtime.MarshalUnsafe(dst) 14824 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmCpid)) 14825 dst = dst[4:] 14826 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmLpid)) 14827 dst = dst[4:] 14828 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmNattach)) 14829 dst = dst[8:] 14830 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused4)) 14831 dst = dst[8:] 14832 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused5)) 14833 dst = dst[8:] 14834 return dst 14835 } 14836 14837 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14838 func (s *ShmidDS) UnmarshalBytes(src []byte) []byte { 14839 src = s.ShmPerm.UnmarshalUnsafe(src) 14840 s.ShmSegsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14841 src = src[8:] 14842 src = s.ShmAtime.UnmarshalUnsafe(src) 14843 src = s.ShmDtime.UnmarshalUnsafe(src) 14844 src = s.ShmCtime.UnmarshalUnsafe(src) 14845 s.ShmCpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14846 src = src[4:] 14847 s.ShmLpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14848 src = src[4:] 14849 s.ShmNattach = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14850 src = src[8:] 14851 s.Unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14852 src = src[8:] 14853 s.Unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14854 src = src[8:] 14855 return src 14856 } 14857 14858 // Packed implements marshal.Marshallable.Packed. 14859 //go:nosplit 14860 func (s *ShmidDS) Packed() bool { 14861 return s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() 14862 } 14863 14864 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14865 func (s *ShmidDS) MarshalUnsafe(dst []byte) []byte { 14866 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14867 size := s.SizeBytes() 14868 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14869 return dst[size:] 14870 } 14871 // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 14872 return s.MarshalBytes(dst) 14873 } 14874 14875 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14876 func (s *ShmidDS) UnmarshalUnsafe(src []byte) []byte { 14877 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14878 size := s.SizeBytes() 14879 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14880 return src[size:] 14881 } 14882 // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14883 return s.UnmarshalBytes(src) 14884 } 14885 14886 // CopyOutN implements marshal.Marshallable.CopyOutN. 14887 func (s *ShmidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14888 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14889 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 14890 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14891 s.MarshalBytes(buf) // escapes: fallback. 14892 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14893 } 14894 14895 // Construct a slice backed by dst's underlying memory. 14896 var buf []byte 14897 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14898 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14899 hdr.Len = s.SizeBytes() 14900 hdr.Cap = s.SizeBytes() 14901 14902 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14903 // Since we bypassed the compiler's escape analysis, indicate that s 14904 // must live until the use above. 14905 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14906 return length, err 14907 } 14908 14909 // CopyOut implements marshal.Marshallable.CopyOut. 14910 func (s *ShmidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14911 return s.CopyOutN(cc, addr, s.SizeBytes()) 14912 } 14913 14914 // CopyInN implements marshal.Marshallable.CopyInN. 14915 func (s *ShmidDS) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14916 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14917 // Type ShmidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14918 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14919 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14920 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14921 // partially unmarshalled struct. 14922 s.UnmarshalBytes(buf) // escapes: fallback. 14923 return length, err 14924 } 14925 14926 // Construct a slice backed by dst's underlying memory. 14927 var buf []byte 14928 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14929 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14930 hdr.Len = s.SizeBytes() 14931 hdr.Cap = s.SizeBytes() 14932 14933 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14934 // Since we bypassed the compiler's escape analysis, indicate that s 14935 // must live until the use above. 14936 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14937 return length, err 14938 } 14939 14940 // CopyIn implements marshal.Marshallable.CopyIn. 14941 func (s *ShmidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14942 return s.CopyInN(cc, addr, s.SizeBytes()) 14943 } 14944 14945 // WriteTo implements io.WriterTo.WriteTo. 14946 func (s *ShmidDS) WriteTo(writer io.Writer) (int64, error) { 14947 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14948 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 14949 buf := make([]byte, s.SizeBytes()) 14950 s.MarshalBytes(buf) 14951 length, err := writer.Write(buf) 14952 return int64(length), err 14953 } 14954 14955 // Construct a slice backed by dst's underlying memory. 14956 var buf []byte 14957 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14958 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14959 hdr.Len = s.SizeBytes() 14960 hdr.Cap = s.SizeBytes() 14961 14962 length, err := writer.Write(buf) 14963 // Since we bypassed the compiler's escape analysis, indicate that s 14964 // must live until the use above. 14965 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14966 return int64(length), err 14967 } 14968 14969 // SizeBytes implements marshal.Marshallable.SizeBytes. 14970 func (s *SigAction) SizeBytes() int { 14971 return 24 + 14972 (*SignalSet)(nil).SizeBytes() 14973 } 14974 14975 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14976 func (s *SigAction) MarshalBytes(dst []byte) []byte { 14977 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Handler)) 14978 dst = dst[8:] 14979 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 14980 dst = dst[8:] 14981 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Restorer)) 14982 dst = dst[8:] 14983 dst = s.Mask.MarshalUnsafe(dst) 14984 return dst 14985 } 14986 14987 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14988 func (s *SigAction) UnmarshalBytes(src []byte) []byte { 14989 s.Handler = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14990 src = src[8:] 14991 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14992 src = src[8:] 14993 s.Restorer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14994 src = src[8:] 14995 src = s.Mask.UnmarshalUnsafe(src) 14996 return src 14997 } 14998 14999 // Packed implements marshal.Marshallable.Packed. 15000 //go:nosplit 15001 func (s *SigAction) Packed() bool { 15002 return s.Mask.Packed() 15003 } 15004 15005 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15006 func (s *SigAction) MarshalUnsafe(dst []byte) []byte { 15007 if s.Mask.Packed() { 15008 size := s.SizeBytes() 15009 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15010 return dst[size:] 15011 } 15012 // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes. 15013 return s.MarshalBytes(dst) 15014 } 15015 15016 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15017 func (s *SigAction) UnmarshalUnsafe(src []byte) []byte { 15018 if s.Mask.Packed() { 15019 size := s.SizeBytes() 15020 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15021 return src[size:] 15022 } 15023 // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15024 return s.UnmarshalBytes(src) 15025 } 15026 15027 // CopyOutN implements marshal.Marshallable.CopyOutN. 15028 func (s *SigAction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15029 if !s.Mask.Packed() { 15030 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 15031 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15032 s.MarshalBytes(buf) // escapes: fallback. 15033 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15034 } 15035 15036 // Construct a slice backed by dst's underlying memory. 15037 var buf []byte 15038 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15039 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15040 hdr.Len = s.SizeBytes() 15041 hdr.Cap = s.SizeBytes() 15042 15043 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15044 // Since we bypassed the compiler's escape analysis, indicate that s 15045 // must live until the use above. 15046 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15047 return length, err 15048 } 15049 15050 // CopyOut implements marshal.Marshallable.CopyOut. 15051 func (s *SigAction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15052 return s.CopyOutN(cc, addr, s.SizeBytes()) 15053 } 15054 15055 // CopyInN implements marshal.Marshallable.CopyInN. 15056 func (s *SigAction) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15057 if !s.Mask.Packed() { 15058 // Type SigAction doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15059 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15060 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15061 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15062 // partially unmarshalled struct. 15063 s.UnmarshalBytes(buf) // escapes: fallback. 15064 return length, err 15065 } 15066 15067 // Construct a slice backed by dst's underlying memory. 15068 var buf []byte 15069 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15070 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15071 hdr.Len = s.SizeBytes() 15072 hdr.Cap = s.SizeBytes() 15073 15074 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15075 // Since we bypassed the compiler's escape analysis, indicate that s 15076 // must live until the use above. 15077 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15078 return length, err 15079 } 15080 15081 // CopyIn implements marshal.Marshallable.CopyIn. 15082 func (s *SigAction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15083 return s.CopyInN(cc, addr, s.SizeBytes()) 15084 } 15085 15086 // WriteTo implements io.WriterTo.WriteTo. 15087 func (s *SigAction) WriteTo(writer io.Writer) (int64, error) { 15088 if !s.Mask.Packed() { 15089 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 15090 buf := make([]byte, s.SizeBytes()) 15091 s.MarshalBytes(buf) 15092 length, err := writer.Write(buf) 15093 return int64(length), err 15094 } 15095 15096 // Construct a slice backed by dst's underlying memory. 15097 var buf []byte 15098 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15099 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15100 hdr.Len = s.SizeBytes() 15101 hdr.Cap = s.SizeBytes() 15102 15103 length, err := writer.Write(buf) 15104 // Since we bypassed the compiler's escape analysis, indicate that s 15105 // must live until the use above. 15106 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15107 return int64(length), err 15108 } 15109 15110 // SizeBytes implements marshal.Marshallable.SizeBytes. 15111 func (s *Sigevent) SizeBytes() int { 15112 return 20 + 15113 1*44 15114 } 15115 15116 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15117 func (s *Sigevent) MarshalBytes(dst []byte) []byte { 15118 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Value)) 15119 dst = dst[8:] 15120 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 15121 dst = dst[4:] 15122 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Notify)) 15123 dst = dst[4:] 15124 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Tid)) 15125 dst = dst[4:] 15126 for idx := 0; idx < 44; idx++ { 15127 dst[0] = byte(s.UnRemainder[idx]) 15128 dst = dst[1:] 15129 } 15130 return dst 15131 } 15132 15133 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15134 func (s *Sigevent) UnmarshalBytes(src []byte) []byte { 15135 s.Value = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15136 src = src[8:] 15137 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 15138 src = src[4:] 15139 s.Notify = int32(hostarch.ByteOrder.Uint32(src[:4])) 15140 src = src[4:] 15141 s.Tid = int32(hostarch.ByteOrder.Uint32(src[:4])) 15142 src = src[4:] 15143 for idx := 0; idx < 44; idx++ { 15144 s.UnRemainder[idx] = src[0] 15145 src = src[1:] 15146 } 15147 return src 15148 } 15149 15150 // Packed implements marshal.Marshallable.Packed. 15151 //go:nosplit 15152 func (s *Sigevent) Packed() bool { 15153 return true 15154 } 15155 15156 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15157 func (s *Sigevent) MarshalUnsafe(dst []byte) []byte { 15158 size := s.SizeBytes() 15159 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15160 return dst[size:] 15161 } 15162 15163 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15164 func (s *Sigevent) UnmarshalUnsafe(src []byte) []byte { 15165 size := s.SizeBytes() 15166 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15167 return src[size:] 15168 } 15169 15170 // CopyOutN implements marshal.Marshallable.CopyOutN. 15171 func (s *Sigevent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15172 // Construct a slice backed by dst's underlying memory. 15173 var buf []byte 15174 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15175 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15176 hdr.Len = s.SizeBytes() 15177 hdr.Cap = s.SizeBytes() 15178 15179 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15180 // Since we bypassed the compiler's escape analysis, indicate that s 15181 // must live until the use above. 15182 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15183 return length, err 15184 } 15185 15186 // CopyOut implements marshal.Marshallable.CopyOut. 15187 func (s *Sigevent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15188 return s.CopyOutN(cc, addr, s.SizeBytes()) 15189 } 15190 15191 // CopyInN implements marshal.Marshallable.CopyInN. 15192 func (s *Sigevent) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15193 // Construct a slice backed by dst's underlying memory. 15194 var buf []byte 15195 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15196 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15197 hdr.Len = s.SizeBytes() 15198 hdr.Cap = s.SizeBytes() 15199 15200 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15201 // Since we bypassed the compiler's escape analysis, indicate that s 15202 // must live until the use above. 15203 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15204 return length, err 15205 } 15206 15207 // CopyIn implements marshal.Marshallable.CopyIn. 15208 func (s *Sigevent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15209 return s.CopyInN(cc, addr, s.SizeBytes()) 15210 } 15211 15212 // WriteTo implements io.WriterTo.WriteTo. 15213 func (s *Sigevent) WriteTo(writer io.Writer) (int64, error) { 15214 // Construct a slice backed by dst's underlying memory. 15215 var buf []byte 15216 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15217 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15218 hdr.Len = s.SizeBytes() 15219 hdr.Cap = s.SizeBytes() 15220 15221 length, err := writer.Write(buf) 15222 // Since we bypassed the compiler's escape analysis, indicate that s 15223 // must live until the use above. 15224 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15225 return int64(length), err 15226 } 15227 15228 // SizeBytes implements marshal.Marshallable.SizeBytes. 15229 func (s *SignalInfo) SizeBytes() int { 15230 return 16 + 15231 1*(128-16) 15232 } 15233 15234 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15235 func (s *SignalInfo) MarshalBytes(dst []byte) []byte { 15236 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 15237 dst = dst[4:] 15238 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 15239 dst = dst[4:] 15240 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 15241 dst = dst[4:] 15242 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 15243 dst = dst[4:] 15244 for idx := 0; idx < (128-16); idx++ { 15245 dst[0] = byte(s.Fields[idx]) 15246 dst = dst[1:] 15247 } 15248 return dst 15249 } 15250 15251 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15252 func (s *SignalInfo) UnmarshalBytes(src []byte) []byte { 15253 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 15254 src = src[4:] 15255 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 15256 src = src[4:] 15257 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 15258 src = src[4:] 15259 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 15260 src = src[4:] 15261 for idx := 0; idx < (128-16); idx++ { 15262 s.Fields[idx] = src[0] 15263 src = src[1:] 15264 } 15265 return src 15266 } 15267 15268 // Packed implements marshal.Marshallable.Packed. 15269 //go:nosplit 15270 func (s *SignalInfo) Packed() bool { 15271 return true 15272 } 15273 15274 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15275 func (s *SignalInfo) MarshalUnsafe(dst []byte) []byte { 15276 size := s.SizeBytes() 15277 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15278 return dst[size:] 15279 } 15280 15281 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15282 func (s *SignalInfo) UnmarshalUnsafe(src []byte) []byte { 15283 size := s.SizeBytes() 15284 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15285 return src[size:] 15286 } 15287 15288 // CopyOutN implements marshal.Marshallable.CopyOutN. 15289 func (s *SignalInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15290 // Construct a slice backed by dst's underlying memory. 15291 var buf []byte 15292 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15293 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15294 hdr.Len = s.SizeBytes() 15295 hdr.Cap = s.SizeBytes() 15296 15297 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15298 // Since we bypassed the compiler's escape analysis, indicate that s 15299 // must live until the use above. 15300 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15301 return length, err 15302 } 15303 15304 // CopyOut implements marshal.Marshallable.CopyOut. 15305 func (s *SignalInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15306 return s.CopyOutN(cc, addr, s.SizeBytes()) 15307 } 15308 15309 // CopyInN implements marshal.Marshallable.CopyInN. 15310 func (s *SignalInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15311 // Construct a slice backed by dst's underlying memory. 15312 var buf []byte 15313 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15314 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15315 hdr.Len = s.SizeBytes() 15316 hdr.Cap = s.SizeBytes() 15317 15318 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15319 // Since we bypassed the compiler's escape analysis, indicate that s 15320 // must live until the use above. 15321 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15322 return length, err 15323 } 15324 15325 // CopyIn implements marshal.Marshallable.CopyIn. 15326 func (s *SignalInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15327 return s.CopyInN(cc, addr, s.SizeBytes()) 15328 } 15329 15330 // WriteTo implements io.WriterTo.WriteTo. 15331 func (s *SignalInfo) WriteTo(writer io.Writer) (int64, error) { 15332 // Construct a slice backed by dst's underlying memory. 15333 var buf []byte 15334 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15335 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15336 hdr.Len = s.SizeBytes() 15337 hdr.Cap = s.SizeBytes() 15338 15339 length, err := writer.Write(buf) 15340 // Since we bypassed the compiler's escape analysis, indicate that s 15341 // must live until the use above. 15342 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15343 return int64(length), err 15344 } 15345 15346 // SizeBytes implements marshal.Marshallable.SizeBytes. 15347 //go:nosplit 15348 func (s *SignalSet) SizeBytes() int { 15349 return 8 15350 } 15351 15352 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15353 func (s *SignalSet) MarshalBytes(dst []byte) []byte { 15354 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*s)) 15355 return dst[8:] 15356 } 15357 15358 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15359 func (s *SignalSet) UnmarshalBytes(src []byte) []byte { 15360 *s = SignalSet(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 15361 return src[8:] 15362 } 15363 15364 // Packed implements marshal.Marshallable.Packed. 15365 //go:nosplit 15366 func (s *SignalSet) Packed() bool { 15367 // Scalar newtypes are always packed. 15368 return true 15369 } 15370 15371 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15372 func (s *SignalSet) MarshalUnsafe(dst []byte) []byte { 15373 size := s.SizeBytes() 15374 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15375 return dst[size:] 15376 } 15377 15378 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15379 func (s *SignalSet) UnmarshalUnsafe(src []byte) []byte { 15380 size := s.SizeBytes() 15381 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15382 return src[size:] 15383 } 15384 15385 // CopyOutN implements marshal.Marshallable.CopyOutN. 15386 func (s *SignalSet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15387 // Construct a slice backed by dst's underlying memory. 15388 var buf []byte 15389 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15390 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15391 hdr.Len = s.SizeBytes() 15392 hdr.Cap = s.SizeBytes() 15393 15394 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15395 // Since we bypassed the compiler's escape analysis, indicate that s 15396 // must live until the use above. 15397 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15398 return length, err 15399 } 15400 15401 // CopyOut implements marshal.Marshallable.CopyOut. 15402 func (s *SignalSet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15403 return s.CopyOutN(cc, addr, s.SizeBytes()) 15404 } 15405 15406 // CopyInN implements marshal.Marshallable.CopyInN. 15407 func (s *SignalSet) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15408 // Construct a slice backed by dst's underlying memory. 15409 var buf []byte 15410 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15411 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15412 hdr.Len = s.SizeBytes() 15413 hdr.Cap = s.SizeBytes() 15414 15415 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15416 // Since we bypassed the compiler's escape analysis, indicate that s 15417 // must live until the use above. 15418 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15419 return length, err 15420 } 15421 15422 // CopyIn implements marshal.Marshallable.CopyIn. 15423 func (s *SignalSet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15424 return s.CopyInN(cc, addr, s.SizeBytes()) 15425 } 15426 15427 // WriteTo implements io.WriterTo.WriteTo. 15428 func (s *SignalSet) WriteTo(writer io.Writer) (int64, error) { 15429 // Construct a slice backed by dst's underlying memory. 15430 var buf []byte 15431 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15432 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15433 hdr.Len = s.SizeBytes() 15434 hdr.Cap = s.SizeBytes() 15435 15436 length, err := writer.Write(buf) 15437 // Since we bypassed the compiler's escape analysis, indicate that s 15438 // must live until the use above. 15439 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15440 return int64(length), err 15441 } 15442 15443 // SizeBytes implements marshal.Marshallable.SizeBytes. 15444 func (s *SignalStack) SizeBytes() int { 15445 return 24 15446 } 15447 15448 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15449 func (s *SignalStack) MarshalBytes(dst []byte) []byte { 15450 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 15451 dst = dst[8:] 15452 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flags)) 15453 dst = dst[4:] 15454 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 15455 dst = dst[4:] 15456 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 15457 dst = dst[8:] 15458 return dst 15459 } 15460 15461 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15462 func (s *SignalStack) UnmarshalBytes(src []byte) []byte { 15463 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15464 src = src[8:] 15465 s.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15466 src = src[4:] 15467 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 15468 src = src[4:] 15469 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15470 src = src[8:] 15471 return src 15472 } 15473 15474 // Packed implements marshal.Marshallable.Packed. 15475 //go:nosplit 15476 func (s *SignalStack) Packed() bool { 15477 return true 15478 } 15479 15480 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15481 func (s *SignalStack) MarshalUnsafe(dst []byte) []byte { 15482 size := s.SizeBytes() 15483 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15484 return dst[size:] 15485 } 15486 15487 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15488 func (s *SignalStack) UnmarshalUnsafe(src []byte) []byte { 15489 size := s.SizeBytes() 15490 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15491 return src[size:] 15492 } 15493 15494 // CopyOutN implements marshal.Marshallable.CopyOutN. 15495 func (s *SignalStack) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15496 // Construct a slice backed by dst's underlying memory. 15497 var buf []byte 15498 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15499 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15500 hdr.Len = s.SizeBytes() 15501 hdr.Cap = s.SizeBytes() 15502 15503 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15504 // Since we bypassed the compiler's escape analysis, indicate that s 15505 // must live until the use above. 15506 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15507 return length, err 15508 } 15509 15510 // CopyOut implements marshal.Marshallable.CopyOut. 15511 func (s *SignalStack) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15512 return s.CopyOutN(cc, addr, s.SizeBytes()) 15513 } 15514 15515 // CopyInN implements marshal.Marshallable.CopyInN. 15516 func (s *SignalStack) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15517 // Construct a slice backed by dst's underlying memory. 15518 var buf []byte 15519 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15520 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15521 hdr.Len = s.SizeBytes() 15522 hdr.Cap = s.SizeBytes() 15523 15524 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15525 // Since we bypassed the compiler's escape analysis, indicate that s 15526 // must live until the use above. 15527 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15528 return length, err 15529 } 15530 15531 // CopyIn implements marshal.Marshallable.CopyIn. 15532 func (s *SignalStack) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15533 return s.CopyInN(cc, addr, s.SizeBytes()) 15534 } 15535 15536 // WriteTo implements io.WriterTo.WriteTo. 15537 func (s *SignalStack) WriteTo(writer io.Writer) (int64, error) { 15538 // Construct a slice backed by dst's underlying memory. 15539 var buf []byte 15540 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15541 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15542 hdr.Len = s.SizeBytes() 15543 hdr.Cap = s.SizeBytes() 15544 15545 length, err := writer.Write(buf) 15546 // Since we bypassed the compiler's escape analysis, indicate that s 15547 // must live until the use above. 15548 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15549 return int64(length), err 15550 } 15551 15552 // SizeBytes implements marshal.Marshallable.SizeBytes. 15553 func (s *SignalfdSiginfo) SizeBytes() int { 15554 return 82 + 15555 1*48 15556 } 15557 15558 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15559 func (s *SignalfdSiginfo) MarshalBytes(dst []byte) []byte { 15560 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 15561 dst = dst[4:] 15562 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 15563 dst = dst[4:] 15564 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 15565 dst = dst[4:] 15566 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PID)) 15567 dst = dst[4:] 15568 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 15569 dst = dst[4:] 15570 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FD)) 15571 dst = dst[4:] 15572 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TID)) 15573 dst = dst[4:] 15574 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Band)) 15575 dst = dst[4:] 15576 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Overrun)) 15577 dst = dst[4:] 15578 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TrapNo)) 15579 dst = dst[4:] 15580 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Status)) 15581 dst = dst[4:] 15582 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Int)) 15583 dst = dst[4:] 15584 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ptr)) 15585 dst = dst[8:] 15586 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.UTime)) 15587 dst = dst[8:] 15588 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.STime)) 15589 dst = dst[8:] 15590 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 15591 dst = dst[8:] 15592 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.AddrLSB)) 15593 dst = dst[2:] 15594 // Padding: dst[:sizeof(uint8)*48] ~= [48]uint8{0} 15595 dst = dst[1*(48):] 15596 return dst 15597 } 15598 15599 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15600 func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) []byte { 15601 s.Signo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15602 src = src[4:] 15603 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 15604 src = src[4:] 15605 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 15606 src = src[4:] 15607 s.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15608 src = src[4:] 15609 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15610 src = src[4:] 15611 s.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 15612 src = src[4:] 15613 s.TID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15614 src = src[4:] 15615 s.Band = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15616 src = src[4:] 15617 s.Overrun = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15618 src = src[4:] 15619 s.TrapNo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15620 src = src[4:] 15621 s.Status = int32(hostarch.ByteOrder.Uint32(src[:4])) 15622 src = src[4:] 15623 s.Int = int32(hostarch.ByteOrder.Uint32(src[:4])) 15624 src = src[4:] 15625 s.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15626 src = src[8:] 15627 s.UTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15628 src = src[8:] 15629 s.STime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15630 src = src[8:] 15631 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15632 src = src[8:] 15633 s.AddrLSB = uint16(hostarch.ByteOrder.Uint16(src[:2])) 15634 src = src[2:] 15635 // Padding: ~ copy([48]uint8(s._), src[:sizeof(uint8)*48]) 15636 src = src[1*(48):] 15637 return src 15638 } 15639 15640 // Packed implements marshal.Marshallable.Packed. 15641 //go:nosplit 15642 func (s *SignalfdSiginfo) Packed() bool { 15643 return false 15644 } 15645 15646 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15647 func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) []byte { 15648 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15649 return s.MarshalBytes(dst) 15650 } 15651 15652 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15653 func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) []byte { 15654 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15655 return s.UnmarshalBytes(src) 15656 } 15657 15658 // CopyOutN implements marshal.Marshallable.CopyOutN. 15659 func (s *SignalfdSiginfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15660 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15661 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15662 s.MarshalBytes(buf) // escapes: fallback. 15663 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15664 } 15665 15666 // CopyOut implements marshal.Marshallable.CopyOut. 15667 func (s *SignalfdSiginfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15668 return s.CopyOutN(cc, addr, s.SizeBytes()) 15669 } 15670 15671 // CopyInN implements marshal.Marshallable.CopyInN. 15672 func (s *SignalfdSiginfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15673 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15674 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15675 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15676 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15677 // partially unmarshalled struct. 15678 s.UnmarshalBytes(buf) // escapes: fallback. 15679 return length, err 15680 } 15681 15682 // CopyIn implements marshal.Marshallable.CopyIn. 15683 func (s *SignalfdSiginfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15684 return s.CopyInN(cc, addr, s.SizeBytes()) 15685 } 15686 15687 // WriteTo implements io.WriterTo.WriteTo. 15688 func (s *SignalfdSiginfo) WriteTo(writer io.Writer) (int64, error) { 15689 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15690 buf := make([]byte, s.SizeBytes()) 15691 s.MarshalBytes(buf) 15692 length, err := writer.Write(buf) 15693 return int64(length), err 15694 } 15695 15696 // SizeBytes implements marshal.Marshallable.SizeBytes. 15697 func (c *ControlMessageCredentials) SizeBytes() int { 15698 return 12 15699 } 15700 15701 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15702 func (c *ControlMessageCredentials) MarshalBytes(dst []byte) []byte { 15703 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.PID)) 15704 dst = dst[4:] 15705 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.UID)) 15706 dst = dst[4:] 15707 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.GID)) 15708 dst = dst[4:] 15709 return dst 15710 } 15711 15712 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15713 func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) []byte { 15714 c.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 15715 src = src[4:] 15716 c.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15717 src = src[4:] 15718 c.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15719 src = src[4:] 15720 return src 15721 } 15722 15723 // Packed implements marshal.Marshallable.Packed. 15724 //go:nosplit 15725 func (c *ControlMessageCredentials) Packed() bool { 15726 return true 15727 } 15728 15729 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15730 func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) []byte { 15731 size := c.SizeBytes() 15732 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15733 return dst[size:] 15734 } 15735 15736 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15737 func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) []byte { 15738 size := c.SizeBytes() 15739 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15740 return src[size:] 15741 } 15742 15743 // CopyOutN implements marshal.Marshallable.CopyOutN. 15744 func (c *ControlMessageCredentials) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15745 // Construct a slice backed by dst's underlying memory. 15746 var buf []byte 15747 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15748 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15749 hdr.Len = c.SizeBytes() 15750 hdr.Cap = c.SizeBytes() 15751 15752 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15753 // Since we bypassed the compiler's escape analysis, indicate that c 15754 // must live until the use above. 15755 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15756 return length, err 15757 } 15758 15759 // CopyOut implements marshal.Marshallable.CopyOut. 15760 func (c *ControlMessageCredentials) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15761 return c.CopyOutN(cc, addr, c.SizeBytes()) 15762 } 15763 15764 // CopyInN implements marshal.Marshallable.CopyInN. 15765 func (c *ControlMessageCredentials) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15766 // Construct a slice backed by dst's underlying memory. 15767 var buf []byte 15768 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15769 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15770 hdr.Len = c.SizeBytes() 15771 hdr.Cap = c.SizeBytes() 15772 15773 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15774 // Since we bypassed the compiler's escape analysis, indicate that c 15775 // must live until the use above. 15776 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15777 return length, err 15778 } 15779 15780 // CopyIn implements marshal.Marshallable.CopyIn. 15781 func (c *ControlMessageCredentials) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15782 return c.CopyInN(cc, addr, c.SizeBytes()) 15783 } 15784 15785 // WriteTo implements io.WriterTo.WriteTo. 15786 func (c *ControlMessageCredentials) WriteTo(writer io.Writer) (int64, error) { 15787 // Construct a slice backed by dst's underlying memory. 15788 var buf []byte 15789 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15790 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15791 hdr.Len = c.SizeBytes() 15792 hdr.Cap = c.SizeBytes() 15793 15794 length, err := writer.Write(buf) 15795 // Since we bypassed the compiler's escape analysis, indicate that c 15796 // must live until the use above. 15797 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15798 return int64(length), err 15799 } 15800 15801 // SizeBytes implements marshal.Marshallable.SizeBytes. 15802 func (c *ControlMessageHeader) SizeBytes() int { 15803 return 16 15804 } 15805 15806 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15807 func (c *ControlMessageHeader) MarshalBytes(dst []byte) []byte { 15808 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Length)) 15809 dst = dst[8:] 15810 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Level)) 15811 dst = dst[4:] 15812 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Type)) 15813 dst = dst[4:] 15814 return dst 15815 } 15816 15817 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15818 func (c *ControlMessageHeader) UnmarshalBytes(src []byte) []byte { 15819 c.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15820 src = src[8:] 15821 c.Level = int32(hostarch.ByteOrder.Uint32(src[:4])) 15822 src = src[4:] 15823 c.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 15824 src = src[4:] 15825 return src 15826 } 15827 15828 // Packed implements marshal.Marshallable.Packed. 15829 //go:nosplit 15830 func (c *ControlMessageHeader) Packed() bool { 15831 return true 15832 } 15833 15834 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15835 func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) []byte { 15836 size := c.SizeBytes() 15837 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15838 return dst[size:] 15839 } 15840 15841 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15842 func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) []byte { 15843 size := c.SizeBytes() 15844 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15845 return src[size:] 15846 } 15847 15848 // CopyOutN implements marshal.Marshallable.CopyOutN. 15849 func (c *ControlMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15850 // Construct a slice backed by dst's underlying memory. 15851 var buf []byte 15852 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15853 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15854 hdr.Len = c.SizeBytes() 15855 hdr.Cap = c.SizeBytes() 15856 15857 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15858 // Since we bypassed the compiler's escape analysis, indicate that c 15859 // must live until the use above. 15860 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15861 return length, err 15862 } 15863 15864 // CopyOut implements marshal.Marshallable.CopyOut. 15865 func (c *ControlMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15866 return c.CopyOutN(cc, addr, c.SizeBytes()) 15867 } 15868 15869 // CopyInN implements marshal.Marshallable.CopyInN. 15870 func (c *ControlMessageHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15871 // Construct a slice backed by dst's underlying memory. 15872 var buf []byte 15873 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15874 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15875 hdr.Len = c.SizeBytes() 15876 hdr.Cap = c.SizeBytes() 15877 15878 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15879 // Since we bypassed the compiler's escape analysis, indicate that c 15880 // must live until the use above. 15881 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15882 return length, err 15883 } 15884 15885 // CopyIn implements marshal.Marshallable.CopyIn. 15886 func (c *ControlMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15887 return c.CopyInN(cc, addr, c.SizeBytes()) 15888 } 15889 15890 // WriteTo implements io.WriterTo.WriteTo. 15891 func (c *ControlMessageHeader) WriteTo(writer io.Writer) (int64, error) { 15892 // Construct a slice backed by dst's underlying memory. 15893 var buf []byte 15894 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15895 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15896 hdr.Len = c.SizeBytes() 15897 hdr.Cap = c.SizeBytes() 15898 15899 length, err := writer.Write(buf) 15900 // Since we bypassed the compiler's escape analysis, indicate that c 15901 // must live until the use above. 15902 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15903 return int64(length), err 15904 } 15905 15906 // SizeBytes implements marshal.Marshallable.SizeBytes. 15907 func (c *ControlMessageIPPacketInfo) SizeBytes() int { 15908 return 4 + 15909 (*InetAddr)(nil).SizeBytes() + 15910 (*InetAddr)(nil).SizeBytes() 15911 } 15912 15913 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15914 func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) []byte { 15915 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 15916 dst = dst[4:] 15917 dst = c.LocalAddr.MarshalUnsafe(dst) 15918 dst = c.DestinationAddr.MarshalUnsafe(dst) 15919 return dst 15920 } 15921 15922 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15923 func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) []byte { 15924 c.NIC = int32(hostarch.ByteOrder.Uint32(src[:4])) 15925 src = src[4:] 15926 src = c.LocalAddr.UnmarshalUnsafe(src) 15927 src = c.DestinationAddr.UnmarshalUnsafe(src) 15928 return src 15929 } 15930 15931 // Packed implements marshal.Marshallable.Packed. 15932 //go:nosplit 15933 func (c *ControlMessageIPPacketInfo) Packed() bool { 15934 return c.DestinationAddr.Packed() && c.LocalAddr.Packed() 15935 } 15936 15937 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15938 func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) []byte { 15939 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15940 size := c.SizeBytes() 15941 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15942 return dst[size:] 15943 } 15944 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15945 return c.MarshalBytes(dst) 15946 } 15947 15948 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15949 func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) []byte { 15950 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15951 size := c.SizeBytes() 15952 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15953 return src[size:] 15954 } 15955 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15956 return c.UnmarshalBytes(src) 15957 } 15958 15959 // CopyOutN implements marshal.Marshallable.CopyOutN. 15960 func (c *ControlMessageIPPacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15961 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15962 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15963 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15964 c.MarshalBytes(buf) // escapes: fallback. 15965 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15966 } 15967 15968 // Construct a slice backed by dst's underlying memory. 15969 var buf []byte 15970 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15971 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15972 hdr.Len = c.SizeBytes() 15973 hdr.Cap = c.SizeBytes() 15974 15975 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15976 // Since we bypassed the compiler's escape analysis, indicate that c 15977 // must live until the use above. 15978 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15979 return length, err 15980 } 15981 15982 // CopyOut implements marshal.Marshallable.CopyOut. 15983 func (c *ControlMessageIPPacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15984 return c.CopyOutN(cc, addr, c.SizeBytes()) 15985 } 15986 15987 // CopyInN implements marshal.Marshallable.CopyInN. 15988 func (c *ControlMessageIPPacketInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15989 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15990 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15991 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15992 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15993 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15994 // partially unmarshalled struct. 15995 c.UnmarshalBytes(buf) // escapes: fallback. 15996 return length, err 15997 } 15998 15999 // Construct a slice backed by dst's underlying memory. 16000 var buf []byte 16001 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16002 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16003 hdr.Len = c.SizeBytes() 16004 hdr.Cap = c.SizeBytes() 16005 16006 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16007 // Since we bypassed the compiler's escape analysis, indicate that c 16008 // must live until the use above. 16009 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16010 return length, err 16011 } 16012 16013 // CopyIn implements marshal.Marshallable.CopyIn. 16014 func (c *ControlMessageIPPacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16015 return c.CopyInN(cc, addr, c.SizeBytes()) 16016 } 16017 16018 // WriteTo implements io.WriterTo.WriteTo. 16019 func (c *ControlMessageIPPacketInfo) WriteTo(writer io.Writer) (int64, error) { 16020 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 16021 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16022 buf := make([]byte, c.SizeBytes()) 16023 c.MarshalBytes(buf) 16024 length, err := writer.Write(buf) 16025 return int64(length), err 16026 } 16027 16028 // Construct a slice backed by dst's underlying memory. 16029 var buf []byte 16030 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16031 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16032 hdr.Len = c.SizeBytes() 16033 hdr.Cap = c.SizeBytes() 16034 16035 length, err := writer.Write(buf) 16036 // Since we bypassed the compiler's escape analysis, indicate that c 16037 // must live until the use above. 16038 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16039 return int64(length), err 16040 } 16041 16042 // SizeBytes implements marshal.Marshallable.SizeBytes. 16043 func (c *ControlMessageIPv6PacketInfo) SizeBytes() int { 16044 return 4 + 16045 (*Inet6Addr)(nil).SizeBytes() 16046 } 16047 16048 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16049 func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) []byte { 16050 dst = c.Addr.MarshalUnsafe(dst) 16051 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 16052 dst = dst[4:] 16053 return dst 16054 } 16055 16056 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16057 func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) []byte { 16058 src = c.Addr.UnmarshalUnsafe(src) 16059 c.NIC = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16060 src = src[4:] 16061 return src 16062 } 16063 16064 // Packed implements marshal.Marshallable.Packed. 16065 //go:nosplit 16066 func (c *ControlMessageIPv6PacketInfo) Packed() bool { 16067 return c.Addr.Packed() 16068 } 16069 16070 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16071 func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) []byte { 16072 if c.Addr.Packed() { 16073 size := c.SizeBytes() 16074 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 16075 return dst[size:] 16076 } 16077 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 16078 return c.MarshalBytes(dst) 16079 } 16080 16081 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16082 func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) []byte { 16083 if c.Addr.Packed() { 16084 size := c.SizeBytes() 16085 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 16086 return src[size:] 16087 } 16088 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16089 return c.UnmarshalBytes(src) 16090 } 16091 16092 // CopyOutN implements marshal.Marshallable.CopyOutN. 16093 func (c *ControlMessageIPv6PacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16094 if !c.Addr.Packed() { 16095 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16096 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 16097 c.MarshalBytes(buf) // escapes: fallback. 16098 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16099 } 16100 16101 // Construct a slice backed by dst's underlying memory. 16102 var buf []byte 16103 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16104 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16105 hdr.Len = c.SizeBytes() 16106 hdr.Cap = c.SizeBytes() 16107 16108 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16109 // Since we bypassed the compiler's escape analysis, indicate that c 16110 // must live until the use above. 16111 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16112 return length, err 16113 } 16114 16115 // CopyOut implements marshal.Marshallable.CopyOut. 16116 func (c *ControlMessageIPv6PacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16117 return c.CopyOutN(cc, addr, c.SizeBytes()) 16118 } 16119 16120 // CopyInN implements marshal.Marshallable.CopyInN. 16121 func (c *ControlMessageIPv6PacketInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16122 if !c.Addr.Packed() { 16123 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16124 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 16125 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16126 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16127 // partially unmarshalled struct. 16128 c.UnmarshalBytes(buf) // escapes: fallback. 16129 return length, err 16130 } 16131 16132 // Construct a slice backed by dst's underlying memory. 16133 var buf []byte 16134 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16135 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16136 hdr.Len = c.SizeBytes() 16137 hdr.Cap = c.SizeBytes() 16138 16139 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16140 // Since we bypassed the compiler's escape analysis, indicate that c 16141 // must live until the use above. 16142 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16143 return length, err 16144 } 16145 16146 // CopyIn implements marshal.Marshallable.CopyIn. 16147 func (c *ControlMessageIPv6PacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16148 return c.CopyInN(cc, addr, c.SizeBytes()) 16149 } 16150 16151 // WriteTo implements io.WriterTo.WriteTo. 16152 func (c *ControlMessageIPv6PacketInfo) WriteTo(writer io.Writer) (int64, error) { 16153 if !c.Addr.Packed() { 16154 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16155 buf := make([]byte, c.SizeBytes()) 16156 c.MarshalBytes(buf) 16157 length, err := writer.Write(buf) 16158 return int64(length), err 16159 } 16160 16161 // Construct a slice backed by dst's underlying memory. 16162 var buf []byte 16163 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16164 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16165 hdr.Len = c.SizeBytes() 16166 hdr.Cap = c.SizeBytes() 16167 16168 length, err := writer.Write(buf) 16169 // Since we bypassed the compiler's escape analysis, indicate that c 16170 // must live until the use above. 16171 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16172 return int64(length), err 16173 } 16174 16175 // SizeBytes implements marshal.Marshallable.SizeBytes. 16176 func (i *ICMP6Filter) SizeBytes() int { 16177 return 0 + 16178 4*8 16179 } 16180 16181 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16182 func (i *ICMP6Filter) MarshalBytes(dst []byte) []byte { 16183 for idx := 0; idx < 8; idx++ { 16184 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Filter[idx])) 16185 dst = dst[4:] 16186 } 16187 return dst 16188 } 16189 16190 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16191 func (i *ICMP6Filter) UnmarshalBytes(src []byte) []byte { 16192 for idx := 0; idx < 8; idx++ { 16193 i.Filter[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16194 src = src[4:] 16195 } 16196 return src 16197 } 16198 16199 // Packed implements marshal.Marshallable.Packed. 16200 //go:nosplit 16201 func (i *ICMP6Filter) Packed() bool { 16202 return true 16203 } 16204 16205 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16206 func (i *ICMP6Filter) MarshalUnsafe(dst []byte) []byte { 16207 size := i.SizeBytes() 16208 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 16209 return dst[size:] 16210 } 16211 16212 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16213 func (i *ICMP6Filter) UnmarshalUnsafe(src []byte) []byte { 16214 size := i.SizeBytes() 16215 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16216 return src[size:] 16217 } 16218 16219 // CopyOutN implements marshal.Marshallable.CopyOutN. 16220 func (i *ICMP6Filter) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16221 // Construct a slice backed by dst's underlying memory. 16222 var buf []byte 16223 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16224 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16225 hdr.Len = i.SizeBytes() 16226 hdr.Cap = i.SizeBytes() 16227 16228 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16229 // Since we bypassed the compiler's escape analysis, indicate that i 16230 // must live until the use above. 16231 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16232 return length, err 16233 } 16234 16235 // CopyOut implements marshal.Marshallable.CopyOut. 16236 func (i *ICMP6Filter) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16237 return i.CopyOutN(cc, addr, i.SizeBytes()) 16238 } 16239 16240 // CopyInN implements marshal.Marshallable.CopyInN. 16241 func (i *ICMP6Filter) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16242 // Construct a slice backed by dst's underlying memory. 16243 var buf []byte 16244 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16245 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16246 hdr.Len = i.SizeBytes() 16247 hdr.Cap = i.SizeBytes() 16248 16249 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16250 // Since we bypassed the compiler's escape analysis, indicate that i 16251 // must live until the use above. 16252 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16253 return length, err 16254 } 16255 16256 // CopyIn implements marshal.Marshallable.CopyIn. 16257 func (i *ICMP6Filter) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16258 return i.CopyInN(cc, addr, i.SizeBytes()) 16259 } 16260 16261 // WriteTo implements io.WriterTo.WriteTo. 16262 func (i *ICMP6Filter) WriteTo(writer io.Writer) (int64, error) { 16263 // Construct a slice backed by dst's underlying memory. 16264 var buf []byte 16265 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16266 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16267 hdr.Len = i.SizeBytes() 16268 hdr.Cap = i.SizeBytes() 16269 16270 length, err := writer.Write(buf) 16271 // Since we bypassed the compiler's escape analysis, indicate that i 16272 // must live until the use above. 16273 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16274 return int64(length), err 16275 } 16276 16277 // SizeBytes implements marshal.Marshallable.SizeBytes. 16278 //go:nosplit 16279 func (i *Inet6Addr) SizeBytes() int { 16280 return 1 * 16 16281 } 16282 16283 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16284 func (i *Inet6Addr) MarshalBytes(dst []byte) []byte { 16285 for idx := 0; idx < 16; idx++ { 16286 dst[0] = byte(i[idx]) 16287 dst = dst[1:] 16288 } 16289 return dst 16290 } 16291 16292 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16293 func (i *Inet6Addr) UnmarshalBytes(src []byte) []byte { 16294 for idx := 0; idx < 16; idx++ { 16295 i[idx] = src[0] 16296 src = src[1:] 16297 } 16298 return src 16299 } 16300 16301 // Packed implements marshal.Marshallable.Packed. 16302 //go:nosplit 16303 func (i *Inet6Addr) Packed() bool { 16304 // Array newtypes are always packed. 16305 return true 16306 } 16307 16308 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16309 func (i *Inet6Addr) MarshalUnsafe(dst []byte) []byte { 16310 size := i.SizeBytes() 16311 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 16312 return dst[size:] 16313 } 16314 16315 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16316 func (i *Inet6Addr) UnmarshalUnsafe(src []byte) []byte { 16317 size := i.SizeBytes() 16318 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16319 return src[size:] 16320 } 16321 16322 // CopyOutN implements marshal.Marshallable.CopyOutN. 16323 func (i *Inet6Addr) 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(i))) 16328 hdr.Len = i.SizeBytes() 16329 hdr.Cap = i.SizeBytes() 16330 16331 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16332 // Since we bypassed the compiler's escape analysis, indicate that i 16333 // must live until the use above. 16334 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16335 return length, err 16336 } 16337 16338 // CopyOut implements marshal.Marshallable.CopyOut. 16339 func (i *Inet6Addr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16340 return i.CopyOutN(cc, addr, i.SizeBytes()) 16341 } 16342 16343 // CopyInN implements marshal.Marshallable.CopyInN. 16344 func (i *Inet6Addr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (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(i))) 16349 hdr.Len = i.SizeBytes() 16350 hdr.Cap = i.SizeBytes() 16351 16352 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16353 // Since we bypassed the compiler's escape analysis, indicate that i 16354 // must live until the use above. 16355 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16356 return length, err 16357 } 16358 16359 // CopyIn implements marshal.Marshallable.CopyIn. 16360 func (i *Inet6Addr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16361 return i.CopyInN(cc, addr, i.SizeBytes()) 16362 } 16363 16364 // WriteTo implements io.WriterTo.WriteTo. 16365 func (i *Inet6Addr) WriteTo(writer io.Writer) (int64, error) { 16366 // Construct a slice backed by dst's underlying memory. 16367 var buf []byte 16368 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16369 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16370 hdr.Len = i.SizeBytes() 16371 hdr.Cap = i.SizeBytes() 16372 16373 length, err := writer.Write(buf) 16374 // Since we bypassed the compiler's escape analysis, indicate that i 16375 // must live until the use above. 16376 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16377 return int64(length), err 16378 } 16379 16380 // SizeBytes implements marshal.Marshallable.SizeBytes. 16381 func (i *Inet6MulticastRequest) SizeBytes() int { 16382 return 4 + 16383 (*Inet6Addr)(nil).SizeBytes() 16384 } 16385 16386 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16387 func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) []byte { 16388 dst = i.MulticastAddr.MarshalUnsafe(dst) 16389 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 16390 dst = dst[4:] 16391 return dst 16392 } 16393 16394 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16395 func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) []byte { 16396 src = i.MulticastAddr.UnmarshalUnsafe(src) 16397 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 16398 src = src[4:] 16399 return src 16400 } 16401 16402 // Packed implements marshal.Marshallable.Packed. 16403 //go:nosplit 16404 func (i *Inet6MulticastRequest) Packed() bool { 16405 return i.MulticastAddr.Packed() 16406 } 16407 16408 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16409 func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) []byte { 16410 if i.MulticastAddr.Packed() { 16411 size := i.SizeBytes() 16412 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 16413 return dst[size:] 16414 } 16415 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 16416 return i.MarshalBytes(dst) 16417 } 16418 16419 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16420 func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) []byte { 16421 if i.MulticastAddr.Packed() { 16422 size := i.SizeBytes() 16423 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16424 return src[size:] 16425 } 16426 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16427 return i.UnmarshalBytes(src) 16428 } 16429 16430 // CopyOutN implements marshal.Marshallable.CopyOutN. 16431 func (i *Inet6MulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16432 if !i.MulticastAddr.Packed() { 16433 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 16434 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16435 i.MarshalBytes(buf) // escapes: fallback. 16436 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16437 } 16438 16439 // Construct a slice backed by dst's underlying memory. 16440 var buf []byte 16441 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16442 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16443 hdr.Len = i.SizeBytes() 16444 hdr.Cap = i.SizeBytes() 16445 16446 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16447 // Since we bypassed the compiler's escape analysis, indicate that i 16448 // must live until the use above. 16449 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16450 return length, err 16451 } 16452 16453 // CopyOut implements marshal.Marshallable.CopyOut. 16454 func (i *Inet6MulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16455 return i.CopyOutN(cc, addr, i.SizeBytes()) 16456 } 16457 16458 // CopyInN implements marshal.Marshallable.CopyInN. 16459 func (i *Inet6MulticastRequest) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16460 if !i.MulticastAddr.Packed() { 16461 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16462 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16463 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16464 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16465 // partially unmarshalled struct. 16466 i.UnmarshalBytes(buf) // escapes: fallback. 16467 return length, err 16468 } 16469 16470 // Construct a slice backed by dst's underlying memory. 16471 var buf []byte 16472 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16473 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16474 hdr.Len = i.SizeBytes() 16475 hdr.Cap = i.SizeBytes() 16476 16477 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16478 // Since we bypassed the compiler's escape analysis, indicate that i 16479 // must live until the use above. 16480 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16481 return length, err 16482 } 16483 16484 // CopyIn implements marshal.Marshallable.CopyIn. 16485 func (i *Inet6MulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16486 return i.CopyInN(cc, addr, i.SizeBytes()) 16487 } 16488 16489 // WriteTo implements io.WriterTo.WriteTo. 16490 func (i *Inet6MulticastRequest) WriteTo(writer io.Writer) (int64, error) { 16491 if !i.MulticastAddr.Packed() { 16492 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 16493 buf := make([]byte, i.SizeBytes()) 16494 i.MarshalBytes(buf) 16495 length, err := writer.Write(buf) 16496 return int64(length), err 16497 } 16498 16499 // Construct a slice backed by dst's underlying memory. 16500 var buf []byte 16501 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16502 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16503 hdr.Len = i.SizeBytes() 16504 hdr.Cap = i.SizeBytes() 16505 16506 length, err := writer.Write(buf) 16507 // Since we bypassed the compiler's escape analysis, indicate that i 16508 // must live until the use above. 16509 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16510 return int64(length), err 16511 } 16512 16513 // SizeBytes implements marshal.Marshallable.SizeBytes. 16514 //go:nosplit 16515 func (i *InetAddr) SizeBytes() int { 16516 return 1 * 4 16517 } 16518 16519 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16520 func (i *InetAddr) MarshalBytes(dst []byte) []byte { 16521 for idx := 0; idx < 4; idx++ { 16522 dst[0] = byte(i[idx]) 16523 dst = dst[1:] 16524 } 16525 return dst 16526 } 16527 16528 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16529 func (i *InetAddr) UnmarshalBytes(src []byte) []byte { 16530 for idx := 0; idx < 4; idx++ { 16531 i[idx] = src[0] 16532 src = src[1:] 16533 } 16534 return src 16535 } 16536 16537 // Packed implements marshal.Marshallable.Packed. 16538 //go:nosplit 16539 func (i *InetAddr) Packed() bool { 16540 // Array newtypes are always packed. 16541 return true 16542 } 16543 16544 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16545 func (i *InetAddr) MarshalUnsafe(dst []byte) []byte { 16546 size := i.SizeBytes() 16547 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 16548 return dst[size:] 16549 } 16550 16551 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16552 func (i *InetAddr) UnmarshalUnsafe(src []byte) []byte { 16553 size := i.SizeBytes() 16554 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16555 return src[size:] 16556 } 16557 16558 // CopyOutN implements marshal.Marshallable.CopyOutN. 16559 func (i *InetAddr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16560 // Construct a slice backed by dst's underlying memory. 16561 var buf []byte 16562 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16563 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16564 hdr.Len = i.SizeBytes() 16565 hdr.Cap = i.SizeBytes() 16566 16567 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16568 // Since we bypassed the compiler's escape analysis, indicate that i 16569 // must live until the use above. 16570 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16571 return length, err 16572 } 16573 16574 // CopyOut implements marshal.Marshallable.CopyOut. 16575 func (i *InetAddr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16576 return i.CopyOutN(cc, addr, i.SizeBytes()) 16577 } 16578 16579 // CopyInN implements marshal.Marshallable.CopyInN. 16580 func (i *InetAddr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16581 // Construct a slice backed by dst's underlying memory. 16582 var buf []byte 16583 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16584 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16585 hdr.Len = i.SizeBytes() 16586 hdr.Cap = i.SizeBytes() 16587 16588 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16589 // Since we bypassed the compiler's escape analysis, indicate that i 16590 // must live until the use above. 16591 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16592 return length, err 16593 } 16594 16595 // CopyIn implements marshal.Marshallable.CopyIn. 16596 func (i *InetAddr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16597 return i.CopyInN(cc, addr, i.SizeBytes()) 16598 } 16599 16600 // WriteTo implements io.WriterTo.WriteTo. 16601 func (i *InetAddr) WriteTo(writer io.Writer) (int64, error) { 16602 // Construct a slice backed by dst's underlying memory. 16603 var buf []byte 16604 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16605 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16606 hdr.Len = i.SizeBytes() 16607 hdr.Cap = i.SizeBytes() 16608 16609 length, err := writer.Write(buf) 16610 // Since we bypassed the compiler's escape analysis, indicate that i 16611 // must live until the use above. 16612 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16613 return int64(length), err 16614 } 16615 16616 // SizeBytes implements marshal.Marshallable.SizeBytes. 16617 func (i *InetMulticastRequest) SizeBytes() int { 16618 return 0 + 16619 (*InetAddr)(nil).SizeBytes() + 16620 (*InetAddr)(nil).SizeBytes() 16621 } 16622 16623 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16624 func (i *InetMulticastRequest) MarshalBytes(dst []byte) []byte { 16625 dst = i.MulticastAddr.MarshalUnsafe(dst) 16626 dst = i.InterfaceAddr.MarshalUnsafe(dst) 16627 return dst 16628 } 16629 16630 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16631 func (i *InetMulticastRequest) UnmarshalBytes(src []byte) []byte { 16632 src = i.MulticastAddr.UnmarshalUnsafe(src) 16633 src = i.InterfaceAddr.UnmarshalUnsafe(src) 16634 return src 16635 } 16636 16637 // Packed implements marshal.Marshallable.Packed. 16638 //go:nosplit 16639 func (i *InetMulticastRequest) Packed() bool { 16640 return i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() 16641 } 16642 16643 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16644 func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) []byte { 16645 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16646 size := i.SizeBytes() 16647 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 16648 return dst[size:] 16649 } 16650 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 16651 return i.MarshalBytes(dst) 16652 } 16653 16654 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16655 func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) []byte { 16656 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16657 size := i.SizeBytes() 16658 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16659 return src[size:] 16660 } 16661 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16662 return i.UnmarshalBytes(src) 16663 } 16664 16665 // CopyOutN implements marshal.Marshallable.CopyOutN. 16666 func (i *InetMulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16667 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16668 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 16669 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16670 i.MarshalBytes(buf) // escapes: fallback. 16671 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16672 } 16673 16674 // Construct a slice backed by dst's underlying memory. 16675 var buf []byte 16676 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16677 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16678 hdr.Len = i.SizeBytes() 16679 hdr.Cap = i.SizeBytes() 16680 16681 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16682 // Since we bypassed the compiler's escape analysis, indicate that i 16683 // must live until the use above. 16684 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16685 return length, err 16686 } 16687 16688 // CopyOut implements marshal.Marshallable.CopyOut. 16689 func (i *InetMulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16690 return i.CopyOutN(cc, addr, i.SizeBytes()) 16691 } 16692 16693 // CopyInN implements marshal.Marshallable.CopyInN. 16694 func (i *InetMulticastRequest) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16695 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16696 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16697 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16698 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16699 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16700 // partially unmarshalled struct. 16701 i.UnmarshalBytes(buf) // escapes: fallback. 16702 return length, err 16703 } 16704 16705 // Construct a slice backed by dst's underlying memory. 16706 var buf []byte 16707 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16708 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16709 hdr.Len = i.SizeBytes() 16710 hdr.Cap = i.SizeBytes() 16711 16712 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16713 // Since we bypassed the compiler's escape analysis, indicate that i 16714 // must live until the use above. 16715 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16716 return length, err 16717 } 16718 16719 // CopyIn implements marshal.Marshallable.CopyIn. 16720 func (i *InetMulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16721 return i.CopyInN(cc, addr, i.SizeBytes()) 16722 } 16723 16724 // WriteTo implements io.WriterTo.WriteTo. 16725 func (i *InetMulticastRequest) WriteTo(writer io.Writer) (int64, error) { 16726 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16727 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 16728 buf := make([]byte, i.SizeBytes()) 16729 i.MarshalBytes(buf) 16730 length, err := writer.Write(buf) 16731 return int64(length), err 16732 } 16733 16734 // Construct a slice backed by dst's underlying memory. 16735 var buf []byte 16736 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16737 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16738 hdr.Len = i.SizeBytes() 16739 hdr.Cap = i.SizeBytes() 16740 16741 length, err := writer.Write(buf) 16742 // Since we bypassed the compiler's escape analysis, indicate that i 16743 // must live until the use above. 16744 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16745 return int64(length), err 16746 } 16747 16748 // SizeBytes implements marshal.Marshallable.SizeBytes. 16749 func (i *InetMulticastRequestWithNIC) SizeBytes() int { 16750 return 4 + 16751 (*InetMulticastRequest)(nil).SizeBytes() 16752 } 16753 16754 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16755 func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) []byte { 16756 dst = i.InetMulticastRequest.MarshalUnsafe(dst) 16757 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 16758 dst = dst[4:] 16759 return dst 16760 } 16761 16762 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16763 func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) []byte { 16764 src = i.InetMulticastRequest.UnmarshalUnsafe(src) 16765 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 16766 src = src[4:] 16767 return src 16768 } 16769 16770 // Packed implements marshal.Marshallable.Packed. 16771 //go:nosplit 16772 func (i *InetMulticastRequestWithNIC) Packed() bool { 16773 return i.InetMulticastRequest.Packed() 16774 } 16775 16776 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16777 func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) []byte { 16778 if i.InetMulticastRequest.Packed() { 16779 size := i.SizeBytes() 16780 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 16781 return dst[size:] 16782 } 16783 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes. 16784 return i.MarshalBytes(dst) 16785 } 16786 16787 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16788 func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) []byte { 16789 if i.InetMulticastRequest.Packed() { 16790 size := i.SizeBytes() 16791 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16792 return src[size:] 16793 } 16794 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16795 return i.UnmarshalBytes(src) 16796 } 16797 16798 // CopyOutN implements marshal.Marshallable.CopyOutN. 16799 func (i *InetMulticastRequestWithNIC) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16800 if !i.InetMulticastRequest.Packed() { 16801 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 16802 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16803 i.MarshalBytes(buf) // escapes: fallback. 16804 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16805 } 16806 16807 // Construct a slice backed by dst's underlying memory. 16808 var buf []byte 16809 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16810 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16811 hdr.Len = i.SizeBytes() 16812 hdr.Cap = i.SizeBytes() 16813 16814 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16815 // Since we bypassed the compiler's escape analysis, indicate that i 16816 // must live until the use above. 16817 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16818 return length, err 16819 } 16820 16821 // CopyOut implements marshal.Marshallable.CopyOut. 16822 func (i *InetMulticastRequestWithNIC) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16823 return i.CopyOutN(cc, addr, i.SizeBytes()) 16824 } 16825 16826 // CopyInN implements marshal.Marshallable.CopyInN. 16827 func (i *InetMulticastRequestWithNIC) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16828 if !i.InetMulticastRequest.Packed() { 16829 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16830 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16831 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16832 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16833 // partially unmarshalled struct. 16834 i.UnmarshalBytes(buf) // escapes: fallback. 16835 return length, err 16836 } 16837 16838 // Construct a slice backed by dst's underlying memory. 16839 var buf []byte 16840 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16841 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16842 hdr.Len = i.SizeBytes() 16843 hdr.Cap = i.SizeBytes() 16844 16845 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16846 // Since we bypassed the compiler's escape analysis, indicate that i 16847 // must live until the use above. 16848 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16849 return length, err 16850 } 16851 16852 // CopyIn implements marshal.Marshallable.CopyIn. 16853 func (i *InetMulticastRequestWithNIC) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16854 return i.CopyInN(cc, addr, i.SizeBytes()) 16855 } 16856 16857 // WriteTo implements io.WriterTo.WriteTo. 16858 func (i *InetMulticastRequestWithNIC) WriteTo(writer io.Writer) (int64, error) { 16859 if !i.InetMulticastRequest.Packed() { 16860 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 16861 buf := make([]byte, i.SizeBytes()) 16862 i.MarshalBytes(buf) 16863 length, err := writer.Write(buf) 16864 return int64(length), err 16865 } 16866 16867 // Construct a slice backed by dst's underlying memory. 16868 var buf []byte 16869 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16870 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16871 hdr.Len = i.SizeBytes() 16872 hdr.Cap = i.SizeBytes() 16873 16874 length, err := writer.Write(buf) 16875 // Since we bypassed the compiler's escape analysis, indicate that i 16876 // must live until the use above. 16877 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16878 return int64(length), err 16879 } 16880 16881 // SizeBytes implements marshal.Marshallable.SizeBytes. 16882 func (l *Linger) SizeBytes() int { 16883 return 8 16884 } 16885 16886 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16887 func (l *Linger) MarshalBytes(dst []byte) []byte { 16888 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.OnOff)) 16889 dst = dst[4:] 16890 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Linger)) 16891 dst = dst[4:] 16892 return dst 16893 } 16894 16895 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16896 func (l *Linger) UnmarshalBytes(src []byte) []byte { 16897 l.OnOff = int32(hostarch.ByteOrder.Uint32(src[:4])) 16898 src = src[4:] 16899 l.Linger = int32(hostarch.ByteOrder.Uint32(src[:4])) 16900 src = src[4:] 16901 return src 16902 } 16903 16904 // Packed implements marshal.Marshallable.Packed. 16905 //go:nosplit 16906 func (l *Linger) Packed() bool { 16907 return true 16908 } 16909 16910 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16911 func (l *Linger) MarshalUnsafe(dst []byte) []byte { 16912 size := l.SizeBytes() 16913 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 16914 return dst[size:] 16915 } 16916 16917 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16918 func (l *Linger) UnmarshalUnsafe(src []byte) []byte { 16919 size := l.SizeBytes() 16920 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 16921 return src[size:] 16922 } 16923 16924 // CopyOutN implements marshal.Marshallable.CopyOutN. 16925 func (l *Linger) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16926 // Construct a slice backed by dst's underlying memory. 16927 var buf []byte 16928 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16929 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16930 hdr.Len = l.SizeBytes() 16931 hdr.Cap = l.SizeBytes() 16932 16933 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16934 // Since we bypassed the compiler's escape analysis, indicate that l 16935 // must live until the use above. 16936 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16937 return length, err 16938 } 16939 16940 // CopyOut implements marshal.Marshallable.CopyOut. 16941 func (l *Linger) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16942 return l.CopyOutN(cc, addr, l.SizeBytes()) 16943 } 16944 16945 // CopyInN implements marshal.Marshallable.CopyInN. 16946 func (l *Linger) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16947 // Construct a slice backed by dst's underlying memory. 16948 var buf []byte 16949 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16950 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16951 hdr.Len = l.SizeBytes() 16952 hdr.Cap = l.SizeBytes() 16953 16954 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16955 // Since we bypassed the compiler's escape analysis, indicate that l 16956 // must live until the use above. 16957 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16958 return length, err 16959 } 16960 16961 // CopyIn implements marshal.Marshallable.CopyIn. 16962 func (l *Linger) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16963 return l.CopyInN(cc, addr, l.SizeBytes()) 16964 } 16965 16966 // WriteTo implements io.WriterTo.WriteTo. 16967 func (l *Linger) WriteTo(writer io.Writer) (int64, error) { 16968 // Construct a slice backed by dst's underlying memory. 16969 var buf []byte 16970 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16971 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16972 hdr.Len = l.SizeBytes() 16973 hdr.Cap = l.SizeBytes() 16974 16975 length, err := writer.Write(buf) 16976 // Since we bypassed the compiler's escape analysis, indicate that l 16977 // must live until the use above. 16978 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16979 return int64(length), err 16980 } 16981 16982 // SizeBytes implements marshal.Marshallable.SizeBytes. 16983 func (s *SockAddrInet) SizeBytes() int { 16984 return 4 + 16985 (*InetAddr)(nil).SizeBytes() + 16986 1*8 16987 } 16988 16989 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16990 func (s *SockAddrInet) MarshalBytes(dst []byte) []byte { 16991 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16992 dst = dst[2:] 16993 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 16994 dst = dst[2:] 16995 dst = s.Addr.MarshalUnsafe(dst) 16996 // Padding: dst[:sizeof(uint8)*8] ~= [8]uint8{0} 16997 dst = dst[1*(8):] 16998 return dst 16999 } 17000 17001 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17002 func (s *SockAddrInet) UnmarshalBytes(src []byte) []byte { 17003 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17004 src = src[2:] 17005 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17006 src = src[2:] 17007 src = s.Addr.UnmarshalUnsafe(src) 17008 // Padding: ~ copy([8]uint8(s._), src[:sizeof(uint8)*8]) 17009 src = src[1*(8):] 17010 return src 17011 } 17012 17013 // Packed implements marshal.Marshallable.Packed. 17014 //go:nosplit 17015 func (s *SockAddrInet) Packed() bool { 17016 return s.Addr.Packed() 17017 } 17018 17019 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17020 func (s *SockAddrInet) MarshalUnsafe(dst []byte) []byte { 17021 if s.Addr.Packed() { 17022 size := s.SizeBytes() 17023 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17024 return dst[size:] 17025 } 17026 // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes. 17027 return s.MarshalBytes(dst) 17028 } 17029 17030 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17031 func (s *SockAddrInet) UnmarshalUnsafe(src []byte) []byte { 17032 if s.Addr.Packed() { 17033 size := s.SizeBytes() 17034 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17035 return src[size:] 17036 } 17037 // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17038 return s.UnmarshalBytes(src) 17039 } 17040 17041 // CopyOutN implements marshal.Marshallable.CopyOutN. 17042 func (s *SockAddrInet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17043 if !s.Addr.Packed() { 17044 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 17045 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 17046 s.MarshalBytes(buf) // escapes: fallback. 17047 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17048 } 17049 17050 // Construct a slice backed by dst's underlying memory. 17051 var buf []byte 17052 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17053 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17054 hdr.Len = s.SizeBytes() 17055 hdr.Cap = s.SizeBytes() 17056 17057 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17058 // Since we bypassed the compiler's escape analysis, indicate that s 17059 // must live until the use above. 17060 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17061 return length, err 17062 } 17063 17064 // CopyOut implements marshal.Marshallable.CopyOut. 17065 func (s *SockAddrInet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17066 return s.CopyOutN(cc, addr, s.SizeBytes()) 17067 } 17068 17069 // CopyInN implements marshal.Marshallable.CopyInN. 17070 func (s *SockAddrInet) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17071 if !s.Addr.Packed() { 17072 // Type SockAddrInet doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17073 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 17074 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17075 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17076 // partially unmarshalled struct. 17077 s.UnmarshalBytes(buf) // escapes: fallback. 17078 return length, err 17079 } 17080 17081 // Construct a slice backed by dst's underlying memory. 17082 var buf []byte 17083 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17084 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17085 hdr.Len = s.SizeBytes() 17086 hdr.Cap = s.SizeBytes() 17087 17088 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17089 // Since we bypassed the compiler's escape analysis, indicate that s 17090 // must live until the use above. 17091 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17092 return length, err 17093 } 17094 17095 // CopyIn implements marshal.Marshallable.CopyIn. 17096 func (s *SockAddrInet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17097 return s.CopyInN(cc, addr, s.SizeBytes()) 17098 } 17099 17100 // WriteTo implements io.WriterTo.WriteTo. 17101 func (s *SockAddrInet) WriteTo(writer io.Writer) (int64, error) { 17102 if !s.Addr.Packed() { 17103 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 17104 buf := make([]byte, s.SizeBytes()) 17105 s.MarshalBytes(buf) 17106 length, err := writer.Write(buf) 17107 return int64(length), err 17108 } 17109 17110 // Construct a slice backed by dst's underlying memory. 17111 var buf []byte 17112 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17113 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17114 hdr.Len = s.SizeBytes() 17115 hdr.Cap = s.SizeBytes() 17116 17117 length, err := writer.Write(buf) 17118 // Since we bypassed the compiler's escape analysis, indicate that s 17119 // must live until the use above. 17120 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17121 return int64(length), err 17122 } 17123 17124 // SizeBytes implements marshal.Marshallable.SizeBytes. 17125 func (s *SockAddrInet6) SizeBytes() int { 17126 return 12 + 17127 1*16 17128 } 17129 17130 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17131 func (s *SockAddrInet6) MarshalBytes(dst []byte) []byte { 17132 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 17133 dst = dst[2:] 17134 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 17135 dst = dst[2:] 17136 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flowinfo)) 17137 dst = dst[4:] 17138 for idx := 0; idx < 16; idx++ { 17139 dst[0] = byte(s.Addr[idx]) 17140 dst = dst[1:] 17141 } 17142 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Scope_id)) 17143 dst = dst[4:] 17144 return dst 17145 } 17146 17147 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17148 func (s *SockAddrInet6) UnmarshalBytes(src []byte) []byte { 17149 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17150 src = src[2:] 17151 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17152 src = src[2:] 17153 s.Flowinfo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17154 src = src[4:] 17155 for idx := 0; idx < 16; idx++ { 17156 s.Addr[idx] = src[0] 17157 src = src[1:] 17158 } 17159 s.Scope_id = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17160 src = src[4:] 17161 return src 17162 } 17163 17164 // Packed implements marshal.Marshallable.Packed. 17165 //go:nosplit 17166 func (s *SockAddrInet6) Packed() bool { 17167 return true 17168 } 17169 17170 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17171 func (s *SockAddrInet6) MarshalUnsafe(dst []byte) []byte { 17172 size := s.SizeBytes() 17173 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17174 return dst[size:] 17175 } 17176 17177 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17178 func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) []byte { 17179 size := s.SizeBytes() 17180 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17181 return src[size:] 17182 } 17183 17184 // CopyOutN implements marshal.Marshallable.CopyOutN. 17185 func (s *SockAddrInet6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17186 // Construct a slice backed by dst's underlying memory. 17187 var buf []byte 17188 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17189 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17190 hdr.Len = s.SizeBytes() 17191 hdr.Cap = s.SizeBytes() 17192 17193 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17194 // Since we bypassed the compiler's escape analysis, indicate that s 17195 // must live until the use above. 17196 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17197 return length, err 17198 } 17199 17200 // CopyOut implements marshal.Marshallable.CopyOut. 17201 func (s *SockAddrInet6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17202 return s.CopyOutN(cc, addr, s.SizeBytes()) 17203 } 17204 17205 // CopyInN implements marshal.Marshallable.CopyInN. 17206 func (s *SockAddrInet6) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17207 // Construct a slice backed by dst's underlying memory. 17208 var buf []byte 17209 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17210 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17211 hdr.Len = s.SizeBytes() 17212 hdr.Cap = s.SizeBytes() 17213 17214 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17215 // Since we bypassed the compiler's escape analysis, indicate that s 17216 // must live until the use above. 17217 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17218 return length, err 17219 } 17220 17221 // CopyIn implements marshal.Marshallable.CopyIn. 17222 func (s *SockAddrInet6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17223 return s.CopyInN(cc, addr, s.SizeBytes()) 17224 } 17225 17226 // WriteTo implements io.WriterTo.WriteTo. 17227 func (s *SockAddrInet6) WriteTo(writer io.Writer) (int64, error) { 17228 // Construct a slice backed by dst's underlying memory. 17229 var buf []byte 17230 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17231 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17232 hdr.Len = s.SizeBytes() 17233 hdr.Cap = s.SizeBytes() 17234 17235 length, err := writer.Write(buf) 17236 // Since we bypassed the compiler's escape analysis, indicate that s 17237 // must live until the use above. 17238 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17239 return int64(length), err 17240 } 17241 17242 // SizeBytes implements marshal.Marshallable.SizeBytes. 17243 func (s *SockAddrLink) SizeBytes() int { 17244 return 12 + 17245 1*8 17246 } 17247 17248 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17249 func (s *SockAddrLink) MarshalBytes(dst []byte) []byte { 17250 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 17251 dst = dst[2:] 17252 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Protocol)) 17253 dst = dst[2:] 17254 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.InterfaceIndex)) 17255 dst = dst[4:] 17256 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.ARPHardwareType)) 17257 dst = dst[2:] 17258 dst[0] = byte(s.PacketType) 17259 dst = dst[1:] 17260 dst[0] = byte(s.HardwareAddrLen) 17261 dst = dst[1:] 17262 for idx := 0; idx < 8; idx++ { 17263 dst[0] = byte(s.HardwareAddr[idx]) 17264 dst = dst[1:] 17265 } 17266 return dst 17267 } 17268 17269 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17270 func (s *SockAddrLink) UnmarshalBytes(src []byte) []byte { 17271 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17272 src = src[2:] 17273 s.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17274 src = src[2:] 17275 s.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 17276 src = src[4:] 17277 s.ARPHardwareType = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17278 src = src[2:] 17279 s.PacketType = src[0] 17280 src = src[1:] 17281 s.HardwareAddrLen = src[0] 17282 src = src[1:] 17283 for idx := 0; idx < 8; idx++ { 17284 s.HardwareAddr[idx] = src[0] 17285 src = src[1:] 17286 } 17287 return src 17288 } 17289 17290 // Packed implements marshal.Marshallable.Packed. 17291 //go:nosplit 17292 func (s *SockAddrLink) Packed() bool { 17293 return true 17294 } 17295 17296 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17297 func (s *SockAddrLink) MarshalUnsafe(dst []byte) []byte { 17298 size := s.SizeBytes() 17299 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17300 return dst[size:] 17301 } 17302 17303 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17304 func (s *SockAddrLink) UnmarshalUnsafe(src []byte) []byte { 17305 size := s.SizeBytes() 17306 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17307 return src[size:] 17308 } 17309 17310 // CopyOutN implements marshal.Marshallable.CopyOutN. 17311 func (s *SockAddrLink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17312 // Construct a slice backed by dst's underlying memory. 17313 var buf []byte 17314 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17315 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17316 hdr.Len = s.SizeBytes() 17317 hdr.Cap = s.SizeBytes() 17318 17319 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17320 // Since we bypassed the compiler's escape analysis, indicate that s 17321 // must live until the use above. 17322 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17323 return length, err 17324 } 17325 17326 // CopyOut implements marshal.Marshallable.CopyOut. 17327 func (s *SockAddrLink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17328 return s.CopyOutN(cc, addr, s.SizeBytes()) 17329 } 17330 17331 // CopyInN implements marshal.Marshallable.CopyInN. 17332 func (s *SockAddrLink) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17333 // Construct a slice backed by dst's underlying memory. 17334 var buf []byte 17335 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17336 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17337 hdr.Len = s.SizeBytes() 17338 hdr.Cap = s.SizeBytes() 17339 17340 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17341 // Since we bypassed the compiler's escape analysis, indicate that s 17342 // must live until the use above. 17343 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17344 return length, err 17345 } 17346 17347 // CopyIn implements marshal.Marshallable.CopyIn. 17348 func (s *SockAddrLink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17349 return s.CopyInN(cc, addr, s.SizeBytes()) 17350 } 17351 17352 // WriteTo implements io.WriterTo.WriteTo. 17353 func (s *SockAddrLink) WriteTo(writer io.Writer) (int64, error) { 17354 // Construct a slice backed by dst's underlying memory. 17355 var buf []byte 17356 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17357 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17358 hdr.Len = s.SizeBytes() 17359 hdr.Cap = s.SizeBytes() 17360 17361 length, err := writer.Write(buf) 17362 // Since we bypassed the compiler's escape analysis, indicate that s 17363 // must live until the use above. 17364 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17365 return int64(length), err 17366 } 17367 17368 // SizeBytes implements marshal.Marshallable.SizeBytes. 17369 func (s *SockAddrUnix) SizeBytes() int { 17370 return 2 + 17371 1*UnixPathMax 17372 } 17373 17374 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17375 func (s *SockAddrUnix) MarshalBytes(dst []byte) []byte { 17376 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 17377 dst = dst[2:] 17378 for idx := 0; idx < UnixPathMax; idx++ { 17379 dst[0] = byte(s.Path[idx]) 17380 dst = dst[1:] 17381 } 17382 return dst 17383 } 17384 17385 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17386 func (s *SockAddrUnix) UnmarshalBytes(src []byte) []byte { 17387 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17388 src = src[2:] 17389 for idx := 0; idx < UnixPathMax; idx++ { 17390 s.Path[idx] = int8(src[0]) 17391 src = src[1:] 17392 } 17393 return src 17394 } 17395 17396 // Packed implements marshal.Marshallable.Packed. 17397 //go:nosplit 17398 func (s *SockAddrUnix) Packed() bool { 17399 return true 17400 } 17401 17402 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17403 func (s *SockAddrUnix) MarshalUnsafe(dst []byte) []byte { 17404 size := s.SizeBytes() 17405 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17406 return dst[size:] 17407 } 17408 17409 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17410 func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) []byte { 17411 size := s.SizeBytes() 17412 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17413 return src[size:] 17414 } 17415 17416 // CopyOutN implements marshal.Marshallable.CopyOutN. 17417 func (s *SockAddrUnix) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17418 // Construct a slice backed by dst's underlying memory. 17419 var buf []byte 17420 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17421 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17422 hdr.Len = s.SizeBytes() 17423 hdr.Cap = s.SizeBytes() 17424 17425 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17426 // Since we bypassed the compiler's escape analysis, indicate that s 17427 // must live until the use above. 17428 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17429 return length, err 17430 } 17431 17432 // CopyOut implements marshal.Marshallable.CopyOut. 17433 func (s *SockAddrUnix) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17434 return s.CopyOutN(cc, addr, s.SizeBytes()) 17435 } 17436 17437 // CopyInN implements marshal.Marshallable.CopyInN. 17438 func (s *SockAddrUnix) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17439 // Construct a slice backed by dst's underlying memory. 17440 var buf []byte 17441 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17442 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17443 hdr.Len = s.SizeBytes() 17444 hdr.Cap = s.SizeBytes() 17445 17446 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17447 // Since we bypassed the compiler's escape analysis, indicate that s 17448 // must live until the use above. 17449 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17450 return length, err 17451 } 17452 17453 // CopyIn implements marshal.Marshallable.CopyIn. 17454 func (s *SockAddrUnix) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17455 return s.CopyInN(cc, addr, s.SizeBytes()) 17456 } 17457 17458 // WriteTo implements io.WriterTo.WriteTo. 17459 func (s *SockAddrUnix) WriteTo(writer io.Writer) (int64, error) { 17460 // Construct a slice backed by dst's underlying memory. 17461 var buf []byte 17462 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17463 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17464 hdr.Len = s.SizeBytes() 17465 hdr.Cap = s.SizeBytes() 17466 17467 length, err := writer.Write(buf) 17468 // Since we bypassed the compiler's escape analysis, indicate that s 17469 // must live until the use above. 17470 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17471 return int64(length), err 17472 } 17473 17474 // SizeBytes implements marshal.Marshallable.SizeBytes. 17475 func (t *TCPInfo) SizeBytes() int { 17476 return 224 17477 } 17478 17479 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17480 func (t *TCPInfo) MarshalBytes(dst []byte) []byte { 17481 dst[0] = byte(t.State) 17482 dst = dst[1:] 17483 dst[0] = byte(t.CaState) 17484 dst = dst[1:] 17485 dst[0] = byte(t.Retransmits) 17486 dst = dst[1:] 17487 dst[0] = byte(t.Probes) 17488 dst = dst[1:] 17489 dst[0] = byte(t.Backoff) 17490 dst = dst[1:] 17491 dst[0] = byte(t.Options) 17492 dst = dst[1:] 17493 dst[0] = byte(t.WindowScale) 17494 dst = dst[1:] 17495 dst[0] = byte(t.DeliveryRateAppLimited) 17496 dst = dst[1:] 17497 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTO)) 17498 dst = dst[4:] 17499 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ATO)) 17500 dst = dst[4:] 17501 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndMss)) 17502 dst = dst[4:] 17503 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvMss)) 17504 dst = dst[4:] 17505 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Unacked)) 17506 dst = dst[4:] 17507 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Sacked)) 17508 dst = dst[4:] 17509 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Lost)) 17510 dst = dst[4:] 17511 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Retrans)) 17512 dst = dst[4:] 17513 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Fackets)) 17514 dst = dst[4:] 17515 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataSent)) 17516 dst = dst[4:] 17517 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckSent)) 17518 dst = dst[4:] 17519 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataRecv)) 17520 dst = dst[4:] 17521 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckRecv)) 17522 dst = dst[4:] 17523 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.PMTU)) 17524 dst = dst[4:] 17525 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSsthresh)) 17526 dst = dst[4:] 17527 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTT)) 17528 dst = dst[4:] 17529 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTTVar)) 17530 dst = dst[4:] 17531 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndSsthresh)) 17532 dst = dst[4:] 17533 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndCwnd)) 17534 dst = dst[4:] 17535 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Advmss)) 17536 dst = dst[4:] 17537 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Reordering)) 17538 dst = dst[4:] 17539 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvRTT)) 17540 dst = dst[4:] 17541 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSpace)) 17542 dst = dst[4:] 17543 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.TotalRetrans)) 17544 dst = dst[4:] 17545 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.PacingRate)) 17546 dst = dst[8:] 17547 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.MaxPacingRate)) 17548 dst = dst[8:] 17549 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesAcked)) 17550 dst = dst[8:] 17551 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesReceived)) 17552 dst = dst[8:] 17553 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsOut)) 17554 dst = dst[4:] 17555 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsIn)) 17556 dst = dst[4:] 17557 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.NotSentBytes)) 17558 dst = dst[4:] 17559 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.MinRTT)) 17560 dst = dst[4:] 17561 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsIn)) 17562 dst = dst[4:] 17563 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsOut)) 17564 dst = dst[4:] 17565 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.DeliveryRate)) 17566 dst = dst[8:] 17567 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BusyTime)) 17568 dst = dst[8:] 17569 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.RwndLimited)) 17570 dst = dst[8:] 17571 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.SndBufLimited)) 17572 dst = dst[8:] 17573 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Delivered)) 17574 dst = dst[4:] 17575 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DeliveredCE)) 17576 dst = dst[4:] 17577 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesSent)) 17578 dst = dst[8:] 17579 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesRetrans)) 17580 dst = dst[8:] 17581 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DSACKDups)) 17582 dst = dst[4:] 17583 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ReordSeen)) 17584 dst = dst[4:] 17585 return dst 17586 } 17587 17588 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17589 func (t *TCPInfo) UnmarshalBytes(src []byte) []byte { 17590 t.State = uint8(src[0]) 17591 src = src[1:] 17592 t.CaState = uint8(src[0]) 17593 src = src[1:] 17594 t.Retransmits = uint8(src[0]) 17595 src = src[1:] 17596 t.Probes = uint8(src[0]) 17597 src = src[1:] 17598 t.Backoff = uint8(src[0]) 17599 src = src[1:] 17600 t.Options = uint8(src[0]) 17601 src = src[1:] 17602 t.WindowScale = uint8(src[0]) 17603 src = src[1:] 17604 t.DeliveryRateAppLimited = uint8(src[0]) 17605 src = src[1:] 17606 t.RTO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17607 src = src[4:] 17608 t.ATO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17609 src = src[4:] 17610 t.SndMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17611 src = src[4:] 17612 t.RcvMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17613 src = src[4:] 17614 t.Unacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17615 src = src[4:] 17616 t.Sacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17617 src = src[4:] 17618 t.Lost = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17619 src = src[4:] 17620 t.Retrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17621 src = src[4:] 17622 t.Fackets = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17623 src = src[4:] 17624 t.LastDataSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17625 src = src[4:] 17626 t.LastAckSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17627 src = src[4:] 17628 t.LastDataRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17629 src = src[4:] 17630 t.LastAckRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17631 src = src[4:] 17632 t.PMTU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17633 src = src[4:] 17634 t.RcvSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17635 src = src[4:] 17636 t.RTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17637 src = src[4:] 17638 t.RTTVar = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17639 src = src[4:] 17640 t.SndSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17641 src = src[4:] 17642 t.SndCwnd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17643 src = src[4:] 17644 t.Advmss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17645 src = src[4:] 17646 t.Reordering = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17647 src = src[4:] 17648 t.RcvRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17649 src = src[4:] 17650 t.RcvSpace = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17651 src = src[4:] 17652 t.TotalRetrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17653 src = src[4:] 17654 t.PacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17655 src = src[8:] 17656 t.MaxPacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17657 src = src[8:] 17658 t.BytesAcked = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17659 src = src[8:] 17660 t.BytesReceived = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17661 src = src[8:] 17662 t.SegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17663 src = src[4:] 17664 t.SegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17665 src = src[4:] 17666 t.NotSentBytes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17667 src = src[4:] 17668 t.MinRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17669 src = src[4:] 17670 t.DataSegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17671 src = src[4:] 17672 t.DataSegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17673 src = src[4:] 17674 t.DeliveryRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17675 src = src[8:] 17676 t.BusyTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17677 src = src[8:] 17678 t.RwndLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17679 src = src[8:] 17680 t.SndBufLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17681 src = src[8:] 17682 t.Delivered = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17683 src = src[4:] 17684 t.DeliveredCE = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17685 src = src[4:] 17686 t.BytesSent = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17687 src = src[8:] 17688 t.BytesRetrans = uint64(hostarch.ByteOrder.Uint64(src[:8])) 17689 src = src[8:] 17690 t.DSACKDups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17691 src = src[4:] 17692 t.ReordSeen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17693 src = src[4:] 17694 return src 17695 } 17696 17697 // Packed implements marshal.Marshallable.Packed. 17698 //go:nosplit 17699 func (t *TCPInfo) Packed() bool { 17700 return true 17701 } 17702 17703 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17704 func (t *TCPInfo) MarshalUnsafe(dst []byte) []byte { 17705 size := t.SizeBytes() 17706 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17707 return dst[size:] 17708 } 17709 17710 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17711 func (t *TCPInfo) UnmarshalUnsafe(src []byte) []byte { 17712 size := t.SizeBytes() 17713 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17714 return src[size:] 17715 } 17716 17717 // CopyOutN implements marshal.Marshallable.CopyOutN. 17718 func (t *TCPInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17719 // Construct a slice backed by dst's underlying memory. 17720 var buf []byte 17721 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17722 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17723 hdr.Len = t.SizeBytes() 17724 hdr.Cap = t.SizeBytes() 17725 17726 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17727 // Since we bypassed the compiler's escape analysis, indicate that t 17728 // must live until the use above. 17729 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17730 return length, err 17731 } 17732 17733 // CopyOut implements marshal.Marshallable.CopyOut. 17734 func (t *TCPInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17735 return t.CopyOutN(cc, addr, t.SizeBytes()) 17736 } 17737 17738 // CopyInN implements marshal.Marshallable.CopyInN. 17739 func (t *TCPInfo) CopyInN(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(t))) 17744 hdr.Len = t.SizeBytes() 17745 hdr.Cap = t.SizeBytes() 17746 17747 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17748 // Since we bypassed the compiler's escape analysis, indicate that t 17749 // must live until the use above. 17750 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17751 return length, err 17752 } 17753 17754 // CopyIn implements marshal.Marshallable.CopyIn. 17755 func (t *TCPInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17756 return t.CopyInN(cc, addr, t.SizeBytes()) 17757 } 17758 17759 // WriteTo implements io.WriterTo.WriteTo. 17760 func (t *TCPInfo) WriteTo(writer io.Writer) (int64, 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(t))) 17765 hdr.Len = t.SizeBytes() 17766 hdr.Cap = t.SizeBytes() 17767 17768 length, err := writer.Write(buf) 17769 // Since we bypassed the compiler's escape analysis, indicate that t 17770 // must live until the use above. 17771 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17772 return int64(length), err 17773 } 17774 17775 // SizeBytes implements marshal.Marshallable.SizeBytes. 17776 //go:nosplit 17777 func (c *ClockT) SizeBytes() int { 17778 return 8 17779 } 17780 17781 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17782 func (c *ClockT) MarshalBytes(dst []byte) []byte { 17783 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*c)) 17784 return dst[8:] 17785 } 17786 17787 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17788 func (c *ClockT) UnmarshalBytes(src []byte) []byte { 17789 *c = ClockT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 17790 return src[8:] 17791 } 17792 17793 // Packed implements marshal.Marshallable.Packed. 17794 //go:nosplit 17795 func (c *ClockT) Packed() bool { 17796 // Scalar newtypes are always packed. 17797 return true 17798 } 17799 17800 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17801 func (c *ClockT) MarshalUnsafe(dst []byte) []byte { 17802 size := c.SizeBytes() 17803 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 17804 return dst[size:] 17805 } 17806 17807 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17808 func (c *ClockT) UnmarshalUnsafe(src []byte) []byte { 17809 size := c.SizeBytes() 17810 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 17811 return src[size:] 17812 } 17813 17814 // CopyOutN implements marshal.Marshallable.CopyOutN. 17815 func (c *ClockT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17816 // Construct a slice backed by dst's underlying memory. 17817 var buf []byte 17818 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17819 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 17820 hdr.Len = c.SizeBytes() 17821 hdr.Cap = c.SizeBytes() 17822 17823 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17824 // Since we bypassed the compiler's escape analysis, indicate that c 17825 // must live until the use above. 17826 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 17827 return length, err 17828 } 17829 17830 // CopyOut implements marshal.Marshallable.CopyOut. 17831 func (c *ClockT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17832 return c.CopyOutN(cc, addr, c.SizeBytes()) 17833 } 17834 17835 // CopyInN implements marshal.Marshallable.CopyInN. 17836 func (c *ClockT) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17837 // Construct a slice backed by dst's underlying memory. 17838 var buf []byte 17839 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17840 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 17841 hdr.Len = c.SizeBytes() 17842 hdr.Cap = c.SizeBytes() 17843 17844 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17845 // Since we bypassed the compiler's escape analysis, indicate that c 17846 // must live until the use above. 17847 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 17848 return length, err 17849 } 17850 17851 // CopyIn implements marshal.Marshallable.CopyIn. 17852 func (c *ClockT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17853 return c.CopyInN(cc, addr, c.SizeBytes()) 17854 } 17855 17856 // WriteTo implements io.WriterTo.WriteTo. 17857 func (c *ClockT) WriteTo(writer io.Writer) (int64, error) { 17858 // Construct a slice backed by dst's underlying memory. 17859 var buf []byte 17860 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17861 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 17862 hdr.Len = c.SizeBytes() 17863 hdr.Cap = c.SizeBytes() 17864 17865 length, err := writer.Write(buf) 17866 // Since we bypassed the compiler's escape analysis, indicate that c 17867 // must live until the use above. 17868 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 17869 return int64(length), err 17870 } 17871 17872 // SizeBytes implements marshal.Marshallable.SizeBytes. 17873 func (i *ItimerVal) SizeBytes() int { 17874 return 0 + 17875 (*Timeval)(nil).SizeBytes() + 17876 (*Timeval)(nil).SizeBytes() 17877 } 17878 17879 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17880 func (i *ItimerVal) MarshalBytes(dst []byte) []byte { 17881 dst = i.Interval.MarshalUnsafe(dst) 17882 dst = i.Value.MarshalUnsafe(dst) 17883 return dst 17884 } 17885 17886 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17887 func (i *ItimerVal) UnmarshalBytes(src []byte) []byte { 17888 src = i.Interval.UnmarshalUnsafe(src) 17889 src = i.Value.UnmarshalUnsafe(src) 17890 return src 17891 } 17892 17893 // Packed implements marshal.Marshallable.Packed. 17894 //go:nosplit 17895 func (i *ItimerVal) Packed() bool { 17896 return i.Interval.Packed() && i.Value.Packed() 17897 } 17898 17899 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17900 func (i *ItimerVal) MarshalUnsafe(dst []byte) []byte { 17901 if i.Interval.Packed() && i.Value.Packed() { 17902 size := i.SizeBytes() 17903 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17904 return dst[size:] 17905 } 17906 // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes. 17907 return i.MarshalBytes(dst) 17908 } 17909 17910 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17911 func (i *ItimerVal) UnmarshalUnsafe(src []byte) []byte { 17912 if i.Interval.Packed() && i.Value.Packed() { 17913 size := i.SizeBytes() 17914 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17915 return src[size:] 17916 } 17917 // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17918 return i.UnmarshalBytes(src) 17919 } 17920 17921 // CopyOutN implements marshal.Marshallable.CopyOutN. 17922 func (i *ItimerVal) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17923 if !i.Interval.Packed() && i.Value.Packed() { 17924 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 17925 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17926 i.MarshalBytes(buf) // escapes: fallback. 17927 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17928 } 17929 17930 // Construct a slice backed by dst's underlying memory. 17931 var buf []byte 17932 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17933 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17934 hdr.Len = i.SizeBytes() 17935 hdr.Cap = i.SizeBytes() 17936 17937 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17938 // Since we bypassed the compiler's escape analysis, indicate that i 17939 // must live until the use above. 17940 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17941 return length, err 17942 } 17943 17944 // CopyOut implements marshal.Marshallable.CopyOut. 17945 func (i *ItimerVal) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17946 return i.CopyOutN(cc, addr, i.SizeBytes()) 17947 } 17948 17949 // CopyInN implements marshal.Marshallable.CopyInN. 17950 func (i *ItimerVal) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17951 if !i.Interval.Packed() && i.Value.Packed() { 17952 // Type ItimerVal doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17953 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17954 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17955 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17956 // partially unmarshalled struct. 17957 i.UnmarshalBytes(buf) // escapes: fallback. 17958 return length, err 17959 } 17960 17961 // Construct a slice backed by dst's underlying memory. 17962 var buf []byte 17963 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17964 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17965 hdr.Len = i.SizeBytes() 17966 hdr.Cap = i.SizeBytes() 17967 17968 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17969 // Since we bypassed the compiler's escape analysis, indicate that i 17970 // must live until the use above. 17971 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17972 return length, err 17973 } 17974 17975 // CopyIn implements marshal.Marshallable.CopyIn. 17976 func (i *ItimerVal) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17977 return i.CopyInN(cc, addr, i.SizeBytes()) 17978 } 17979 17980 // WriteTo implements io.WriterTo.WriteTo. 17981 func (i *ItimerVal) WriteTo(writer io.Writer) (int64, error) { 17982 if !i.Interval.Packed() && i.Value.Packed() { 17983 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 17984 buf := make([]byte, i.SizeBytes()) 17985 i.MarshalBytes(buf) 17986 length, err := writer.Write(buf) 17987 return int64(length), err 17988 } 17989 17990 // Construct a slice backed by dst's underlying memory. 17991 var buf []byte 17992 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17993 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17994 hdr.Len = i.SizeBytes() 17995 hdr.Cap = i.SizeBytes() 17996 17997 length, err := writer.Write(buf) 17998 // Since we bypassed the compiler's escape analysis, indicate that i 17999 // must live until the use above. 18000 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18001 return int64(length), err 18002 } 18003 18004 // SizeBytes implements marshal.Marshallable.SizeBytes. 18005 func (i *Itimerspec) SizeBytes() int { 18006 return 0 + 18007 (*Timespec)(nil).SizeBytes() + 18008 (*Timespec)(nil).SizeBytes() 18009 } 18010 18011 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18012 func (i *Itimerspec) MarshalBytes(dst []byte) []byte { 18013 dst = i.Interval.MarshalUnsafe(dst) 18014 dst = i.Value.MarshalUnsafe(dst) 18015 return dst 18016 } 18017 18018 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18019 func (i *Itimerspec) UnmarshalBytes(src []byte) []byte { 18020 src = i.Interval.UnmarshalUnsafe(src) 18021 src = i.Value.UnmarshalUnsafe(src) 18022 return src 18023 } 18024 18025 // Packed implements marshal.Marshallable.Packed. 18026 //go:nosplit 18027 func (i *Itimerspec) Packed() bool { 18028 return i.Interval.Packed() && i.Value.Packed() 18029 } 18030 18031 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18032 func (i *Itimerspec) MarshalUnsafe(dst []byte) []byte { 18033 if i.Interval.Packed() && i.Value.Packed() { 18034 size := i.SizeBytes() 18035 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 18036 return dst[size:] 18037 } 18038 // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes. 18039 return i.MarshalBytes(dst) 18040 } 18041 18042 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18043 func (i *Itimerspec) UnmarshalUnsafe(src []byte) []byte { 18044 if i.Interval.Packed() && i.Value.Packed() { 18045 size := i.SizeBytes() 18046 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 18047 return src[size:] 18048 } 18049 // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes. 18050 return i.UnmarshalBytes(src) 18051 } 18052 18053 // CopyOutN implements marshal.Marshallable.CopyOutN. 18054 func (i *Itimerspec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18055 if !i.Interval.Packed() && i.Value.Packed() { 18056 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 18057 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 18058 i.MarshalBytes(buf) // escapes: fallback. 18059 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18060 } 18061 18062 // Construct a slice backed by dst's underlying memory. 18063 var buf []byte 18064 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18065 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18066 hdr.Len = i.SizeBytes() 18067 hdr.Cap = i.SizeBytes() 18068 18069 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18070 // Since we bypassed the compiler's escape analysis, indicate that i 18071 // must live until the use above. 18072 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18073 return length, err 18074 } 18075 18076 // CopyOut implements marshal.Marshallable.CopyOut. 18077 func (i *Itimerspec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18078 return i.CopyOutN(cc, addr, i.SizeBytes()) 18079 } 18080 18081 // CopyInN implements marshal.Marshallable.CopyInN. 18082 func (i *Itimerspec) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18083 if !i.Interval.Packed() && i.Value.Packed() { 18084 // Type Itimerspec doesn't have a packed layout in memory, fall back to UnmarshalBytes. 18085 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 18086 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18087 // Unmarshal unconditionally. If we had a short copy-in, this results in a 18088 // partially unmarshalled struct. 18089 i.UnmarshalBytes(buf) // escapes: fallback. 18090 return length, err 18091 } 18092 18093 // Construct a slice backed by dst's underlying memory. 18094 var buf []byte 18095 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18096 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18097 hdr.Len = i.SizeBytes() 18098 hdr.Cap = i.SizeBytes() 18099 18100 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18101 // Since we bypassed the compiler's escape analysis, indicate that i 18102 // must live until the use above. 18103 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18104 return length, err 18105 } 18106 18107 // CopyIn implements marshal.Marshallable.CopyIn. 18108 func (i *Itimerspec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18109 return i.CopyInN(cc, addr, i.SizeBytes()) 18110 } 18111 18112 // WriteTo implements io.WriterTo.WriteTo. 18113 func (i *Itimerspec) WriteTo(writer io.Writer) (int64, error) { 18114 if !i.Interval.Packed() && i.Value.Packed() { 18115 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 18116 buf := make([]byte, i.SizeBytes()) 18117 i.MarshalBytes(buf) 18118 length, err := writer.Write(buf) 18119 return int64(length), err 18120 } 18121 18122 // Construct a slice backed by dst's underlying memory. 18123 var buf []byte 18124 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18125 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18126 hdr.Len = i.SizeBytes() 18127 hdr.Cap = i.SizeBytes() 18128 18129 length, err := writer.Write(buf) 18130 // Since we bypassed the compiler's escape analysis, indicate that i 18131 // must live until the use above. 18132 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18133 return int64(length), err 18134 } 18135 18136 // SizeBytes implements marshal.Marshallable.SizeBytes. 18137 func (sxts *StatxTimestamp) SizeBytes() int { 18138 return 16 18139 } 18140 18141 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18142 func (sxts *StatxTimestamp) MarshalBytes(dst []byte) []byte { 18143 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sxts.Sec)) 18144 dst = dst[8:] 18145 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sxts.Nsec)) 18146 dst = dst[4:] 18147 // Padding: dst[:sizeof(int32)] ~= int32(0) 18148 dst = dst[4:] 18149 return dst 18150 } 18151 18152 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18153 func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) []byte { 18154 sxts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 18155 src = src[8:] 18156 sxts.Nsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18157 src = src[4:] 18158 // Padding: var _ int32 ~= src[:sizeof(int32)] 18159 src = src[4:] 18160 return src 18161 } 18162 18163 // Packed implements marshal.Marshallable.Packed. 18164 //go:nosplit 18165 func (sxts *StatxTimestamp) Packed() bool { 18166 return true 18167 } 18168 18169 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18170 func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) []byte { 18171 size := sxts.SizeBytes() 18172 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(size)) 18173 return dst[size:] 18174 } 18175 18176 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18177 func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) []byte { 18178 size := sxts.SizeBytes() 18179 gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(size)) 18180 return src[size:] 18181 } 18182 18183 // CopyOutN implements marshal.Marshallable.CopyOutN. 18184 func (sxts *StatxTimestamp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18185 // Construct a slice backed by dst's underlying memory. 18186 var buf []byte 18187 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18188 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 18189 hdr.Len = sxts.SizeBytes() 18190 hdr.Cap = sxts.SizeBytes() 18191 18192 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18193 // Since we bypassed the compiler's escape analysis, indicate that sxts 18194 // must live until the use above. 18195 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 18196 return length, err 18197 } 18198 18199 // CopyOut implements marshal.Marshallable.CopyOut. 18200 func (sxts *StatxTimestamp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18201 return sxts.CopyOutN(cc, addr, sxts.SizeBytes()) 18202 } 18203 18204 // CopyInN implements marshal.Marshallable.CopyInN. 18205 func (sxts *StatxTimestamp) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18206 // Construct a slice backed by dst's underlying memory. 18207 var buf []byte 18208 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18209 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 18210 hdr.Len = sxts.SizeBytes() 18211 hdr.Cap = sxts.SizeBytes() 18212 18213 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18214 // Since we bypassed the compiler's escape analysis, indicate that sxts 18215 // must live until the use above. 18216 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 18217 return length, err 18218 } 18219 18220 // CopyIn implements marshal.Marshallable.CopyIn. 18221 func (sxts *StatxTimestamp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18222 return sxts.CopyInN(cc, addr, sxts.SizeBytes()) 18223 } 18224 18225 // WriteTo implements io.WriterTo.WriteTo. 18226 func (sxts *StatxTimestamp) WriteTo(writer io.Writer) (int64, error) { 18227 // Construct a slice backed by dst's underlying memory. 18228 var buf []byte 18229 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18230 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 18231 hdr.Len = sxts.SizeBytes() 18232 hdr.Cap = sxts.SizeBytes() 18233 18234 length, err := writer.Write(buf) 18235 // Since we bypassed the compiler's escape analysis, indicate that sxts 18236 // must live until the use above. 18237 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 18238 return int64(length), err 18239 } 18240 18241 // SizeBytes implements marshal.Marshallable.SizeBytes. 18242 //go:nosplit 18243 func (t *TimeT) SizeBytes() int { 18244 return 8 18245 } 18246 18247 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18248 func (t *TimeT) MarshalBytes(dst []byte) []byte { 18249 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*t)) 18250 return dst[8:] 18251 } 18252 18253 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18254 func (t *TimeT) UnmarshalBytes(src []byte) []byte { 18255 *t = TimeT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 18256 return src[8:] 18257 } 18258 18259 // Packed implements marshal.Marshallable.Packed. 18260 //go:nosplit 18261 func (t *TimeT) Packed() bool { 18262 // Scalar newtypes are always packed. 18263 return true 18264 } 18265 18266 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18267 func (t *TimeT) MarshalUnsafe(dst []byte) []byte { 18268 size := t.SizeBytes() 18269 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18270 return dst[size:] 18271 } 18272 18273 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18274 func (t *TimeT) UnmarshalUnsafe(src []byte) []byte { 18275 size := t.SizeBytes() 18276 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18277 return src[size:] 18278 } 18279 18280 // CopyOutN implements marshal.Marshallable.CopyOutN. 18281 func (t *TimeT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18282 // Construct a slice backed by dst's underlying memory. 18283 var buf []byte 18284 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18285 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18286 hdr.Len = t.SizeBytes() 18287 hdr.Cap = t.SizeBytes() 18288 18289 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18290 // Since we bypassed the compiler's escape analysis, indicate that t 18291 // must live until the use above. 18292 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18293 return length, err 18294 } 18295 18296 // CopyOut implements marshal.Marshallable.CopyOut. 18297 func (t *TimeT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18298 return t.CopyOutN(cc, addr, t.SizeBytes()) 18299 } 18300 18301 // CopyInN implements marshal.Marshallable.CopyInN. 18302 func (t *TimeT) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18303 // Construct a slice backed by dst's underlying memory. 18304 var buf []byte 18305 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18306 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18307 hdr.Len = t.SizeBytes() 18308 hdr.Cap = t.SizeBytes() 18309 18310 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18311 // Since we bypassed the compiler's escape analysis, indicate that t 18312 // must live until the use above. 18313 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18314 return length, err 18315 } 18316 18317 // CopyIn implements marshal.Marshallable.CopyIn. 18318 func (t *TimeT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18319 return t.CopyInN(cc, addr, t.SizeBytes()) 18320 } 18321 18322 // WriteTo implements io.WriterTo.WriteTo. 18323 func (t *TimeT) WriteTo(writer io.Writer) (int64, error) { 18324 // Construct a slice backed by dst's underlying memory. 18325 var buf []byte 18326 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18327 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18328 hdr.Len = t.SizeBytes() 18329 hdr.Cap = t.SizeBytes() 18330 18331 length, err := writer.Write(buf) 18332 // Since we bypassed the compiler's escape analysis, indicate that t 18333 // must live until the use above. 18334 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18335 return int64(length), err 18336 } 18337 18338 // SizeBytes implements marshal.Marshallable.SizeBytes. 18339 //go:nosplit 18340 func (t *TimerID) SizeBytes() int { 18341 return 4 18342 } 18343 18344 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18345 func (t *TimerID) MarshalBytes(dst []byte) []byte { 18346 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*t)) 18347 return dst[4:] 18348 } 18349 18350 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18351 func (t *TimerID) UnmarshalBytes(src []byte) []byte { 18352 *t = TimerID(int32(hostarch.ByteOrder.Uint32(src[:4]))) 18353 return src[4:] 18354 } 18355 18356 // Packed implements marshal.Marshallable.Packed. 18357 //go:nosplit 18358 func (t *TimerID) Packed() bool { 18359 // Scalar newtypes are always packed. 18360 return true 18361 } 18362 18363 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18364 func (t *TimerID) MarshalUnsafe(dst []byte) []byte { 18365 size := t.SizeBytes() 18366 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18367 return dst[size:] 18368 } 18369 18370 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18371 func (t *TimerID) UnmarshalUnsafe(src []byte) []byte { 18372 size := t.SizeBytes() 18373 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18374 return src[size:] 18375 } 18376 18377 // CopyOutN implements marshal.Marshallable.CopyOutN. 18378 func (t *TimerID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18379 // Construct a slice backed by dst's underlying memory. 18380 var buf []byte 18381 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18382 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18383 hdr.Len = t.SizeBytes() 18384 hdr.Cap = t.SizeBytes() 18385 18386 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18387 // Since we bypassed the compiler's escape analysis, indicate that t 18388 // must live until the use above. 18389 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18390 return length, err 18391 } 18392 18393 // CopyOut implements marshal.Marshallable.CopyOut. 18394 func (t *TimerID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18395 return t.CopyOutN(cc, addr, t.SizeBytes()) 18396 } 18397 18398 // CopyInN implements marshal.Marshallable.CopyInN. 18399 func (t *TimerID) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18400 // Construct a slice backed by dst's underlying memory. 18401 var buf []byte 18402 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18403 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18404 hdr.Len = t.SizeBytes() 18405 hdr.Cap = t.SizeBytes() 18406 18407 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18408 // Since we bypassed the compiler's escape analysis, indicate that t 18409 // must live until the use above. 18410 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18411 return length, err 18412 } 18413 18414 // CopyIn implements marshal.Marshallable.CopyIn. 18415 func (t *TimerID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18416 return t.CopyInN(cc, addr, t.SizeBytes()) 18417 } 18418 18419 // WriteTo implements io.WriterTo.WriteTo. 18420 func (t *TimerID) WriteTo(writer io.Writer) (int64, error) { 18421 // Construct a slice backed by dst's underlying memory. 18422 var buf []byte 18423 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18424 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18425 hdr.Len = t.SizeBytes() 18426 hdr.Cap = t.SizeBytes() 18427 18428 length, err := writer.Write(buf) 18429 // Since we bypassed the compiler's escape analysis, indicate that t 18430 // must live until the use above. 18431 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18432 return int64(length), err 18433 } 18434 18435 // SizeBytes implements marshal.Marshallable.SizeBytes. 18436 func (ts *Timespec) SizeBytes() int { 18437 return 16 18438 } 18439 18440 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18441 func (ts *Timespec) MarshalBytes(dst []byte) []byte { 18442 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Sec)) 18443 dst = dst[8:] 18444 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Nsec)) 18445 dst = dst[8:] 18446 return dst 18447 } 18448 18449 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18450 func (ts *Timespec) UnmarshalBytes(src []byte) []byte { 18451 ts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 18452 src = src[8:] 18453 ts.Nsec = int64(hostarch.ByteOrder.Uint64(src[:8])) 18454 src = src[8:] 18455 return src 18456 } 18457 18458 // Packed implements marshal.Marshallable.Packed. 18459 //go:nosplit 18460 func (ts *Timespec) Packed() bool { 18461 return true 18462 } 18463 18464 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18465 func (ts *Timespec) MarshalUnsafe(dst []byte) []byte { 18466 size := ts.SizeBytes() 18467 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(size)) 18468 return dst[size:] 18469 } 18470 18471 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18472 func (ts *Timespec) UnmarshalUnsafe(src []byte) []byte { 18473 size := ts.SizeBytes() 18474 gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(size)) 18475 return src[size:] 18476 } 18477 18478 // CopyOutN implements marshal.Marshallable.CopyOutN. 18479 func (ts *Timespec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18480 // Construct a slice backed by dst's underlying memory. 18481 var buf []byte 18482 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18483 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 18484 hdr.Len = ts.SizeBytes() 18485 hdr.Cap = ts.SizeBytes() 18486 18487 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18488 // Since we bypassed the compiler's escape analysis, indicate that ts 18489 // must live until the use above. 18490 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 18491 return length, err 18492 } 18493 18494 // CopyOut implements marshal.Marshallable.CopyOut. 18495 func (ts *Timespec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18496 return ts.CopyOutN(cc, addr, ts.SizeBytes()) 18497 } 18498 18499 // CopyInN implements marshal.Marshallable.CopyInN. 18500 func (ts *Timespec) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18501 // Construct a slice backed by dst's underlying memory. 18502 var buf []byte 18503 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18504 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 18505 hdr.Len = ts.SizeBytes() 18506 hdr.Cap = ts.SizeBytes() 18507 18508 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18509 // Since we bypassed the compiler's escape analysis, indicate that ts 18510 // must live until the use above. 18511 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 18512 return length, err 18513 } 18514 18515 // CopyIn implements marshal.Marshallable.CopyIn. 18516 func (ts *Timespec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18517 return ts.CopyInN(cc, addr, ts.SizeBytes()) 18518 } 18519 18520 // WriteTo implements io.WriterTo.WriteTo. 18521 func (ts *Timespec) WriteTo(writer io.Writer) (int64, error) { 18522 // Construct a slice backed by dst's underlying memory. 18523 var buf []byte 18524 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18525 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 18526 hdr.Len = ts.SizeBytes() 18527 hdr.Cap = ts.SizeBytes() 18528 18529 length, err := writer.Write(buf) 18530 // Since we bypassed the compiler's escape analysis, indicate that ts 18531 // must live until the use above. 18532 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 18533 return int64(length), err 18534 } 18535 18536 // CopyTimespecSliceIn copies in a slice of Timespec objects from the task's memory. 18537 func CopyTimespecSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timespec) (int, error) { 18538 count := len(dst) 18539 if count == 0 { 18540 return 0, nil 18541 } 18542 size := (*Timespec)(nil).SizeBytes() 18543 18544 ptr := unsafe.Pointer(&dst) 18545 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 18546 18547 // Construct a slice backed by dst's underlying memory. 18548 var buf []byte 18549 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18550 hdr.Data = uintptr(val) 18551 hdr.Len = size * count 18552 hdr.Cap = size * count 18553 18554 length, err := cc.CopyInBytes(addr, buf) 18555 // Since we bypassed the compiler's escape analysis, indicate that dst 18556 // must live until the use above. 18557 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 18558 return length, err 18559 } 18560 18561 // CopyTimespecSliceOut copies a slice of Timespec objects to the task's memory. 18562 func CopyTimespecSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timespec) (int, error) { 18563 count := len(src) 18564 if count == 0 { 18565 return 0, nil 18566 } 18567 size := (*Timespec)(nil).SizeBytes() 18568 18569 ptr := unsafe.Pointer(&src) 18570 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 18571 18572 // Construct a slice backed by dst's underlying memory. 18573 var buf []byte 18574 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18575 hdr.Data = uintptr(val) 18576 hdr.Len = size * count 18577 hdr.Cap = size * count 18578 18579 length, err := cc.CopyOutBytes(addr, buf) 18580 // Since we bypassed the compiler's escape analysis, indicate that src 18581 // must live until the use above. 18582 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 18583 return length, err 18584 } 18585 18586 // MarshalUnsafeTimespecSlice is like Timespec.MarshalUnsafe, but for a []Timespec. 18587 func MarshalUnsafeTimespecSlice(src []Timespec, dst []byte) []byte { 18588 count := len(src) 18589 if count == 0 { 18590 return dst 18591 } 18592 18593 size := (*Timespec)(nil).SizeBytes() 18594 buf := dst[:size*count] 18595 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 18596 return dst[size*count:] 18597 } 18598 18599 // UnmarshalUnsafeTimespecSlice is like Timespec.UnmarshalUnsafe, but for a []Timespec. 18600 func UnmarshalUnsafeTimespecSlice(dst []Timespec, src []byte) []byte { 18601 count := len(dst) 18602 if count == 0 { 18603 return src 18604 } 18605 18606 size := (*Timespec)(nil).SizeBytes() 18607 buf := src[:size*count] 18608 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 18609 return src[size*count:] 18610 } 18611 18612 // SizeBytes implements marshal.Marshallable.SizeBytes. 18613 func (tv *Timeval) SizeBytes() int { 18614 return 16 18615 } 18616 18617 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18618 func (tv *Timeval) MarshalBytes(dst []byte) []byte { 18619 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Sec)) 18620 dst = dst[8:] 18621 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Usec)) 18622 dst = dst[8:] 18623 return dst 18624 } 18625 18626 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18627 func (tv *Timeval) UnmarshalBytes(src []byte) []byte { 18628 tv.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 18629 src = src[8:] 18630 tv.Usec = int64(hostarch.ByteOrder.Uint64(src[:8])) 18631 src = src[8:] 18632 return src 18633 } 18634 18635 // Packed implements marshal.Marshallable.Packed. 18636 //go:nosplit 18637 func (tv *Timeval) Packed() bool { 18638 return true 18639 } 18640 18641 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18642 func (tv *Timeval) MarshalUnsafe(dst []byte) []byte { 18643 size := tv.SizeBytes() 18644 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(size)) 18645 return dst[size:] 18646 } 18647 18648 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18649 func (tv *Timeval) UnmarshalUnsafe(src []byte) []byte { 18650 size := tv.SizeBytes() 18651 gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(size)) 18652 return src[size:] 18653 } 18654 18655 // CopyOutN implements marshal.Marshallable.CopyOutN. 18656 func (tv *Timeval) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18657 // Construct a slice backed by dst's underlying memory. 18658 var buf []byte 18659 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18660 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 18661 hdr.Len = tv.SizeBytes() 18662 hdr.Cap = tv.SizeBytes() 18663 18664 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18665 // Since we bypassed the compiler's escape analysis, indicate that tv 18666 // must live until the use above. 18667 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 18668 return length, err 18669 } 18670 18671 // CopyOut implements marshal.Marshallable.CopyOut. 18672 func (tv *Timeval) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18673 return tv.CopyOutN(cc, addr, tv.SizeBytes()) 18674 } 18675 18676 // CopyInN implements marshal.Marshallable.CopyInN. 18677 func (tv *Timeval) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18678 // Construct a slice backed by dst's underlying memory. 18679 var buf []byte 18680 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18681 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 18682 hdr.Len = tv.SizeBytes() 18683 hdr.Cap = tv.SizeBytes() 18684 18685 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18686 // Since we bypassed the compiler's escape analysis, indicate that tv 18687 // must live until the use above. 18688 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 18689 return length, err 18690 } 18691 18692 // CopyIn implements marshal.Marshallable.CopyIn. 18693 func (tv *Timeval) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18694 return tv.CopyInN(cc, addr, tv.SizeBytes()) 18695 } 18696 18697 // WriteTo implements io.WriterTo.WriteTo. 18698 func (tv *Timeval) WriteTo(writer io.Writer) (int64, error) { 18699 // Construct a slice backed by dst's underlying memory. 18700 var buf []byte 18701 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18702 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 18703 hdr.Len = tv.SizeBytes() 18704 hdr.Cap = tv.SizeBytes() 18705 18706 length, err := writer.Write(buf) 18707 // Since we bypassed the compiler's escape analysis, indicate that tv 18708 // must live until the use above. 18709 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 18710 return int64(length), err 18711 } 18712 18713 // CopyTimevalSliceIn copies in a slice of Timeval objects from the task's memory. 18714 func CopyTimevalSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timeval) (int, error) { 18715 count := len(dst) 18716 if count == 0 { 18717 return 0, nil 18718 } 18719 size := (*Timeval)(nil).SizeBytes() 18720 18721 ptr := unsafe.Pointer(&dst) 18722 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 18723 18724 // Construct a slice backed by dst's underlying memory. 18725 var buf []byte 18726 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18727 hdr.Data = uintptr(val) 18728 hdr.Len = size * count 18729 hdr.Cap = size * count 18730 18731 length, err := cc.CopyInBytes(addr, buf) 18732 // Since we bypassed the compiler's escape analysis, indicate that dst 18733 // must live until the use above. 18734 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 18735 return length, err 18736 } 18737 18738 // CopyTimevalSliceOut copies a slice of Timeval objects to the task's memory. 18739 func CopyTimevalSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timeval) (int, error) { 18740 count := len(src) 18741 if count == 0 { 18742 return 0, nil 18743 } 18744 size := (*Timeval)(nil).SizeBytes() 18745 18746 ptr := unsafe.Pointer(&src) 18747 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 18748 18749 // Construct a slice backed by dst's underlying memory. 18750 var buf []byte 18751 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18752 hdr.Data = uintptr(val) 18753 hdr.Len = size * count 18754 hdr.Cap = size * count 18755 18756 length, err := cc.CopyOutBytes(addr, buf) 18757 // Since we bypassed the compiler's escape analysis, indicate that src 18758 // must live until the use above. 18759 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 18760 return length, err 18761 } 18762 18763 // MarshalUnsafeTimevalSlice is like Timeval.MarshalUnsafe, but for a []Timeval. 18764 func MarshalUnsafeTimevalSlice(src []Timeval, dst []byte) []byte { 18765 count := len(src) 18766 if count == 0 { 18767 return dst 18768 } 18769 18770 size := (*Timeval)(nil).SizeBytes() 18771 buf := dst[:size*count] 18772 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 18773 return dst[size*count:] 18774 } 18775 18776 // UnmarshalUnsafeTimevalSlice is like Timeval.UnmarshalUnsafe, but for a []Timeval. 18777 func UnmarshalUnsafeTimevalSlice(dst []Timeval, src []byte) []byte { 18778 count := len(dst) 18779 if count == 0 { 18780 return src 18781 } 18782 18783 size := (*Timeval)(nil).SizeBytes() 18784 buf := src[:size*count] 18785 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 18786 return src[size*count:] 18787 } 18788 18789 // SizeBytes implements marshal.Marshallable.SizeBytes. 18790 func (t *Tms) SizeBytes() int { 18791 return 0 + 18792 (*ClockT)(nil).SizeBytes() + 18793 (*ClockT)(nil).SizeBytes() + 18794 (*ClockT)(nil).SizeBytes() + 18795 (*ClockT)(nil).SizeBytes() 18796 } 18797 18798 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18799 func (t *Tms) MarshalBytes(dst []byte) []byte { 18800 dst = t.UTime.MarshalUnsafe(dst) 18801 dst = t.STime.MarshalUnsafe(dst) 18802 dst = t.CUTime.MarshalUnsafe(dst) 18803 dst = t.CSTime.MarshalUnsafe(dst) 18804 return dst 18805 } 18806 18807 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18808 func (t *Tms) UnmarshalBytes(src []byte) []byte { 18809 src = t.UTime.UnmarshalUnsafe(src) 18810 src = t.STime.UnmarshalUnsafe(src) 18811 src = t.CUTime.UnmarshalUnsafe(src) 18812 src = t.CSTime.UnmarshalUnsafe(src) 18813 return src 18814 } 18815 18816 // Packed implements marshal.Marshallable.Packed. 18817 //go:nosplit 18818 func (t *Tms) Packed() bool { 18819 return t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() 18820 } 18821 18822 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18823 func (t *Tms) MarshalUnsafe(dst []byte) []byte { 18824 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18825 size := t.SizeBytes() 18826 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18827 return dst[size:] 18828 } 18829 // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes. 18830 return t.MarshalBytes(dst) 18831 } 18832 18833 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18834 func (t *Tms) UnmarshalUnsafe(src []byte) []byte { 18835 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18836 size := t.SizeBytes() 18837 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18838 return src[size:] 18839 } 18840 // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes. 18841 return t.UnmarshalBytes(src) 18842 } 18843 18844 // CopyOutN implements marshal.Marshallable.CopyOutN. 18845 func (t *Tms) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18846 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18847 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 18848 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 18849 t.MarshalBytes(buf) // escapes: fallback. 18850 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18851 } 18852 18853 // Construct a slice backed by dst's underlying memory. 18854 var buf []byte 18855 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18856 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18857 hdr.Len = t.SizeBytes() 18858 hdr.Cap = t.SizeBytes() 18859 18860 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18861 // Since we bypassed the compiler's escape analysis, indicate that t 18862 // must live until the use above. 18863 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18864 return length, err 18865 } 18866 18867 // CopyOut implements marshal.Marshallable.CopyOut. 18868 func (t *Tms) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18869 return t.CopyOutN(cc, addr, t.SizeBytes()) 18870 } 18871 18872 // CopyInN implements marshal.Marshallable.CopyInN. 18873 func (t *Tms) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18874 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18875 // Type Tms doesn't have a packed layout in memory, fall back to UnmarshalBytes. 18876 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 18877 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18878 // Unmarshal unconditionally. If we had a short copy-in, this results in a 18879 // partially unmarshalled struct. 18880 t.UnmarshalBytes(buf) // escapes: fallback. 18881 return length, err 18882 } 18883 18884 // Construct a slice backed by dst's underlying memory. 18885 var buf []byte 18886 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18887 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18888 hdr.Len = t.SizeBytes() 18889 hdr.Cap = t.SizeBytes() 18890 18891 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18892 // Since we bypassed the compiler's escape analysis, indicate that t 18893 // must live until the use above. 18894 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18895 return length, err 18896 } 18897 18898 // CopyIn implements marshal.Marshallable.CopyIn. 18899 func (t *Tms) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18900 return t.CopyInN(cc, addr, t.SizeBytes()) 18901 } 18902 18903 // WriteTo implements io.WriterTo.WriteTo. 18904 func (t *Tms) WriteTo(writer io.Writer) (int64, error) { 18905 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18906 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 18907 buf := make([]byte, t.SizeBytes()) 18908 t.MarshalBytes(buf) 18909 length, err := writer.Write(buf) 18910 return int64(length), err 18911 } 18912 18913 // Construct a slice backed by dst's underlying memory. 18914 var buf []byte 18915 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18916 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18917 hdr.Len = t.SizeBytes() 18918 hdr.Cap = t.SizeBytes() 18919 18920 length, err := writer.Write(buf) 18921 // Since we bypassed the compiler's escape analysis, indicate that t 18922 // must live until the use above. 18923 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18924 return int64(length), err 18925 } 18926 18927 // SizeBytes implements marshal.Marshallable.SizeBytes. 18928 func (u *Utime) SizeBytes() int { 18929 return 16 18930 } 18931 18932 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18933 func (u *Utime) MarshalBytes(dst []byte) []byte { 18934 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Actime)) 18935 dst = dst[8:] 18936 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Modtime)) 18937 dst = dst[8:] 18938 return dst 18939 } 18940 18941 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18942 func (u *Utime) UnmarshalBytes(src []byte) []byte { 18943 u.Actime = int64(hostarch.ByteOrder.Uint64(src[:8])) 18944 src = src[8:] 18945 u.Modtime = int64(hostarch.ByteOrder.Uint64(src[:8])) 18946 src = src[8:] 18947 return src 18948 } 18949 18950 // Packed implements marshal.Marshallable.Packed. 18951 //go:nosplit 18952 func (u *Utime) Packed() bool { 18953 return true 18954 } 18955 18956 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18957 func (u *Utime) MarshalUnsafe(dst []byte) []byte { 18958 size := u.SizeBytes() 18959 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 18960 return dst[size:] 18961 } 18962 18963 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18964 func (u *Utime) UnmarshalUnsafe(src []byte) []byte { 18965 size := u.SizeBytes() 18966 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 18967 return src[size:] 18968 } 18969 18970 // CopyOutN implements marshal.Marshallable.CopyOutN. 18971 func (u *Utime) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18972 // Construct a slice backed by dst's underlying memory. 18973 var buf []byte 18974 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18975 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18976 hdr.Len = u.SizeBytes() 18977 hdr.Cap = u.SizeBytes() 18978 18979 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18980 // Since we bypassed the compiler's escape analysis, indicate that u 18981 // must live until the use above. 18982 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18983 return length, err 18984 } 18985 18986 // CopyOut implements marshal.Marshallable.CopyOut. 18987 func (u *Utime) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18988 return u.CopyOutN(cc, addr, u.SizeBytes()) 18989 } 18990 18991 // CopyInN implements marshal.Marshallable.CopyInN. 18992 func (u *Utime) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18993 // Construct a slice backed by dst's underlying memory. 18994 var buf []byte 18995 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18996 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18997 hdr.Len = u.SizeBytes() 18998 hdr.Cap = u.SizeBytes() 18999 19000 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19001 // Since we bypassed the compiler's escape analysis, indicate that u 19002 // must live until the use above. 19003 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19004 return length, err 19005 } 19006 19007 // CopyIn implements marshal.Marshallable.CopyIn. 19008 func (u *Utime) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19009 return u.CopyInN(cc, addr, u.SizeBytes()) 19010 } 19011 19012 // WriteTo implements io.WriterTo.WriteTo. 19013 func (u *Utime) WriteTo(writer io.Writer) (int64, error) { 19014 // Construct a slice backed by dst's underlying memory. 19015 var buf []byte 19016 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19017 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19018 hdr.Len = u.SizeBytes() 19019 hdr.Cap = u.SizeBytes() 19020 19021 length, err := writer.Write(buf) 19022 // Since we bypassed the compiler's escape analysis, indicate that u 19023 // must live until the use above. 19024 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19025 return int64(length), err 19026 } 19027 19028 // SizeBytes implements marshal.Marshallable.SizeBytes. 19029 func (t *Termios) SizeBytes() int { 19030 return 17 + 19031 1*NumControlCharacters 19032 } 19033 19034 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19035 func (t *Termios) MarshalBytes(dst []byte) []byte { 19036 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.InputFlags)) 19037 dst = dst[4:] 19038 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.OutputFlags)) 19039 dst = dst[4:] 19040 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ControlFlags)) 19041 dst = dst[4:] 19042 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LocalFlags)) 19043 dst = dst[4:] 19044 dst[0] = byte(t.LineDiscipline) 19045 dst = dst[1:] 19046 for idx := 0; idx < NumControlCharacters; idx++ { 19047 dst[0] = byte(t.ControlCharacters[idx]) 19048 dst = dst[1:] 19049 } 19050 return dst 19051 } 19052 19053 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19054 func (t *Termios) UnmarshalBytes(src []byte) []byte { 19055 t.InputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19056 src = src[4:] 19057 t.OutputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19058 src = src[4:] 19059 t.ControlFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19060 src = src[4:] 19061 t.LocalFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19062 src = src[4:] 19063 t.LineDiscipline = uint8(src[0]) 19064 src = src[1:] 19065 for idx := 0; idx < NumControlCharacters; idx++ { 19066 t.ControlCharacters[idx] = uint8(src[0]) 19067 src = src[1:] 19068 } 19069 return src 19070 } 19071 19072 // Packed implements marshal.Marshallable.Packed. 19073 //go:nosplit 19074 func (t *Termios) Packed() bool { 19075 return true 19076 } 19077 19078 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19079 func (t *Termios) MarshalUnsafe(dst []byte) []byte { 19080 size := t.SizeBytes() 19081 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 19082 return dst[size:] 19083 } 19084 19085 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19086 func (t *Termios) UnmarshalUnsafe(src []byte) []byte { 19087 size := t.SizeBytes() 19088 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 19089 return src[size:] 19090 } 19091 19092 // CopyOutN implements marshal.Marshallable.CopyOutN. 19093 func (t *Termios) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19094 // Construct a slice backed by dst's underlying memory. 19095 var buf []byte 19096 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19097 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19098 hdr.Len = t.SizeBytes() 19099 hdr.Cap = t.SizeBytes() 19100 19101 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19102 // Since we bypassed the compiler's escape analysis, indicate that t 19103 // must live until the use above. 19104 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19105 return length, err 19106 } 19107 19108 // CopyOut implements marshal.Marshallable.CopyOut. 19109 func (t *Termios) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19110 return t.CopyOutN(cc, addr, t.SizeBytes()) 19111 } 19112 19113 // CopyInN implements marshal.Marshallable.CopyInN. 19114 func (t *Termios) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19115 // Construct a slice backed by dst's underlying memory. 19116 var buf []byte 19117 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19118 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19119 hdr.Len = t.SizeBytes() 19120 hdr.Cap = t.SizeBytes() 19121 19122 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19123 // Since we bypassed the compiler's escape analysis, indicate that t 19124 // must live until the use above. 19125 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19126 return length, err 19127 } 19128 19129 // CopyIn implements marshal.Marshallable.CopyIn. 19130 func (t *Termios) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19131 return t.CopyInN(cc, addr, t.SizeBytes()) 19132 } 19133 19134 // WriteTo implements io.WriterTo.WriteTo. 19135 func (t *Termios) WriteTo(writer io.Writer) (int64, error) { 19136 // Construct a slice backed by dst's underlying memory. 19137 var buf []byte 19138 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19139 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19140 hdr.Len = t.SizeBytes() 19141 hdr.Cap = t.SizeBytes() 19142 19143 length, err := writer.Write(buf) 19144 // Since we bypassed the compiler's escape analysis, indicate that t 19145 // must live until the use above. 19146 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19147 return int64(length), err 19148 } 19149 19150 // SizeBytes implements marshal.Marshallable.SizeBytes. 19151 func (w *WindowSize) SizeBytes() int { 19152 return 4 + 19153 1*4 19154 } 19155 19156 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19157 func (w *WindowSize) MarshalBytes(dst []byte) []byte { 19158 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Rows)) 19159 dst = dst[2:] 19160 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Cols)) 19161 dst = dst[2:] 19162 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 19163 dst = dst[1*(4):] 19164 return dst 19165 } 19166 19167 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19168 func (w *WindowSize) UnmarshalBytes(src []byte) []byte { 19169 w.Rows = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19170 src = src[2:] 19171 w.Cols = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19172 src = src[2:] 19173 // Padding: ~ copy([4]byte(w._), src[:sizeof(byte)*4]) 19174 src = src[1*(4):] 19175 return src 19176 } 19177 19178 // Packed implements marshal.Marshallable.Packed. 19179 //go:nosplit 19180 func (w *WindowSize) Packed() bool { 19181 return true 19182 } 19183 19184 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19185 func (w *WindowSize) MarshalUnsafe(dst []byte) []byte { 19186 size := w.SizeBytes() 19187 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 19188 return dst[size:] 19189 } 19190 19191 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19192 func (w *WindowSize) UnmarshalUnsafe(src []byte) []byte { 19193 size := w.SizeBytes() 19194 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 19195 return src[size:] 19196 } 19197 19198 // CopyOutN implements marshal.Marshallable.CopyOutN. 19199 func (w *WindowSize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19200 // Construct a slice backed by dst's underlying memory. 19201 var buf []byte 19202 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19203 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19204 hdr.Len = w.SizeBytes() 19205 hdr.Cap = w.SizeBytes() 19206 19207 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19208 // Since we bypassed the compiler's escape analysis, indicate that w 19209 // must live until the use above. 19210 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19211 return length, err 19212 } 19213 19214 // CopyOut implements marshal.Marshallable.CopyOut. 19215 func (w *WindowSize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19216 return w.CopyOutN(cc, addr, w.SizeBytes()) 19217 } 19218 19219 // CopyInN implements marshal.Marshallable.CopyInN. 19220 func (w *WindowSize) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19221 // Construct a slice backed by dst's underlying memory. 19222 var buf []byte 19223 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19224 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19225 hdr.Len = w.SizeBytes() 19226 hdr.Cap = w.SizeBytes() 19227 19228 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19229 // Since we bypassed the compiler's escape analysis, indicate that w 19230 // must live until the use above. 19231 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19232 return length, err 19233 } 19234 19235 // CopyIn implements marshal.Marshallable.CopyIn. 19236 func (w *WindowSize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19237 return w.CopyInN(cc, addr, w.SizeBytes()) 19238 } 19239 19240 // WriteTo implements io.WriterTo.WriteTo. 19241 func (w *WindowSize) WriteTo(writer io.Writer) (int64, error) { 19242 // Construct a slice backed by dst's underlying memory. 19243 var buf []byte 19244 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19245 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19246 hdr.Len = w.SizeBytes() 19247 hdr.Cap = w.SizeBytes() 19248 19249 length, err := writer.Write(buf) 19250 // Since we bypassed the compiler's escape analysis, indicate that w 19251 // must live until the use above. 19252 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19253 return int64(length), err 19254 } 19255 19256 // SizeBytes implements marshal.Marshallable.SizeBytes. 19257 func (w *Winsize) SizeBytes() int { 19258 return 8 19259 } 19260 19261 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19262 func (w *Winsize) MarshalBytes(dst []byte) []byte { 19263 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Row)) 19264 dst = dst[2:] 19265 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Col)) 19266 dst = dst[2:] 19267 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Xpixel)) 19268 dst = dst[2:] 19269 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Ypixel)) 19270 dst = dst[2:] 19271 return dst 19272 } 19273 19274 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19275 func (w *Winsize) UnmarshalBytes(src []byte) []byte { 19276 w.Row = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19277 src = src[2:] 19278 w.Col = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19279 src = src[2:] 19280 w.Xpixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19281 src = src[2:] 19282 w.Ypixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19283 src = src[2:] 19284 return src 19285 } 19286 19287 // Packed implements marshal.Marshallable.Packed. 19288 //go:nosplit 19289 func (w *Winsize) Packed() bool { 19290 return true 19291 } 19292 19293 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19294 func (w *Winsize) MarshalUnsafe(dst []byte) []byte { 19295 size := w.SizeBytes() 19296 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 19297 return dst[size:] 19298 } 19299 19300 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19301 func (w *Winsize) UnmarshalUnsafe(src []byte) []byte { 19302 size := w.SizeBytes() 19303 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 19304 return src[size:] 19305 } 19306 19307 // CopyOutN implements marshal.Marshallable.CopyOutN. 19308 func (w *Winsize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19309 // Construct a slice backed by dst's underlying memory. 19310 var buf []byte 19311 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19312 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19313 hdr.Len = w.SizeBytes() 19314 hdr.Cap = w.SizeBytes() 19315 19316 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19317 // Since we bypassed the compiler's escape analysis, indicate that w 19318 // must live until the use above. 19319 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19320 return length, err 19321 } 19322 19323 // CopyOut implements marshal.Marshallable.CopyOut. 19324 func (w *Winsize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19325 return w.CopyOutN(cc, addr, w.SizeBytes()) 19326 } 19327 19328 // CopyInN implements marshal.Marshallable.CopyInN. 19329 func (w *Winsize) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19330 // Construct a slice backed by dst's underlying memory. 19331 var buf []byte 19332 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19333 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19334 hdr.Len = w.SizeBytes() 19335 hdr.Cap = w.SizeBytes() 19336 19337 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19338 // Since we bypassed the compiler's escape analysis, indicate that w 19339 // must live until the use above. 19340 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19341 return length, err 19342 } 19343 19344 // CopyIn implements marshal.Marshallable.CopyIn. 19345 func (w *Winsize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19346 return w.CopyInN(cc, addr, w.SizeBytes()) 19347 } 19348 19349 // WriteTo implements io.WriterTo.WriteTo. 19350 func (w *Winsize) WriteTo(writer io.Writer) (int64, error) { 19351 // Construct a slice backed by dst's underlying memory. 19352 var buf []byte 19353 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19354 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19355 hdr.Len = w.SizeBytes() 19356 hdr.Cap = w.SizeBytes() 19357 19358 length, err := writer.Write(buf) 19359 // Since we bypassed the compiler's escape analysis, indicate that w 19360 // must live until the use above. 19361 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19362 return int64(length), err 19363 } 19364 19365 // SizeBytes implements marshal.Marshallable.SizeBytes. 19366 func (u *UtsName) SizeBytes() int { 19367 return 0 + 19368 1*(UTSLen+1) + 19369 1*(UTSLen+1) + 19370 1*(UTSLen+1) + 19371 1*(UTSLen+1) + 19372 1*(UTSLen+1) + 19373 1*(UTSLen+1) 19374 } 19375 19376 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19377 func (u *UtsName) MarshalBytes(dst []byte) []byte { 19378 for idx := 0; idx < (UTSLen+1); idx++ { 19379 dst[0] = byte(u.Sysname[idx]) 19380 dst = dst[1:] 19381 } 19382 for idx := 0; idx < (UTSLen+1); idx++ { 19383 dst[0] = byte(u.Nodename[idx]) 19384 dst = dst[1:] 19385 } 19386 for idx := 0; idx < (UTSLen+1); idx++ { 19387 dst[0] = byte(u.Release[idx]) 19388 dst = dst[1:] 19389 } 19390 for idx := 0; idx < (UTSLen+1); idx++ { 19391 dst[0] = byte(u.Version[idx]) 19392 dst = dst[1:] 19393 } 19394 for idx := 0; idx < (UTSLen+1); idx++ { 19395 dst[0] = byte(u.Machine[idx]) 19396 dst = dst[1:] 19397 } 19398 for idx := 0; idx < (UTSLen+1); idx++ { 19399 dst[0] = byte(u.Domainname[idx]) 19400 dst = dst[1:] 19401 } 19402 return dst 19403 } 19404 19405 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19406 func (u *UtsName) UnmarshalBytes(src []byte) []byte { 19407 for idx := 0; idx < (UTSLen+1); idx++ { 19408 u.Sysname[idx] = src[0] 19409 src = src[1:] 19410 } 19411 for idx := 0; idx < (UTSLen+1); idx++ { 19412 u.Nodename[idx] = src[0] 19413 src = src[1:] 19414 } 19415 for idx := 0; idx < (UTSLen+1); idx++ { 19416 u.Release[idx] = src[0] 19417 src = src[1:] 19418 } 19419 for idx := 0; idx < (UTSLen+1); idx++ { 19420 u.Version[idx] = src[0] 19421 src = src[1:] 19422 } 19423 for idx := 0; idx < (UTSLen+1); idx++ { 19424 u.Machine[idx] = src[0] 19425 src = src[1:] 19426 } 19427 for idx := 0; idx < (UTSLen+1); idx++ { 19428 u.Domainname[idx] = src[0] 19429 src = src[1:] 19430 } 19431 return src 19432 } 19433 19434 // Packed implements marshal.Marshallable.Packed. 19435 //go:nosplit 19436 func (u *UtsName) Packed() bool { 19437 return true 19438 } 19439 19440 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19441 func (u *UtsName) MarshalUnsafe(dst []byte) []byte { 19442 size := u.SizeBytes() 19443 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 19444 return dst[size:] 19445 } 19446 19447 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19448 func (u *UtsName) UnmarshalUnsafe(src []byte) []byte { 19449 size := u.SizeBytes() 19450 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 19451 return src[size:] 19452 } 19453 19454 // CopyOutN implements marshal.Marshallable.CopyOutN. 19455 func (u *UtsName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19456 // Construct a slice backed by dst's underlying memory. 19457 var buf []byte 19458 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19459 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19460 hdr.Len = u.SizeBytes() 19461 hdr.Cap = u.SizeBytes() 19462 19463 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19464 // Since we bypassed the compiler's escape analysis, indicate that u 19465 // must live until the use above. 19466 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19467 return length, err 19468 } 19469 19470 // CopyOut implements marshal.Marshallable.CopyOut. 19471 func (u *UtsName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19472 return u.CopyOutN(cc, addr, u.SizeBytes()) 19473 } 19474 19475 // CopyInN implements marshal.Marshallable.CopyInN. 19476 func (u *UtsName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19477 // Construct a slice backed by dst's underlying memory. 19478 var buf []byte 19479 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19480 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19481 hdr.Len = u.SizeBytes() 19482 hdr.Cap = u.SizeBytes() 19483 19484 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19485 // Since we bypassed the compiler's escape analysis, indicate that u 19486 // must live until the use above. 19487 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19488 return length, err 19489 } 19490 19491 // CopyIn implements marshal.Marshallable.CopyIn. 19492 func (u *UtsName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19493 return u.CopyInN(cc, addr, u.SizeBytes()) 19494 } 19495 19496 // WriteTo implements io.WriterTo.WriteTo. 19497 func (u *UtsName) WriteTo(writer io.Writer) (int64, error) { 19498 // Construct a slice backed by dst's underlying memory. 19499 var buf []byte 19500 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19501 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19502 hdr.Len = u.SizeBytes() 19503 hdr.Cap = u.SizeBytes() 19504 19505 length, err := writer.Write(buf) 19506 // Since we bypassed the compiler's escape analysis, indicate that u 19507 // must live until the use above. 19508 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19509 return int64(length), err 19510 } 19511