inet.af/netstack@v0.0.0-20220214151720-7585b01ddccf/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 "inet.af/netstack/gohacks" 7 "inet.af/netstack/hostarch" 8 "inet.af/netstack/marshal" 9 "io" 10 "reflect" 11 "runtime" 12 "unsafe" 13 ) 14 15 // Marshallable types used by this file. 16 var _ marshal.Marshallable = (*BPFInstruction)(nil) 17 var _ marshal.Marshallable = (*CString)(nil) 18 var _ marshal.Marshallable = (*CapUserData)(nil) 19 var _ marshal.Marshallable = (*CapUserHeader)(nil) 20 var _ marshal.Marshallable = (*ClockT)(nil) 21 var _ marshal.Marshallable = (*ControlMessageCredentials)(nil) 22 var _ marshal.Marshallable = (*ControlMessageHeader)(nil) 23 var _ marshal.Marshallable = (*ControlMessageIPPacketInfo)(nil) 24 var _ marshal.Marshallable = (*ControlMessageIPv6PacketInfo)(nil) 25 var _ marshal.Marshallable = (*DigestMetadata)(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 = (*ExtensionName)(nil) 31 var _ marshal.Marshallable = (*FOwnerEx)(nil) 32 var _ marshal.Marshallable = (*FUSEAttr)(nil) 33 var _ marshal.Marshallable = (*FUSECreateIn)(nil) 34 var _ marshal.Marshallable = (*FUSECreateMeta)(nil) 35 var _ marshal.Marshallable = (*FUSEDirent)(nil) 36 var _ marshal.Marshallable = (*FUSEDirentMeta)(nil) 37 var _ marshal.Marshallable = (*FUSEDirents)(nil) 38 var _ marshal.Marshallable = (*FUSEEmptyIn)(nil) 39 var _ marshal.Marshallable = (*FUSEEntryOut)(nil) 40 var _ marshal.Marshallable = (*FUSEGetAttrIn)(nil) 41 var _ marshal.Marshallable = (*FUSEGetAttrOut)(nil) 42 var _ marshal.Marshallable = (*FUSEHeaderIn)(nil) 43 var _ marshal.Marshallable = (*FUSEHeaderOut)(nil) 44 var _ marshal.Marshallable = (*FUSEInitIn)(nil) 45 var _ marshal.Marshallable = (*FUSEInitOut)(nil) 46 var _ marshal.Marshallable = (*FUSELookupIn)(nil) 47 var _ marshal.Marshallable = (*FUSEMkdirIn)(nil) 48 var _ marshal.Marshallable = (*FUSEMkdirMeta)(nil) 49 var _ marshal.Marshallable = (*FUSEMknodIn)(nil) 50 var _ marshal.Marshallable = (*FUSEMknodMeta)(nil) 51 var _ marshal.Marshallable = (*FUSEOpID)(nil) 52 var _ marshal.Marshallable = (*FUSEOpcode)(nil) 53 var _ marshal.Marshallable = (*FUSEOpenIn)(nil) 54 var _ marshal.Marshallable = (*FUSEOpenOut)(nil) 55 var _ marshal.Marshallable = (*FUSEReadIn)(nil) 56 var _ marshal.Marshallable = (*FUSEReleaseIn)(nil) 57 var _ marshal.Marshallable = (*FUSERmDirIn)(nil) 58 var _ marshal.Marshallable = (*FUSESetAttrIn)(nil) 59 var _ marshal.Marshallable = (*FUSESymlinkIn)(nil) 60 var _ marshal.Marshallable = (*FUSEUnlinkIn)(nil) 61 var _ marshal.Marshallable = (*FUSEWriteIn)(nil) 62 var _ marshal.Marshallable = (*FUSEWriteOut)(nil) 63 var _ marshal.Marshallable = (*FileMode)(nil) 64 var _ marshal.Marshallable = (*Flock)(nil) 65 var _ marshal.Marshallable = (*IFConf)(nil) 66 var _ marshal.Marshallable = (*IFReq)(nil) 67 var _ marshal.Marshallable = (*IOCallback)(nil) 68 var _ marshal.Marshallable = (*IOEvent)(nil) 69 var _ marshal.Marshallable = (*IP6TEntry)(nil) 70 var _ marshal.Marshallable = (*IP6TIP)(nil) 71 var _ marshal.Marshallable = (*IP6TReplace)(nil) 72 var _ marshal.Marshallable = (*IPCPerm)(nil) 73 var _ marshal.Marshallable = (*IPTEntry)(nil) 74 var _ marshal.Marshallable = (*IPTGetEntries)(nil) 75 var _ marshal.Marshallable = (*IPTGetinfo)(nil) 76 var _ marshal.Marshallable = (*IPTIP)(nil) 77 var _ marshal.Marshallable = (*IPTOwnerInfo)(nil) 78 var _ marshal.Marshallable = (*IPTReplace)(nil) 79 var _ marshal.Marshallable = (*Inet6Addr)(nil) 80 var _ marshal.Marshallable = (*Inet6MulticastRequest)(nil) 81 var _ marshal.Marshallable = (*InetAddr)(nil) 82 var _ marshal.Marshallable = (*InetMulticastRequest)(nil) 83 var _ marshal.Marshallable = (*InetMulticastRequestWithNIC)(nil) 84 var _ marshal.Marshallable = (*InterfaceAddrMessage)(nil) 85 var _ marshal.Marshallable = (*InterfaceInfoMessage)(nil) 86 var _ marshal.Marshallable = (*ItimerVal)(nil) 87 var _ marshal.Marshallable = (*Itimerspec)(nil) 88 var _ marshal.Marshallable = (*KernelIP6TEntry)(nil) 89 var _ marshal.Marshallable = (*KernelIP6TGetEntries)(nil) 90 var _ marshal.Marshallable = (*KernelIPTEntry)(nil) 91 var _ marshal.Marshallable = (*KernelIPTGetEntries)(nil) 92 var _ marshal.Marshallable = (*Linger)(nil) 93 var _ marshal.Marshallable = (*MqAttr)(nil) 94 var _ marshal.Marshallable = (*MsgBuf)(nil) 95 var _ marshal.Marshallable = (*MsgInfo)(nil) 96 var _ marshal.Marshallable = (*MsqidDS)(nil) 97 var _ marshal.Marshallable = (*NFNATRange)(nil) 98 var _ marshal.Marshallable = (*NetlinkAttrHeader)(nil) 99 var _ marshal.Marshallable = (*NetlinkErrorMessage)(nil) 100 var _ marshal.Marshallable = (*NetlinkMessageHeader)(nil) 101 var _ marshal.Marshallable = (*NfNATIPV4MultiRangeCompat)(nil) 102 var _ marshal.Marshallable = (*NfNATIPV4Range)(nil) 103 var _ marshal.Marshallable = (*NumaPolicy)(nil) 104 var _ marshal.Marshallable = (*PollFD)(nil) 105 var _ marshal.Marshallable = (*RSeqCriticalSection)(nil) 106 var _ marshal.Marshallable = (*RobustListHead)(nil) 107 var _ marshal.Marshallable = (*RouteMessage)(nil) 108 var _ marshal.Marshallable = (*Rusage)(nil) 109 var _ marshal.Marshallable = (*SeccompData)(nil) 110 var _ marshal.Marshallable = (*SemInfo)(nil) 111 var _ marshal.Marshallable = (*Sembuf)(nil) 112 var _ marshal.Marshallable = (*ShmInfo)(nil) 113 var _ marshal.Marshallable = (*ShmParams)(nil) 114 var _ marshal.Marshallable = (*ShmidDS)(nil) 115 var _ marshal.Marshallable = (*SigAction)(nil) 116 var _ marshal.Marshallable = (*Sigevent)(nil) 117 var _ marshal.Marshallable = (*SignalInfo)(nil) 118 var _ marshal.Marshallable = (*SignalSet)(nil) 119 var _ marshal.Marshallable = (*SignalStack)(nil) 120 var _ marshal.Marshallable = (*SignalfdSiginfo)(nil) 121 var _ marshal.Marshallable = (*SockAddrInet)(nil) 122 var _ marshal.Marshallable = (*SockAddrInet6)(nil) 123 var _ marshal.Marshallable = (*SockAddrLink)(nil) 124 var _ marshal.Marshallable = (*SockAddrNetlink)(nil) 125 var _ marshal.Marshallable = (*SockAddrUnix)(nil) 126 var _ marshal.Marshallable = (*SockErrCMsgIPv4)(nil) 127 var _ marshal.Marshallable = (*SockErrCMsgIPv6)(nil) 128 var _ marshal.Marshallable = (*SockExtendedErr)(nil) 129 var _ marshal.Marshallable = (*Statfs)(nil) 130 var _ marshal.Marshallable = (*Statx)(nil) 131 var _ marshal.Marshallable = (*StatxTimestamp)(nil) 132 var _ marshal.Marshallable = (*Sysinfo)(nil) 133 var _ marshal.Marshallable = (*TCPInfo)(nil) 134 var _ marshal.Marshallable = (*TableName)(nil) 135 var _ marshal.Marshallable = (*Termios)(nil) 136 var _ marshal.Marshallable = (*TimeT)(nil) 137 var _ marshal.Marshallable = (*TimerID)(nil) 138 var _ marshal.Marshallable = (*Timespec)(nil) 139 var _ marshal.Marshallable = (*Timeval)(nil) 140 var _ marshal.Marshallable = (*Tms)(nil) 141 var _ marshal.Marshallable = (*Utime)(nil) 142 var _ marshal.Marshallable = (*UtsName)(nil) 143 var _ marshal.Marshallable = (*WindowSize)(nil) 144 var _ marshal.Marshallable = (*Winsize)(nil) 145 var _ marshal.Marshallable = (*XTCounters)(nil) 146 var _ marshal.Marshallable = (*XTEntryMatch)(nil) 147 var _ marshal.Marshallable = (*XTEntryTarget)(nil) 148 var _ marshal.Marshallable = (*XTErrorTarget)(nil) 149 var _ marshal.Marshallable = (*XTGetRevision)(nil) 150 var _ marshal.Marshallable = (*XTRedirectTarget)(nil) 151 var _ marshal.Marshallable = (*XTSNATTarget)(nil) 152 var _ marshal.Marshallable = (*XTStandardTarget)(nil) 153 var _ marshal.Marshallable = (*XTTCP)(nil) 154 var _ marshal.Marshallable = (*XTUDP)(nil) 155 156 // SizeBytes implements marshal.Marshallable.SizeBytes. 157 func (i *IOCallback) SizeBytes() int { 158 return 64 159 } 160 161 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 162 func (i *IOCallback) MarshalBytes(dst []byte) []byte { 163 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 164 dst = dst[8:] 165 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 166 dst = dst[4:] 167 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 168 dst = dst[4:] 169 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.OpCode)) 170 dst = dst[2:] 171 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.ReqPrio)) 172 dst = dst[2:] 173 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.FD)) 174 dst = dst[4:] 175 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Buf)) 176 dst = dst[8:] 177 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Bytes)) 178 dst = dst[8:] 179 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Offset)) 180 dst = dst[8:] 181 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Reserved2)) 182 dst = dst[8:] 183 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 184 dst = dst[4:] 185 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ResFD)) 186 dst = dst[4:] 187 return dst 188 } 189 190 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 191 func (i *IOCallback) UnmarshalBytes(src []byte) []byte { 192 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 193 src = src[8:] 194 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 195 src = src[4:] 196 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 197 src = src[4:] 198 i.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 199 src = src[2:] 200 i.ReqPrio = int16(hostarch.ByteOrder.Uint16(src[:2])) 201 src = src[2:] 202 i.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 203 src = src[4:] 204 i.Buf = uint64(hostarch.ByteOrder.Uint64(src[:8])) 205 src = src[8:] 206 i.Bytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 207 src = src[8:] 208 i.Offset = int64(hostarch.ByteOrder.Uint64(src[:8])) 209 src = src[8:] 210 i.Reserved2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 211 src = src[8:] 212 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 213 src = src[4:] 214 i.ResFD = int32(hostarch.ByteOrder.Uint32(src[:4])) 215 src = src[4:] 216 return src 217 } 218 219 // Packed implements marshal.Marshallable.Packed. 220 //go:nosplit 221 func (i *IOCallback) Packed() bool { 222 return true 223 } 224 225 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 226 func (i *IOCallback) MarshalUnsafe(dst []byte) []byte { 227 size := i.SizeBytes() 228 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 229 return dst[size:] 230 } 231 232 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 233 func (i *IOCallback) UnmarshalUnsafe(src []byte) []byte { 234 size := i.SizeBytes() 235 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 236 return src[size:] 237 } 238 239 // CopyOutN implements marshal.Marshallable.CopyOutN. 240 //go:nosplit 241 func (i *IOCallback) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 242 // Construct a slice backed by dst's underlying memory. 243 var buf []byte 244 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 245 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 246 hdr.Len = i.SizeBytes() 247 hdr.Cap = i.SizeBytes() 248 249 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 250 // Since we bypassed the compiler's escape analysis, indicate that i 251 // must live until the use above. 252 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 253 return length, err 254 } 255 256 // CopyOut implements marshal.Marshallable.CopyOut. 257 //go:nosplit 258 func (i *IOCallback) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 259 return i.CopyOutN(cc, addr, i.SizeBytes()) 260 } 261 262 // CopyIn implements marshal.Marshallable.CopyIn. 263 //go:nosplit 264 func (i *IOCallback) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 265 // Construct a slice backed by dst's underlying memory. 266 var buf []byte 267 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 268 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 269 hdr.Len = i.SizeBytes() 270 hdr.Cap = i.SizeBytes() 271 272 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 273 // Since we bypassed the compiler's escape analysis, indicate that i 274 // must live until the use above. 275 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 276 return length, err 277 } 278 279 // WriteTo implements io.WriterTo.WriteTo. 280 func (i *IOCallback) WriteTo(writer io.Writer) (int64, error) { 281 // Construct a slice backed by dst's underlying memory. 282 var buf []byte 283 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 284 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 285 hdr.Len = i.SizeBytes() 286 hdr.Cap = i.SizeBytes() 287 288 length, err := writer.Write(buf) 289 // Since we bypassed the compiler's escape analysis, indicate that i 290 // must live until the use above. 291 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 292 return int64(length), err 293 } 294 295 // SizeBytes implements marshal.Marshallable.SizeBytes. 296 func (i *IOEvent) SizeBytes() int { 297 return 32 298 } 299 300 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 301 func (i *IOEvent) MarshalBytes(dst []byte) []byte { 302 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 303 dst = dst[8:] 304 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Obj)) 305 dst = dst[8:] 306 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result)) 307 dst = dst[8:] 308 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result2)) 309 dst = dst[8:] 310 return dst 311 } 312 313 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 314 func (i *IOEvent) UnmarshalBytes(src []byte) []byte { 315 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 316 src = src[8:] 317 i.Obj = uint64(hostarch.ByteOrder.Uint64(src[:8])) 318 src = src[8:] 319 i.Result = int64(hostarch.ByteOrder.Uint64(src[:8])) 320 src = src[8:] 321 i.Result2 = int64(hostarch.ByteOrder.Uint64(src[:8])) 322 src = src[8:] 323 return src 324 } 325 326 // Packed implements marshal.Marshallable.Packed. 327 //go:nosplit 328 func (i *IOEvent) Packed() bool { 329 return true 330 } 331 332 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 333 func (i *IOEvent) MarshalUnsafe(dst []byte) []byte { 334 size := i.SizeBytes() 335 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 336 return dst[size:] 337 } 338 339 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 340 func (i *IOEvent) UnmarshalUnsafe(src []byte) []byte { 341 size := i.SizeBytes() 342 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 343 return src[size:] 344 } 345 346 // CopyOutN implements marshal.Marshallable.CopyOutN. 347 //go:nosplit 348 func (i *IOEvent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 349 // Construct a slice backed by dst's underlying memory. 350 var buf []byte 351 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 352 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 353 hdr.Len = i.SizeBytes() 354 hdr.Cap = i.SizeBytes() 355 356 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 357 // Since we bypassed the compiler's escape analysis, indicate that i 358 // must live until the use above. 359 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 360 return length, err 361 } 362 363 // CopyOut implements marshal.Marshallable.CopyOut. 364 //go:nosplit 365 func (i *IOEvent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 366 return i.CopyOutN(cc, addr, i.SizeBytes()) 367 } 368 369 // CopyIn implements marshal.Marshallable.CopyIn. 370 //go:nosplit 371 func (i *IOEvent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 372 // Construct a slice backed by dst's underlying memory. 373 var buf []byte 374 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 375 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 376 hdr.Len = i.SizeBytes() 377 hdr.Cap = i.SizeBytes() 378 379 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 380 // Since we bypassed the compiler's escape analysis, indicate that i 381 // must live until the use above. 382 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 383 return length, err 384 } 385 386 // WriteTo implements io.WriterTo.WriteTo. 387 func (i *IOEvent) WriteTo(writer io.Writer) (int64, error) { 388 // Construct a slice backed by dst's underlying memory. 389 var buf []byte 390 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 391 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 392 hdr.Len = i.SizeBytes() 393 hdr.Cap = i.SizeBytes() 394 395 length, err := writer.Write(buf) 396 // Since we bypassed the compiler's escape analysis, indicate that i 397 // must live until the use above. 398 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 399 return int64(length), err 400 } 401 402 // SizeBytes implements marshal.Marshallable.SizeBytes. 403 func (b *BPFInstruction) SizeBytes() int { 404 return 8 405 } 406 407 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 408 func (b *BPFInstruction) MarshalBytes(dst []byte) []byte { 409 hostarch.ByteOrder.PutUint16(dst[:2], uint16(b.OpCode)) 410 dst = dst[2:] 411 dst[0] = byte(b.JumpIfTrue) 412 dst = dst[1:] 413 dst[0] = byte(b.JumpIfFalse) 414 dst = dst[1:] 415 hostarch.ByteOrder.PutUint32(dst[:4], uint32(b.K)) 416 dst = dst[4:] 417 return dst 418 } 419 420 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 421 func (b *BPFInstruction) UnmarshalBytes(src []byte) []byte { 422 b.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 423 src = src[2:] 424 b.JumpIfTrue = uint8(src[0]) 425 src = src[1:] 426 b.JumpIfFalse = uint8(src[0]) 427 src = src[1:] 428 b.K = uint32(hostarch.ByteOrder.Uint32(src[:4])) 429 src = src[4:] 430 return src 431 } 432 433 // Packed implements marshal.Marshallable.Packed. 434 //go:nosplit 435 func (b *BPFInstruction) Packed() bool { 436 return true 437 } 438 439 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 440 func (b *BPFInstruction) MarshalUnsafe(dst []byte) []byte { 441 size := b.SizeBytes() 442 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size)) 443 return dst[size:] 444 } 445 446 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 447 func (b *BPFInstruction) UnmarshalUnsafe(src []byte) []byte { 448 size := b.SizeBytes() 449 gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size)) 450 return src[size:] 451 } 452 453 // CopyOutN implements marshal.Marshallable.CopyOutN. 454 //go:nosplit 455 func (b *BPFInstruction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 456 // Construct a slice backed by dst's underlying memory. 457 var buf []byte 458 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 459 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 460 hdr.Len = b.SizeBytes() 461 hdr.Cap = b.SizeBytes() 462 463 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 464 // Since we bypassed the compiler's escape analysis, indicate that b 465 // must live until the use above. 466 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 467 return length, err 468 } 469 470 // CopyOut implements marshal.Marshallable.CopyOut. 471 //go:nosplit 472 func (b *BPFInstruction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 473 return b.CopyOutN(cc, addr, b.SizeBytes()) 474 } 475 476 // CopyIn implements marshal.Marshallable.CopyIn. 477 //go:nosplit 478 func (b *BPFInstruction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 479 // Construct a slice backed by dst's underlying memory. 480 var buf []byte 481 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 482 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 483 hdr.Len = b.SizeBytes() 484 hdr.Cap = b.SizeBytes() 485 486 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 487 // Since we bypassed the compiler's escape analysis, indicate that b 488 // must live until the use above. 489 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 490 return length, err 491 } 492 493 // WriteTo implements io.WriterTo.WriteTo. 494 func (b *BPFInstruction) WriteTo(writer io.Writer) (int64, error) { 495 // Construct a slice backed by dst's underlying memory. 496 var buf []byte 497 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 498 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 499 hdr.Len = b.SizeBytes() 500 hdr.Cap = b.SizeBytes() 501 502 length, err := writer.Write(buf) 503 // Since we bypassed the compiler's escape analysis, indicate that b 504 // must live until the use above. 505 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 506 return int64(length), err 507 } 508 509 // CopyBPFInstructionSliceIn copies in a slice of BPFInstruction objects from the task's memory. 510 func CopyBPFInstructionSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []BPFInstruction) (int, error) { 511 count := len(dst) 512 if count == 0 { 513 return 0, nil 514 } 515 size := (*BPFInstruction)(nil).SizeBytes() 516 517 ptr := unsafe.Pointer(&dst) 518 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 519 520 // Construct a slice backed by dst's underlying memory. 521 var buf []byte 522 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 523 hdr.Data = uintptr(val) 524 hdr.Len = size * count 525 hdr.Cap = size * count 526 527 length, err := cc.CopyInBytes(addr, buf) 528 // Since we bypassed the compiler's escape analysis, indicate that dst 529 // must live until the use above. 530 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 531 return length, err 532 } 533 534 // CopyBPFInstructionSliceOut copies a slice of BPFInstruction objects to the task's memory. 535 func CopyBPFInstructionSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []BPFInstruction) (int, error) { 536 count := len(src) 537 if count == 0 { 538 return 0, nil 539 } 540 size := (*BPFInstruction)(nil).SizeBytes() 541 542 ptr := unsafe.Pointer(&src) 543 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 544 545 // Construct a slice backed by dst's underlying memory. 546 var buf []byte 547 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 548 hdr.Data = uintptr(val) 549 hdr.Len = size * count 550 hdr.Cap = size * count 551 552 length, err := cc.CopyOutBytes(addr, buf) 553 // Since we bypassed the compiler's escape analysis, indicate that src 554 // must live until the use above. 555 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 556 return length, err 557 } 558 559 // MarshalUnsafeBPFInstructionSlice is like BPFInstruction.MarshalUnsafe, but for a []BPFInstruction. 560 func MarshalUnsafeBPFInstructionSlice(src []BPFInstruction, dst []byte) []byte { 561 count := len(src) 562 if count == 0 { 563 return dst 564 } 565 566 size := (*BPFInstruction)(nil).SizeBytes() 567 buf := dst[:size*count] 568 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 569 return dst[size*count:] 570 } 571 572 // UnmarshalUnsafeBPFInstructionSlice is like BPFInstruction.UnmarshalUnsafe, but for a []BPFInstruction. 573 func UnmarshalUnsafeBPFInstructionSlice(dst []BPFInstruction, src []byte) []byte { 574 count := len(dst) 575 if count == 0 { 576 return src 577 } 578 579 size := (*BPFInstruction)(nil).SizeBytes() 580 buf := src[:size*count] 581 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 582 return src[size*count:] 583 } 584 585 // SizeBytes implements marshal.Marshallable.SizeBytes. 586 func (c *CapUserData) SizeBytes() int { 587 return 12 588 } 589 590 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 591 func (c *CapUserData) MarshalBytes(dst []byte) []byte { 592 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Effective)) 593 dst = dst[4:] 594 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Permitted)) 595 dst = dst[4:] 596 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Inheritable)) 597 dst = dst[4:] 598 return dst 599 } 600 601 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 602 func (c *CapUserData) UnmarshalBytes(src []byte) []byte { 603 c.Effective = uint32(hostarch.ByteOrder.Uint32(src[:4])) 604 src = src[4:] 605 c.Permitted = uint32(hostarch.ByteOrder.Uint32(src[:4])) 606 src = src[4:] 607 c.Inheritable = uint32(hostarch.ByteOrder.Uint32(src[:4])) 608 src = src[4:] 609 return src 610 } 611 612 // Packed implements marshal.Marshallable.Packed. 613 //go:nosplit 614 func (c *CapUserData) Packed() bool { 615 return true 616 } 617 618 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 619 func (c *CapUserData) MarshalUnsafe(dst []byte) []byte { 620 size := c.SizeBytes() 621 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 622 return dst[size:] 623 } 624 625 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 626 func (c *CapUserData) UnmarshalUnsafe(src []byte) []byte { 627 size := c.SizeBytes() 628 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 629 return src[size:] 630 } 631 632 // CopyOutN implements marshal.Marshallable.CopyOutN. 633 //go:nosplit 634 func (c *CapUserData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 635 // Construct a slice backed by dst's underlying memory. 636 var buf []byte 637 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 638 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 639 hdr.Len = c.SizeBytes() 640 hdr.Cap = c.SizeBytes() 641 642 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 643 // Since we bypassed the compiler's escape analysis, indicate that c 644 // must live until the use above. 645 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 646 return length, err 647 } 648 649 // CopyOut implements marshal.Marshallable.CopyOut. 650 //go:nosplit 651 func (c *CapUserData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 652 return c.CopyOutN(cc, addr, c.SizeBytes()) 653 } 654 655 // CopyIn implements marshal.Marshallable.CopyIn. 656 //go:nosplit 657 func (c *CapUserData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 658 // Construct a slice backed by dst's underlying memory. 659 var buf []byte 660 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 661 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 662 hdr.Len = c.SizeBytes() 663 hdr.Cap = c.SizeBytes() 664 665 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 666 // Since we bypassed the compiler's escape analysis, indicate that c 667 // must live until the use above. 668 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 669 return length, err 670 } 671 672 // WriteTo implements io.WriterTo.WriteTo. 673 func (c *CapUserData) WriteTo(writer io.Writer) (int64, error) { 674 // Construct a slice backed by dst's underlying memory. 675 var buf []byte 676 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 677 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 678 hdr.Len = c.SizeBytes() 679 hdr.Cap = c.SizeBytes() 680 681 length, err := writer.Write(buf) 682 // Since we bypassed the compiler's escape analysis, indicate that c 683 // must live until the use above. 684 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 685 return int64(length), err 686 } 687 688 // CopyCapUserDataSliceIn copies in a slice of CapUserData objects from the task's memory. 689 func CopyCapUserDataSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []CapUserData) (int, error) { 690 count := len(dst) 691 if count == 0 { 692 return 0, nil 693 } 694 size := (*CapUserData)(nil).SizeBytes() 695 696 ptr := unsafe.Pointer(&dst) 697 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 698 699 // Construct a slice backed by dst's underlying memory. 700 var buf []byte 701 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 702 hdr.Data = uintptr(val) 703 hdr.Len = size * count 704 hdr.Cap = size * count 705 706 length, err := cc.CopyInBytes(addr, buf) 707 // Since we bypassed the compiler's escape analysis, indicate that dst 708 // must live until the use above. 709 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 710 return length, err 711 } 712 713 // CopyCapUserDataSliceOut copies a slice of CapUserData objects to the task's memory. 714 func CopyCapUserDataSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []CapUserData) (int, error) { 715 count := len(src) 716 if count == 0 { 717 return 0, nil 718 } 719 size := (*CapUserData)(nil).SizeBytes() 720 721 ptr := unsafe.Pointer(&src) 722 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 723 724 // Construct a slice backed by dst's underlying memory. 725 var buf []byte 726 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 727 hdr.Data = uintptr(val) 728 hdr.Len = size * count 729 hdr.Cap = size * count 730 731 length, err := cc.CopyOutBytes(addr, buf) 732 // Since we bypassed the compiler's escape analysis, indicate that src 733 // must live until the use above. 734 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 735 return length, err 736 } 737 738 // MarshalUnsafeCapUserDataSlice is like CapUserData.MarshalUnsafe, but for a []CapUserData. 739 func MarshalUnsafeCapUserDataSlice(src []CapUserData, dst []byte) []byte { 740 count := len(src) 741 if count == 0 { 742 return dst 743 } 744 745 size := (*CapUserData)(nil).SizeBytes() 746 buf := dst[:size*count] 747 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 748 return dst[size*count:] 749 } 750 751 // UnmarshalUnsafeCapUserDataSlice is like CapUserData.UnmarshalUnsafe, but for a []CapUserData. 752 func UnmarshalUnsafeCapUserDataSlice(dst []CapUserData, src []byte) []byte { 753 count := len(dst) 754 if count == 0 { 755 return src 756 } 757 758 size := (*CapUserData)(nil).SizeBytes() 759 buf := src[:size*count] 760 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 761 return src[size*count:] 762 } 763 764 // SizeBytes implements marshal.Marshallable.SizeBytes. 765 func (c *CapUserHeader) SizeBytes() int { 766 return 8 767 } 768 769 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 770 func (c *CapUserHeader) MarshalBytes(dst []byte) []byte { 771 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Version)) 772 dst = dst[4:] 773 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Pid)) 774 dst = dst[4:] 775 return dst 776 } 777 778 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 779 func (c *CapUserHeader) UnmarshalBytes(src []byte) []byte { 780 c.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 781 src = src[4:] 782 c.Pid = int32(hostarch.ByteOrder.Uint32(src[:4])) 783 src = src[4:] 784 return src 785 } 786 787 // Packed implements marshal.Marshallable.Packed. 788 //go:nosplit 789 func (c *CapUserHeader) Packed() bool { 790 return true 791 } 792 793 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 794 func (c *CapUserHeader) MarshalUnsafe(dst []byte) []byte { 795 size := c.SizeBytes() 796 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 797 return dst[size:] 798 } 799 800 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 801 func (c *CapUserHeader) UnmarshalUnsafe(src []byte) []byte { 802 size := c.SizeBytes() 803 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 804 return src[size:] 805 } 806 807 // CopyOutN implements marshal.Marshallable.CopyOutN. 808 //go:nosplit 809 func (c *CapUserHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 810 // Construct a slice backed by dst's underlying memory. 811 var buf []byte 812 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 813 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 814 hdr.Len = c.SizeBytes() 815 hdr.Cap = c.SizeBytes() 816 817 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 818 // Since we bypassed the compiler's escape analysis, indicate that c 819 // must live until the use above. 820 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 821 return length, err 822 } 823 824 // CopyOut implements marshal.Marshallable.CopyOut. 825 //go:nosplit 826 func (c *CapUserHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 827 return c.CopyOutN(cc, addr, c.SizeBytes()) 828 } 829 830 // CopyIn implements marshal.Marshallable.CopyIn. 831 //go:nosplit 832 func (c *CapUserHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 833 // Construct a slice backed by dst's underlying memory. 834 var buf []byte 835 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 836 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 837 hdr.Len = c.SizeBytes() 838 hdr.Cap = c.SizeBytes() 839 840 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 841 // Since we bypassed the compiler's escape analysis, indicate that c 842 // must live until the use above. 843 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 844 return length, err 845 } 846 847 // WriteTo implements io.WriterTo.WriteTo. 848 func (c *CapUserHeader) WriteTo(writer io.Writer) (int64, error) { 849 // Construct a slice backed by dst's underlying memory. 850 var buf []byte 851 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 852 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 853 hdr.Len = c.SizeBytes() 854 hdr.Cap = c.SizeBytes() 855 856 length, err := writer.Write(buf) 857 // Since we bypassed the compiler's escape analysis, indicate that c 858 // must live until the use above. 859 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 860 return int64(length), err 861 } 862 863 // SizeBytes implements marshal.Marshallable.SizeBytes. 864 func (e *ElfHeader64) SizeBytes() int { 865 return 48 + 866 1*16 867 } 868 869 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 870 func (e *ElfHeader64) MarshalBytes(dst []byte) []byte { 871 for idx := 0; idx < 16; idx++ { 872 dst[0] = byte(e.Ident[idx]) 873 dst = dst[1:] 874 } 875 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Type)) 876 dst = dst[2:] 877 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Machine)) 878 dst = dst[2:] 879 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Version)) 880 dst = dst[4:] 881 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entry)) 882 dst = dst[8:] 883 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Phoff)) 884 dst = dst[8:] 885 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Shoff)) 886 dst = dst[8:] 887 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 888 dst = dst[4:] 889 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Ehsize)) 890 dst = dst[2:] 891 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phentsize)) 892 dst = dst[2:] 893 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phnum)) 894 dst = dst[2:] 895 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shentsize)) 896 dst = dst[2:] 897 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shnum)) 898 dst = dst[2:] 899 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shstrndx)) 900 dst = dst[2:] 901 return dst 902 } 903 904 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 905 func (e *ElfHeader64) UnmarshalBytes(src []byte) []byte { 906 for idx := 0; idx < 16; idx++ { 907 e.Ident[idx] = src[0] 908 src = src[1:] 909 } 910 e.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 911 src = src[2:] 912 e.Machine = uint16(hostarch.ByteOrder.Uint16(src[:2])) 913 src = src[2:] 914 e.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 915 src = src[4:] 916 e.Entry = uint64(hostarch.ByteOrder.Uint64(src[:8])) 917 src = src[8:] 918 e.Phoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 919 src = src[8:] 920 e.Shoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 921 src = src[8:] 922 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 923 src = src[4:] 924 e.Ehsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 925 src = src[2:] 926 e.Phentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 927 src = src[2:] 928 e.Phnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 929 src = src[2:] 930 e.Shentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 931 src = src[2:] 932 e.Shnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 933 src = src[2:] 934 e.Shstrndx = uint16(hostarch.ByteOrder.Uint16(src[:2])) 935 src = src[2:] 936 return src 937 } 938 939 // Packed implements marshal.Marshallable.Packed. 940 //go:nosplit 941 func (e *ElfHeader64) Packed() bool { 942 return true 943 } 944 945 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 946 func (e *ElfHeader64) MarshalUnsafe(dst []byte) []byte { 947 size := e.SizeBytes() 948 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 949 return dst[size:] 950 } 951 952 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 953 func (e *ElfHeader64) UnmarshalUnsafe(src []byte) []byte { 954 size := e.SizeBytes() 955 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 956 return src[size:] 957 } 958 959 // CopyOutN implements marshal.Marshallable.CopyOutN. 960 //go:nosplit 961 func (e *ElfHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 962 // Construct a slice backed by dst's underlying memory. 963 var buf []byte 964 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 965 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 966 hdr.Len = e.SizeBytes() 967 hdr.Cap = e.SizeBytes() 968 969 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 970 // Since we bypassed the compiler's escape analysis, indicate that e 971 // must live until the use above. 972 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 973 return length, err 974 } 975 976 // CopyOut implements marshal.Marshallable.CopyOut. 977 //go:nosplit 978 func (e *ElfHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 979 return e.CopyOutN(cc, addr, e.SizeBytes()) 980 } 981 982 // CopyIn implements marshal.Marshallable.CopyIn. 983 //go:nosplit 984 func (e *ElfHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 985 // Construct a slice backed by dst's underlying memory. 986 var buf []byte 987 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 988 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 989 hdr.Len = e.SizeBytes() 990 hdr.Cap = e.SizeBytes() 991 992 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 993 // Since we bypassed the compiler's escape analysis, indicate that e 994 // must live until the use above. 995 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 996 return length, err 997 } 998 999 // WriteTo implements io.WriterTo.WriteTo. 1000 func (e *ElfHeader64) WriteTo(writer io.Writer) (int64, error) { 1001 // Construct a slice backed by dst's underlying memory. 1002 var buf []byte 1003 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1004 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1005 hdr.Len = e.SizeBytes() 1006 hdr.Cap = e.SizeBytes() 1007 1008 length, err := writer.Write(buf) 1009 // Since we bypassed the compiler's escape analysis, indicate that e 1010 // must live until the use above. 1011 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1012 return int64(length), err 1013 } 1014 1015 // SizeBytes implements marshal.Marshallable.SizeBytes. 1016 func (e *ElfProg64) SizeBytes() int { 1017 return 56 1018 } 1019 1020 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1021 func (e *ElfProg64) MarshalBytes(dst []byte) []byte { 1022 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1023 dst = dst[4:] 1024 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1025 dst = dst[4:] 1026 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1027 dst = dst[8:] 1028 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Vaddr)) 1029 dst = dst[8:] 1030 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Paddr)) 1031 dst = dst[8:] 1032 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Filesz)) 1033 dst = dst[8:] 1034 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Memsz)) 1035 dst = dst[8:] 1036 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Align)) 1037 dst = dst[8:] 1038 return dst 1039 } 1040 1041 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1042 func (e *ElfProg64) UnmarshalBytes(src []byte) []byte { 1043 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1044 src = src[4:] 1045 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1046 src = src[4:] 1047 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1048 src = src[8:] 1049 e.Vaddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1050 src = src[8:] 1051 e.Paddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1052 src = src[8:] 1053 e.Filesz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1054 src = src[8:] 1055 e.Memsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1056 src = src[8:] 1057 e.Align = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1058 src = src[8:] 1059 return src 1060 } 1061 1062 // Packed implements marshal.Marshallable.Packed. 1063 //go:nosplit 1064 func (e *ElfProg64) Packed() bool { 1065 return true 1066 } 1067 1068 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1069 func (e *ElfProg64) MarshalUnsafe(dst []byte) []byte { 1070 size := e.SizeBytes() 1071 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1072 return dst[size:] 1073 } 1074 1075 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1076 func (e *ElfProg64) UnmarshalUnsafe(src []byte) []byte { 1077 size := e.SizeBytes() 1078 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1079 return src[size:] 1080 } 1081 1082 // CopyOutN implements marshal.Marshallable.CopyOutN. 1083 //go:nosplit 1084 func (e *ElfProg64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1085 // Construct a slice backed by dst's underlying memory. 1086 var buf []byte 1087 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1088 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1089 hdr.Len = e.SizeBytes() 1090 hdr.Cap = e.SizeBytes() 1091 1092 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1093 // Since we bypassed the compiler's escape analysis, indicate that e 1094 // must live until the use above. 1095 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1096 return length, err 1097 } 1098 1099 // CopyOut implements marshal.Marshallable.CopyOut. 1100 //go:nosplit 1101 func (e *ElfProg64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1102 return e.CopyOutN(cc, addr, e.SizeBytes()) 1103 } 1104 1105 // CopyIn implements marshal.Marshallable.CopyIn. 1106 //go:nosplit 1107 func (e *ElfProg64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1108 // Construct a slice backed by dst's underlying memory. 1109 var buf []byte 1110 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1111 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1112 hdr.Len = e.SizeBytes() 1113 hdr.Cap = e.SizeBytes() 1114 1115 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1116 // Since we bypassed the compiler's escape analysis, indicate that e 1117 // must live until the use above. 1118 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1119 return length, err 1120 } 1121 1122 // WriteTo implements io.WriterTo.WriteTo. 1123 func (e *ElfProg64) WriteTo(writer io.Writer) (int64, error) { 1124 // Construct a slice backed by dst's underlying memory. 1125 var buf []byte 1126 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1127 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1128 hdr.Len = e.SizeBytes() 1129 hdr.Cap = e.SizeBytes() 1130 1131 length, err := writer.Write(buf) 1132 // Since we bypassed the compiler's escape analysis, indicate that e 1133 // must live until the use above. 1134 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1135 return int64(length), err 1136 } 1137 1138 // SizeBytes implements marshal.Marshallable.SizeBytes. 1139 func (e *ElfSection64) SizeBytes() int { 1140 return 64 1141 } 1142 1143 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1144 func (e *ElfSection64) MarshalBytes(dst []byte) []byte { 1145 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Name)) 1146 dst = dst[4:] 1147 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1148 dst = dst[4:] 1149 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Flags)) 1150 dst = dst[8:] 1151 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addr)) 1152 dst = dst[8:] 1153 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1154 dst = dst[8:] 1155 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Size)) 1156 dst = dst[8:] 1157 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Link)) 1158 dst = dst[4:] 1159 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Info)) 1160 dst = dst[4:] 1161 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addralign)) 1162 dst = dst[8:] 1163 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entsize)) 1164 dst = dst[8:] 1165 return dst 1166 } 1167 1168 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1169 func (e *ElfSection64) UnmarshalBytes(src []byte) []byte { 1170 e.Name = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1171 src = src[4:] 1172 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1173 src = src[4:] 1174 e.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1175 src = src[8:] 1176 e.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1177 src = src[8:] 1178 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1179 src = src[8:] 1180 e.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1181 src = src[8:] 1182 e.Link = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1183 src = src[4:] 1184 e.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1185 src = src[4:] 1186 e.Addralign = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1187 src = src[8:] 1188 e.Entsize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1189 src = src[8:] 1190 return src 1191 } 1192 1193 // Packed implements marshal.Marshallable.Packed. 1194 //go:nosplit 1195 func (e *ElfSection64) Packed() bool { 1196 return true 1197 } 1198 1199 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1200 func (e *ElfSection64) MarshalUnsafe(dst []byte) []byte { 1201 size := e.SizeBytes() 1202 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1203 return dst[size:] 1204 } 1205 1206 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1207 func (e *ElfSection64) UnmarshalUnsafe(src []byte) []byte { 1208 size := e.SizeBytes() 1209 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1210 return src[size:] 1211 } 1212 1213 // CopyOutN implements marshal.Marshallable.CopyOutN. 1214 //go:nosplit 1215 func (e *ElfSection64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1216 // Construct a slice backed by dst's underlying memory. 1217 var buf []byte 1218 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1219 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1220 hdr.Len = e.SizeBytes() 1221 hdr.Cap = e.SizeBytes() 1222 1223 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1224 // Since we bypassed the compiler's escape analysis, indicate that e 1225 // must live until the use above. 1226 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1227 return length, err 1228 } 1229 1230 // CopyOut implements marshal.Marshallable.CopyOut. 1231 //go:nosplit 1232 func (e *ElfSection64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1233 return e.CopyOutN(cc, addr, e.SizeBytes()) 1234 } 1235 1236 // CopyIn implements marshal.Marshallable.CopyIn. 1237 //go:nosplit 1238 func (e *ElfSection64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1239 // Construct a slice backed by dst's underlying memory. 1240 var buf []byte 1241 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1242 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1243 hdr.Len = e.SizeBytes() 1244 hdr.Cap = e.SizeBytes() 1245 1246 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1247 // Since we bypassed the compiler's escape analysis, indicate that e 1248 // must live until the use above. 1249 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1250 return length, err 1251 } 1252 1253 // WriteTo implements io.WriterTo.WriteTo. 1254 func (e *ElfSection64) WriteTo(writer io.Writer) (int64, error) { 1255 // Construct a slice backed by dst's underlying memory. 1256 var buf []byte 1257 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1258 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1259 hdr.Len = e.SizeBytes() 1260 hdr.Cap = e.SizeBytes() 1261 1262 length, err := writer.Write(buf) 1263 // Since we bypassed the compiler's escape analysis, indicate that e 1264 // must live until the use above. 1265 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1266 return int64(length), err 1267 } 1268 1269 // SizeBytes implements marshal.Marshallable.SizeBytes. 1270 func (s *SockErrCMsgIPv4) SizeBytes() int { 1271 return 0 + 1272 (*SockExtendedErr)(nil).SizeBytes() + 1273 (*SockAddrInet)(nil).SizeBytes() 1274 } 1275 1276 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1277 func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) []byte { 1278 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1279 dst = s.Offender.MarshalUnsafe(dst) 1280 return dst 1281 } 1282 1283 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1284 func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) []byte { 1285 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1286 src = s.Offender.UnmarshalUnsafe(src) 1287 return src 1288 } 1289 1290 // Packed implements marshal.Marshallable.Packed. 1291 //go:nosplit 1292 func (s *SockErrCMsgIPv4) Packed() bool { 1293 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1294 } 1295 1296 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1297 func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) []byte { 1298 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1299 size := s.SizeBytes() 1300 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1301 return dst[size:] 1302 } 1303 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes. 1304 return s.MarshalBytes(dst) 1305 } 1306 1307 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1308 func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) []byte { 1309 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1310 size := s.SizeBytes() 1311 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1312 return src[size:] 1313 } 1314 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1315 return s.UnmarshalBytes(src) 1316 } 1317 1318 // CopyOutN implements marshal.Marshallable.CopyOutN. 1319 //go:nosplit 1320 func (s *SockErrCMsgIPv4) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1321 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1322 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1323 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1324 s.MarshalBytes(buf) // escapes: fallback. 1325 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1326 } 1327 1328 // Construct a slice backed by dst's underlying memory. 1329 var buf []byte 1330 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1331 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1332 hdr.Len = s.SizeBytes() 1333 hdr.Cap = s.SizeBytes() 1334 1335 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1336 // Since we bypassed the compiler's escape analysis, indicate that s 1337 // must live until the use above. 1338 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1339 return length, err 1340 } 1341 1342 // CopyOut implements marshal.Marshallable.CopyOut. 1343 //go:nosplit 1344 func (s *SockErrCMsgIPv4) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1345 return s.CopyOutN(cc, addr, s.SizeBytes()) 1346 } 1347 1348 // CopyIn implements marshal.Marshallable.CopyIn. 1349 //go:nosplit 1350 func (s *SockErrCMsgIPv4) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1351 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1352 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1353 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1354 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1355 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1356 // partially unmarshalled struct. 1357 s.UnmarshalBytes(buf) // escapes: fallback. 1358 return length, err 1359 } 1360 1361 // Construct a slice backed by dst's underlying memory. 1362 var buf []byte 1363 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1364 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1365 hdr.Len = s.SizeBytes() 1366 hdr.Cap = s.SizeBytes() 1367 1368 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1369 // Since we bypassed the compiler's escape analysis, indicate that s 1370 // must live until the use above. 1371 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1372 return length, err 1373 } 1374 1375 // WriteTo implements io.WriterTo.WriteTo. 1376 func (s *SockErrCMsgIPv4) WriteTo(writer io.Writer) (int64, error) { 1377 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1378 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1379 buf := make([]byte, s.SizeBytes()) 1380 s.MarshalBytes(buf) 1381 length, err := writer.Write(buf) 1382 return int64(length), err 1383 } 1384 1385 // Construct a slice backed by dst's underlying memory. 1386 var buf []byte 1387 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1388 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1389 hdr.Len = s.SizeBytes() 1390 hdr.Cap = s.SizeBytes() 1391 1392 length, err := writer.Write(buf) 1393 // Since we bypassed the compiler's escape analysis, indicate that s 1394 // must live until the use above. 1395 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1396 return int64(length), err 1397 } 1398 1399 // SizeBytes implements marshal.Marshallable.SizeBytes. 1400 func (s *SockErrCMsgIPv6) SizeBytes() int { 1401 return 0 + 1402 (*SockExtendedErr)(nil).SizeBytes() + 1403 (*SockAddrInet6)(nil).SizeBytes() 1404 } 1405 1406 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1407 func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) []byte { 1408 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1409 dst = s.Offender.MarshalUnsafe(dst) 1410 return dst 1411 } 1412 1413 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1414 func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) []byte { 1415 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1416 src = s.Offender.UnmarshalUnsafe(src) 1417 return src 1418 } 1419 1420 // Packed implements marshal.Marshallable.Packed. 1421 //go:nosplit 1422 func (s *SockErrCMsgIPv6) Packed() bool { 1423 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1424 } 1425 1426 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1427 func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) []byte { 1428 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1429 size := s.SizeBytes() 1430 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1431 return dst[size:] 1432 } 1433 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes. 1434 return s.MarshalBytes(dst) 1435 } 1436 1437 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1438 func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) []byte { 1439 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1440 size := s.SizeBytes() 1441 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1442 return src[size:] 1443 } 1444 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1445 return s.UnmarshalBytes(src) 1446 } 1447 1448 // CopyOutN implements marshal.Marshallable.CopyOutN. 1449 //go:nosplit 1450 func (s *SockErrCMsgIPv6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1451 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1452 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1453 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1454 s.MarshalBytes(buf) // escapes: fallback. 1455 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1456 } 1457 1458 // Construct a slice backed by dst's underlying memory. 1459 var buf []byte 1460 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1461 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1462 hdr.Len = s.SizeBytes() 1463 hdr.Cap = s.SizeBytes() 1464 1465 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1466 // Since we bypassed the compiler's escape analysis, indicate that s 1467 // must live until the use above. 1468 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1469 return length, err 1470 } 1471 1472 // CopyOut implements marshal.Marshallable.CopyOut. 1473 //go:nosplit 1474 func (s *SockErrCMsgIPv6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1475 return s.CopyOutN(cc, addr, s.SizeBytes()) 1476 } 1477 1478 // CopyIn implements marshal.Marshallable.CopyIn. 1479 //go:nosplit 1480 func (s *SockErrCMsgIPv6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1481 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1482 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1483 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1484 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1485 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1486 // partially unmarshalled struct. 1487 s.UnmarshalBytes(buf) // escapes: fallback. 1488 return length, err 1489 } 1490 1491 // Construct a slice backed by dst's underlying memory. 1492 var buf []byte 1493 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1494 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1495 hdr.Len = s.SizeBytes() 1496 hdr.Cap = s.SizeBytes() 1497 1498 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1499 // Since we bypassed the compiler's escape analysis, indicate that s 1500 // must live until the use above. 1501 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1502 return length, err 1503 } 1504 1505 // WriteTo implements io.WriterTo.WriteTo. 1506 func (s *SockErrCMsgIPv6) WriteTo(writer io.Writer) (int64, error) { 1507 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1508 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1509 buf := make([]byte, s.SizeBytes()) 1510 s.MarshalBytes(buf) 1511 length, err := writer.Write(buf) 1512 return int64(length), err 1513 } 1514 1515 // Construct a slice backed by dst's underlying memory. 1516 var buf []byte 1517 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1518 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1519 hdr.Len = s.SizeBytes() 1520 hdr.Cap = s.SizeBytes() 1521 1522 length, err := writer.Write(buf) 1523 // Since we bypassed the compiler's escape analysis, indicate that s 1524 // must live until the use above. 1525 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1526 return int64(length), err 1527 } 1528 1529 // SizeBytes implements marshal.Marshallable.SizeBytes. 1530 func (s *SockExtendedErr) SizeBytes() int { 1531 return 16 1532 } 1533 1534 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1535 func (s *SockExtendedErr) MarshalBytes(dst []byte) []byte { 1536 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 1537 dst = dst[4:] 1538 dst[0] = byte(s.Origin) 1539 dst = dst[1:] 1540 dst[0] = byte(s.Type) 1541 dst = dst[1:] 1542 dst[0] = byte(s.Code) 1543 dst = dst[1:] 1544 dst[0] = byte(s.Pad) 1545 dst = dst[1:] 1546 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Info)) 1547 dst = dst[4:] 1548 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Data)) 1549 dst = dst[4:] 1550 return dst 1551 } 1552 1553 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1554 func (s *SockExtendedErr) UnmarshalBytes(src []byte) []byte { 1555 s.Errno = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1556 src = src[4:] 1557 s.Origin = uint8(src[0]) 1558 src = src[1:] 1559 s.Type = uint8(src[0]) 1560 src = src[1:] 1561 s.Code = uint8(src[0]) 1562 src = src[1:] 1563 s.Pad = uint8(src[0]) 1564 src = src[1:] 1565 s.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1566 src = src[4:] 1567 s.Data = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1568 src = src[4:] 1569 return src 1570 } 1571 1572 // Packed implements marshal.Marshallable.Packed. 1573 //go:nosplit 1574 func (s *SockExtendedErr) Packed() bool { 1575 return true 1576 } 1577 1578 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1579 func (s *SockExtendedErr) MarshalUnsafe(dst []byte) []byte { 1580 size := s.SizeBytes() 1581 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1582 return dst[size:] 1583 } 1584 1585 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1586 func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) []byte { 1587 size := s.SizeBytes() 1588 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1589 return src[size:] 1590 } 1591 1592 // CopyOutN implements marshal.Marshallable.CopyOutN. 1593 //go:nosplit 1594 func (s *SockExtendedErr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1595 // Construct a slice backed by dst's underlying memory. 1596 var buf []byte 1597 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1598 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1599 hdr.Len = s.SizeBytes() 1600 hdr.Cap = s.SizeBytes() 1601 1602 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1603 // Since we bypassed the compiler's escape analysis, indicate that s 1604 // must live until the use above. 1605 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1606 return length, err 1607 } 1608 1609 // CopyOut implements marshal.Marshallable.CopyOut. 1610 //go:nosplit 1611 func (s *SockExtendedErr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1612 return s.CopyOutN(cc, addr, s.SizeBytes()) 1613 } 1614 1615 // CopyIn implements marshal.Marshallable.CopyIn. 1616 //go:nosplit 1617 func (s *SockExtendedErr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1618 // Construct a slice backed by dst's underlying memory. 1619 var buf []byte 1620 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1621 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1622 hdr.Len = s.SizeBytes() 1623 hdr.Cap = s.SizeBytes() 1624 1625 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1626 // Since we bypassed the compiler's escape analysis, indicate that s 1627 // must live until the use above. 1628 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1629 return length, err 1630 } 1631 1632 // WriteTo implements io.WriterTo.WriteTo. 1633 func (s *SockExtendedErr) WriteTo(writer io.Writer) (int64, error) { 1634 // Construct a slice backed by dst's underlying memory. 1635 var buf []byte 1636 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1637 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1638 hdr.Len = s.SizeBytes() 1639 hdr.Cap = s.SizeBytes() 1640 1641 length, err := writer.Write(buf) 1642 // Since we bypassed the compiler's escape analysis, indicate that s 1643 // must live until the use above. 1644 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1645 return int64(length), err 1646 } 1647 1648 // SizeBytes implements marshal.Marshallable.SizeBytes. 1649 func (f *FOwnerEx) SizeBytes() int { 1650 return 8 1651 } 1652 1653 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1654 func (f *FOwnerEx) MarshalBytes(dst []byte) []byte { 1655 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 1656 dst = dst[4:] 1657 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1658 dst = dst[4:] 1659 return dst 1660 } 1661 1662 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1663 func (f *FOwnerEx) UnmarshalBytes(src []byte) []byte { 1664 f.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 1665 src = src[4:] 1666 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1667 src = src[4:] 1668 return src 1669 } 1670 1671 // Packed implements marshal.Marshallable.Packed. 1672 //go:nosplit 1673 func (f *FOwnerEx) Packed() bool { 1674 return true 1675 } 1676 1677 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1678 func (f *FOwnerEx) MarshalUnsafe(dst []byte) []byte { 1679 size := f.SizeBytes() 1680 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1681 return dst[size:] 1682 } 1683 1684 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1685 func (f *FOwnerEx) UnmarshalUnsafe(src []byte) []byte { 1686 size := f.SizeBytes() 1687 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1688 return src[size:] 1689 } 1690 1691 // CopyOutN implements marshal.Marshallable.CopyOutN. 1692 //go:nosplit 1693 func (f *FOwnerEx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1694 // Construct a slice backed by dst's underlying memory. 1695 var buf []byte 1696 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1697 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1698 hdr.Len = f.SizeBytes() 1699 hdr.Cap = f.SizeBytes() 1700 1701 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1702 // Since we bypassed the compiler's escape analysis, indicate that f 1703 // must live until the use above. 1704 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1705 return length, err 1706 } 1707 1708 // CopyOut implements marshal.Marshallable.CopyOut. 1709 //go:nosplit 1710 func (f *FOwnerEx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1711 return f.CopyOutN(cc, addr, f.SizeBytes()) 1712 } 1713 1714 // CopyIn implements marshal.Marshallable.CopyIn. 1715 //go:nosplit 1716 func (f *FOwnerEx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1717 // Construct a slice backed by dst's underlying memory. 1718 var buf []byte 1719 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1720 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1721 hdr.Len = f.SizeBytes() 1722 hdr.Cap = f.SizeBytes() 1723 1724 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1725 // Since we bypassed the compiler's escape analysis, indicate that f 1726 // must live until the use above. 1727 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1728 return length, err 1729 } 1730 1731 // WriteTo implements io.WriterTo.WriteTo. 1732 func (f *FOwnerEx) WriteTo(writer io.Writer) (int64, error) { 1733 // Construct a slice backed by dst's underlying memory. 1734 var buf []byte 1735 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1736 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1737 hdr.Len = f.SizeBytes() 1738 hdr.Cap = f.SizeBytes() 1739 1740 length, err := writer.Write(buf) 1741 // Since we bypassed the compiler's escape analysis, indicate that f 1742 // must live until the use above. 1743 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1744 return int64(length), err 1745 } 1746 1747 // SizeBytes implements marshal.Marshallable.SizeBytes. 1748 func (f *Flock) SizeBytes() int { 1749 return 24 + 1750 1*4 + 1751 1*4 1752 } 1753 1754 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1755 func (f *Flock) MarshalBytes(dst []byte) []byte { 1756 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Type)) 1757 dst = dst[2:] 1758 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Whence)) 1759 dst = dst[2:] 1760 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1761 dst = dst[1*(4):] 1762 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Start)) 1763 dst = dst[8:] 1764 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Len)) 1765 dst = dst[8:] 1766 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1767 dst = dst[4:] 1768 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1769 dst = dst[1*(4):] 1770 return dst 1771 } 1772 1773 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1774 func (f *Flock) UnmarshalBytes(src []byte) []byte { 1775 f.Type = int16(hostarch.ByteOrder.Uint16(src[:2])) 1776 src = src[2:] 1777 f.Whence = int16(hostarch.ByteOrder.Uint16(src[:2])) 1778 src = src[2:] 1779 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1780 src = src[1*(4):] 1781 f.Start = int64(hostarch.ByteOrder.Uint64(src[:8])) 1782 src = src[8:] 1783 f.Len = int64(hostarch.ByteOrder.Uint64(src[:8])) 1784 src = src[8:] 1785 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1786 src = src[4:] 1787 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1788 src = src[1*(4):] 1789 return src 1790 } 1791 1792 // Packed implements marshal.Marshallable.Packed. 1793 //go:nosplit 1794 func (f *Flock) Packed() bool { 1795 return true 1796 } 1797 1798 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1799 func (f *Flock) MarshalUnsafe(dst []byte) []byte { 1800 size := f.SizeBytes() 1801 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1802 return dst[size:] 1803 } 1804 1805 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1806 func (f *Flock) UnmarshalUnsafe(src []byte) []byte { 1807 size := f.SizeBytes() 1808 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1809 return src[size:] 1810 } 1811 1812 // CopyOutN implements marshal.Marshallable.CopyOutN. 1813 //go:nosplit 1814 func (f *Flock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1815 // Construct a slice backed by dst's underlying memory. 1816 var buf []byte 1817 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1818 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1819 hdr.Len = f.SizeBytes() 1820 hdr.Cap = f.SizeBytes() 1821 1822 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1823 // Since we bypassed the compiler's escape analysis, indicate that f 1824 // must live until the use above. 1825 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1826 return length, err 1827 } 1828 1829 // CopyOut implements marshal.Marshallable.CopyOut. 1830 //go:nosplit 1831 func (f *Flock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1832 return f.CopyOutN(cc, addr, f.SizeBytes()) 1833 } 1834 1835 // CopyIn implements marshal.Marshallable.CopyIn. 1836 //go:nosplit 1837 func (f *Flock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1838 // Construct a slice backed by dst's underlying memory. 1839 var buf []byte 1840 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1841 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1842 hdr.Len = f.SizeBytes() 1843 hdr.Cap = f.SizeBytes() 1844 1845 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1846 // Since we bypassed the compiler's escape analysis, indicate that f 1847 // must live until the use above. 1848 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1849 return length, err 1850 } 1851 1852 // WriteTo implements io.WriterTo.WriteTo. 1853 func (f *Flock) WriteTo(writer io.Writer) (int64, error) { 1854 // Construct a slice backed by dst's underlying memory. 1855 var buf []byte 1856 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1857 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1858 hdr.Len = f.SizeBytes() 1859 hdr.Cap = f.SizeBytes() 1860 1861 length, err := writer.Write(buf) 1862 // Since we bypassed the compiler's escape analysis, indicate that f 1863 // must live until the use above. 1864 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1865 return int64(length), err 1866 } 1867 1868 // SizeBytes implements marshal.Marshallable.SizeBytes. 1869 //go:nosplit 1870 func (m *FileMode) SizeBytes() int { 1871 return 2 1872 } 1873 1874 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1875 func (m *FileMode) MarshalBytes(dst []byte) []byte { 1876 hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m)) 1877 return dst[2:] 1878 } 1879 1880 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1881 func (m *FileMode) UnmarshalBytes(src []byte) []byte { 1882 *m = FileMode(uint16(hostarch.ByteOrder.Uint16(src[:2]))) 1883 return src[2:] 1884 } 1885 1886 // Packed implements marshal.Marshallable.Packed. 1887 //go:nosplit 1888 func (m *FileMode) Packed() bool { 1889 // Scalar newtypes are always packed. 1890 return true 1891 } 1892 1893 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1894 func (m *FileMode) MarshalUnsafe(dst []byte) []byte { 1895 size := m.SizeBytes() 1896 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 1897 return dst[size:] 1898 } 1899 1900 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1901 func (m *FileMode) UnmarshalUnsafe(src []byte) []byte { 1902 size := m.SizeBytes() 1903 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 1904 return src[size:] 1905 } 1906 1907 // CopyOutN implements marshal.Marshallable.CopyOutN. 1908 //go:nosplit 1909 func (m *FileMode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1910 // Construct a slice backed by dst's underlying memory. 1911 var buf []byte 1912 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1913 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1914 hdr.Len = m.SizeBytes() 1915 hdr.Cap = m.SizeBytes() 1916 1917 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1918 // Since we bypassed the compiler's escape analysis, indicate that m 1919 // must live until the use above. 1920 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1921 return length, err 1922 } 1923 1924 // CopyOut implements marshal.Marshallable.CopyOut. 1925 //go:nosplit 1926 func (m *FileMode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1927 return m.CopyOutN(cc, addr, m.SizeBytes()) 1928 } 1929 1930 // CopyIn implements marshal.Marshallable.CopyIn. 1931 //go:nosplit 1932 func (m *FileMode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1933 // Construct a slice backed by dst's underlying memory. 1934 var buf []byte 1935 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1936 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1937 hdr.Len = m.SizeBytes() 1938 hdr.Cap = m.SizeBytes() 1939 1940 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1941 // Since we bypassed the compiler's escape analysis, indicate that m 1942 // must live until the use above. 1943 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1944 return length, err 1945 } 1946 1947 // WriteTo implements io.WriterTo.WriteTo. 1948 func (m *FileMode) WriteTo(writer io.Writer) (int64, error) { 1949 // Construct a slice backed by dst's underlying memory. 1950 var buf []byte 1951 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1952 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1953 hdr.Len = m.SizeBytes() 1954 hdr.Cap = m.SizeBytes() 1955 1956 length, err := writer.Write(buf) 1957 // Since we bypassed the compiler's escape analysis, indicate that m 1958 // must live until the use above. 1959 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1960 return int64(length), err 1961 } 1962 1963 // SizeBytes implements marshal.Marshallable.SizeBytes. 1964 func (s *Statx) SizeBytes() int { 1965 return 80 + 1966 (*StatxTimestamp)(nil).SizeBytes() + 1967 (*StatxTimestamp)(nil).SizeBytes() + 1968 (*StatxTimestamp)(nil).SizeBytes() + 1969 (*StatxTimestamp)(nil).SizeBytes() 1970 } 1971 1972 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1973 func (s *Statx) MarshalBytes(dst []byte) []byte { 1974 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask)) 1975 dst = dst[4:] 1976 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Blksize)) 1977 dst = dst[4:] 1978 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Attributes)) 1979 dst = dst[8:] 1980 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nlink)) 1981 dst = dst[4:] 1982 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 1983 dst = dst[4:] 1984 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.GID)) 1985 dst = dst[4:] 1986 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Mode)) 1987 dst = dst[2:] 1988 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 1989 dst = dst[2:] 1990 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino)) 1991 dst = dst[8:] 1992 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 1993 dst = dst[8:] 1994 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 1995 dst = dst[8:] 1996 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.AttributesMask)) 1997 dst = dst[8:] 1998 dst = s.Atime.MarshalUnsafe(dst) 1999 dst = s.Btime.MarshalUnsafe(dst) 2000 dst = s.Ctime.MarshalUnsafe(dst) 2001 dst = s.Mtime.MarshalUnsafe(dst) 2002 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMajor)) 2003 dst = dst[4:] 2004 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMinor)) 2005 dst = dst[4:] 2006 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMajor)) 2007 dst = dst[4:] 2008 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMinor)) 2009 dst = dst[4:] 2010 return dst 2011 } 2012 2013 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2014 func (s *Statx) UnmarshalBytes(src []byte) []byte { 2015 s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2016 src = src[4:] 2017 s.Blksize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2018 src = src[4:] 2019 s.Attributes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2020 src = src[8:] 2021 s.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2022 src = src[4:] 2023 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2024 src = src[4:] 2025 s.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2026 src = src[4:] 2027 s.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 2028 src = src[2:] 2029 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 2030 src = src[2:] 2031 s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2032 src = src[8:] 2033 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2034 src = src[8:] 2035 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2036 src = src[8:] 2037 s.AttributesMask = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2038 src = src[8:] 2039 src = s.Atime.UnmarshalUnsafe(src) 2040 src = s.Btime.UnmarshalUnsafe(src) 2041 src = s.Ctime.UnmarshalUnsafe(src) 2042 src = s.Mtime.UnmarshalUnsafe(src) 2043 s.RdevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2044 src = src[4:] 2045 s.RdevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2046 src = src[4:] 2047 s.DevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2048 src = src[4:] 2049 s.DevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2050 src = src[4:] 2051 return src 2052 } 2053 2054 // Packed implements marshal.Marshallable.Packed. 2055 //go:nosplit 2056 func (s *Statx) Packed() bool { 2057 return s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() 2058 } 2059 2060 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2061 func (s *Statx) MarshalUnsafe(dst []byte) []byte { 2062 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2063 size := s.SizeBytes() 2064 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2065 return dst[size:] 2066 } 2067 // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes. 2068 return s.MarshalBytes(dst) 2069 } 2070 2071 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2072 func (s *Statx) UnmarshalUnsafe(src []byte) []byte { 2073 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2074 size := s.SizeBytes() 2075 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2076 return src[size:] 2077 } 2078 // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2079 return s.UnmarshalBytes(src) 2080 } 2081 2082 // CopyOutN implements marshal.Marshallable.CopyOutN. 2083 //go:nosplit 2084 func (s *Statx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2085 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2086 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2087 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2088 s.MarshalBytes(buf) // escapes: fallback. 2089 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2090 } 2091 2092 // Construct a slice backed by dst's underlying memory. 2093 var buf []byte 2094 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2095 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2096 hdr.Len = s.SizeBytes() 2097 hdr.Cap = s.SizeBytes() 2098 2099 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2100 // Since we bypassed the compiler's escape analysis, indicate that s 2101 // must live until the use above. 2102 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2103 return length, err 2104 } 2105 2106 // CopyOut implements marshal.Marshallable.CopyOut. 2107 //go:nosplit 2108 func (s *Statx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2109 return s.CopyOutN(cc, addr, s.SizeBytes()) 2110 } 2111 2112 // CopyIn implements marshal.Marshallable.CopyIn. 2113 //go:nosplit 2114 func (s *Statx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2115 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2116 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2117 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2118 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2119 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2120 // partially unmarshalled struct. 2121 s.UnmarshalBytes(buf) // escapes: fallback. 2122 return length, err 2123 } 2124 2125 // Construct a slice backed by dst's underlying memory. 2126 var buf []byte 2127 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2128 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2129 hdr.Len = s.SizeBytes() 2130 hdr.Cap = s.SizeBytes() 2131 2132 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2133 // Since we bypassed the compiler's escape analysis, indicate that s 2134 // must live until the use above. 2135 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2136 return length, err 2137 } 2138 2139 // WriteTo implements io.WriterTo.WriteTo. 2140 func (s *Statx) WriteTo(writer io.Writer) (int64, error) { 2141 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2142 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2143 buf := make([]byte, s.SizeBytes()) 2144 s.MarshalBytes(buf) 2145 length, err := writer.Write(buf) 2146 return int64(length), err 2147 } 2148 2149 // Construct a slice backed by dst's underlying memory. 2150 var buf []byte 2151 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2152 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2153 hdr.Len = s.SizeBytes() 2154 hdr.Cap = s.SizeBytes() 2155 2156 length, err := writer.Write(buf) 2157 // Since we bypassed the compiler's escape analysis, indicate that s 2158 // must live until the use above. 2159 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2160 return int64(length), err 2161 } 2162 2163 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2164 func (s *Statx) CheckedMarshal(dst []byte) ([]byte, bool) { 2165 if s.SizeBytes() > len(dst) { 2166 return dst, false 2167 } 2168 return s.MarshalUnsafe(dst), true 2169 } 2170 2171 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2172 func (s *Statx) CheckedUnmarshal(src []byte) ([]byte, bool) { 2173 if s.SizeBytes() > len(src) { 2174 return src, false 2175 } 2176 return s.UnmarshalUnsafe(src), true 2177 } 2178 2179 // CopyStatxSliceIn copies in a slice of Statx objects from the task's memory. 2180 func CopyStatxSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Statx) (int, error) { 2181 count := len(dst) 2182 if count == 0 { 2183 return 0, nil 2184 } 2185 size := (*Statx)(nil).SizeBytes() 2186 2187 if !dst[0].Packed() { 2188 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2189 buf := cc.CopyScratchBuffer(size * count) 2190 length, err := cc.CopyInBytes(addr, buf) 2191 2192 // Unmarshal as much as possible, even on error. First handle full objects. 2193 limit := length/size 2194 for idx := 0; idx < limit; idx++ { 2195 buf = dst[idx].UnmarshalBytes(buf) 2196 } 2197 2198 // Handle any final partial object. buf is guaranteed to be long enough for the 2199 // final element, but may not contain valid data for the entire range. This may 2200 // result in unmarshalling zero values for some parts of the object. 2201 if length%size != 0 { 2202 dst[limit].UnmarshalBytes(buf) 2203 } 2204 2205 return length, err 2206 } 2207 2208 ptr := unsafe.Pointer(&dst) 2209 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2210 2211 // Construct a slice backed by dst's underlying memory. 2212 var buf []byte 2213 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2214 hdr.Data = uintptr(val) 2215 hdr.Len = size * count 2216 hdr.Cap = size * count 2217 2218 length, err := cc.CopyInBytes(addr, buf) 2219 // Since we bypassed the compiler's escape analysis, indicate that dst 2220 // must live until the use above. 2221 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 2222 return length, err 2223 } 2224 2225 // CopyStatxSliceOut copies a slice of Statx objects to the task's memory. 2226 func CopyStatxSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Statx) (int, error) { 2227 count := len(src) 2228 if count == 0 { 2229 return 0, nil 2230 } 2231 size := (*Statx)(nil).SizeBytes() 2232 2233 if !src[0].Packed() { 2234 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2235 buf := cc.CopyScratchBuffer(size * count) 2236 curBuf := buf 2237 for idx := 0; idx < count; idx++ { 2238 curBuf = src[idx].MarshalBytes(curBuf) 2239 } 2240 return cc.CopyOutBytes(addr, buf) 2241 } 2242 2243 ptr := unsafe.Pointer(&src) 2244 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2245 2246 // Construct a slice backed by dst's underlying memory. 2247 var buf []byte 2248 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2249 hdr.Data = uintptr(val) 2250 hdr.Len = size * count 2251 hdr.Cap = size * count 2252 2253 length, err := cc.CopyOutBytes(addr, buf) 2254 // Since we bypassed the compiler's escape analysis, indicate that src 2255 // must live until the use above. 2256 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2257 return length, err 2258 } 2259 2260 // MarshalUnsafeStatxSlice is like Statx.MarshalUnsafe, but for a []Statx. 2261 func MarshalUnsafeStatxSlice(src []Statx, dst []byte) []byte { 2262 count := len(src) 2263 if count == 0 { 2264 return dst 2265 } 2266 2267 if !src[0].Packed() { 2268 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2269 for idx := 0; idx < count; idx++ { 2270 dst = src[idx].MarshalBytes(dst) 2271 } 2272 return dst 2273 } 2274 2275 size := (*Statx)(nil).SizeBytes() 2276 buf := dst[:size*count] 2277 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2278 return dst[size*count:] 2279 } 2280 2281 // UnmarshalUnsafeStatxSlice is like Statx.UnmarshalUnsafe, but for a []Statx. 2282 func UnmarshalUnsafeStatxSlice(dst []Statx, src []byte) []byte { 2283 count := len(dst) 2284 if count == 0 { 2285 return src 2286 } 2287 2288 if !dst[0].Packed() { 2289 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2290 for idx := 0; idx < count; idx++ { 2291 src = dst[idx].UnmarshalBytes(src) 2292 } 2293 return src 2294 } 2295 2296 size := (*Statx)(nil).SizeBytes() 2297 buf := src[:size*count] 2298 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2299 return src[size*count:] 2300 } 2301 2302 // SizeBytes implements marshal.Marshallable.SizeBytes. 2303 func (s *Statfs) SizeBytes() int { 2304 return 80 + 2305 4*2 + 2306 8*4 2307 } 2308 2309 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2310 func (s *Statfs) MarshalBytes(dst []byte) []byte { 2311 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type)) 2312 dst = dst[8:] 2313 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize)) 2314 dst = dst[8:] 2315 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2316 dst = dst[8:] 2317 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksFree)) 2318 dst = dst[8:] 2319 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksAvailable)) 2320 dst = dst[8:] 2321 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Files)) 2322 dst = dst[8:] 2323 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FilesFree)) 2324 dst = dst[8:] 2325 for idx := 0; idx < 2; idx++ { 2326 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FSID[idx])) 2327 dst = dst[4:] 2328 } 2329 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength)) 2330 dst = dst[8:] 2331 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FragmentSize)) 2332 dst = dst[8:] 2333 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 2334 dst = dst[8:] 2335 for idx := 0; idx < 4; idx++ { 2336 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Spare[idx])) 2337 dst = dst[8:] 2338 } 2339 return dst 2340 } 2341 2342 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2343 func (s *Statfs) UnmarshalBytes(src []byte) []byte { 2344 s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2345 src = src[8:] 2346 s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2347 src = src[8:] 2348 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2349 src = src[8:] 2350 s.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2351 src = src[8:] 2352 s.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2353 src = src[8:] 2354 s.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2355 src = src[8:] 2356 s.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2357 src = src[8:] 2358 for idx := 0; idx < 2; idx++ { 2359 s.FSID[idx] = int32(hostarch.ByteOrder.Uint32(src[:4])) 2360 src = src[4:] 2361 } 2362 s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2363 src = src[8:] 2364 s.FragmentSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2365 src = src[8:] 2366 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2367 src = src[8:] 2368 for idx := 0; idx < 4; idx++ { 2369 s.Spare[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2370 src = src[8:] 2371 } 2372 return src 2373 } 2374 2375 // Packed implements marshal.Marshallable.Packed. 2376 //go:nosplit 2377 func (s *Statfs) Packed() bool { 2378 return true 2379 } 2380 2381 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2382 func (s *Statfs) MarshalUnsafe(dst []byte) []byte { 2383 size := s.SizeBytes() 2384 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2385 return dst[size:] 2386 } 2387 2388 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2389 func (s *Statfs) UnmarshalUnsafe(src []byte) []byte { 2390 size := s.SizeBytes() 2391 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2392 return src[size:] 2393 } 2394 2395 // CopyOutN implements marshal.Marshallable.CopyOutN. 2396 //go:nosplit 2397 func (s *Statfs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2398 // Construct a slice backed by dst's underlying memory. 2399 var buf []byte 2400 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2401 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2402 hdr.Len = s.SizeBytes() 2403 hdr.Cap = s.SizeBytes() 2404 2405 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2406 // Since we bypassed the compiler's escape analysis, indicate that s 2407 // must live until the use above. 2408 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2409 return length, err 2410 } 2411 2412 // CopyOut implements marshal.Marshallable.CopyOut. 2413 //go:nosplit 2414 func (s *Statfs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2415 return s.CopyOutN(cc, addr, s.SizeBytes()) 2416 } 2417 2418 // CopyIn implements marshal.Marshallable.CopyIn. 2419 //go:nosplit 2420 func (s *Statfs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2421 // Construct a slice backed by dst's underlying memory. 2422 var buf []byte 2423 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2424 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2425 hdr.Len = s.SizeBytes() 2426 hdr.Cap = s.SizeBytes() 2427 2428 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2429 // Since we bypassed the compiler's escape analysis, indicate that s 2430 // must live until the use above. 2431 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2432 return length, err 2433 } 2434 2435 // WriteTo implements io.WriterTo.WriteTo. 2436 func (s *Statfs) WriteTo(writer io.Writer) (int64, error) { 2437 // Construct a slice backed by dst's underlying memory. 2438 var buf []byte 2439 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2440 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2441 hdr.Len = s.SizeBytes() 2442 hdr.Cap = s.SizeBytes() 2443 2444 length, err := writer.Write(buf) 2445 // Since we bypassed the compiler's escape analysis, indicate that s 2446 // must live until the use above. 2447 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2448 return int64(length), err 2449 } 2450 2451 // Packed implements marshal.Marshallable.Packed. 2452 //go:nosplit 2453 func (s *CString) Packed() bool { 2454 // Type CString is dynamic so it might have slice/string headers. Hence, it is not packed. 2455 return false 2456 } 2457 2458 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2459 func (s *CString) MarshalUnsafe(dst []byte) []byte { 2460 // Type CString doesn't have a packed layout in memory, fallback to MarshalBytes. 2461 return s.MarshalBytes(dst) 2462 } 2463 2464 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2465 func (s *CString) UnmarshalUnsafe(src []byte) []byte { 2466 // Type CString doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2467 return s.UnmarshalBytes(src) 2468 } 2469 2470 // CopyOutN implements marshal.Marshallable.CopyOutN. 2471 //go:nosplit 2472 func (s *CString) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2473 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2474 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2475 s.MarshalBytes(buf) // escapes: fallback. 2476 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2477 } 2478 2479 // CopyOut implements marshal.Marshallable.CopyOut. 2480 //go:nosplit 2481 func (s *CString) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2482 return s.CopyOutN(cc, addr, s.SizeBytes()) 2483 } 2484 2485 // CopyIn implements marshal.Marshallable.CopyIn. 2486 //go:nosplit 2487 func (s *CString) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2488 // Type CString doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2489 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2490 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2491 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2492 // partially unmarshalled struct. 2493 s.UnmarshalBytes(buf) // escapes: fallback. 2494 return length, err 2495 } 2496 2497 // WriteTo implements io.WriterTo.WriteTo. 2498 func (s *CString) WriteTo(writer io.Writer) (int64, error) { 2499 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2500 buf := make([]byte, s.SizeBytes()) 2501 s.MarshalBytes(buf) 2502 length, err := writer.Write(buf) 2503 return int64(length), err 2504 } 2505 2506 // SizeBytes implements marshal.Marshallable.SizeBytes. 2507 func (f *FUSEAttr) SizeBytes() int { 2508 return 88 2509 } 2510 2511 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2512 func (f *FUSEAttr) MarshalBytes(dst []byte) []byte { 2513 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino)) 2514 dst = dst[8:] 2515 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size)) 2516 dst = dst[8:] 2517 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Blocks)) 2518 dst = dst[8:] 2519 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Atime)) 2520 dst = dst[8:] 2521 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mtime)) 2522 dst = dst[8:] 2523 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ctime)) 2524 dst = dst[8:] 2525 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AtimeNsec)) 2526 dst = dst[4:] 2527 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MtimeNsec)) 2528 dst = dst[4:] 2529 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.CtimeNsec)) 2530 dst = dst[4:] 2531 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 2532 dst = dst[4:] 2533 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Nlink)) 2534 dst = dst[4:] 2535 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 2536 dst = dst[4:] 2537 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 2538 dst = dst[4:] 2539 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev)) 2540 dst = dst[4:] 2541 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.BlkSize)) 2542 dst = dst[4:] 2543 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2544 dst = dst[4:] 2545 return dst 2546 } 2547 2548 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2549 func (f *FUSEAttr) UnmarshalBytes(src []byte) []byte { 2550 f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2551 src = src[8:] 2552 f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2553 src = src[8:] 2554 f.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2555 src = src[8:] 2556 f.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2557 src = src[8:] 2558 f.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2559 src = src[8:] 2560 f.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2561 src = src[8:] 2562 f.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2563 src = src[4:] 2564 f.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2565 src = src[4:] 2566 f.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2567 src = src[4:] 2568 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2569 src = src[4:] 2570 f.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2571 src = src[4:] 2572 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2573 src = src[4:] 2574 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2575 src = src[4:] 2576 f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2577 src = src[4:] 2578 f.BlkSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2579 src = src[4:] 2580 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2581 src = src[4:] 2582 return src 2583 } 2584 2585 // Packed implements marshal.Marshallable.Packed. 2586 //go:nosplit 2587 func (f *FUSEAttr) Packed() bool { 2588 return true 2589 } 2590 2591 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2592 func (f *FUSEAttr) MarshalUnsafe(dst []byte) []byte { 2593 size := f.SizeBytes() 2594 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2595 return dst[size:] 2596 } 2597 2598 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2599 func (f *FUSEAttr) UnmarshalUnsafe(src []byte) []byte { 2600 size := f.SizeBytes() 2601 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2602 return src[size:] 2603 } 2604 2605 // CopyOutN implements marshal.Marshallable.CopyOutN. 2606 //go:nosplit 2607 func (f *FUSEAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2608 // Construct a slice backed by dst's underlying memory. 2609 var buf []byte 2610 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2611 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2612 hdr.Len = f.SizeBytes() 2613 hdr.Cap = f.SizeBytes() 2614 2615 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2616 // Since we bypassed the compiler's escape analysis, indicate that f 2617 // must live until the use above. 2618 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2619 return length, err 2620 } 2621 2622 // CopyOut implements marshal.Marshallable.CopyOut. 2623 //go:nosplit 2624 func (f *FUSEAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2625 return f.CopyOutN(cc, addr, f.SizeBytes()) 2626 } 2627 2628 // CopyIn implements marshal.Marshallable.CopyIn. 2629 //go:nosplit 2630 func (f *FUSEAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2631 // Construct a slice backed by dst's underlying memory. 2632 var buf []byte 2633 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2634 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2635 hdr.Len = f.SizeBytes() 2636 hdr.Cap = f.SizeBytes() 2637 2638 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2639 // Since we bypassed the compiler's escape analysis, indicate that f 2640 // must live until the use above. 2641 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2642 return length, err 2643 } 2644 2645 // WriteTo implements io.WriterTo.WriteTo. 2646 func (f *FUSEAttr) WriteTo(writer io.Writer) (int64, error) { 2647 // Construct a slice backed by dst's underlying memory. 2648 var buf []byte 2649 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2650 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2651 hdr.Len = f.SizeBytes() 2652 hdr.Cap = f.SizeBytes() 2653 2654 length, err := writer.Write(buf) 2655 // Since we bypassed the compiler's escape analysis, indicate that f 2656 // must live until the use above. 2657 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2658 return int64(length), err 2659 } 2660 2661 // Packed implements marshal.Marshallable.Packed. 2662 //go:nosplit 2663 func (r *FUSECreateIn) Packed() bool { 2664 // Type FUSECreateIn is dynamic so it might have slice/string headers. Hence, it is not packed. 2665 return false 2666 } 2667 2668 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2669 func (r *FUSECreateIn) MarshalUnsafe(dst []byte) []byte { 2670 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to MarshalBytes. 2671 return r.MarshalBytes(dst) 2672 } 2673 2674 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2675 func (r *FUSECreateIn) UnmarshalUnsafe(src []byte) []byte { 2676 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2677 return r.UnmarshalBytes(src) 2678 } 2679 2680 // CopyOutN implements marshal.Marshallable.CopyOutN. 2681 //go:nosplit 2682 func (r *FUSECreateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2683 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 2684 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2685 r.MarshalBytes(buf) // escapes: fallback. 2686 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2687 } 2688 2689 // CopyOut implements marshal.Marshallable.CopyOut. 2690 //go:nosplit 2691 func (r *FUSECreateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2692 return r.CopyOutN(cc, addr, r.SizeBytes()) 2693 } 2694 2695 // CopyIn implements marshal.Marshallable.CopyIn. 2696 //go:nosplit 2697 func (r *FUSECreateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2698 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2699 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2700 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2701 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2702 // partially unmarshalled struct. 2703 r.UnmarshalBytes(buf) // escapes: fallback. 2704 return length, err 2705 } 2706 2707 // WriteTo implements io.WriterTo.WriteTo. 2708 func (r *FUSECreateIn) WriteTo(writer io.Writer) (int64, error) { 2709 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 2710 buf := make([]byte, r.SizeBytes()) 2711 r.MarshalBytes(buf) 2712 length, err := writer.Write(buf) 2713 return int64(length), err 2714 } 2715 2716 // SizeBytes implements marshal.Marshallable.SizeBytes. 2717 func (f *FUSECreateMeta) SizeBytes() int { 2718 return 16 2719 } 2720 2721 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2722 func (f *FUSECreateMeta) MarshalBytes(dst []byte) []byte { 2723 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 2724 dst = dst[4:] 2725 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 2726 dst = dst[4:] 2727 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 2728 dst = dst[4:] 2729 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2730 dst = dst[4:] 2731 return dst 2732 } 2733 2734 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2735 func (f *FUSECreateMeta) UnmarshalBytes(src []byte) []byte { 2736 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2737 src = src[4:] 2738 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2739 src = src[4:] 2740 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2741 src = src[4:] 2742 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2743 src = src[4:] 2744 return src 2745 } 2746 2747 // Packed implements marshal.Marshallable.Packed. 2748 //go:nosplit 2749 func (f *FUSECreateMeta) Packed() bool { 2750 return true 2751 } 2752 2753 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2754 func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) []byte { 2755 size := f.SizeBytes() 2756 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2757 return dst[size:] 2758 } 2759 2760 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2761 func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) []byte { 2762 size := f.SizeBytes() 2763 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2764 return src[size:] 2765 } 2766 2767 // CopyOutN implements marshal.Marshallable.CopyOutN. 2768 //go:nosplit 2769 func (f *FUSECreateMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2770 // Construct a slice backed by dst's underlying memory. 2771 var buf []byte 2772 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2773 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2774 hdr.Len = f.SizeBytes() 2775 hdr.Cap = f.SizeBytes() 2776 2777 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2778 // Since we bypassed the compiler's escape analysis, indicate that f 2779 // must live until the use above. 2780 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2781 return length, err 2782 } 2783 2784 // CopyOut implements marshal.Marshallable.CopyOut. 2785 //go:nosplit 2786 func (f *FUSECreateMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2787 return f.CopyOutN(cc, addr, f.SizeBytes()) 2788 } 2789 2790 // CopyIn implements marshal.Marshallable.CopyIn. 2791 //go:nosplit 2792 func (f *FUSECreateMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2793 // Construct a slice backed by dst's underlying memory. 2794 var buf []byte 2795 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2796 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2797 hdr.Len = f.SizeBytes() 2798 hdr.Cap = f.SizeBytes() 2799 2800 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2801 // Since we bypassed the compiler's escape analysis, indicate that f 2802 // must live until the use above. 2803 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2804 return length, err 2805 } 2806 2807 // WriteTo implements io.WriterTo.WriteTo. 2808 func (f *FUSECreateMeta) WriteTo(writer io.Writer) (int64, error) { 2809 // Construct a slice backed by dst's underlying memory. 2810 var buf []byte 2811 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2812 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2813 hdr.Len = f.SizeBytes() 2814 hdr.Cap = f.SizeBytes() 2815 2816 length, err := writer.Write(buf) 2817 // Since we bypassed the compiler's escape analysis, indicate that f 2818 // must live until the use above. 2819 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2820 return int64(length), err 2821 } 2822 2823 // Packed implements marshal.Marshallable.Packed. 2824 //go:nosplit 2825 func (r *FUSEDirent) Packed() bool { 2826 // Type FUSEDirent is dynamic so it might have slice/string headers. Hence, it is not packed. 2827 return false 2828 } 2829 2830 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2831 func (r *FUSEDirent) MarshalUnsafe(dst []byte) []byte { 2832 // Type FUSEDirent doesn't have a packed layout in memory, fallback to MarshalBytes. 2833 return r.MarshalBytes(dst) 2834 } 2835 2836 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2837 func (r *FUSEDirent) UnmarshalUnsafe(src []byte) []byte { 2838 // Type FUSEDirent doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2839 return r.UnmarshalBytes(src) 2840 } 2841 2842 // CopyOutN implements marshal.Marshallable.CopyOutN. 2843 //go:nosplit 2844 func (r *FUSEDirent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2845 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 2846 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2847 r.MarshalBytes(buf) // escapes: fallback. 2848 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2849 } 2850 2851 // CopyOut implements marshal.Marshallable.CopyOut. 2852 //go:nosplit 2853 func (r *FUSEDirent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2854 return r.CopyOutN(cc, addr, r.SizeBytes()) 2855 } 2856 2857 // CopyIn implements marshal.Marshallable.CopyIn. 2858 //go:nosplit 2859 func (r *FUSEDirent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2860 // Type FUSEDirent doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2861 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2862 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2863 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2864 // partially unmarshalled struct. 2865 r.UnmarshalBytes(buf) // escapes: fallback. 2866 return length, err 2867 } 2868 2869 // WriteTo implements io.WriterTo.WriteTo. 2870 func (r *FUSEDirent) WriteTo(writer io.Writer) (int64, error) { 2871 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 2872 buf := make([]byte, r.SizeBytes()) 2873 r.MarshalBytes(buf) 2874 length, err := writer.Write(buf) 2875 return int64(length), err 2876 } 2877 2878 // SizeBytes implements marshal.Marshallable.SizeBytes. 2879 func (f *FUSEDirentMeta) SizeBytes() int { 2880 return 24 2881 } 2882 2883 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2884 func (f *FUSEDirentMeta) MarshalBytes(dst []byte) []byte { 2885 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino)) 2886 dst = dst[8:] 2887 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Off)) 2888 dst = dst[8:] 2889 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLen)) 2890 dst = dst[4:] 2891 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 2892 dst = dst[4:] 2893 return dst 2894 } 2895 2896 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2897 func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) []byte { 2898 f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2899 src = src[8:] 2900 f.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2901 src = src[8:] 2902 f.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2903 src = src[4:] 2904 f.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2905 src = src[4:] 2906 return src 2907 } 2908 2909 // Packed implements marshal.Marshallable.Packed. 2910 //go:nosplit 2911 func (f *FUSEDirentMeta) Packed() bool { 2912 return true 2913 } 2914 2915 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2916 func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) []byte { 2917 size := f.SizeBytes() 2918 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2919 return dst[size:] 2920 } 2921 2922 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2923 func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) []byte { 2924 size := f.SizeBytes() 2925 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2926 return src[size:] 2927 } 2928 2929 // CopyOutN implements marshal.Marshallable.CopyOutN. 2930 //go:nosplit 2931 func (f *FUSEDirentMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2932 // Construct a slice backed by dst's underlying memory. 2933 var buf []byte 2934 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2935 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2936 hdr.Len = f.SizeBytes() 2937 hdr.Cap = f.SizeBytes() 2938 2939 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2940 // Since we bypassed the compiler's escape analysis, indicate that f 2941 // must live until the use above. 2942 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2943 return length, err 2944 } 2945 2946 // CopyOut implements marshal.Marshallable.CopyOut. 2947 //go:nosplit 2948 func (f *FUSEDirentMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2949 return f.CopyOutN(cc, addr, f.SizeBytes()) 2950 } 2951 2952 // CopyIn implements marshal.Marshallable.CopyIn. 2953 //go:nosplit 2954 func (f *FUSEDirentMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2955 // Construct a slice backed by dst's underlying memory. 2956 var buf []byte 2957 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2958 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2959 hdr.Len = f.SizeBytes() 2960 hdr.Cap = f.SizeBytes() 2961 2962 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2963 // Since we bypassed the compiler's escape analysis, indicate that f 2964 // must live until the use above. 2965 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2966 return length, err 2967 } 2968 2969 // WriteTo implements io.WriterTo.WriteTo. 2970 func (f *FUSEDirentMeta) WriteTo(writer io.Writer) (int64, error) { 2971 // Construct a slice backed by dst's underlying memory. 2972 var buf []byte 2973 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2974 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2975 hdr.Len = f.SizeBytes() 2976 hdr.Cap = f.SizeBytes() 2977 2978 length, err := writer.Write(buf) 2979 // Since we bypassed the compiler's escape analysis, indicate that f 2980 // must live until the use above. 2981 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2982 return int64(length), err 2983 } 2984 2985 // Packed implements marshal.Marshallable.Packed. 2986 //go:nosplit 2987 func (r *FUSEDirents) Packed() bool { 2988 // Type FUSEDirents is dynamic so it might have slice/string headers. Hence, it is not packed. 2989 return false 2990 } 2991 2992 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2993 func (r *FUSEDirents) MarshalUnsafe(dst []byte) []byte { 2994 // Type FUSEDirents doesn't have a packed layout in memory, fallback to MarshalBytes. 2995 return r.MarshalBytes(dst) 2996 } 2997 2998 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2999 func (r *FUSEDirents) UnmarshalUnsafe(src []byte) []byte { 3000 // Type FUSEDirents doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3001 return r.UnmarshalBytes(src) 3002 } 3003 3004 // CopyOutN implements marshal.Marshallable.CopyOutN. 3005 //go:nosplit 3006 func (r *FUSEDirents) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3007 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3008 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3009 r.MarshalBytes(buf) // escapes: fallback. 3010 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3011 } 3012 3013 // CopyOut implements marshal.Marshallable.CopyOut. 3014 //go:nosplit 3015 func (r *FUSEDirents) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3016 return r.CopyOutN(cc, addr, r.SizeBytes()) 3017 } 3018 3019 // CopyIn implements marshal.Marshallable.CopyIn. 3020 //go:nosplit 3021 func (r *FUSEDirents) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3022 // Type FUSEDirents doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3023 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3024 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3025 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3026 // partially unmarshalled struct. 3027 r.UnmarshalBytes(buf) // escapes: fallback. 3028 return length, err 3029 } 3030 3031 // WriteTo implements io.WriterTo.WriteTo. 3032 func (r *FUSEDirents) WriteTo(writer io.Writer) (int64, error) { 3033 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3034 buf := make([]byte, r.SizeBytes()) 3035 r.MarshalBytes(buf) 3036 length, err := writer.Write(buf) 3037 return int64(length), err 3038 } 3039 3040 // Packed implements marshal.Marshallable.Packed. 3041 //go:nosplit 3042 func (r *FUSEEmptyIn) Packed() bool { 3043 // Type FUSEEmptyIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3044 return false 3045 } 3046 3047 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3048 func (r *FUSEEmptyIn) MarshalUnsafe(dst []byte) []byte { 3049 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3050 return r.MarshalBytes(dst) 3051 } 3052 3053 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3054 func (r *FUSEEmptyIn) UnmarshalUnsafe(src []byte) []byte { 3055 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3056 return r.UnmarshalBytes(src) 3057 } 3058 3059 // CopyOutN implements marshal.Marshallable.CopyOutN. 3060 //go:nosplit 3061 func (r *FUSEEmptyIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3062 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3063 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3064 r.MarshalBytes(buf) // escapes: fallback. 3065 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3066 } 3067 3068 // CopyOut implements marshal.Marshallable.CopyOut. 3069 //go:nosplit 3070 func (r *FUSEEmptyIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3071 return r.CopyOutN(cc, addr, r.SizeBytes()) 3072 } 3073 3074 // CopyIn implements marshal.Marshallable.CopyIn. 3075 //go:nosplit 3076 func (r *FUSEEmptyIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3077 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3078 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3079 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3080 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3081 // partially unmarshalled struct. 3082 r.UnmarshalBytes(buf) // escapes: fallback. 3083 return length, err 3084 } 3085 3086 // WriteTo implements io.WriterTo.WriteTo. 3087 func (r *FUSEEmptyIn) WriteTo(writer io.Writer) (int64, error) { 3088 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3089 buf := make([]byte, r.SizeBytes()) 3090 r.MarshalBytes(buf) 3091 length, err := writer.Write(buf) 3092 return int64(length), err 3093 } 3094 3095 // SizeBytes implements marshal.Marshallable.SizeBytes. 3096 func (f *FUSEEntryOut) SizeBytes() int { 3097 return 40 + 3098 (*FUSEAttr)(nil).SizeBytes() 3099 } 3100 3101 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3102 func (f *FUSEEntryOut) MarshalBytes(dst []byte) []byte { 3103 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3104 dst = dst[8:] 3105 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Generation)) 3106 dst = dst[8:] 3107 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.EntryValid)) 3108 dst = dst[8:] 3109 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 3110 dst = dst[8:] 3111 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.EntryValidNSec)) 3112 dst = dst[4:] 3113 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNSec)) 3114 dst = dst[4:] 3115 dst = f.Attr.MarshalUnsafe(dst) 3116 return dst 3117 } 3118 3119 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3120 func (f *FUSEEntryOut) UnmarshalBytes(src []byte) []byte { 3121 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3122 src = src[8:] 3123 f.Generation = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3124 src = src[8:] 3125 f.EntryValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3126 src = src[8:] 3127 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3128 src = src[8:] 3129 f.EntryValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3130 src = src[4:] 3131 f.AttrValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3132 src = src[4:] 3133 src = f.Attr.UnmarshalUnsafe(src) 3134 return src 3135 } 3136 3137 // Packed implements marshal.Marshallable.Packed. 3138 //go:nosplit 3139 func (f *FUSEEntryOut) Packed() bool { 3140 return f.Attr.Packed() 3141 } 3142 3143 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3144 func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) []byte { 3145 if f.Attr.Packed() { 3146 size := f.SizeBytes() 3147 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3148 return dst[size:] 3149 } 3150 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3151 return f.MarshalBytes(dst) 3152 } 3153 3154 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3155 func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) []byte { 3156 if f.Attr.Packed() { 3157 size := f.SizeBytes() 3158 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3159 return src[size:] 3160 } 3161 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3162 return f.UnmarshalBytes(src) 3163 } 3164 3165 // CopyOutN implements marshal.Marshallable.CopyOutN. 3166 //go:nosplit 3167 func (f *FUSEEntryOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3168 if !f.Attr.Packed() { 3169 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3170 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3171 f.MarshalBytes(buf) // escapes: fallback. 3172 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3173 } 3174 3175 // Construct a slice backed by dst's underlying memory. 3176 var buf []byte 3177 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3178 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3179 hdr.Len = f.SizeBytes() 3180 hdr.Cap = f.SizeBytes() 3181 3182 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3183 // Since we bypassed the compiler's escape analysis, indicate that f 3184 // must live until the use above. 3185 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3186 return length, err 3187 } 3188 3189 // CopyOut implements marshal.Marshallable.CopyOut. 3190 //go:nosplit 3191 func (f *FUSEEntryOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3192 return f.CopyOutN(cc, addr, f.SizeBytes()) 3193 } 3194 3195 // CopyIn implements marshal.Marshallable.CopyIn. 3196 //go:nosplit 3197 func (f *FUSEEntryOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3198 if !f.Attr.Packed() { 3199 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3200 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3201 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3202 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3203 // partially unmarshalled struct. 3204 f.UnmarshalBytes(buf) // escapes: fallback. 3205 return length, err 3206 } 3207 3208 // Construct a slice backed by dst's underlying memory. 3209 var buf []byte 3210 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3211 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3212 hdr.Len = f.SizeBytes() 3213 hdr.Cap = f.SizeBytes() 3214 3215 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3216 // Since we bypassed the compiler's escape analysis, indicate that f 3217 // must live until the use above. 3218 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3219 return length, err 3220 } 3221 3222 // WriteTo implements io.WriterTo.WriteTo. 3223 func (f *FUSEEntryOut) WriteTo(writer io.Writer) (int64, error) { 3224 if !f.Attr.Packed() { 3225 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3226 buf := make([]byte, f.SizeBytes()) 3227 f.MarshalBytes(buf) 3228 length, err := writer.Write(buf) 3229 return int64(length), err 3230 } 3231 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 := writer.Write(buf) 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 int64(length), err 3244 } 3245 3246 // SizeBytes implements marshal.Marshallable.SizeBytes. 3247 func (f *FUSEGetAttrIn) SizeBytes() int { 3248 return 16 3249 } 3250 3251 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3252 func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) []byte { 3253 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GetAttrFlags)) 3254 dst = dst[4:] 3255 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3256 dst = dst[4:] 3257 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3258 dst = dst[8:] 3259 return dst 3260 } 3261 3262 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3263 func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) []byte { 3264 f.GetAttrFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3265 src = src[4:] 3266 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3267 src = src[4:] 3268 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3269 src = src[8:] 3270 return src 3271 } 3272 3273 // Packed implements marshal.Marshallable.Packed. 3274 //go:nosplit 3275 func (f *FUSEGetAttrIn) Packed() bool { 3276 return true 3277 } 3278 3279 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3280 func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) []byte { 3281 size := f.SizeBytes() 3282 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3283 return dst[size:] 3284 } 3285 3286 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3287 func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) []byte { 3288 size := f.SizeBytes() 3289 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3290 return src[size:] 3291 } 3292 3293 // CopyOutN implements marshal.Marshallable.CopyOutN. 3294 //go:nosplit 3295 func (f *FUSEGetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3296 // Construct a slice backed by dst's underlying memory. 3297 var buf []byte 3298 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3299 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3300 hdr.Len = f.SizeBytes() 3301 hdr.Cap = f.SizeBytes() 3302 3303 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3304 // Since we bypassed the compiler's escape analysis, indicate that f 3305 // must live until the use above. 3306 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3307 return length, err 3308 } 3309 3310 // CopyOut implements marshal.Marshallable.CopyOut. 3311 //go:nosplit 3312 func (f *FUSEGetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3313 return f.CopyOutN(cc, addr, f.SizeBytes()) 3314 } 3315 3316 // CopyIn implements marshal.Marshallable.CopyIn. 3317 //go:nosplit 3318 func (f *FUSEGetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3319 // Construct a slice backed by dst's underlying memory. 3320 var buf []byte 3321 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3322 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3323 hdr.Len = f.SizeBytes() 3324 hdr.Cap = f.SizeBytes() 3325 3326 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3327 // Since we bypassed the compiler's escape analysis, indicate that f 3328 // must live until the use above. 3329 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3330 return length, err 3331 } 3332 3333 // WriteTo implements io.WriterTo.WriteTo. 3334 func (f *FUSEGetAttrIn) WriteTo(writer io.Writer) (int64, error) { 3335 // Construct a slice backed by dst's underlying memory. 3336 var buf []byte 3337 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3338 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3339 hdr.Len = f.SizeBytes() 3340 hdr.Cap = f.SizeBytes() 3341 3342 length, err := writer.Write(buf) 3343 // Since we bypassed the compiler's escape analysis, indicate that f 3344 // must live until the use above. 3345 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3346 return int64(length), err 3347 } 3348 3349 // SizeBytes implements marshal.Marshallable.SizeBytes. 3350 func (f *FUSEGetAttrOut) SizeBytes() int { 3351 return 16 + 3352 (*FUSEAttr)(nil).SizeBytes() 3353 } 3354 3355 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3356 func (f *FUSEGetAttrOut) MarshalBytes(dst []byte) []byte { 3357 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 3358 dst = dst[8:] 3359 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNsec)) 3360 dst = dst[4:] 3361 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3362 dst = dst[4:] 3363 dst = f.Attr.MarshalUnsafe(dst) 3364 return dst 3365 } 3366 3367 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3368 func (f *FUSEGetAttrOut) UnmarshalBytes(src []byte) []byte { 3369 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3370 src = src[8:] 3371 f.AttrValidNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3372 src = src[4:] 3373 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3374 src = src[4:] 3375 src = f.Attr.UnmarshalUnsafe(src) 3376 return src 3377 } 3378 3379 // Packed implements marshal.Marshallable.Packed. 3380 //go:nosplit 3381 func (f *FUSEGetAttrOut) Packed() bool { 3382 return f.Attr.Packed() 3383 } 3384 3385 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3386 func (f *FUSEGetAttrOut) MarshalUnsafe(dst []byte) []byte { 3387 if f.Attr.Packed() { 3388 size := f.SizeBytes() 3389 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3390 return dst[size:] 3391 } 3392 // Type FUSEGetAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3393 return f.MarshalBytes(dst) 3394 } 3395 3396 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3397 func (f *FUSEGetAttrOut) UnmarshalUnsafe(src []byte) []byte { 3398 if f.Attr.Packed() { 3399 size := f.SizeBytes() 3400 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3401 return src[size:] 3402 } 3403 // Type FUSEGetAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3404 return f.UnmarshalBytes(src) 3405 } 3406 3407 // CopyOutN implements marshal.Marshallable.CopyOutN. 3408 //go:nosplit 3409 func (f *FUSEGetAttrOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3410 if !f.Attr.Packed() { 3411 // Type FUSEGetAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3412 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3413 f.MarshalBytes(buf) // escapes: fallback. 3414 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3415 } 3416 3417 // Construct a slice backed by dst's underlying memory. 3418 var buf []byte 3419 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3420 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3421 hdr.Len = f.SizeBytes() 3422 hdr.Cap = f.SizeBytes() 3423 3424 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3425 // Since we bypassed the compiler's escape analysis, indicate that f 3426 // must live until the use above. 3427 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3428 return length, err 3429 } 3430 3431 // CopyOut implements marshal.Marshallable.CopyOut. 3432 //go:nosplit 3433 func (f *FUSEGetAttrOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3434 return f.CopyOutN(cc, addr, f.SizeBytes()) 3435 } 3436 3437 // CopyIn implements marshal.Marshallable.CopyIn. 3438 //go:nosplit 3439 func (f *FUSEGetAttrOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3440 if !f.Attr.Packed() { 3441 // Type FUSEGetAttrOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3442 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3443 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3444 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3445 // partially unmarshalled struct. 3446 f.UnmarshalBytes(buf) // escapes: fallback. 3447 return length, err 3448 } 3449 3450 // Construct a slice backed by dst's underlying memory. 3451 var buf []byte 3452 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3453 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3454 hdr.Len = f.SizeBytes() 3455 hdr.Cap = f.SizeBytes() 3456 3457 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3458 // Since we bypassed the compiler's escape analysis, indicate that f 3459 // must live until the use above. 3460 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3461 return length, err 3462 } 3463 3464 // WriteTo implements io.WriterTo.WriteTo. 3465 func (f *FUSEGetAttrOut) WriteTo(writer io.Writer) (int64, error) { 3466 if !f.Attr.Packed() { 3467 // Type FUSEGetAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3468 buf := make([]byte, f.SizeBytes()) 3469 f.MarshalBytes(buf) 3470 length, err := writer.Write(buf) 3471 return int64(length), err 3472 } 3473 3474 // Construct a slice backed by dst's underlying memory. 3475 var buf []byte 3476 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3477 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3478 hdr.Len = f.SizeBytes() 3479 hdr.Cap = f.SizeBytes() 3480 3481 length, err := writer.Write(buf) 3482 // Since we bypassed the compiler's escape analysis, indicate that f 3483 // must live until the use above. 3484 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3485 return int64(length), err 3486 } 3487 3488 // SizeBytes implements marshal.Marshallable.SizeBytes. 3489 func (f *FUSEHeaderIn) SizeBytes() int { 3490 return 28 + 3491 (*FUSEOpcode)(nil).SizeBytes() + 3492 (*FUSEOpID)(nil).SizeBytes() 3493 } 3494 3495 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3496 func (f *FUSEHeaderIn) MarshalBytes(dst []byte) []byte { 3497 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 3498 dst = dst[4:] 3499 dst = f.Opcode.MarshalUnsafe(dst) 3500 dst = f.Unique.MarshalUnsafe(dst) 3501 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3502 dst = dst[8:] 3503 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 3504 dst = dst[4:] 3505 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 3506 dst = dst[4:] 3507 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 3508 dst = dst[4:] 3509 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3510 dst = dst[4:] 3511 return dst 3512 } 3513 3514 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3515 func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) []byte { 3516 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3517 src = src[4:] 3518 src = f.Opcode.UnmarshalUnsafe(src) 3519 src = f.Unique.UnmarshalUnsafe(src) 3520 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3521 src = src[8:] 3522 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3523 src = src[4:] 3524 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3525 src = src[4:] 3526 f.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3527 src = src[4:] 3528 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3529 src = src[4:] 3530 return src 3531 } 3532 3533 // Packed implements marshal.Marshallable.Packed. 3534 //go:nosplit 3535 func (f *FUSEHeaderIn) Packed() bool { 3536 return f.Opcode.Packed() && f.Unique.Packed() 3537 } 3538 3539 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3540 func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) []byte { 3541 if f.Opcode.Packed() && f.Unique.Packed() { 3542 size := f.SizeBytes() 3543 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3544 return dst[size:] 3545 } 3546 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3547 return f.MarshalBytes(dst) 3548 } 3549 3550 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3551 func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) []byte { 3552 if f.Opcode.Packed() && f.Unique.Packed() { 3553 size := f.SizeBytes() 3554 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3555 return src[size:] 3556 } 3557 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3558 return f.UnmarshalBytes(src) 3559 } 3560 3561 // CopyOutN implements marshal.Marshallable.CopyOutN. 3562 //go:nosplit 3563 func (f *FUSEHeaderIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3564 if !f.Opcode.Packed() && f.Unique.Packed() { 3565 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3566 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3567 f.MarshalBytes(buf) // escapes: fallback. 3568 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3569 } 3570 3571 // Construct a slice backed by dst's underlying memory. 3572 var buf []byte 3573 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3574 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3575 hdr.Len = f.SizeBytes() 3576 hdr.Cap = f.SizeBytes() 3577 3578 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3579 // Since we bypassed the compiler's escape analysis, indicate that f 3580 // must live until the use above. 3581 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3582 return length, err 3583 } 3584 3585 // CopyOut implements marshal.Marshallable.CopyOut. 3586 //go:nosplit 3587 func (f *FUSEHeaderIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3588 return f.CopyOutN(cc, addr, f.SizeBytes()) 3589 } 3590 3591 // CopyIn implements marshal.Marshallable.CopyIn. 3592 //go:nosplit 3593 func (f *FUSEHeaderIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3594 if !f.Opcode.Packed() && f.Unique.Packed() { 3595 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3596 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3597 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3598 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3599 // partially unmarshalled struct. 3600 f.UnmarshalBytes(buf) // escapes: fallback. 3601 return length, err 3602 } 3603 3604 // Construct a slice backed by dst's underlying memory. 3605 var buf []byte 3606 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3607 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3608 hdr.Len = f.SizeBytes() 3609 hdr.Cap = f.SizeBytes() 3610 3611 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3612 // Since we bypassed the compiler's escape analysis, indicate that f 3613 // must live until the use above. 3614 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3615 return length, err 3616 } 3617 3618 // WriteTo implements io.WriterTo.WriteTo. 3619 func (f *FUSEHeaderIn) WriteTo(writer io.Writer) (int64, error) { 3620 if !f.Opcode.Packed() && f.Unique.Packed() { 3621 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3622 buf := make([]byte, f.SizeBytes()) 3623 f.MarshalBytes(buf) 3624 length, err := writer.Write(buf) 3625 return int64(length), err 3626 } 3627 3628 // Construct a slice backed by dst's underlying memory. 3629 var buf []byte 3630 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3631 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3632 hdr.Len = f.SizeBytes() 3633 hdr.Cap = f.SizeBytes() 3634 3635 length, err := writer.Write(buf) 3636 // Since we bypassed the compiler's escape analysis, indicate that f 3637 // must live until the use above. 3638 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3639 return int64(length), err 3640 } 3641 3642 // SizeBytes implements marshal.Marshallable.SizeBytes. 3643 func (f *FUSEHeaderOut) SizeBytes() int { 3644 return 8 + 3645 (*FUSEOpID)(nil).SizeBytes() 3646 } 3647 3648 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3649 func (f *FUSEHeaderOut) MarshalBytes(dst []byte) []byte { 3650 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 3651 dst = dst[4:] 3652 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Error)) 3653 dst = dst[4:] 3654 dst = f.Unique.MarshalUnsafe(dst) 3655 return dst 3656 } 3657 3658 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3659 func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) []byte { 3660 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3661 src = src[4:] 3662 f.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 3663 src = src[4:] 3664 src = f.Unique.UnmarshalUnsafe(src) 3665 return src 3666 } 3667 3668 // Packed implements marshal.Marshallable.Packed. 3669 //go:nosplit 3670 func (f *FUSEHeaderOut) Packed() bool { 3671 return f.Unique.Packed() 3672 } 3673 3674 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3675 func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) []byte { 3676 if f.Unique.Packed() { 3677 size := f.SizeBytes() 3678 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3679 return dst[size:] 3680 } 3681 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3682 return f.MarshalBytes(dst) 3683 } 3684 3685 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3686 func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) []byte { 3687 if f.Unique.Packed() { 3688 size := f.SizeBytes() 3689 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3690 return src[size:] 3691 } 3692 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3693 return f.UnmarshalBytes(src) 3694 } 3695 3696 // CopyOutN implements marshal.Marshallable.CopyOutN. 3697 //go:nosplit 3698 func (f *FUSEHeaderOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3699 if !f.Unique.Packed() { 3700 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3701 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3702 f.MarshalBytes(buf) // escapes: fallback. 3703 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3704 } 3705 3706 // Construct a slice backed by dst's underlying memory. 3707 var buf []byte 3708 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3709 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3710 hdr.Len = f.SizeBytes() 3711 hdr.Cap = f.SizeBytes() 3712 3713 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3714 // Since we bypassed the compiler's escape analysis, indicate that f 3715 // must live until the use above. 3716 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3717 return length, err 3718 } 3719 3720 // CopyOut implements marshal.Marshallable.CopyOut. 3721 //go:nosplit 3722 func (f *FUSEHeaderOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3723 return f.CopyOutN(cc, addr, f.SizeBytes()) 3724 } 3725 3726 // CopyIn implements marshal.Marshallable.CopyIn. 3727 //go:nosplit 3728 func (f *FUSEHeaderOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3729 if !f.Unique.Packed() { 3730 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3731 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3732 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3733 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3734 // partially unmarshalled struct. 3735 f.UnmarshalBytes(buf) // escapes: fallback. 3736 return length, err 3737 } 3738 3739 // Construct a slice backed by dst's underlying memory. 3740 var buf []byte 3741 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3742 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3743 hdr.Len = f.SizeBytes() 3744 hdr.Cap = f.SizeBytes() 3745 3746 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3747 // Since we bypassed the compiler's escape analysis, indicate that f 3748 // must live until the use above. 3749 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3750 return length, err 3751 } 3752 3753 // WriteTo implements io.WriterTo.WriteTo. 3754 func (f *FUSEHeaderOut) WriteTo(writer io.Writer) (int64, error) { 3755 if !f.Unique.Packed() { 3756 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3757 buf := make([]byte, f.SizeBytes()) 3758 f.MarshalBytes(buf) 3759 length, err := writer.Write(buf) 3760 return int64(length), err 3761 } 3762 3763 // Construct a slice backed by dst's underlying memory. 3764 var buf []byte 3765 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3766 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3767 hdr.Len = f.SizeBytes() 3768 hdr.Cap = f.SizeBytes() 3769 3770 length, err := writer.Write(buf) 3771 // Since we bypassed the compiler's escape analysis, indicate that f 3772 // must live until the use above. 3773 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3774 return int64(length), err 3775 } 3776 3777 // SizeBytes implements marshal.Marshallable.SizeBytes. 3778 func (f *FUSEInitIn) SizeBytes() int { 3779 return 16 3780 } 3781 3782 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3783 func (f *FUSEInitIn) MarshalBytes(dst []byte) []byte { 3784 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 3785 dst = dst[4:] 3786 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 3787 dst = dst[4:] 3788 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 3789 dst = dst[4:] 3790 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 3791 dst = dst[4:] 3792 return dst 3793 } 3794 3795 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3796 func (f *FUSEInitIn) UnmarshalBytes(src []byte) []byte { 3797 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3798 src = src[4:] 3799 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3800 src = src[4:] 3801 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3802 src = src[4:] 3803 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3804 src = src[4:] 3805 return src 3806 } 3807 3808 // Packed implements marshal.Marshallable.Packed. 3809 //go:nosplit 3810 func (f *FUSEInitIn) Packed() bool { 3811 return true 3812 } 3813 3814 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3815 func (f *FUSEInitIn) MarshalUnsafe(dst []byte) []byte { 3816 size := f.SizeBytes() 3817 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3818 return dst[size:] 3819 } 3820 3821 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3822 func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) []byte { 3823 size := f.SizeBytes() 3824 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3825 return src[size:] 3826 } 3827 3828 // CopyOutN implements marshal.Marshallable.CopyOutN. 3829 //go:nosplit 3830 func (f *FUSEInitIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3831 // Construct a slice backed by dst's underlying memory. 3832 var buf []byte 3833 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3834 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3835 hdr.Len = f.SizeBytes() 3836 hdr.Cap = f.SizeBytes() 3837 3838 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3839 // Since we bypassed the compiler's escape analysis, indicate that f 3840 // must live until the use above. 3841 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3842 return length, err 3843 } 3844 3845 // CopyOut implements marshal.Marshallable.CopyOut. 3846 //go:nosplit 3847 func (f *FUSEInitIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3848 return f.CopyOutN(cc, addr, f.SizeBytes()) 3849 } 3850 3851 // CopyIn implements marshal.Marshallable.CopyIn. 3852 //go:nosplit 3853 func (f *FUSEInitIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3854 // Construct a slice backed by dst's underlying memory. 3855 var buf []byte 3856 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3857 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3858 hdr.Len = f.SizeBytes() 3859 hdr.Cap = f.SizeBytes() 3860 3861 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3862 // Since we bypassed the compiler's escape analysis, indicate that f 3863 // must live until the use above. 3864 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3865 return length, err 3866 } 3867 3868 // WriteTo implements io.WriterTo.WriteTo. 3869 func (f *FUSEInitIn) WriteTo(writer io.Writer) (int64, error) { 3870 // Construct a slice backed by dst's underlying memory. 3871 var buf []byte 3872 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3873 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3874 hdr.Len = f.SizeBytes() 3875 hdr.Cap = f.SizeBytes() 3876 3877 length, err := writer.Write(buf) 3878 // Since we bypassed the compiler's escape analysis, indicate that f 3879 // must live until the use above. 3880 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3881 return int64(length), err 3882 } 3883 3884 // SizeBytes implements marshal.Marshallable.SizeBytes. 3885 func (f *FUSEInitOut) SizeBytes() int { 3886 return 32 + 3887 4*8 3888 } 3889 3890 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3891 func (f *FUSEInitOut) MarshalBytes(dst []byte) []byte { 3892 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 3893 dst = dst[4:] 3894 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 3895 dst = dst[4:] 3896 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 3897 dst = dst[4:] 3898 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 3899 dst = dst[4:] 3900 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxBackground)) 3901 dst = dst[2:] 3902 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.CongestionThreshold)) 3903 dst = dst[2:] 3904 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxWrite)) 3905 dst = dst[4:] 3906 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.TimeGran)) 3907 dst = dst[4:] 3908 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxPages)) 3909 dst = dst[2:] 3910 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 3911 dst = dst[2:] 3912 // Padding: dst[:sizeof(uint32)*8] ~= [8]uint32{0} 3913 dst = dst[4*(8):] 3914 return dst 3915 } 3916 3917 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3918 func (f *FUSEInitOut) UnmarshalBytes(src []byte) []byte { 3919 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3920 src = src[4:] 3921 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3922 src = src[4:] 3923 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3924 src = src[4:] 3925 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3926 src = src[4:] 3927 f.MaxBackground = uint16(hostarch.ByteOrder.Uint16(src[:2])) 3928 src = src[2:] 3929 f.CongestionThreshold = uint16(hostarch.ByteOrder.Uint16(src[:2])) 3930 src = src[2:] 3931 f.MaxWrite = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3932 src = src[4:] 3933 f.TimeGran = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3934 src = src[4:] 3935 f.MaxPages = uint16(hostarch.ByteOrder.Uint16(src[:2])) 3936 src = src[2:] 3937 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 3938 src = src[2:] 3939 // Padding: ~ copy([8]uint32(f._), src[:sizeof(uint32)*8]) 3940 src = src[4*(8):] 3941 return src 3942 } 3943 3944 // Packed implements marshal.Marshallable.Packed. 3945 //go:nosplit 3946 func (f *FUSEInitOut) Packed() bool { 3947 return true 3948 } 3949 3950 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3951 func (f *FUSEInitOut) MarshalUnsafe(dst []byte) []byte { 3952 size := f.SizeBytes() 3953 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3954 return dst[size:] 3955 } 3956 3957 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3958 func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) []byte { 3959 size := f.SizeBytes() 3960 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3961 return src[size:] 3962 } 3963 3964 // CopyOutN implements marshal.Marshallable.CopyOutN. 3965 //go:nosplit 3966 func (f *FUSEInitOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3967 // Construct a slice backed by dst's underlying memory. 3968 var buf []byte 3969 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3970 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3971 hdr.Len = f.SizeBytes() 3972 hdr.Cap = f.SizeBytes() 3973 3974 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3975 // Since we bypassed the compiler's escape analysis, indicate that f 3976 // must live until the use above. 3977 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3978 return length, err 3979 } 3980 3981 // CopyOut implements marshal.Marshallable.CopyOut. 3982 //go:nosplit 3983 func (f *FUSEInitOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3984 return f.CopyOutN(cc, addr, f.SizeBytes()) 3985 } 3986 3987 // CopyIn implements marshal.Marshallable.CopyIn. 3988 //go:nosplit 3989 func (f *FUSEInitOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3990 // Construct a slice backed by dst's underlying memory. 3991 var buf []byte 3992 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3993 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3994 hdr.Len = f.SizeBytes() 3995 hdr.Cap = f.SizeBytes() 3996 3997 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3998 // Since we bypassed the compiler's escape analysis, indicate that f 3999 // must live until the use above. 4000 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4001 return length, err 4002 } 4003 4004 // WriteTo implements io.WriterTo.WriteTo. 4005 func (f *FUSEInitOut) WriteTo(writer io.Writer) (int64, error) { 4006 // Construct a slice backed by dst's underlying memory. 4007 var buf []byte 4008 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4009 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4010 hdr.Len = f.SizeBytes() 4011 hdr.Cap = f.SizeBytes() 4012 4013 length, err := writer.Write(buf) 4014 // Since we bypassed the compiler's escape analysis, indicate that f 4015 // must live until the use above. 4016 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4017 return int64(length), err 4018 } 4019 4020 // Packed implements marshal.Marshallable.Packed. 4021 //go:nosplit 4022 func (r *FUSELookupIn) Packed() bool { 4023 // Type FUSELookupIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4024 return false 4025 } 4026 4027 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4028 func (r *FUSELookupIn) MarshalUnsafe(dst []byte) []byte { 4029 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4030 return r.MarshalBytes(dst) 4031 } 4032 4033 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4034 func (r *FUSELookupIn) UnmarshalUnsafe(src []byte) []byte { 4035 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4036 return r.UnmarshalBytes(src) 4037 } 4038 4039 // CopyOutN implements marshal.Marshallable.CopyOutN. 4040 //go:nosplit 4041 func (r *FUSELookupIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4042 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4043 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4044 r.MarshalBytes(buf) // escapes: fallback. 4045 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4046 } 4047 4048 // CopyOut implements marshal.Marshallable.CopyOut. 4049 //go:nosplit 4050 func (r *FUSELookupIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4051 return r.CopyOutN(cc, addr, r.SizeBytes()) 4052 } 4053 4054 // CopyIn implements marshal.Marshallable.CopyIn. 4055 //go:nosplit 4056 func (r *FUSELookupIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4057 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4058 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4059 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4060 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4061 // partially unmarshalled struct. 4062 r.UnmarshalBytes(buf) // escapes: fallback. 4063 return length, err 4064 } 4065 4066 // WriteTo implements io.WriterTo.WriteTo. 4067 func (r *FUSELookupIn) WriteTo(writer io.Writer) (int64, error) { 4068 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4069 buf := make([]byte, r.SizeBytes()) 4070 r.MarshalBytes(buf) 4071 length, err := writer.Write(buf) 4072 return int64(length), err 4073 } 4074 4075 // Packed implements marshal.Marshallable.Packed. 4076 //go:nosplit 4077 func (r *FUSEMkdirIn) Packed() bool { 4078 // Type FUSEMkdirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4079 return false 4080 } 4081 4082 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4083 func (r *FUSEMkdirIn) MarshalUnsafe(dst []byte) []byte { 4084 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4085 return r.MarshalBytes(dst) 4086 } 4087 4088 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4089 func (r *FUSEMkdirIn) UnmarshalUnsafe(src []byte) []byte { 4090 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4091 return r.UnmarshalBytes(src) 4092 } 4093 4094 // CopyOutN implements marshal.Marshallable.CopyOutN. 4095 //go:nosplit 4096 func (r *FUSEMkdirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4097 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4098 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4099 r.MarshalBytes(buf) // escapes: fallback. 4100 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4101 } 4102 4103 // CopyOut implements marshal.Marshallable.CopyOut. 4104 //go:nosplit 4105 func (r *FUSEMkdirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4106 return r.CopyOutN(cc, addr, r.SizeBytes()) 4107 } 4108 4109 // CopyIn implements marshal.Marshallable.CopyIn. 4110 //go:nosplit 4111 func (r *FUSEMkdirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4112 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4113 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4114 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4115 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4116 // partially unmarshalled struct. 4117 r.UnmarshalBytes(buf) // escapes: fallback. 4118 return length, err 4119 } 4120 4121 // WriteTo implements io.WriterTo.WriteTo. 4122 func (r *FUSEMkdirIn) WriteTo(writer io.Writer) (int64, error) { 4123 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4124 buf := make([]byte, r.SizeBytes()) 4125 r.MarshalBytes(buf) 4126 length, err := writer.Write(buf) 4127 return int64(length), err 4128 } 4129 4130 // SizeBytes implements marshal.Marshallable.SizeBytes. 4131 func (f *FUSEMkdirMeta) SizeBytes() int { 4132 return 8 4133 } 4134 4135 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4136 func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) []byte { 4137 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4138 dst = dst[4:] 4139 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4140 dst = dst[4:] 4141 return dst 4142 } 4143 4144 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4145 func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) []byte { 4146 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4147 src = src[4:] 4148 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4149 src = src[4:] 4150 return src 4151 } 4152 4153 // Packed implements marshal.Marshallable.Packed. 4154 //go:nosplit 4155 func (f *FUSEMkdirMeta) Packed() bool { 4156 return true 4157 } 4158 4159 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4160 func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) []byte { 4161 size := f.SizeBytes() 4162 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4163 return dst[size:] 4164 } 4165 4166 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4167 func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) []byte { 4168 size := f.SizeBytes() 4169 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4170 return src[size:] 4171 } 4172 4173 // CopyOutN implements marshal.Marshallable.CopyOutN. 4174 //go:nosplit 4175 func (f *FUSEMkdirMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4176 // Construct a slice backed by dst's underlying memory. 4177 var buf []byte 4178 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4179 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4180 hdr.Len = f.SizeBytes() 4181 hdr.Cap = f.SizeBytes() 4182 4183 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4184 // Since we bypassed the compiler's escape analysis, indicate that f 4185 // must live until the use above. 4186 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4187 return length, err 4188 } 4189 4190 // CopyOut implements marshal.Marshallable.CopyOut. 4191 //go:nosplit 4192 func (f *FUSEMkdirMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4193 return f.CopyOutN(cc, addr, f.SizeBytes()) 4194 } 4195 4196 // CopyIn implements marshal.Marshallable.CopyIn. 4197 //go:nosplit 4198 func (f *FUSEMkdirMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4199 // Construct a slice backed by dst's underlying memory. 4200 var buf []byte 4201 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4202 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4203 hdr.Len = f.SizeBytes() 4204 hdr.Cap = f.SizeBytes() 4205 4206 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4207 // Since we bypassed the compiler's escape analysis, indicate that f 4208 // must live until the use above. 4209 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4210 return length, err 4211 } 4212 4213 // WriteTo implements io.WriterTo.WriteTo. 4214 func (f *FUSEMkdirMeta) WriteTo(writer io.Writer) (int64, error) { 4215 // Construct a slice backed by dst's underlying memory. 4216 var buf []byte 4217 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4218 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4219 hdr.Len = f.SizeBytes() 4220 hdr.Cap = f.SizeBytes() 4221 4222 length, err := writer.Write(buf) 4223 // Since we bypassed the compiler's escape analysis, indicate that f 4224 // must live until the use above. 4225 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4226 return int64(length), err 4227 } 4228 4229 // Packed implements marshal.Marshallable.Packed. 4230 //go:nosplit 4231 func (r *FUSEMknodIn) Packed() bool { 4232 // Type FUSEMknodIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4233 return false 4234 } 4235 4236 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4237 func (r *FUSEMknodIn) MarshalUnsafe(dst []byte) []byte { 4238 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4239 return r.MarshalBytes(dst) 4240 } 4241 4242 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4243 func (r *FUSEMknodIn) UnmarshalUnsafe(src []byte) []byte { 4244 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4245 return r.UnmarshalBytes(src) 4246 } 4247 4248 // CopyOutN implements marshal.Marshallable.CopyOutN. 4249 //go:nosplit 4250 func (r *FUSEMknodIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4251 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4252 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4253 r.MarshalBytes(buf) // escapes: fallback. 4254 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4255 } 4256 4257 // CopyOut implements marshal.Marshallable.CopyOut. 4258 //go:nosplit 4259 func (r *FUSEMknodIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4260 return r.CopyOutN(cc, addr, r.SizeBytes()) 4261 } 4262 4263 // CopyIn implements marshal.Marshallable.CopyIn. 4264 //go:nosplit 4265 func (r *FUSEMknodIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4266 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4267 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4268 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4269 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4270 // partially unmarshalled struct. 4271 r.UnmarshalBytes(buf) // escapes: fallback. 4272 return length, err 4273 } 4274 4275 // WriteTo implements io.WriterTo.WriteTo. 4276 func (r *FUSEMknodIn) WriteTo(writer io.Writer) (int64, error) { 4277 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4278 buf := make([]byte, r.SizeBytes()) 4279 r.MarshalBytes(buf) 4280 length, err := writer.Write(buf) 4281 return int64(length), err 4282 } 4283 4284 // SizeBytes implements marshal.Marshallable.SizeBytes. 4285 func (f *FUSEMknodMeta) SizeBytes() int { 4286 return 16 4287 } 4288 4289 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4290 func (f *FUSEMknodMeta) MarshalBytes(dst []byte) []byte { 4291 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4292 dst = dst[4:] 4293 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev)) 4294 dst = dst[4:] 4295 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4296 dst = dst[4:] 4297 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4298 dst = dst[4:] 4299 return dst 4300 } 4301 4302 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4303 func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) []byte { 4304 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4305 src = src[4:] 4306 f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4307 src = src[4:] 4308 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4309 src = src[4:] 4310 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4311 src = src[4:] 4312 return src 4313 } 4314 4315 // Packed implements marshal.Marshallable.Packed. 4316 //go:nosplit 4317 func (f *FUSEMknodMeta) Packed() bool { 4318 return true 4319 } 4320 4321 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4322 func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) []byte { 4323 size := f.SizeBytes() 4324 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4325 return dst[size:] 4326 } 4327 4328 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4329 func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) []byte { 4330 size := f.SizeBytes() 4331 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4332 return src[size:] 4333 } 4334 4335 // CopyOutN implements marshal.Marshallable.CopyOutN. 4336 //go:nosplit 4337 func (f *FUSEMknodMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4338 // Construct a slice backed by dst's underlying memory. 4339 var buf []byte 4340 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4341 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4342 hdr.Len = f.SizeBytes() 4343 hdr.Cap = f.SizeBytes() 4344 4345 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4346 // Since we bypassed the compiler's escape analysis, indicate that f 4347 // must live until the use above. 4348 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4349 return length, err 4350 } 4351 4352 // CopyOut implements marshal.Marshallable.CopyOut. 4353 //go:nosplit 4354 func (f *FUSEMknodMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4355 return f.CopyOutN(cc, addr, f.SizeBytes()) 4356 } 4357 4358 // CopyIn implements marshal.Marshallable.CopyIn. 4359 //go:nosplit 4360 func (f *FUSEMknodMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4361 // Construct a slice backed by dst's underlying memory. 4362 var buf []byte 4363 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4364 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4365 hdr.Len = f.SizeBytes() 4366 hdr.Cap = f.SizeBytes() 4367 4368 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4369 // Since we bypassed the compiler's escape analysis, indicate that f 4370 // must live until the use above. 4371 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4372 return length, err 4373 } 4374 4375 // WriteTo implements io.WriterTo.WriteTo. 4376 func (f *FUSEMknodMeta) WriteTo(writer io.Writer) (int64, error) { 4377 // Construct a slice backed by dst's underlying memory. 4378 var buf []byte 4379 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4380 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4381 hdr.Len = f.SizeBytes() 4382 hdr.Cap = f.SizeBytes() 4383 4384 length, err := writer.Write(buf) 4385 // Since we bypassed the compiler's escape analysis, indicate that f 4386 // must live until the use above. 4387 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4388 return int64(length), err 4389 } 4390 4391 // SizeBytes implements marshal.Marshallable.SizeBytes. 4392 //go:nosplit 4393 func (f *FUSEOpID) SizeBytes() int { 4394 return 8 4395 } 4396 4397 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4398 func (f *FUSEOpID) MarshalBytes(dst []byte) []byte { 4399 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f)) 4400 return dst[8:] 4401 } 4402 4403 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4404 func (f *FUSEOpID) UnmarshalBytes(src []byte) []byte { 4405 *f = FUSEOpID(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 4406 return src[8:] 4407 } 4408 4409 // Packed implements marshal.Marshallable.Packed. 4410 //go:nosplit 4411 func (f *FUSEOpID) Packed() bool { 4412 // Scalar newtypes are always packed. 4413 return true 4414 } 4415 4416 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4417 func (f *FUSEOpID) MarshalUnsafe(dst []byte) []byte { 4418 size := f.SizeBytes() 4419 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4420 return dst[size:] 4421 } 4422 4423 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4424 func (f *FUSEOpID) UnmarshalUnsafe(src []byte) []byte { 4425 size := f.SizeBytes() 4426 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4427 return src[size:] 4428 } 4429 4430 // CopyOutN implements marshal.Marshallable.CopyOutN. 4431 //go:nosplit 4432 func (f *FUSEOpID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4433 // Construct a slice backed by dst's underlying memory. 4434 var buf []byte 4435 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4436 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4437 hdr.Len = f.SizeBytes() 4438 hdr.Cap = f.SizeBytes() 4439 4440 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4441 // Since we bypassed the compiler's escape analysis, indicate that f 4442 // must live until the use above. 4443 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4444 return length, err 4445 } 4446 4447 // CopyOut implements marshal.Marshallable.CopyOut. 4448 //go:nosplit 4449 func (f *FUSEOpID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4450 return f.CopyOutN(cc, addr, f.SizeBytes()) 4451 } 4452 4453 // CopyIn implements marshal.Marshallable.CopyIn. 4454 //go:nosplit 4455 func (f *FUSEOpID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4456 // Construct a slice backed by dst's underlying memory. 4457 var buf []byte 4458 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4459 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4460 hdr.Len = f.SizeBytes() 4461 hdr.Cap = f.SizeBytes() 4462 4463 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4464 // Since we bypassed the compiler's escape analysis, indicate that f 4465 // must live until the use above. 4466 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4467 return length, err 4468 } 4469 4470 // WriteTo implements io.WriterTo.WriteTo. 4471 func (f *FUSEOpID) WriteTo(writer io.Writer) (int64, error) { 4472 // Construct a slice backed by dst's underlying memory. 4473 var buf []byte 4474 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4475 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4476 hdr.Len = f.SizeBytes() 4477 hdr.Cap = f.SizeBytes() 4478 4479 length, err := writer.Write(buf) 4480 // Since we bypassed the compiler's escape analysis, indicate that f 4481 // must live until the use above. 4482 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4483 return int64(length), err 4484 } 4485 4486 // SizeBytes implements marshal.Marshallable.SizeBytes. 4487 //go:nosplit 4488 func (f *FUSEOpcode) SizeBytes() int { 4489 return 4 4490 } 4491 4492 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4493 func (f *FUSEOpcode) MarshalBytes(dst []byte) []byte { 4494 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f)) 4495 return dst[4:] 4496 } 4497 4498 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4499 func (f *FUSEOpcode) UnmarshalBytes(src []byte) []byte { 4500 *f = FUSEOpcode(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 4501 return src[4:] 4502 } 4503 4504 // Packed implements marshal.Marshallable.Packed. 4505 //go:nosplit 4506 func (f *FUSEOpcode) Packed() bool { 4507 // Scalar newtypes are always packed. 4508 return true 4509 } 4510 4511 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4512 func (f *FUSEOpcode) MarshalUnsafe(dst []byte) []byte { 4513 size := f.SizeBytes() 4514 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4515 return dst[size:] 4516 } 4517 4518 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4519 func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) []byte { 4520 size := f.SizeBytes() 4521 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4522 return src[size:] 4523 } 4524 4525 // CopyOutN implements marshal.Marshallable.CopyOutN. 4526 //go:nosplit 4527 func (f *FUSEOpcode) CopyOutN(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.CopyOutBytes(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 // CopyOut implements marshal.Marshallable.CopyOut. 4543 //go:nosplit 4544 func (f *FUSEOpcode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4545 return f.CopyOutN(cc, addr, f.SizeBytes()) 4546 } 4547 4548 // CopyIn implements marshal.Marshallable.CopyIn. 4549 //go:nosplit 4550 func (f *FUSEOpcode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4551 // Construct a slice backed by dst's underlying memory. 4552 var buf []byte 4553 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4554 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4555 hdr.Len = f.SizeBytes() 4556 hdr.Cap = f.SizeBytes() 4557 4558 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4559 // Since we bypassed the compiler's escape analysis, indicate that f 4560 // must live until the use above. 4561 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4562 return length, err 4563 } 4564 4565 // WriteTo implements io.WriterTo.WriteTo. 4566 func (f *FUSEOpcode) WriteTo(writer io.Writer) (int64, error) { 4567 // Construct a slice backed by dst's underlying memory. 4568 var buf []byte 4569 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4570 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4571 hdr.Len = f.SizeBytes() 4572 hdr.Cap = f.SizeBytes() 4573 4574 length, err := writer.Write(buf) 4575 // Since we bypassed the compiler's escape analysis, indicate that f 4576 // must live until the use above. 4577 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4578 return int64(length), err 4579 } 4580 4581 // SizeBytes implements marshal.Marshallable.SizeBytes. 4582 func (f *FUSEOpenIn) SizeBytes() int { 4583 return 8 4584 } 4585 4586 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4587 func (f *FUSEOpenIn) MarshalBytes(dst []byte) []byte { 4588 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4589 dst = dst[4:] 4590 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4591 dst = dst[4:] 4592 return dst 4593 } 4594 4595 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4596 func (f *FUSEOpenIn) UnmarshalBytes(src []byte) []byte { 4597 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4598 src = src[4:] 4599 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4600 src = src[4:] 4601 return src 4602 } 4603 4604 // Packed implements marshal.Marshallable.Packed. 4605 //go:nosplit 4606 func (f *FUSEOpenIn) Packed() bool { 4607 return true 4608 } 4609 4610 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4611 func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) []byte { 4612 size := f.SizeBytes() 4613 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4614 return dst[size:] 4615 } 4616 4617 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4618 func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) []byte { 4619 size := f.SizeBytes() 4620 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4621 return src[size:] 4622 } 4623 4624 // CopyOutN implements marshal.Marshallable.CopyOutN. 4625 //go:nosplit 4626 func (f *FUSEOpenIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4627 // Construct a slice backed by dst's underlying memory. 4628 var buf []byte 4629 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4630 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4631 hdr.Len = f.SizeBytes() 4632 hdr.Cap = f.SizeBytes() 4633 4634 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4635 // Since we bypassed the compiler's escape analysis, indicate that f 4636 // must live until the use above. 4637 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4638 return length, err 4639 } 4640 4641 // CopyOut implements marshal.Marshallable.CopyOut. 4642 //go:nosplit 4643 func (f *FUSEOpenIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4644 return f.CopyOutN(cc, addr, f.SizeBytes()) 4645 } 4646 4647 // CopyIn implements marshal.Marshallable.CopyIn. 4648 //go:nosplit 4649 func (f *FUSEOpenIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4650 // Construct a slice backed by dst's underlying memory. 4651 var buf []byte 4652 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4653 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4654 hdr.Len = f.SizeBytes() 4655 hdr.Cap = f.SizeBytes() 4656 4657 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4658 // Since we bypassed the compiler's escape analysis, indicate that f 4659 // must live until the use above. 4660 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4661 return length, err 4662 } 4663 4664 // WriteTo implements io.WriterTo.WriteTo. 4665 func (f *FUSEOpenIn) WriteTo(writer io.Writer) (int64, 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 := writer.Write(buf) 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 int64(length), err 4678 } 4679 4680 // SizeBytes implements marshal.Marshallable.SizeBytes. 4681 func (f *FUSEOpenOut) SizeBytes() int { 4682 return 16 4683 } 4684 4685 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4686 func (f *FUSEOpenOut) MarshalBytes(dst []byte) []byte { 4687 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 4688 dst = dst[8:] 4689 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.OpenFlag)) 4690 dst = dst[4:] 4691 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4692 dst = dst[4:] 4693 return dst 4694 } 4695 4696 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4697 func (f *FUSEOpenOut) UnmarshalBytes(src []byte) []byte { 4698 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4699 src = src[8:] 4700 f.OpenFlag = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4701 src = src[4:] 4702 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4703 src = src[4:] 4704 return src 4705 } 4706 4707 // Packed implements marshal.Marshallable.Packed. 4708 //go:nosplit 4709 func (f *FUSEOpenOut) Packed() bool { 4710 return true 4711 } 4712 4713 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4714 func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) []byte { 4715 size := f.SizeBytes() 4716 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4717 return dst[size:] 4718 } 4719 4720 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4721 func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) []byte { 4722 size := f.SizeBytes() 4723 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4724 return src[size:] 4725 } 4726 4727 // CopyOutN implements marshal.Marshallable.CopyOutN. 4728 //go:nosplit 4729 func (f *FUSEOpenOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4730 // Construct a slice backed by dst's underlying memory. 4731 var buf []byte 4732 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4733 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4734 hdr.Len = f.SizeBytes() 4735 hdr.Cap = f.SizeBytes() 4736 4737 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4738 // Since we bypassed the compiler's escape analysis, indicate that f 4739 // must live until the use above. 4740 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4741 return length, err 4742 } 4743 4744 // CopyOut implements marshal.Marshallable.CopyOut. 4745 //go:nosplit 4746 func (f *FUSEOpenOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4747 return f.CopyOutN(cc, addr, f.SizeBytes()) 4748 } 4749 4750 // CopyIn implements marshal.Marshallable.CopyIn. 4751 //go:nosplit 4752 func (f *FUSEOpenOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4753 // Construct a slice backed by dst's underlying memory. 4754 var buf []byte 4755 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4756 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4757 hdr.Len = f.SizeBytes() 4758 hdr.Cap = f.SizeBytes() 4759 4760 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4761 // Since we bypassed the compiler's escape analysis, indicate that f 4762 // must live until the use above. 4763 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4764 return length, err 4765 } 4766 4767 // WriteTo implements io.WriterTo.WriteTo. 4768 func (f *FUSEOpenOut) WriteTo(writer io.Writer) (int64, error) { 4769 // Construct a slice backed by dst's underlying memory. 4770 var buf []byte 4771 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4772 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4773 hdr.Len = f.SizeBytes() 4774 hdr.Cap = f.SizeBytes() 4775 4776 length, err := writer.Write(buf) 4777 // Since we bypassed the compiler's escape analysis, indicate that f 4778 // must live until the use above. 4779 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4780 return int64(length), err 4781 } 4782 4783 // SizeBytes implements marshal.Marshallable.SizeBytes. 4784 func (f *FUSEReadIn) SizeBytes() int { 4785 return 40 4786 } 4787 4788 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4789 func (f *FUSEReadIn) MarshalBytes(dst []byte) []byte { 4790 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 4791 dst = dst[8:] 4792 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 4793 dst = dst[8:] 4794 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 4795 dst = dst[4:] 4796 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReadFlags)) 4797 dst = dst[4:] 4798 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 4799 dst = dst[8:] 4800 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4801 dst = dst[4:] 4802 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4803 dst = dst[4:] 4804 return dst 4805 } 4806 4807 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4808 func (f *FUSEReadIn) UnmarshalBytes(src []byte) []byte { 4809 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4810 src = src[8:] 4811 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4812 src = src[8:] 4813 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4814 src = src[4:] 4815 f.ReadFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4816 src = src[4:] 4817 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4818 src = src[8:] 4819 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4820 src = src[4:] 4821 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4822 src = src[4:] 4823 return src 4824 } 4825 4826 // Packed implements marshal.Marshallable.Packed. 4827 //go:nosplit 4828 func (f *FUSEReadIn) Packed() bool { 4829 return true 4830 } 4831 4832 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4833 func (f *FUSEReadIn) MarshalUnsafe(dst []byte) []byte { 4834 size := f.SizeBytes() 4835 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4836 return dst[size:] 4837 } 4838 4839 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4840 func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) []byte { 4841 size := f.SizeBytes() 4842 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4843 return src[size:] 4844 } 4845 4846 // CopyOutN implements marshal.Marshallable.CopyOutN. 4847 //go:nosplit 4848 func (f *FUSEReadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4849 // Construct a slice backed by dst's underlying memory. 4850 var buf []byte 4851 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4852 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4853 hdr.Len = f.SizeBytes() 4854 hdr.Cap = f.SizeBytes() 4855 4856 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4857 // Since we bypassed the compiler's escape analysis, indicate that f 4858 // must live until the use above. 4859 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4860 return length, err 4861 } 4862 4863 // CopyOut implements marshal.Marshallable.CopyOut. 4864 //go:nosplit 4865 func (f *FUSEReadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4866 return f.CopyOutN(cc, addr, f.SizeBytes()) 4867 } 4868 4869 // CopyIn implements marshal.Marshallable.CopyIn. 4870 //go:nosplit 4871 func (f *FUSEReadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4872 // Construct a slice backed by dst's underlying memory. 4873 var buf []byte 4874 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4875 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4876 hdr.Len = f.SizeBytes() 4877 hdr.Cap = f.SizeBytes() 4878 4879 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4880 // Since we bypassed the compiler's escape analysis, indicate that f 4881 // must live until the use above. 4882 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4883 return length, err 4884 } 4885 4886 // WriteTo implements io.WriterTo.WriteTo. 4887 func (f *FUSEReadIn) WriteTo(writer io.Writer) (int64, error) { 4888 // Construct a slice backed by dst's underlying memory. 4889 var buf []byte 4890 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4891 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4892 hdr.Len = f.SizeBytes() 4893 hdr.Cap = f.SizeBytes() 4894 4895 length, err := writer.Write(buf) 4896 // Since we bypassed the compiler's escape analysis, indicate that f 4897 // must live until the use above. 4898 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4899 return int64(length), err 4900 } 4901 4902 // SizeBytes implements marshal.Marshallable.SizeBytes. 4903 func (f *FUSEReleaseIn) SizeBytes() int { 4904 return 24 4905 } 4906 4907 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4908 func (f *FUSEReleaseIn) MarshalBytes(dst []byte) []byte { 4909 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 4910 dst = dst[8:] 4911 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4912 dst = dst[4:] 4913 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReleaseFlags)) 4914 dst = dst[4:] 4915 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 4916 dst = dst[8:] 4917 return dst 4918 } 4919 4920 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4921 func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) []byte { 4922 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4923 src = src[8:] 4924 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4925 src = src[4:] 4926 f.ReleaseFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4927 src = src[4:] 4928 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4929 src = src[8:] 4930 return src 4931 } 4932 4933 // Packed implements marshal.Marshallable.Packed. 4934 //go:nosplit 4935 func (f *FUSEReleaseIn) Packed() bool { 4936 return true 4937 } 4938 4939 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4940 func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) []byte { 4941 size := f.SizeBytes() 4942 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4943 return dst[size:] 4944 } 4945 4946 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4947 func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) []byte { 4948 size := f.SizeBytes() 4949 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4950 return src[size:] 4951 } 4952 4953 // CopyOutN implements marshal.Marshallable.CopyOutN. 4954 //go:nosplit 4955 func (f *FUSEReleaseIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4956 // Construct a slice backed by dst's underlying memory. 4957 var buf []byte 4958 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4959 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4960 hdr.Len = f.SizeBytes() 4961 hdr.Cap = f.SizeBytes() 4962 4963 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4964 // Since we bypassed the compiler's escape analysis, indicate that f 4965 // must live until the use above. 4966 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4967 return length, err 4968 } 4969 4970 // CopyOut implements marshal.Marshallable.CopyOut. 4971 //go:nosplit 4972 func (f *FUSEReleaseIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4973 return f.CopyOutN(cc, addr, f.SizeBytes()) 4974 } 4975 4976 // CopyIn implements marshal.Marshallable.CopyIn. 4977 //go:nosplit 4978 func (f *FUSEReleaseIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4979 // Construct a slice backed by dst's underlying memory. 4980 var buf []byte 4981 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4982 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4983 hdr.Len = f.SizeBytes() 4984 hdr.Cap = f.SizeBytes() 4985 4986 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4987 // Since we bypassed the compiler's escape analysis, indicate that f 4988 // must live until the use above. 4989 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4990 return length, err 4991 } 4992 4993 // WriteTo implements io.WriterTo.WriteTo. 4994 func (f *FUSEReleaseIn) WriteTo(writer io.Writer) (int64, error) { 4995 // Construct a slice backed by dst's underlying memory. 4996 var buf []byte 4997 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4998 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4999 hdr.Len = f.SizeBytes() 5000 hdr.Cap = f.SizeBytes() 5001 5002 length, err := writer.Write(buf) 5003 // Since we bypassed the compiler's escape analysis, indicate that f 5004 // must live until the use above. 5005 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5006 return int64(length), err 5007 } 5008 5009 // Packed implements marshal.Marshallable.Packed. 5010 //go:nosplit 5011 func (r *FUSERmDirIn) Packed() bool { 5012 // Type FUSERmDirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5013 return false 5014 } 5015 5016 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5017 func (r *FUSERmDirIn) MarshalUnsafe(dst []byte) []byte { 5018 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5019 return r.MarshalBytes(dst) 5020 } 5021 5022 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5023 func (r *FUSERmDirIn) UnmarshalUnsafe(src []byte) []byte { 5024 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5025 return r.UnmarshalBytes(src) 5026 } 5027 5028 // CopyOutN implements marshal.Marshallable.CopyOutN. 5029 //go:nosplit 5030 func (r *FUSERmDirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5031 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5032 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5033 r.MarshalBytes(buf) // escapes: fallback. 5034 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5035 } 5036 5037 // CopyOut implements marshal.Marshallable.CopyOut. 5038 //go:nosplit 5039 func (r *FUSERmDirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5040 return r.CopyOutN(cc, addr, r.SizeBytes()) 5041 } 5042 5043 // CopyIn implements marshal.Marshallable.CopyIn. 5044 //go:nosplit 5045 func (r *FUSERmDirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5046 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5047 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5048 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5049 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5050 // partially unmarshalled struct. 5051 r.UnmarshalBytes(buf) // escapes: fallback. 5052 return length, err 5053 } 5054 5055 // WriteTo implements io.WriterTo.WriteTo. 5056 func (r *FUSERmDirIn) WriteTo(writer io.Writer) (int64, error) { 5057 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5058 buf := make([]byte, r.SizeBytes()) 5059 r.MarshalBytes(buf) 5060 length, err := writer.Write(buf) 5061 return int64(length), err 5062 } 5063 5064 // SizeBytes implements marshal.Marshallable.SizeBytes. 5065 func (f *FUSESetAttrIn) SizeBytes() int { 5066 return 88 5067 } 5068 5069 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5070 func (f *FUSESetAttrIn) MarshalBytes(dst []byte) []byte { 5071 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Valid)) 5072 dst = dst[4:] 5073 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5074 dst = dst[4:] 5075 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5076 dst = dst[8:] 5077 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size)) 5078 dst = dst[8:] 5079 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5080 dst = dst[8:] 5081 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Atime)) 5082 dst = dst[8:] 5083 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mtime)) 5084 dst = dst[8:] 5085 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ctime)) 5086 dst = dst[8:] 5087 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AtimeNsec)) 5088 dst = dst[4:] 5089 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MtimeNsec)) 5090 dst = dst[4:] 5091 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.CtimeNsec)) 5092 dst = dst[4:] 5093 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5094 dst = dst[4:] 5095 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5096 dst = dst[4:] 5097 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 5098 dst = dst[4:] 5099 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 5100 dst = dst[4:] 5101 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5102 dst = dst[4:] 5103 return dst 5104 } 5105 5106 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5107 func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) []byte { 5108 f.Valid = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5109 src = src[4:] 5110 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5111 src = src[4:] 5112 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5113 src = src[8:] 5114 f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5115 src = src[8:] 5116 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5117 src = src[8:] 5118 f.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5119 src = src[8:] 5120 f.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5121 src = src[8:] 5122 f.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5123 src = src[8:] 5124 f.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5125 src = src[4:] 5126 f.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5127 src = src[4:] 5128 f.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5129 src = src[4:] 5130 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5131 src = src[4:] 5132 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5133 src = src[4:] 5134 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5135 src = src[4:] 5136 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5137 src = src[4:] 5138 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5139 src = src[4:] 5140 return src 5141 } 5142 5143 // Packed implements marshal.Marshallable.Packed. 5144 //go:nosplit 5145 func (f *FUSESetAttrIn) Packed() bool { 5146 return true 5147 } 5148 5149 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5150 func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) []byte { 5151 size := f.SizeBytes() 5152 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5153 return dst[size:] 5154 } 5155 5156 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5157 func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) []byte { 5158 size := f.SizeBytes() 5159 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5160 return src[size:] 5161 } 5162 5163 // CopyOutN implements marshal.Marshallable.CopyOutN. 5164 //go:nosplit 5165 func (f *FUSESetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5166 // Construct a slice backed by dst's underlying memory. 5167 var buf []byte 5168 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5169 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5170 hdr.Len = f.SizeBytes() 5171 hdr.Cap = f.SizeBytes() 5172 5173 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5174 // Since we bypassed the compiler's escape analysis, indicate that f 5175 // must live until the use above. 5176 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5177 return length, err 5178 } 5179 5180 // CopyOut implements marshal.Marshallable.CopyOut. 5181 //go:nosplit 5182 func (f *FUSESetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5183 return f.CopyOutN(cc, addr, f.SizeBytes()) 5184 } 5185 5186 // CopyIn implements marshal.Marshallable.CopyIn. 5187 //go:nosplit 5188 func (f *FUSESetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5189 // Construct a slice backed by dst's underlying memory. 5190 var buf []byte 5191 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5192 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5193 hdr.Len = f.SizeBytes() 5194 hdr.Cap = f.SizeBytes() 5195 5196 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5197 // Since we bypassed the compiler's escape analysis, indicate that f 5198 // must live until the use above. 5199 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5200 return length, err 5201 } 5202 5203 // WriteTo implements io.WriterTo.WriteTo. 5204 func (f *FUSESetAttrIn) WriteTo(writer io.Writer) (int64, error) { 5205 // Construct a slice backed by dst's underlying memory. 5206 var buf []byte 5207 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5208 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5209 hdr.Len = f.SizeBytes() 5210 hdr.Cap = f.SizeBytes() 5211 5212 length, err := writer.Write(buf) 5213 // Since we bypassed the compiler's escape analysis, indicate that f 5214 // must live until the use above. 5215 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5216 return int64(length), err 5217 } 5218 5219 // Packed implements marshal.Marshallable.Packed. 5220 //go:nosplit 5221 func (r *FUSESymlinkIn) Packed() bool { 5222 // Type FUSESymlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5223 return false 5224 } 5225 5226 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5227 func (r *FUSESymlinkIn) MarshalUnsafe(dst []byte) []byte { 5228 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5229 return r.MarshalBytes(dst) 5230 } 5231 5232 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5233 func (r *FUSESymlinkIn) UnmarshalUnsafe(src []byte) []byte { 5234 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5235 return r.UnmarshalBytes(src) 5236 } 5237 5238 // CopyOutN implements marshal.Marshallable.CopyOutN. 5239 //go:nosplit 5240 func (r *FUSESymlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5241 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5242 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5243 r.MarshalBytes(buf) // escapes: fallback. 5244 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5245 } 5246 5247 // CopyOut implements marshal.Marshallable.CopyOut. 5248 //go:nosplit 5249 func (r *FUSESymlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5250 return r.CopyOutN(cc, addr, r.SizeBytes()) 5251 } 5252 5253 // CopyIn implements marshal.Marshallable.CopyIn. 5254 //go:nosplit 5255 func (r *FUSESymlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5256 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5257 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5258 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5259 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5260 // partially unmarshalled struct. 5261 r.UnmarshalBytes(buf) // escapes: fallback. 5262 return length, err 5263 } 5264 5265 // WriteTo implements io.WriterTo.WriteTo. 5266 func (r *FUSESymlinkIn) WriteTo(writer io.Writer) (int64, error) { 5267 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5268 buf := make([]byte, r.SizeBytes()) 5269 r.MarshalBytes(buf) 5270 length, err := writer.Write(buf) 5271 return int64(length), err 5272 } 5273 5274 // Packed implements marshal.Marshallable.Packed. 5275 //go:nosplit 5276 func (r *FUSEUnlinkIn) Packed() bool { 5277 // Type FUSEUnlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5278 return false 5279 } 5280 5281 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5282 func (r *FUSEUnlinkIn) MarshalUnsafe(dst []byte) []byte { 5283 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5284 return r.MarshalBytes(dst) 5285 } 5286 5287 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5288 func (r *FUSEUnlinkIn) UnmarshalUnsafe(src []byte) []byte { 5289 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5290 return r.UnmarshalBytes(src) 5291 } 5292 5293 // CopyOutN implements marshal.Marshallable.CopyOutN. 5294 //go:nosplit 5295 func (r *FUSEUnlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5296 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5297 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5298 r.MarshalBytes(buf) // escapes: fallback. 5299 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5300 } 5301 5302 // CopyOut implements marshal.Marshallable.CopyOut. 5303 //go:nosplit 5304 func (r *FUSEUnlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5305 return r.CopyOutN(cc, addr, r.SizeBytes()) 5306 } 5307 5308 // CopyIn implements marshal.Marshallable.CopyIn. 5309 //go:nosplit 5310 func (r *FUSEUnlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5311 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5312 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5313 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5314 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5315 // partially unmarshalled struct. 5316 r.UnmarshalBytes(buf) // escapes: fallback. 5317 return length, err 5318 } 5319 5320 // WriteTo implements io.WriterTo.WriteTo. 5321 func (r *FUSEUnlinkIn) WriteTo(writer io.Writer) (int64, error) { 5322 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5323 buf := make([]byte, r.SizeBytes()) 5324 r.MarshalBytes(buf) 5325 length, err := writer.Write(buf) 5326 return int64(length), err 5327 } 5328 5329 // SizeBytes implements marshal.Marshallable.SizeBytes. 5330 func (f *FUSEWriteIn) SizeBytes() int { 5331 return 40 5332 } 5333 5334 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5335 func (f *FUSEWriteIn) MarshalBytes(dst []byte) []byte { 5336 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5337 dst = dst[8:] 5338 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5339 dst = dst[8:] 5340 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5341 dst = dst[4:] 5342 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.WriteFlags)) 5343 dst = dst[4:] 5344 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5345 dst = dst[8:] 5346 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5347 dst = dst[4:] 5348 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5349 dst = dst[4:] 5350 return dst 5351 } 5352 5353 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5354 func (f *FUSEWriteIn) UnmarshalBytes(src []byte) []byte { 5355 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5356 src = src[8:] 5357 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5358 src = src[8:] 5359 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5360 src = src[4:] 5361 f.WriteFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5362 src = src[4:] 5363 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5364 src = src[8:] 5365 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5366 src = src[4:] 5367 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5368 src = src[4:] 5369 return src 5370 } 5371 5372 // Packed implements marshal.Marshallable.Packed. 5373 //go:nosplit 5374 func (f *FUSEWriteIn) Packed() bool { 5375 return true 5376 } 5377 5378 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5379 func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) []byte { 5380 size := f.SizeBytes() 5381 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5382 return dst[size:] 5383 } 5384 5385 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5386 func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) []byte { 5387 size := f.SizeBytes() 5388 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5389 return src[size:] 5390 } 5391 5392 // CopyOutN implements marshal.Marshallable.CopyOutN. 5393 //go:nosplit 5394 func (f *FUSEWriteIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5395 // Construct a slice backed by dst's underlying memory. 5396 var buf []byte 5397 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5398 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5399 hdr.Len = f.SizeBytes() 5400 hdr.Cap = f.SizeBytes() 5401 5402 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5403 // Since we bypassed the compiler's escape analysis, indicate that f 5404 // must live until the use above. 5405 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5406 return length, err 5407 } 5408 5409 // CopyOut implements marshal.Marshallable.CopyOut. 5410 //go:nosplit 5411 func (f *FUSEWriteIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5412 return f.CopyOutN(cc, addr, f.SizeBytes()) 5413 } 5414 5415 // CopyIn implements marshal.Marshallable.CopyIn. 5416 //go:nosplit 5417 func (f *FUSEWriteIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5418 // Construct a slice backed by dst's underlying memory. 5419 var buf []byte 5420 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5421 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5422 hdr.Len = f.SizeBytes() 5423 hdr.Cap = f.SizeBytes() 5424 5425 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5426 // Since we bypassed the compiler's escape analysis, indicate that f 5427 // must live until the use above. 5428 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5429 return length, err 5430 } 5431 5432 // WriteTo implements io.WriterTo.WriteTo. 5433 func (f *FUSEWriteIn) WriteTo(writer io.Writer) (int64, error) { 5434 // Construct a slice backed by dst's underlying memory. 5435 var buf []byte 5436 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5437 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5438 hdr.Len = f.SizeBytes() 5439 hdr.Cap = f.SizeBytes() 5440 5441 length, err := writer.Write(buf) 5442 // Since we bypassed the compiler's escape analysis, indicate that f 5443 // must live until the use above. 5444 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5445 return int64(length), err 5446 } 5447 5448 // SizeBytes implements marshal.Marshallable.SizeBytes. 5449 func (f *FUSEWriteOut) SizeBytes() int { 5450 return 8 5451 } 5452 5453 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5454 func (f *FUSEWriteOut) MarshalBytes(dst []byte) []byte { 5455 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5456 dst = dst[4:] 5457 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5458 dst = dst[4:] 5459 return dst 5460 } 5461 5462 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5463 func (f *FUSEWriteOut) UnmarshalBytes(src []byte) []byte { 5464 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5465 src = src[4:] 5466 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5467 src = src[4:] 5468 return src 5469 } 5470 5471 // Packed implements marshal.Marshallable.Packed. 5472 //go:nosplit 5473 func (f *FUSEWriteOut) Packed() bool { 5474 return true 5475 } 5476 5477 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5478 func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) []byte { 5479 size := f.SizeBytes() 5480 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5481 return dst[size:] 5482 } 5483 5484 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5485 func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) []byte { 5486 size := f.SizeBytes() 5487 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5488 return src[size:] 5489 } 5490 5491 // CopyOutN implements marshal.Marshallable.CopyOutN. 5492 //go:nosplit 5493 func (f *FUSEWriteOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5494 // Construct a slice backed by dst's underlying memory. 5495 var buf []byte 5496 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5497 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5498 hdr.Len = f.SizeBytes() 5499 hdr.Cap = f.SizeBytes() 5500 5501 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5502 // Since we bypassed the compiler's escape analysis, indicate that f 5503 // must live until the use above. 5504 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5505 return length, err 5506 } 5507 5508 // CopyOut implements marshal.Marshallable.CopyOut. 5509 //go:nosplit 5510 func (f *FUSEWriteOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5511 return f.CopyOutN(cc, addr, f.SizeBytes()) 5512 } 5513 5514 // CopyIn implements marshal.Marshallable.CopyIn. 5515 //go:nosplit 5516 func (f *FUSEWriteOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5517 // Construct a slice backed by dst's underlying memory. 5518 var buf []byte 5519 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5520 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5521 hdr.Len = f.SizeBytes() 5522 hdr.Cap = f.SizeBytes() 5523 5524 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5525 // Since we bypassed the compiler's escape analysis, indicate that f 5526 // must live until the use above. 5527 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5528 return length, err 5529 } 5530 5531 // WriteTo implements io.WriterTo.WriteTo. 5532 func (f *FUSEWriteOut) 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 (r *RobustListHead) SizeBytes() int { 5549 return 24 5550 } 5551 5552 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5553 func (r *RobustListHead) MarshalBytes(dst []byte) []byte { 5554 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.List)) 5555 dst = dst[8:] 5556 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.FutexOffset)) 5557 dst = dst[8:] 5558 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ListOpPending)) 5559 dst = dst[8:] 5560 return dst 5561 } 5562 5563 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5564 func (r *RobustListHead) UnmarshalBytes(src []byte) []byte { 5565 r.List = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5566 src = src[8:] 5567 r.FutexOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5568 src = src[8:] 5569 r.ListOpPending = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5570 src = src[8:] 5571 return src 5572 } 5573 5574 // Packed implements marshal.Marshallable.Packed. 5575 //go:nosplit 5576 func (r *RobustListHead) Packed() bool { 5577 return true 5578 } 5579 5580 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5581 func (r *RobustListHead) MarshalUnsafe(dst []byte) []byte { 5582 size := r.SizeBytes() 5583 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 5584 return dst[size:] 5585 } 5586 5587 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5588 func (r *RobustListHead) UnmarshalUnsafe(src []byte) []byte { 5589 size := r.SizeBytes() 5590 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 5591 return src[size:] 5592 } 5593 5594 // CopyOutN implements marshal.Marshallable.CopyOutN. 5595 //go:nosplit 5596 func (r *RobustListHead) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5597 // Construct a slice backed by dst's underlying memory. 5598 var buf []byte 5599 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5600 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 5601 hdr.Len = r.SizeBytes() 5602 hdr.Cap = r.SizeBytes() 5603 5604 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5605 // Since we bypassed the compiler's escape analysis, indicate that r 5606 // must live until the use above. 5607 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 5608 return length, err 5609 } 5610 5611 // CopyOut implements marshal.Marshallable.CopyOut. 5612 //go:nosplit 5613 func (r *RobustListHead) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5614 return r.CopyOutN(cc, addr, r.SizeBytes()) 5615 } 5616 5617 // CopyIn implements marshal.Marshallable.CopyIn. 5618 //go:nosplit 5619 func (r *RobustListHead) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5620 // Construct a slice backed by dst's underlying memory. 5621 var buf []byte 5622 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5623 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 5624 hdr.Len = r.SizeBytes() 5625 hdr.Cap = r.SizeBytes() 5626 5627 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5628 // Since we bypassed the compiler's escape analysis, indicate that r 5629 // must live until the use above. 5630 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 5631 return length, err 5632 } 5633 5634 // WriteTo implements io.WriterTo.WriteTo. 5635 func (r *RobustListHead) WriteTo(writer io.Writer) (int64, error) { 5636 // Construct a slice backed by dst's underlying memory. 5637 var buf []byte 5638 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5639 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 5640 hdr.Len = r.SizeBytes() 5641 hdr.Cap = r.SizeBytes() 5642 5643 length, err := writer.Write(buf) 5644 // Since we bypassed the compiler's escape analysis, indicate that r 5645 // must live until the use above. 5646 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 5647 return int64(length), err 5648 } 5649 5650 // SizeBytes implements marshal.Marshallable.SizeBytes. 5651 func (d *DigestMetadata) SizeBytes() int { 5652 return 4 5653 } 5654 5655 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5656 func (d *DigestMetadata) MarshalBytes(dst []byte) []byte { 5657 hostarch.ByteOrder.PutUint16(dst[:2], uint16(d.DigestAlgorithm)) 5658 dst = dst[2:] 5659 hostarch.ByteOrder.PutUint16(dst[:2], uint16(d.DigestSize)) 5660 dst = dst[2:] 5661 return dst 5662 } 5663 5664 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5665 func (d *DigestMetadata) UnmarshalBytes(src []byte) []byte { 5666 d.DigestAlgorithm = uint16(hostarch.ByteOrder.Uint16(src[:2])) 5667 src = src[2:] 5668 d.DigestSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 5669 src = src[2:] 5670 return src 5671 } 5672 5673 // Packed implements marshal.Marshallable.Packed. 5674 //go:nosplit 5675 func (d *DigestMetadata) Packed() bool { 5676 return true 5677 } 5678 5679 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5680 func (d *DigestMetadata) MarshalUnsafe(dst []byte) []byte { 5681 size := d.SizeBytes() 5682 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(d), uintptr(size)) 5683 return dst[size:] 5684 } 5685 5686 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5687 func (d *DigestMetadata) UnmarshalUnsafe(src []byte) []byte { 5688 size := d.SizeBytes() 5689 gohacks.Memmove(unsafe.Pointer(d), unsafe.Pointer(&src[0]), uintptr(size)) 5690 return src[size:] 5691 } 5692 5693 // CopyOutN implements marshal.Marshallable.CopyOutN. 5694 //go:nosplit 5695 func (d *DigestMetadata) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5696 // Construct a slice backed by dst's underlying memory. 5697 var buf []byte 5698 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5699 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(d))) 5700 hdr.Len = d.SizeBytes() 5701 hdr.Cap = d.SizeBytes() 5702 5703 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5704 // Since we bypassed the compiler's escape analysis, indicate that d 5705 // must live until the use above. 5706 runtime.KeepAlive(d) // escapes: replaced by intrinsic. 5707 return length, err 5708 } 5709 5710 // CopyOut implements marshal.Marshallable.CopyOut. 5711 //go:nosplit 5712 func (d *DigestMetadata) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5713 return d.CopyOutN(cc, addr, d.SizeBytes()) 5714 } 5715 5716 // CopyIn implements marshal.Marshallable.CopyIn. 5717 //go:nosplit 5718 func (d *DigestMetadata) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5719 // Construct a slice backed by dst's underlying memory. 5720 var buf []byte 5721 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5722 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(d))) 5723 hdr.Len = d.SizeBytes() 5724 hdr.Cap = d.SizeBytes() 5725 5726 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5727 // Since we bypassed the compiler's escape analysis, indicate that d 5728 // must live until the use above. 5729 runtime.KeepAlive(d) // escapes: replaced by intrinsic. 5730 return length, err 5731 } 5732 5733 // WriteTo implements io.WriterTo.WriteTo. 5734 func (d *DigestMetadata) WriteTo(writer io.Writer) (int64, error) { 5735 // Construct a slice backed by dst's underlying memory. 5736 var buf []byte 5737 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5738 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(d))) 5739 hdr.Len = d.SizeBytes() 5740 hdr.Cap = d.SizeBytes() 5741 5742 length, err := writer.Write(buf) 5743 // Since we bypassed the compiler's escape analysis, indicate that d 5744 // must live until the use above. 5745 runtime.KeepAlive(d) // escapes: replaced by intrinsic. 5746 return int64(length), err 5747 } 5748 5749 // SizeBytes implements marshal.Marshallable.SizeBytes. 5750 func (i *IPCPerm) SizeBytes() int { 5751 return 48 5752 } 5753 5754 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5755 func (i *IPCPerm) MarshalBytes(dst []byte) []byte { 5756 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 5757 dst = dst[4:] 5758 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 5759 dst = dst[4:] 5760 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 5761 dst = dst[4:] 5762 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CUID)) 5763 dst = dst[4:] 5764 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CGID)) 5765 dst = dst[4:] 5766 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Mode)) 5767 dst = dst[2:] 5768 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 5769 dst = dst[2:] 5770 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Seq)) 5771 dst = dst[2:] 5772 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 5773 dst = dst[2:] 5774 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5775 dst = dst[4:] 5776 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused1)) 5777 dst = dst[8:] 5778 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused2)) 5779 dst = dst[8:] 5780 return dst 5781 } 5782 5783 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5784 func (i *IPCPerm) UnmarshalBytes(src []byte) []byte { 5785 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5786 src = src[4:] 5787 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5788 src = src[4:] 5789 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5790 src = src[4:] 5791 i.CUID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5792 src = src[4:] 5793 i.CGID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5794 src = src[4:] 5795 i.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 5796 src = src[2:] 5797 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 5798 src = src[2:] 5799 i.Seq = uint16(hostarch.ByteOrder.Uint16(src[:2])) 5800 src = src[2:] 5801 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 5802 src = src[2:] 5803 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5804 src = src[4:] 5805 i.unused1 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5806 src = src[8:] 5807 i.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5808 src = src[8:] 5809 return src 5810 } 5811 5812 // Packed implements marshal.Marshallable.Packed. 5813 //go:nosplit 5814 func (i *IPCPerm) Packed() bool { 5815 return true 5816 } 5817 5818 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5819 func (i *IPCPerm) MarshalUnsafe(dst []byte) []byte { 5820 size := i.SizeBytes() 5821 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 5822 return dst[size:] 5823 } 5824 5825 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5826 func (i *IPCPerm) UnmarshalUnsafe(src []byte) []byte { 5827 size := i.SizeBytes() 5828 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 5829 return src[size:] 5830 } 5831 5832 // CopyOutN implements marshal.Marshallable.CopyOutN. 5833 //go:nosplit 5834 func (i *IPCPerm) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5835 // Construct a slice backed by dst's underlying memory. 5836 var buf []byte 5837 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5838 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 5839 hdr.Len = i.SizeBytes() 5840 hdr.Cap = i.SizeBytes() 5841 5842 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5843 // Since we bypassed the compiler's escape analysis, indicate that i 5844 // must live until the use above. 5845 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 5846 return length, err 5847 } 5848 5849 // CopyOut implements marshal.Marshallable.CopyOut. 5850 //go:nosplit 5851 func (i *IPCPerm) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5852 return i.CopyOutN(cc, addr, i.SizeBytes()) 5853 } 5854 5855 // CopyIn implements marshal.Marshallable.CopyIn. 5856 //go:nosplit 5857 func (i *IPCPerm) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5858 // Construct a slice backed by dst's underlying memory. 5859 var buf []byte 5860 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5861 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 5862 hdr.Len = i.SizeBytes() 5863 hdr.Cap = i.SizeBytes() 5864 5865 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5866 // Since we bypassed the compiler's escape analysis, indicate that i 5867 // must live until the use above. 5868 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 5869 return length, err 5870 } 5871 5872 // WriteTo implements io.WriterTo.WriteTo. 5873 func (i *IPCPerm) WriteTo(writer io.Writer) (int64, error) { 5874 // Construct a slice backed by dst's underlying memory. 5875 var buf []byte 5876 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5877 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 5878 hdr.Len = i.SizeBytes() 5879 hdr.Cap = i.SizeBytes() 5880 5881 length, err := writer.Write(buf) 5882 // Since we bypassed the compiler's escape analysis, indicate that i 5883 // must live until the use above. 5884 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 5885 return int64(length), err 5886 } 5887 5888 // SizeBytes implements marshal.Marshallable.SizeBytes. 5889 func (s *Sysinfo) SizeBytes() int { 5890 return 78 + 5891 8*3 + 5892 1*6 5893 } 5894 5895 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5896 func (s *Sysinfo) MarshalBytes(dst []byte) []byte { 5897 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Uptime)) 5898 dst = dst[8:] 5899 for idx := 0; idx < 3; idx++ { 5900 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Loads[idx])) 5901 dst = dst[8:] 5902 } 5903 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalRAM)) 5904 dst = dst[8:] 5905 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeRAM)) 5906 dst = dst[8:] 5907 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SharedRAM)) 5908 dst = dst[8:] 5909 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BufferRAM)) 5910 dst = dst[8:] 5911 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalSwap)) 5912 dst = dst[8:] 5913 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeSwap)) 5914 dst = dst[8:] 5915 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Procs)) 5916 dst = dst[2:] 5917 // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0} 5918 dst = dst[1*(6):] 5919 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalHigh)) 5920 dst = dst[8:] 5921 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeHigh)) 5922 dst = dst[8:] 5923 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Unit)) 5924 dst = dst[4:] 5925 return dst 5926 } 5927 5928 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5929 func (s *Sysinfo) UnmarshalBytes(src []byte) []byte { 5930 s.Uptime = int64(hostarch.ByteOrder.Uint64(src[:8])) 5931 src = src[8:] 5932 for idx := 0; idx < 3; idx++ { 5933 s.Loads[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5934 src = src[8:] 5935 } 5936 s.TotalRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5937 src = src[8:] 5938 s.FreeRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5939 src = src[8:] 5940 s.SharedRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5941 src = src[8:] 5942 s.BufferRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5943 src = src[8:] 5944 s.TotalSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5945 src = src[8:] 5946 s.FreeSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5947 src = src[8:] 5948 s.Procs = uint16(hostarch.ByteOrder.Uint16(src[:2])) 5949 src = src[2:] 5950 // Padding: ~ copy([6]byte(s._), src[:sizeof(byte)*6]) 5951 src = src[1*(6):] 5952 s.TotalHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5953 src = src[8:] 5954 s.FreeHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5955 src = src[8:] 5956 s.Unit = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5957 src = src[4:] 5958 return src 5959 } 5960 5961 // Packed implements marshal.Marshallable.Packed. 5962 //go:nosplit 5963 func (s *Sysinfo) Packed() bool { 5964 return false 5965 } 5966 5967 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5968 func (s *Sysinfo) MarshalUnsafe(dst []byte) []byte { 5969 // Type Sysinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 5970 return s.MarshalBytes(dst) 5971 } 5972 5973 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5974 func (s *Sysinfo) UnmarshalUnsafe(src []byte) []byte { 5975 // Type Sysinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5976 return s.UnmarshalBytes(src) 5977 } 5978 5979 // CopyOutN implements marshal.Marshallable.CopyOutN. 5980 //go:nosplit 5981 func (s *Sysinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5982 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 5983 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 5984 s.MarshalBytes(buf) // escapes: fallback. 5985 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5986 } 5987 5988 // CopyOut implements marshal.Marshallable.CopyOut. 5989 //go:nosplit 5990 func (s *Sysinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5991 return s.CopyOutN(cc, addr, s.SizeBytes()) 5992 } 5993 5994 // CopyIn implements marshal.Marshallable.CopyIn. 5995 //go:nosplit 5996 func (s *Sysinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5997 // Type Sysinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5998 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 5999 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6000 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6001 // partially unmarshalled struct. 6002 s.UnmarshalBytes(buf) // escapes: fallback. 6003 return length, err 6004 } 6005 6006 // WriteTo implements io.WriterTo.WriteTo. 6007 func (s *Sysinfo) WriteTo(writer io.Writer) (int64, error) { 6008 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 6009 buf := make([]byte, s.SizeBytes()) 6010 s.MarshalBytes(buf) 6011 length, err := writer.Write(buf) 6012 return int64(length), err 6013 } 6014 6015 // SizeBytes implements marshal.Marshallable.SizeBytes. 6016 //go:nosplit 6017 func (n *NumaPolicy) SizeBytes() int { 6018 return 4 6019 } 6020 6021 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6022 func (n *NumaPolicy) MarshalBytes(dst []byte) []byte { 6023 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*n)) 6024 return dst[4:] 6025 } 6026 6027 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6028 func (n *NumaPolicy) UnmarshalBytes(src []byte) []byte { 6029 *n = NumaPolicy(int32(hostarch.ByteOrder.Uint32(src[:4]))) 6030 return src[4:] 6031 } 6032 6033 // Packed implements marshal.Marshallable.Packed. 6034 //go:nosplit 6035 func (n *NumaPolicy) Packed() bool { 6036 // Scalar newtypes are always packed. 6037 return true 6038 } 6039 6040 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6041 func (n *NumaPolicy) MarshalUnsafe(dst []byte) []byte { 6042 size := n.SizeBytes() 6043 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 6044 return dst[size:] 6045 } 6046 6047 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6048 func (n *NumaPolicy) UnmarshalUnsafe(src []byte) []byte { 6049 size := n.SizeBytes() 6050 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 6051 return src[size:] 6052 } 6053 6054 // CopyOutN implements marshal.Marshallable.CopyOutN. 6055 //go:nosplit 6056 func (n *NumaPolicy) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6057 // Construct a slice backed by dst's underlying memory. 6058 var buf []byte 6059 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6060 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 6061 hdr.Len = n.SizeBytes() 6062 hdr.Cap = n.SizeBytes() 6063 6064 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6065 // Since we bypassed the compiler's escape analysis, indicate that n 6066 // must live until the use above. 6067 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 6068 return length, err 6069 } 6070 6071 // CopyOut implements marshal.Marshallable.CopyOut. 6072 //go:nosplit 6073 func (n *NumaPolicy) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6074 return n.CopyOutN(cc, addr, n.SizeBytes()) 6075 } 6076 6077 // CopyIn implements marshal.Marshallable.CopyIn. 6078 //go:nosplit 6079 func (n *NumaPolicy) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6080 // Construct a slice backed by dst's underlying memory. 6081 var buf []byte 6082 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6083 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 6084 hdr.Len = n.SizeBytes() 6085 hdr.Cap = n.SizeBytes() 6086 6087 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6088 // Since we bypassed the compiler's escape analysis, indicate that n 6089 // must live until the use above. 6090 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 6091 return length, err 6092 } 6093 6094 // WriteTo implements io.WriterTo.WriteTo. 6095 func (n *NumaPolicy) WriteTo(writer io.Writer) (int64, error) { 6096 // Construct a slice backed by dst's underlying memory. 6097 var buf []byte 6098 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6099 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 6100 hdr.Len = n.SizeBytes() 6101 hdr.Cap = n.SizeBytes() 6102 6103 length, err := writer.Write(buf) 6104 // Since we bypassed the compiler's escape analysis, indicate that n 6105 // must live until the use above. 6106 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 6107 return int64(length), err 6108 } 6109 6110 // SizeBytes implements marshal.Marshallable.SizeBytes. 6111 func (m *MqAttr) SizeBytes() int { 6112 return 32 + 6113 8*4 6114 } 6115 6116 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6117 func (m *MqAttr) MarshalBytes(dst []byte) []byte { 6118 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqFlags)) 6119 dst = dst[8:] 6120 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMaxmsg)) 6121 dst = dst[8:] 6122 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMsgsize)) 6123 dst = dst[8:] 6124 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqCurmsgs)) 6125 dst = dst[8:] 6126 // Padding: dst[:sizeof(int64)*4] ~= [4]int64{0} 6127 dst = dst[8*(4):] 6128 return dst 6129 } 6130 6131 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6132 func (m *MqAttr) UnmarshalBytes(src []byte) []byte { 6133 m.MqFlags = int64(hostarch.ByteOrder.Uint64(src[:8])) 6134 src = src[8:] 6135 m.MqMaxmsg = int64(hostarch.ByteOrder.Uint64(src[:8])) 6136 src = src[8:] 6137 m.MqMsgsize = int64(hostarch.ByteOrder.Uint64(src[:8])) 6138 src = src[8:] 6139 m.MqCurmsgs = int64(hostarch.ByteOrder.Uint64(src[:8])) 6140 src = src[8:] 6141 // Padding: ~ copy([4]int64(m._), src[:sizeof(int64)*4]) 6142 src = src[8*(4):] 6143 return src 6144 } 6145 6146 // Packed implements marshal.Marshallable.Packed. 6147 //go:nosplit 6148 func (m *MqAttr) Packed() bool { 6149 return true 6150 } 6151 6152 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6153 func (m *MqAttr) MarshalUnsafe(dst []byte) []byte { 6154 size := m.SizeBytes() 6155 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 6156 return dst[size:] 6157 } 6158 6159 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6160 func (m *MqAttr) UnmarshalUnsafe(src []byte) []byte { 6161 size := m.SizeBytes() 6162 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 6163 return src[size:] 6164 } 6165 6166 // CopyOutN implements marshal.Marshallable.CopyOutN. 6167 //go:nosplit 6168 func (m *MqAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6169 // Construct a slice backed by dst's underlying memory. 6170 var buf []byte 6171 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6172 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 6173 hdr.Len = m.SizeBytes() 6174 hdr.Cap = m.SizeBytes() 6175 6176 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6177 // Since we bypassed the compiler's escape analysis, indicate that m 6178 // must live until the use above. 6179 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 6180 return length, err 6181 } 6182 6183 // CopyOut implements marshal.Marshallable.CopyOut. 6184 //go:nosplit 6185 func (m *MqAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6186 return m.CopyOutN(cc, addr, m.SizeBytes()) 6187 } 6188 6189 // CopyIn implements marshal.Marshallable.CopyIn. 6190 //go:nosplit 6191 func (m *MqAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6192 // Construct a slice backed by dst's underlying memory. 6193 var buf []byte 6194 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6195 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 6196 hdr.Len = m.SizeBytes() 6197 hdr.Cap = m.SizeBytes() 6198 6199 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6200 // Since we bypassed the compiler's escape analysis, indicate that m 6201 // must live until the use above. 6202 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 6203 return length, err 6204 } 6205 6206 // WriteTo implements io.WriterTo.WriteTo. 6207 func (m *MqAttr) WriteTo(writer io.Writer) (int64, error) { 6208 // Construct a slice backed by dst's underlying memory. 6209 var buf []byte 6210 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6211 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 6212 hdr.Len = m.SizeBytes() 6213 hdr.Cap = m.SizeBytes() 6214 6215 length, err := writer.Write(buf) 6216 // Since we bypassed the compiler's escape analysis, indicate that m 6217 // must live until the use above. 6218 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 6219 return int64(length), err 6220 } 6221 6222 // Packed implements marshal.Marshallable.Packed. 6223 //go:nosplit 6224 func (b *MsgBuf) Packed() bool { 6225 // Type MsgBuf is dynamic so it might have slice/string headers. Hence, it is not packed. 6226 return false 6227 } 6228 6229 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6230 func (b *MsgBuf) MarshalUnsafe(dst []byte) []byte { 6231 // Type MsgBuf doesn't have a packed layout in memory, fallback to MarshalBytes. 6232 return b.MarshalBytes(dst) 6233 } 6234 6235 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6236 func (b *MsgBuf) UnmarshalUnsafe(src []byte) []byte { 6237 // Type MsgBuf doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6238 return b.UnmarshalBytes(src) 6239 } 6240 6241 // CopyOutN implements marshal.Marshallable.CopyOutN. 6242 //go:nosplit 6243 func (b *MsgBuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6244 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 6245 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 6246 b.MarshalBytes(buf) // escapes: fallback. 6247 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6248 } 6249 6250 // CopyOut implements marshal.Marshallable.CopyOut. 6251 //go:nosplit 6252 func (b *MsgBuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6253 return b.CopyOutN(cc, addr, b.SizeBytes()) 6254 } 6255 6256 // CopyIn implements marshal.Marshallable.CopyIn. 6257 //go:nosplit 6258 func (b *MsgBuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6259 // Type MsgBuf doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6260 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 6261 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6262 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6263 // partially unmarshalled struct. 6264 b.UnmarshalBytes(buf) // escapes: fallback. 6265 return length, err 6266 } 6267 6268 // WriteTo implements io.WriterTo.WriteTo. 6269 func (b *MsgBuf) WriteTo(writer io.Writer) (int64, error) { 6270 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 6271 buf := make([]byte, b.SizeBytes()) 6272 b.MarshalBytes(buf) 6273 length, err := writer.Write(buf) 6274 return int64(length), err 6275 } 6276 6277 // SizeBytes implements marshal.Marshallable.SizeBytes. 6278 func (m *MsgInfo) SizeBytes() int { 6279 return 30 6280 } 6281 6282 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6283 func (m *MsgInfo) MarshalBytes(dst []byte) []byte { 6284 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgPool)) 6285 dst = dst[4:] 6286 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMap)) 6287 dst = dst[4:] 6288 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMax)) 6289 dst = dst[4:] 6290 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMnb)) 6291 dst = dst[4:] 6292 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMni)) 6293 dst = dst[4:] 6294 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgSsz)) 6295 dst = dst[4:] 6296 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgTql)) 6297 dst = dst[4:] 6298 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.MsgSeg)) 6299 dst = dst[2:] 6300 return dst 6301 } 6302 6303 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6304 func (m *MsgInfo) UnmarshalBytes(src []byte) []byte { 6305 m.MsgPool = int32(hostarch.ByteOrder.Uint32(src[:4])) 6306 src = src[4:] 6307 m.MsgMap = int32(hostarch.ByteOrder.Uint32(src[:4])) 6308 src = src[4:] 6309 m.MsgMax = int32(hostarch.ByteOrder.Uint32(src[:4])) 6310 src = src[4:] 6311 m.MsgMnb = int32(hostarch.ByteOrder.Uint32(src[:4])) 6312 src = src[4:] 6313 m.MsgMni = int32(hostarch.ByteOrder.Uint32(src[:4])) 6314 src = src[4:] 6315 m.MsgSsz = int32(hostarch.ByteOrder.Uint32(src[:4])) 6316 src = src[4:] 6317 m.MsgTql = int32(hostarch.ByteOrder.Uint32(src[:4])) 6318 src = src[4:] 6319 m.MsgSeg = uint16(hostarch.ByteOrder.Uint16(src[:2])) 6320 src = src[2:] 6321 return src 6322 } 6323 6324 // Packed implements marshal.Marshallable.Packed. 6325 //go:nosplit 6326 func (m *MsgInfo) Packed() bool { 6327 return false 6328 } 6329 6330 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6331 func (m *MsgInfo) MarshalUnsafe(dst []byte) []byte { 6332 // Type MsgInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 6333 return m.MarshalBytes(dst) 6334 } 6335 6336 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6337 func (m *MsgInfo) UnmarshalUnsafe(src []byte) []byte { 6338 // Type MsgInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6339 return m.UnmarshalBytes(src) 6340 } 6341 6342 // CopyOutN implements marshal.Marshallable.CopyOutN. 6343 //go:nosplit 6344 func (m *MsgInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6345 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 6346 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 6347 m.MarshalBytes(buf) // escapes: fallback. 6348 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6349 } 6350 6351 // CopyOut implements marshal.Marshallable.CopyOut. 6352 //go:nosplit 6353 func (m *MsgInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6354 return m.CopyOutN(cc, addr, m.SizeBytes()) 6355 } 6356 6357 // CopyIn implements marshal.Marshallable.CopyIn. 6358 //go:nosplit 6359 func (m *MsgInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6360 // Type MsgInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6361 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 6362 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6363 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6364 // partially unmarshalled struct. 6365 m.UnmarshalBytes(buf) // escapes: fallback. 6366 return length, err 6367 } 6368 6369 // WriteTo implements io.WriterTo.WriteTo. 6370 func (m *MsgInfo) WriteTo(writer io.Writer) (int64, error) { 6371 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 6372 buf := make([]byte, m.SizeBytes()) 6373 m.MarshalBytes(buf) 6374 length, err := writer.Write(buf) 6375 return int64(length), err 6376 } 6377 6378 // SizeBytes implements marshal.Marshallable.SizeBytes. 6379 func (m *MsqidDS) SizeBytes() int { 6380 return 48 + 6381 (*IPCPerm)(nil).SizeBytes() + 6382 (*TimeT)(nil).SizeBytes() + 6383 (*TimeT)(nil).SizeBytes() + 6384 (*TimeT)(nil).SizeBytes() 6385 } 6386 6387 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6388 func (m *MsqidDS) MarshalBytes(dst []byte) []byte { 6389 dst = m.MsgPerm.MarshalUnsafe(dst) 6390 dst = m.MsgStime.MarshalUnsafe(dst) 6391 dst = m.MsgRtime.MarshalUnsafe(dst) 6392 dst = m.MsgCtime.MarshalUnsafe(dst) 6393 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgCbytes)) 6394 dst = dst[8:] 6395 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQnum)) 6396 dst = dst[8:] 6397 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQbytes)) 6398 dst = dst[8:] 6399 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLspid)) 6400 dst = dst[4:] 6401 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLrpid)) 6402 dst = dst[4:] 6403 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused4)) 6404 dst = dst[8:] 6405 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused5)) 6406 dst = dst[8:] 6407 return dst 6408 } 6409 6410 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6411 func (m *MsqidDS) UnmarshalBytes(src []byte) []byte { 6412 src = m.MsgPerm.UnmarshalUnsafe(src) 6413 src = m.MsgStime.UnmarshalUnsafe(src) 6414 src = m.MsgRtime.UnmarshalUnsafe(src) 6415 src = m.MsgCtime.UnmarshalUnsafe(src) 6416 m.MsgCbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6417 src = src[8:] 6418 m.MsgQnum = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6419 src = src[8:] 6420 m.MsgQbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6421 src = src[8:] 6422 m.MsgLspid = int32(hostarch.ByteOrder.Uint32(src[:4])) 6423 src = src[4:] 6424 m.MsgLrpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 6425 src = src[4:] 6426 m.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6427 src = src[8:] 6428 m.unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6429 src = src[8:] 6430 return src 6431 } 6432 6433 // Packed implements marshal.Marshallable.Packed. 6434 //go:nosplit 6435 func (m *MsqidDS) Packed() bool { 6436 return m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() 6437 } 6438 6439 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6440 func (m *MsqidDS) MarshalUnsafe(dst []byte) []byte { 6441 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 6442 size := m.SizeBytes() 6443 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 6444 return dst[size:] 6445 } 6446 // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 6447 return m.MarshalBytes(dst) 6448 } 6449 6450 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6451 func (m *MsqidDS) UnmarshalUnsafe(src []byte) []byte { 6452 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 6453 size := m.SizeBytes() 6454 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 6455 return src[size:] 6456 } 6457 // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6458 return m.UnmarshalBytes(src) 6459 } 6460 6461 // CopyOutN implements marshal.Marshallable.CopyOutN. 6462 //go:nosplit 6463 func (m *MsqidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6464 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 6465 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 6466 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 6467 m.MarshalBytes(buf) // escapes: fallback. 6468 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6469 } 6470 6471 // Construct a slice backed by dst's underlying memory. 6472 var buf []byte 6473 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6474 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 6475 hdr.Len = m.SizeBytes() 6476 hdr.Cap = m.SizeBytes() 6477 6478 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6479 // Since we bypassed the compiler's escape analysis, indicate that m 6480 // must live until the use above. 6481 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 6482 return length, err 6483 } 6484 6485 // CopyOut implements marshal.Marshallable.CopyOut. 6486 //go:nosplit 6487 func (m *MsqidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6488 return m.CopyOutN(cc, addr, m.SizeBytes()) 6489 } 6490 6491 // CopyIn implements marshal.Marshallable.CopyIn. 6492 //go:nosplit 6493 func (m *MsqidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6494 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 6495 // Type MsqidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6496 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 6497 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6498 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6499 // partially unmarshalled struct. 6500 m.UnmarshalBytes(buf) // escapes: fallback. 6501 return length, err 6502 } 6503 6504 // Construct a slice backed by dst's underlying memory. 6505 var buf []byte 6506 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6507 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 6508 hdr.Len = m.SizeBytes() 6509 hdr.Cap = m.SizeBytes() 6510 6511 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6512 // Since we bypassed the compiler's escape analysis, indicate that m 6513 // must live until the use above. 6514 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 6515 return length, err 6516 } 6517 6518 // WriteTo implements io.WriterTo.WriteTo. 6519 func (m *MsqidDS) WriteTo(writer io.Writer) (int64, error) { 6520 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 6521 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 6522 buf := make([]byte, m.SizeBytes()) 6523 m.MarshalBytes(buf) 6524 length, err := writer.Write(buf) 6525 return int64(length), err 6526 } 6527 6528 // Construct a slice backed by dst's underlying memory. 6529 var buf []byte 6530 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6531 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 6532 hdr.Len = m.SizeBytes() 6533 hdr.Cap = m.SizeBytes() 6534 6535 length, err := writer.Write(buf) 6536 // Since we bypassed the compiler's escape analysis, indicate that m 6537 // must live until the use above. 6538 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 6539 return int64(length), err 6540 } 6541 6542 // SizeBytes implements marshal.Marshallable.SizeBytes. 6543 func (i *IFConf) SizeBytes() int { 6544 return 12 + 6545 1*4 6546 } 6547 6548 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6549 func (i *IFConf) MarshalBytes(dst []byte) []byte { 6550 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 6551 dst = dst[4:] 6552 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 6553 dst = dst[1*(4):] 6554 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Ptr)) 6555 dst = dst[8:] 6556 return dst 6557 } 6558 6559 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6560 func (i *IFConf) UnmarshalBytes(src []byte) []byte { 6561 i.Len = int32(hostarch.ByteOrder.Uint32(src[:4])) 6562 src = src[4:] 6563 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 6564 src = src[1*(4):] 6565 i.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6566 src = src[8:] 6567 return src 6568 } 6569 6570 // Packed implements marshal.Marshallable.Packed. 6571 //go:nosplit 6572 func (i *IFConf) Packed() bool { 6573 return true 6574 } 6575 6576 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6577 func (i *IFConf) MarshalUnsafe(dst []byte) []byte { 6578 size := i.SizeBytes() 6579 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6580 return dst[size:] 6581 } 6582 6583 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6584 func (i *IFConf) UnmarshalUnsafe(src []byte) []byte { 6585 size := i.SizeBytes() 6586 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6587 return src[size:] 6588 } 6589 6590 // CopyOutN implements marshal.Marshallable.CopyOutN. 6591 //go:nosplit 6592 func (i *IFConf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6593 // Construct a slice backed by dst's underlying memory. 6594 var buf []byte 6595 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6596 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6597 hdr.Len = i.SizeBytes() 6598 hdr.Cap = i.SizeBytes() 6599 6600 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6601 // Since we bypassed the compiler's escape analysis, indicate that i 6602 // must live until the use above. 6603 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6604 return length, err 6605 } 6606 6607 // CopyOut implements marshal.Marshallable.CopyOut. 6608 //go:nosplit 6609 func (i *IFConf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6610 return i.CopyOutN(cc, addr, i.SizeBytes()) 6611 } 6612 6613 // CopyIn implements marshal.Marshallable.CopyIn. 6614 //go:nosplit 6615 func (i *IFConf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6616 // Construct a slice backed by dst's underlying memory. 6617 var buf []byte 6618 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6619 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6620 hdr.Len = i.SizeBytes() 6621 hdr.Cap = i.SizeBytes() 6622 6623 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6624 // Since we bypassed the compiler's escape analysis, indicate that i 6625 // must live until the use above. 6626 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6627 return length, err 6628 } 6629 6630 // WriteTo implements io.WriterTo.WriteTo. 6631 func (i *IFConf) WriteTo(writer io.Writer) (int64, error) { 6632 // Construct a slice backed by dst's underlying memory. 6633 var buf []byte 6634 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6635 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6636 hdr.Len = i.SizeBytes() 6637 hdr.Cap = i.SizeBytes() 6638 6639 length, err := writer.Write(buf) 6640 // Since we bypassed the compiler's escape analysis, indicate that i 6641 // must live until the use above. 6642 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6643 return int64(length), err 6644 } 6645 6646 // SizeBytes implements marshal.Marshallable.SizeBytes. 6647 func (ifr *IFReq) SizeBytes() int { 6648 return 0 + 6649 1*IFNAMSIZ + 6650 1*24 6651 } 6652 6653 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6654 func (ifr *IFReq) MarshalBytes(dst []byte) []byte { 6655 for idx := 0; idx < IFNAMSIZ; idx++ { 6656 dst[0] = byte(ifr.IFName[idx]) 6657 dst = dst[1:] 6658 } 6659 for idx := 0; idx < 24; idx++ { 6660 dst[0] = byte(ifr.Data[idx]) 6661 dst = dst[1:] 6662 } 6663 return dst 6664 } 6665 6666 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6667 func (ifr *IFReq) UnmarshalBytes(src []byte) []byte { 6668 for idx := 0; idx < IFNAMSIZ; idx++ { 6669 ifr.IFName[idx] = src[0] 6670 src = src[1:] 6671 } 6672 for idx := 0; idx < 24; idx++ { 6673 ifr.Data[idx] = src[0] 6674 src = src[1:] 6675 } 6676 return src 6677 } 6678 6679 // Packed implements marshal.Marshallable.Packed. 6680 //go:nosplit 6681 func (ifr *IFReq) Packed() bool { 6682 return true 6683 } 6684 6685 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6686 func (ifr *IFReq) MarshalUnsafe(dst []byte) []byte { 6687 size := ifr.SizeBytes() 6688 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(size)) 6689 return dst[size:] 6690 } 6691 6692 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6693 func (ifr *IFReq) UnmarshalUnsafe(src []byte) []byte { 6694 size := ifr.SizeBytes() 6695 gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(size)) 6696 return src[size:] 6697 } 6698 6699 // CopyOutN implements marshal.Marshallable.CopyOutN. 6700 //go:nosplit 6701 func (ifr *IFReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6702 // Construct a slice backed by dst's underlying memory. 6703 var buf []byte 6704 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6705 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 6706 hdr.Len = ifr.SizeBytes() 6707 hdr.Cap = ifr.SizeBytes() 6708 6709 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6710 // Since we bypassed the compiler's escape analysis, indicate that ifr 6711 // must live until the use above. 6712 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 6713 return length, err 6714 } 6715 6716 // CopyOut implements marshal.Marshallable.CopyOut. 6717 //go:nosplit 6718 func (ifr *IFReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6719 return ifr.CopyOutN(cc, addr, ifr.SizeBytes()) 6720 } 6721 6722 // CopyIn implements marshal.Marshallable.CopyIn. 6723 //go:nosplit 6724 func (ifr *IFReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6725 // Construct a slice backed by dst's underlying memory. 6726 var buf []byte 6727 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6728 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 6729 hdr.Len = ifr.SizeBytes() 6730 hdr.Cap = ifr.SizeBytes() 6731 6732 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6733 // Since we bypassed the compiler's escape analysis, indicate that ifr 6734 // must live until the use above. 6735 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 6736 return length, err 6737 } 6738 6739 // WriteTo implements io.WriterTo.WriteTo. 6740 func (ifr *IFReq) WriteTo(writer io.Writer) (int64, error) { 6741 // Construct a slice backed by dst's underlying memory. 6742 var buf []byte 6743 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6744 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 6745 hdr.Len = ifr.SizeBytes() 6746 hdr.Cap = ifr.SizeBytes() 6747 6748 length, err := writer.Write(buf) 6749 // Since we bypassed the compiler's escape analysis, indicate that ifr 6750 // must live until the use above. 6751 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 6752 return int64(length), err 6753 } 6754 6755 // SizeBytes implements marshal.Marshallable.SizeBytes. 6756 //go:nosplit 6757 func (en *ErrorName) SizeBytes() int { 6758 return 1 * XT_FUNCTION_MAXNAMELEN 6759 } 6760 6761 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6762 func (en *ErrorName) MarshalBytes(dst []byte) []byte { 6763 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 6764 dst[0] = byte(en[idx]) 6765 dst = dst[1:] 6766 } 6767 return dst 6768 } 6769 6770 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6771 func (en *ErrorName) UnmarshalBytes(src []byte) []byte { 6772 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 6773 en[idx] = src[0] 6774 src = src[1:] 6775 } 6776 return src 6777 } 6778 6779 // Packed implements marshal.Marshallable.Packed. 6780 //go:nosplit 6781 func (en *ErrorName) Packed() bool { 6782 // Array newtypes are always packed. 6783 return true 6784 } 6785 6786 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6787 func (en *ErrorName) MarshalUnsafe(dst []byte) []byte { 6788 size := en.SizeBytes() 6789 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 6790 return dst[size:] 6791 } 6792 6793 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6794 func (en *ErrorName) UnmarshalUnsafe(src []byte) []byte { 6795 size := en.SizeBytes() 6796 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 6797 return src[size:] 6798 } 6799 6800 // CopyOutN implements marshal.Marshallable.CopyOutN. 6801 //go:nosplit 6802 func (en *ErrorName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6803 // Construct a slice backed by dst's underlying memory. 6804 var buf []byte 6805 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6806 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 6807 hdr.Len = en.SizeBytes() 6808 hdr.Cap = en.SizeBytes() 6809 6810 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6811 // Since we bypassed the compiler's escape analysis, indicate that en 6812 // must live until the use above. 6813 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 6814 return length, err 6815 } 6816 6817 // CopyOut implements marshal.Marshallable.CopyOut. 6818 //go:nosplit 6819 func (en *ErrorName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6820 return en.CopyOutN(cc, addr, en.SizeBytes()) 6821 } 6822 6823 // CopyIn implements marshal.Marshallable.CopyIn. 6824 //go:nosplit 6825 func (en *ErrorName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6826 // Construct a slice backed by dst's underlying memory. 6827 var buf []byte 6828 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6829 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 6830 hdr.Len = en.SizeBytes() 6831 hdr.Cap = en.SizeBytes() 6832 6833 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6834 // Since we bypassed the compiler's escape analysis, indicate that en 6835 // must live until the use above. 6836 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 6837 return length, err 6838 } 6839 6840 // WriteTo implements io.WriterTo.WriteTo. 6841 func (en *ErrorName) WriteTo(writer io.Writer) (int64, error) { 6842 // Construct a slice backed by dst's underlying memory. 6843 var buf []byte 6844 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6845 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 6846 hdr.Len = en.SizeBytes() 6847 hdr.Cap = en.SizeBytes() 6848 6849 length, err := writer.Write(buf) 6850 // Since we bypassed the compiler's escape analysis, indicate that en 6851 // must live until the use above. 6852 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 6853 return int64(length), err 6854 } 6855 6856 // SizeBytes implements marshal.Marshallable.SizeBytes. 6857 //go:nosplit 6858 func (en *ExtensionName) SizeBytes() int { 6859 return 1 * XT_EXTENSION_MAXNAMELEN 6860 } 6861 6862 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6863 func (en *ExtensionName) MarshalBytes(dst []byte) []byte { 6864 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 6865 dst[0] = byte(en[idx]) 6866 dst = dst[1:] 6867 } 6868 return dst 6869 } 6870 6871 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6872 func (en *ExtensionName) UnmarshalBytes(src []byte) []byte { 6873 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 6874 en[idx] = src[0] 6875 src = src[1:] 6876 } 6877 return src 6878 } 6879 6880 // Packed implements marshal.Marshallable.Packed. 6881 //go:nosplit 6882 func (en *ExtensionName) Packed() bool { 6883 // Array newtypes are always packed. 6884 return true 6885 } 6886 6887 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6888 func (en *ExtensionName) MarshalUnsafe(dst []byte) []byte { 6889 size := en.SizeBytes() 6890 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 6891 return dst[size:] 6892 } 6893 6894 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6895 func (en *ExtensionName) UnmarshalUnsafe(src []byte) []byte { 6896 size := en.SizeBytes() 6897 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 6898 return src[size:] 6899 } 6900 6901 // CopyOutN implements marshal.Marshallable.CopyOutN. 6902 //go:nosplit 6903 func (en *ExtensionName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6904 // Construct a slice backed by dst's underlying memory. 6905 var buf []byte 6906 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6907 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 6908 hdr.Len = en.SizeBytes() 6909 hdr.Cap = en.SizeBytes() 6910 6911 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6912 // Since we bypassed the compiler's escape analysis, indicate that en 6913 // must live until the use above. 6914 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 6915 return length, err 6916 } 6917 6918 // CopyOut implements marshal.Marshallable.CopyOut. 6919 //go:nosplit 6920 func (en *ExtensionName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6921 return en.CopyOutN(cc, addr, en.SizeBytes()) 6922 } 6923 6924 // CopyIn implements marshal.Marshallable.CopyIn. 6925 //go:nosplit 6926 func (en *ExtensionName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6927 // Construct a slice backed by dst's underlying memory. 6928 var buf []byte 6929 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6930 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 6931 hdr.Len = en.SizeBytes() 6932 hdr.Cap = en.SizeBytes() 6933 6934 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6935 // Since we bypassed the compiler's escape analysis, indicate that en 6936 // must live until the use above. 6937 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 6938 return length, err 6939 } 6940 6941 // WriteTo implements io.WriterTo.WriteTo. 6942 func (en *ExtensionName) WriteTo(writer io.Writer) (int64, error) { 6943 // Construct a slice backed by dst's underlying memory. 6944 var buf []byte 6945 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6946 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 6947 hdr.Len = en.SizeBytes() 6948 hdr.Cap = en.SizeBytes() 6949 6950 length, err := writer.Write(buf) 6951 // Since we bypassed the compiler's escape analysis, indicate that en 6952 // must live until the use above. 6953 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 6954 return int64(length), err 6955 } 6956 6957 // SizeBytes implements marshal.Marshallable.SizeBytes. 6958 func (i *IPTEntry) SizeBytes() int { 6959 return 12 + 6960 (*IPTIP)(nil).SizeBytes() + 6961 (*XTCounters)(nil).SizeBytes() 6962 } 6963 6964 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6965 func (i *IPTEntry) MarshalBytes(dst []byte) []byte { 6966 dst = i.IP.MarshalUnsafe(dst) 6967 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 6968 dst = dst[4:] 6969 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 6970 dst = dst[2:] 6971 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 6972 dst = dst[2:] 6973 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 6974 dst = dst[4:] 6975 dst = i.Counters.MarshalUnsafe(dst) 6976 return dst 6977 } 6978 6979 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6980 func (i *IPTEntry) UnmarshalBytes(src []byte) []byte { 6981 src = i.IP.UnmarshalUnsafe(src) 6982 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6983 src = src[4:] 6984 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 6985 src = src[2:] 6986 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 6987 src = src[2:] 6988 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6989 src = src[4:] 6990 src = i.Counters.UnmarshalUnsafe(src) 6991 return src 6992 } 6993 6994 // Packed implements marshal.Marshallable.Packed. 6995 //go:nosplit 6996 func (i *IPTEntry) Packed() bool { 6997 return i.Counters.Packed() && i.IP.Packed() 6998 } 6999 7000 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7001 func (i *IPTEntry) MarshalUnsafe(dst []byte) []byte { 7002 if i.Counters.Packed() && i.IP.Packed() { 7003 size := i.SizeBytes() 7004 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7005 return dst[size:] 7006 } 7007 // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 7008 return i.MarshalBytes(dst) 7009 } 7010 7011 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7012 func (i *IPTEntry) UnmarshalUnsafe(src []byte) []byte { 7013 if i.Counters.Packed() && i.IP.Packed() { 7014 size := i.SizeBytes() 7015 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7016 return src[size:] 7017 } 7018 // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7019 return i.UnmarshalBytes(src) 7020 } 7021 7022 // CopyOutN implements marshal.Marshallable.CopyOutN. 7023 //go:nosplit 7024 func (i *IPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7025 if !i.Counters.Packed() && i.IP.Packed() { 7026 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 7027 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7028 i.MarshalBytes(buf) // escapes: fallback. 7029 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7030 } 7031 7032 // Construct a slice backed by dst's underlying memory. 7033 var buf []byte 7034 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7035 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7036 hdr.Len = i.SizeBytes() 7037 hdr.Cap = i.SizeBytes() 7038 7039 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7040 // Since we bypassed the compiler's escape analysis, indicate that i 7041 // must live until the use above. 7042 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7043 return length, err 7044 } 7045 7046 // CopyOut implements marshal.Marshallable.CopyOut. 7047 //go:nosplit 7048 func (i *IPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7049 return i.CopyOutN(cc, addr, i.SizeBytes()) 7050 } 7051 7052 // CopyIn implements marshal.Marshallable.CopyIn. 7053 //go:nosplit 7054 func (i *IPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7055 if !i.Counters.Packed() && i.IP.Packed() { 7056 // Type IPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7057 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7058 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7059 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7060 // partially unmarshalled struct. 7061 i.UnmarshalBytes(buf) // escapes: fallback. 7062 return length, err 7063 } 7064 7065 // Construct a slice backed by dst's underlying memory. 7066 var buf []byte 7067 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7068 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7069 hdr.Len = i.SizeBytes() 7070 hdr.Cap = i.SizeBytes() 7071 7072 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7073 // Since we bypassed the compiler's escape analysis, indicate that i 7074 // must live until the use above. 7075 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7076 return length, err 7077 } 7078 7079 // WriteTo implements io.WriterTo.WriteTo. 7080 func (i *IPTEntry) WriteTo(writer io.Writer) (int64, error) { 7081 if !i.Counters.Packed() && i.IP.Packed() { 7082 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 7083 buf := make([]byte, i.SizeBytes()) 7084 i.MarshalBytes(buf) 7085 length, err := writer.Write(buf) 7086 return int64(length), err 7087 } 7088 7089 // Construct a slice backed by dst's underlying memory. 7090 var buf []byte 7091 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7092 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7093 hdr.Len = i.SizeBytes() 7094 hdr.Cap = i.SizeBytes() 7095 7096 length, err := writer.Write(buf) 7097 // Since we bypassed the compiler's escape analysis, indicate that i 7098 // must live until the use above. 7099 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7100 return int64(length), err 7101 } 7102 7103 // SizeBytes implements marshal.Marshallable.SizeBytes. 7104 func (i *IPTGetEntries) SizeBytes() int { 7105 return 4 + 7106 (*TableName)(nil).SizeBytes() + 7107 1*4 7108 } 7109 7110 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7111 func (i *IPTGetEntries) MarshalBytes(dst []byte) []byte { 7112 dst = i.Name.MarshalUnsafe(dst) 7113 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 7114 dst = dst[4:] 7115 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 7116 dst = dst[1*(4):] 7117 return dst 7118 } 7119 7120 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7121 func (i *IPTGetEntries) UnmarshalBytes(src []byte) []byte { 7122 src = i.Name.UnmarshalUnsafe(src) 7123 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7124 src = src[4:] 7125 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 7126 src = src[1*(4):] 7127 return src 7128 } 7129 7130 // Packed implements marshal.Marshallable.Packed. 7131 //go:nosplit 7132 func (i *IPTGetEntries) Packed() bool { 7133 return i.Name.Packed() 7134 } 7135 7136 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7137 func (i *IPTGetEntries) MarshalUnsafe(dst []byte) []byte { 7138 if i.Name.Packed() { 7139 size := i.SizeBytes() 7140 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7141 return dst[size:] 7142 } 7143 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 7144 return i.MarshalBytes(dst) 7145 } 7146 7147 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7148 func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 7149 if i.Name.Packed() { 7150 size := i.SizeBytes() 7151 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7152 return src[size:] 7153 } 7154 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7155 return i.UnmarshalBytes(src) 7156 } 7157 7158 // CopyOutN implements marshal.Marshallable.CopyOutN. 7159 //go:nosplit 7160 func (i *IPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7161 if !i.Name.Packed() { 7162 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 7163 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7164 i.MarshalBytes(buf) // escapes: fallback. 7165 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7166 } 7167 7168 // Construct a slice backed by dst's underlying memory. 7169 var buf []byte 7170 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7171 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7172 hdr.Len = i.SizeBytes() 7173 hdr.Cap = i.SizeBytes() 7174 7175 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7176 // Since we bypassed the compiler's escape analysis, indicate that i 7177 // must live until the use above. 7178 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7179 return length, err 7180 } 7181 7182 // CopyOut implements marshal.Marshallable.CopyOut. 7183 //go:nosplit 7184 func (i *IPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7185 return i.CopyOutN(cc, addr, i.SizeBytes()) 7186 } 7187 7188 // CopyIn implements marshal.Marshallable.CopyIn. 7189 //go:nosplit 7190 func (i *IPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7191 if !i.Name.Packed() { 7192 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7193 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7194 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7195 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7196 // partially unmarshalled struct. 7197 i.UnmarshalBytes(buf) // escapes: fallback. 7198 return length, err 7199 } 7200 7201 // Construct a slice backed by dst's underlying memory. 7202 var buf []byte 7203 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7204 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7205 hdr.Len = i.SizeBytes() 7206 hdr.Cap = i.SizeBytes() 7207 7208 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7209 // Since we bypassed the compiler's escape analysis, indicate that i 7210 // must live until the use above. 7211 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7212 return length, err 7213 } 7214 7215 // WriteTo implements io.WriterTo.WriteTo. 7216 func (i *IPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 7217 if !i.Name.Packed() { 7218 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 7219 buf := make([]byte, i.SizeBytes()) 7220 i.MarshalBytes(buf) 7221 length, err := writer.Write(buf) 7222 return int64(length), err 7223 } 7224 7225 // Construct a slice backed by dst's underlying memory. 7226 var buf []byte 7227 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7228 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7229 hdr.Len = i.SizeBytes() 7230 hdr.Cap = i.SizeBytes() 7231 7232 length, err := writer.Write(buf) 7233 // Since we bypassed the compiler's escape analysis, indicate that i 7234 // must live until the use above. 7235 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7236 return int64(length), err 7237 } 7238 7239 // SizeBytes implements marshal.Marshallable.SizeBytes. 7240 func (i *IPTGetinfo) SizeBytes() int { 7241 return 12 + 7242 (*TableName)(nil).SizeBytes() + 7243 4*NF_INET_NUMHOOKS + 7244 4*NF_INET_NUMHOOKS 7245 } 7246 7247 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7248 func (i *IPTGetinfo) MarshalBytes(dst []byte) []byte { 7249 dst = i.Name.MarshalUnsafe(dst) 7250 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 7251 dst = dst[4:] 7252 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7253 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 7254 dst = dst[4:] 7255 } 7256 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7257 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 7258 dst = dst[4:] 7259 } 7260 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 7261 dst = dst[4:] 7262 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 7263 dst = dst[4:] 7264 return dst 7265 } 7266 7267 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7268 func (i *IPTGetinfo) UnmarshalBytes(src []byte) []byte { 7269 src = i.Name.UnmarshalUnsafe(src) 7270 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7271 src = src[4:] 7272 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7273 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7274 src = src[4:] 7275 } 7276 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7277 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7278 src = src[4:] 7279 } 7280 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7281 src = src[4:] 7282 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7283 src = src[4:] 7284 return src 7285 } 7286 7287 // Packed implements marshal.Marshallable.Packed. 7288 //go:nosplit 7289 func (i *IPTGetinfo) Packed() bool { 7290 return i.Name.Packed() 7291 } 7292 7293 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7294 func (i *IPTGetinfo) MarshalUnsafe(dst []byte) []byte { 7295 if i.Name.Packed() { 7296 size := i.SizeBytes() 7297 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7298 return dst[size:] 7299 } 7300 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7301 return i.MarshalBytes(dst) 7302 } 7303 7304 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7305 func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) []byte { 7306 if i.Name.Packed() { 7307 size := i.SizeBytes() 7308 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7309 return src[size:] 7310 } 7311 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7312 return i.UnmarshalBytes(src) 7313 } 7314 7315 // CopyOutN implements marshal.Marshallable.CopyOutN. 7316 //go:nosplit 7317 func (i *IPTGetinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7318 if !i.Name.Packed() { 7319 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7320 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7321 i.MarshalBytes(buf) // escapes: fallback. 7322 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7323 } 7324 7325 // Construct a slice backed by dst's underlying memory. 7326 var buf []byte 7327 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7328 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7329 hdr.Len = i.SizeBytes() 7330 hdr.Cap = i.SizeBytes() 7331 7332 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7333 // Since we bypassed the compiler's escape analysis, indicate that i 7334 // must live until the use above. 7335 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7336 return length, err 7337 } 7338 7339 // CopyOut implements marshal.Marshallable.CopyOut. 7340 //go:nosplit 7341 func (i *IPTGetinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7342 return i.CopyOutN(cc, addr, i.SizeBytes()) 7343 } 7344 7345 // CopyIn implements marshal.Marshallable.CopyIn. 7346 //go:nosplit 7347 func (i *IPTGetinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7348 if !i.Name.Packed() { 7349 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7350 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7351 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7352 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7353 // partially unmarshalled struct. 7354 i.UnmarshalBytes(buf) // escapes: fallback. 7355 return length, err 7356 } 7357 7358 // Construct a slice backed by dst's underlying memory. 7359 var buf []byte 7360 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7361 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7362 hdr.Len = i.SizeBytes() 7363 hdr.Cap = i.SizeBytes() 7364 7365 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7366 // Since we bypassed the compiler's escape analysis, indicate that i 7367 // must live until the use above. 7368 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7369 return length, err 7370 } 7371 7372 // WriteTo implements io.WriterTo.WriteTo. 7373 func (i *IPTGetinfo) WriteTo(writer io.Writer) (int64, error) { 7374 if !i.Name.Packed() { 7375 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7376 buf := make([]byte, i.SizeBytes()) 7377 i.MarshalBytes(buf) 7378 length, err := writer.Write(buf) 7379 return int64(length), err 7380 } 7381 7382 // Construct a slice backed by dst's underlying memory. 7383 var buf []byte 7384 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7385 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7386 hdr.Len = i.SizeBytes() 7387 hdr.Cap = i.SizeBytes() 7388 7389 length, err := writer.Write(buf) 7390 // Since we bypassed the compiler's escape analysis, indicate that i 7391 // must live until the use above. 7392 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7393 return int64(length), err 7394 } 7395 7396 // SizeBytes implements marshal.Marshallable.SizeBytes. 7397 func (i *IPTIP) SizeBytes() int { 7398 return 4 + 7399 (*InetAddr)(nil).SizeBytes() + 7400 (*InetAddr)(nil).SizeBytes() + 7401 (*InetAddr)(nil).SizeBytes() + 7402 (*InetAddr)(nil).SizeBytes() + 7403 1*IFNAMSIZ + 7404 1*IFNAMSIZ + 7405 1*IFNAMSIZ + 7406 1*IFNAMSIZ 7407 } 7408 7409 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7410 func (i *IPTIP) MarshalBytes(dst []byte) []byte { 7411 dst = i.Src.MarshalUnsafe(dst) 7412 dst = i.Dst.MarshalUnsafe(dst) 7413 dst = i.SrcMask.MarshalUnsafe(dst) 7414 dst = i.DstMask.MarshalUnsafe(dst) 7415 for idx := 0; idx < IFNAMSIZ; idx++ { 7416 dst[0] = byte(i.InputInterface[idx]) 7417 dst = dst[1:] 7418 } 7419 for idx := 0; idx < IFNAMSIZ; idx++ { 7420 dst[0] = byte(i.OutputInterface[idx]) 7421 dst = dst[1:] 7422 } 7423 for idx := 0; idx < IFNAMSIZ; idx++ { 7424 dst[0] = byte(i.InputInterfaceMask[idx]) 7425 dst = dst[1:] 7426 } 7427 for idx := 0; idx < IFNAMSIZ; idx++ { 7428 dst[0] = byte(i.OutputInterfaceMask[idx]) 7429 dst = dst[1:] 7430 } 7431 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 7432 dst = dst[2:] 7433 dst[0] = byte(i.Flags) 7434 dst = dst[1:] 7435 dst[0] = byte(i.InverseFlags) 7436 dst = dst[1:] 7437 return dst 7438 } 7439 7440 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7441 func (i *IPTIP) UnmarshalBytes(src []byte) []byte { 7442 src = i.Src.UnmarshalUnsafe(src) 7443 src = i.Dst.UnmarshalUnsafe(src) 7444 src = i.SrcMask.UnmarshalUnsafe(src) 7445 src = i.DstMask.UnmarshalUnsafe(src) 7446 for idx := 0; idx < IFNAMSIZ; idx++ { 7447 i.InputInterface[idx] = src[0] 7448 src = src[1:] 7449 } 7450 for idx := 0; idx < IFNAMSIZ; idx++ { 7451 i.OutputInterface[idx] = src[0] 7452 src = src[1:] 7453 } 7454 for idx := 0; idx < IFNAMSIZ; idx++ { 7455 i.InputInterfaceMask[idx] = src[0] 7456 src = src[1:] 7457 } 7458 for idx := 0; idx < IFNAMSIZ; idx++ { 7459 i.OutputInterfaceMask[idx] = src[0] 7460 src = src[1:] 7461 } 7462 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7463 src = src[2:] 7464 i.Flags = uint8(src[0]) 7465 src = src[1:] 7466 i.InverseFlags = uint8(src[0]) 7467 src = src[1:] 7468 return src 7469 } 7470 7471 // Packed implements marshal.Marshallable.Packed. 7472 //go:nosplit 7473 func (i *IPTIP) Packed() bool { 7474 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 7475 } 7476 7477 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7478 func (i *IPTIP) MarshalUnsafe(dst []byte) []byte { 7479 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 7480 size := i.SizeBytes() 7481 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7482 return dst[size:] 7483 } 7484 // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes. 7485 return i.MarshalBytes(dst) 7486 } 7487 7488 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7489 func (i *IPTIP) UnmarshalUnsafe(src []byte) []byte { 7490 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 7491 size := i.SizeBytes() 7492 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7493 return src[size:] 7494 } 7495 // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7496 return i.UnmarshalBytes(src) 7497 } 7498 7499 // CopyOutN implements marshal.Marshallable.CopyOutN. 7500 //go:nosplit 7501 func (i *IPTIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7502 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 7503 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 7504 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7505 i.MarshalBytes(buf) // escapes: fallback. 7506 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7507 } 7508 7509 // Construct a slice backed by dst's underlying memory. 7510 var buf []byte 7511 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7512 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7513 hdr.Len = i.SizeBytes() 7514 hdr.Cap = i.SizeBytes() 7515 7516 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7517 // Since we bypassed the compiler's escape analysis, indicate that i 7518 // must live until the use above. 7519 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7520 return length, err 7521 } 7522 7523 // CopyOut implements marshal.Marshallable.CopyOut. 7524 //go:nosplit 7525 func (i *IPTIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7526 return i.CopyOutN(cc, addr, i.SizeBytes()) 7527 } 7528 7529 // CopyIn implements marshal.Marshallable.CopyIn. 7530 //go:nosplit 7531 func (i *IPTIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7532 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 7533 // Type IPTIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7534 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7535 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7536 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7537 // partially unmarshalled struct. 7538 i.UnmarshalBytes(buf) // escapes: fallback. 7539 return length, err 7540 } 7541 7542 // Construct a slice backed by dst's underlying memory. 7543 var buf []byte 7544 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7545 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7546 hdr.Len = i.SizeBytes() 7547 hdr.Cap = i.SizeBytes() 7548 7549 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7550 // Since we bypassed the compiler's escape analysis, indicate that i 7551 // must live until the use above. 7552 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7553 return length, err 7554 } 7555 7556 // WriteTo implements io.WriterTo.WriteTo. 7557 func (i *IPTIP) WriteTo(writer io.Writer) (int64, error) { 7558 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 7559 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 7560 buf := make([]byte, i.SizeBytes()) 7561 i.MarshalBytes(buf) 7562 length, err := writer.Write(buf) 7563 return int64(length), err 7564 } 7565 7566 // Construct a slice backed by dst's underlying memory. 7567 var buf []byte 7568 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7569 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7570 hdr.Len = i.SizeBytes() 7571 hdr.Cap = i.SizeBytes() 7572 7573 length, err := writer.Write(buf) 7574 // Since we bypassed the compiler's escape analysis, indicate that i 7575 // must live until the use above. 7576 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7577 return int64(length), err 7578 } 7579 7580 // SizeBytes implements marshal.Marshallable.SizeBytes. 7581 func (i *IPTOwnerInfo) SizeBytes() int { 7582 return 18 + 7583 1*16 7584 } 7585 7586 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7587 func (i *IPTOwnerInfo) MarshalBytes(dst []byte) []byte { 7588 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 7589 dst = dst[4:] 7590 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 7591 dst = dst[4:] 7592 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.PID)) 7593 dst = dst[4:] 7594 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SID)) 7595 dst = dst[4:] 7596 for idx := 0; idx < 16; idx++ { 7597 dst[0] = byte(i.Comm[idx]) 7598 dst = dst[1:] 7599 } 7600 dst[0] = byte(i.Match) 7601 dst = dst[1:] 7602 dst[0] = byte(i.Invert) 7603 dst = dst[1:] 7604 return dst 7605 } 7606 7607 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7608 func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) []byte { 7609 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7610 src = src[4:] 7611 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7612 src = src[4:] 7613 i.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7614 src = src[4:] 7615 i.SID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7616 src = src[4:] 7617 for idx := 0; idx < 16; idx++ { 7618 i.Comm[idx] = src[0] 7619 src = src[1:] 7620 } 7621 i.Match = uint8(src[0]) 7622 src = src[1:] 7623 i.Invert = uint8(src[0]) 7624 src = src[1:] 7625 return src 7626 } 7627 7628 // Packed implements marshal.Marshallable.Packed. 7629 //go:nosplit 7630 func (i *IPTOwnerInfo) Packed() bool { 7631 return false 7632 } 7633 7634 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7635 func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) []byte { 7636 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7637 return i.MarshalBytes(dst) 7638 } 7639 7640 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7641 func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) []byte { 7642 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7643 return i.UnmarshalBytes(src) 7644 } 7645 7646 // CopyOutN implements marshal.Marshallable.CopyOutN. 7647 //go:nosplit 7648 func (i *IPTOwnerInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7649 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7650 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7651 i.MarshalBytes(buf) // escapes: fallback. 7652 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7653 } 7654 7655 // CopyOut implements marshal.Marshallable.CopyOut. 7656 //go:nosplit 7657 func (i *IPTOwnerInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7658 return i.CopyOutN(cc, addr, i.SizeBytes()) 7659 } 7660 7661 // CopyIn implements marshal.Marshallable.CopyIn. 7662 //go:nosplit 7663 func (i *IPTOwnerInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7664 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7665 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7666 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7667 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7668 // partially unmarshalled struct. 7669 i.UnmarshalBytes(buf) // escapes: fallback. 7670 return length, err 7671 } 7672 7673 // WriteTo implements io.WriterTo.WriteTo. 7674 func (i *IPTOwnerInfo) WriteTo(writer io.Writer) (int64, error) { 7675 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7676 buf := make([]byte, i.SizeBytes()) 7677 i.MarshalBytes(buf) 7678 length, err := writer.Write(buf) 7679 return int64(length), err 7680 } 7681 7682 // SizeBytes implements marshal.Marshallable.SizeBytes. 7683 func (i *IPTReplace) SizeBytes() int { 7684 return 24 + 7685 (*TableName)(nil).SizeBytes() + 7686 4*NF_INET_NUMHOOKS + 7687 4*NF_INET_NUMHOOKS 7688 } 7689 7690 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7691 func (i *IPTReplace) MarshalBytes(dst []byte) []byte { 7692 dst = i.Name.MarshalUnsafe(dst) 7693 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 7694 dst = dst[4:] 7695 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 7696 dst = dst[4:] 7697 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 7698 dst = dst[4:] 7699 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7700 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 7701 dst = dst[4:] 7702 } 7703 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7704 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 7705 dst = dst[4:] 7706 } 7707 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 7708 dst = dst[4:] 7709 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 7710 dst = dst[8:] 7711 return dst 7712 } 7713 7714 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7715 func (i *IPTReplace) UnmarshalBytes(src []byte) []byte { 7716 src = i.Name.UnmarshalUnsafe(src) 7717 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7718 src = src[4:] 7719 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7720 src = src[4:] 7721 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7722 src = src[4:] 7723 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7724 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7725 src = src[4:] 7726 } 7727 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 7728 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7729 src = src[4:] 7730 } 7731 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7732 src = src[4:] 7733 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7734 src = src[8:] 7735 return src 7736 } 7737 7738 // Packed implements marshal.Marshallable.Packed. 7739 //go:nosplit 7740 func (i *IPTReplace) Packed() bool { 7741 return i.Name.Packed() 7742 } 7743 7744 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7745 func (i *IPTReplace) MarshalUnsafe(dst []byte) []byte { 7746 if i.Name.Packed() { 7747 size := i.SizeBytes() 7748 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7749 return dst[size:] 7750 } 7751 // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 7752 return i.MarshalBytes(dst) 7753 } 7754 7755 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7756 func (i *IPTReplace) UnmarshalUnsafe(src []byte) []byte { 7757 if i.Name.Packed() { 7758 size := i.SizeBytes() 7759 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7760 return src[size:] 7761 } 7762 // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7763 return i.UnmarshalBytes(src) 7764 } 7765 7766 // CopyOutN implements marshal.Marshallable.CopyOutN. 7767 //go:nosplit 7768 func (i *IPTReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7769 if !i.Name.Packed() { 7770 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 7771 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7772 i.MarshalBytes(buf) // escapes: fallback. 7773 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7774 } 7775 7776 // Construct a slice backed by dst's underlying memory. 7777 var buf []byte 7778 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7779 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7780 hdr.Len = i.SizeBytes() 7781 hdr.Cap = i.SizeBytes() 7782 7783 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7784 // Since we bypassed the compiler's escape analysis, indicate that i 7785 // must live until the use above. 7786 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7787 return length, err 7788 } 7789 7790 // CopyOut implements marshal.Marshallable.CopyOut. 7791 //go:nosplit 7792 func (i *IPTReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7793 return i.CopyOutN(cc, addr, i.SizeBytes()) 7794 } 7795 7796 // CopyIn implements marshal.Marshallable.CopyIn. 7797 //go:nosplit 7798 func (i *IPTReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7799 if !i.Name.Packed() { 7800 // Type IPTReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7801 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7802 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7803 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7804 // partially unmarshalled struct. 7805 i.UnmarshalBytes(buf) // escapes: fallback. 7806 return length, err 7807 } 7808 7809 // Construct a slice backed by dst's underlying memory. 7810 var buf []byte 7811 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7812 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7813 hdr.Len = i.SizeBytes() 7814 hdr.Cap = i.SizeBytes() 7815 7816 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7817 // Since we bypassed the compiler's escape analysis, indicate that i 7818 // must live until the use above. 7819 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7820 return length, err 7821 } 7822 7823 // WriteTo implements io.WriterTo.WriteTo. 7824 func (i *IPTReplace) WriteTo(writer io.Writer) (int64, error) { 7825 if !i.Name.Packed() { 7826 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 7827 buf := make([]byte, i.SizeBytes()) 7828 i.MarshalBytes(buf) 7829 length, err := writer.Write(buf) 7830 return int64(length), err 7831 } 7832 7833 // Construct a slice backed by dst's underlying memory. 7834 var buf []byte 7835 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7836 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7837 hdr.Len = i.SizeBytes() 7838 hdr.Cap = i.SizeBytes() 7839 7840 length, err := writer.Write(buf) 7841 // Since we bypassed the compiler's escape analysis, indicate that i 7842 // must live until the use above. 7843 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7844 return int64(length), err 7845 } 7846 7847 // Packed implements marshal.Marshallable.Packed. 7848 //go:nosplit 7849 func (ke *KernelIPTEntry) Packed() bool { 7850 // Type KernelIPTEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 7851 return false 7852 } 7853 7854 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7855 func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) []byte { 7856 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 7857 return ke.MarshalBytes(dst) 7858 } 7859 7860 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7861 func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) []byte { 7862 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7863 return ke.UnmarshalBytes(src) 7864 } 7865 7866 // CopyOutN implements marshal.Marshallable.CopyOutN. 7867 //go:nosplit 7868 func (ke *KernelIPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7869 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 7870 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 7871 ke.MarshalBytes(buf) // escapes: fallback. 7872 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7873 } 7874 7875 // CopyOut implements marshal.Marshallable.CopyOut. 7876 //go:nosplit 7877 func (ke *KernelIPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7878 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 7879 } 7880 7881 // CopyIn implements marshal.Marshallable.CopyIn. 7882 //go:nosplit 7883 func (ke *KernelIPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7884 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7885 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 7886 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7887 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7888 // partially unmarshalled struct. 7889 ke.UnmarshalBytes(buf) // escapes: fallback. 7890 return length, err 7891 } 7892 7893 // WriteTo implements io.WriterTo.WriteTo. 7894 func (ke *KernelIPTEntry) WriteTo(writer io.Writer) (int64, error) { 7895 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 7896 buf := make([]byte, ke.SizeBytes()) 7897 ke.MarshalBytes(buf) 7898 length, err := writer.Write(buf) 7899 return int64(length), err 7900 } 7901 7902 // Packed implements marshal.Marshallable.Packed. 7903 //go:nosplit 7904 func (ke *KernelIPTGetEntries) Packed() bool { 7905 // Type KernelIPTGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 7906 return false 7907 } 7908 7909 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7910 func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) []byte { 7911 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 7912 return ke.MarshalBytes(dst) 7913 } 7914 7915 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7916 func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 7917 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7918 return ke.UnmarshalBytes(src) 7919 } 7920 7921 // CopyOutN implements marshal.Marshallable.CopyOutN. 7922 //go:nosplit 7923 func (ke *KernelIPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7924 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 7925 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 7926 ke.MarshalBytes(buf) // escapes: fallback. 7927 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7928 } 7929 7930 // CopyOut implements marshal.Marshallable.CopyOut. 7931 //go:nosplit 7932 func (ke *KernelIPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7933 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 7934 } 7935 7936 // CopyIn implements marshal.Marshallable.CopyIn. 7937 //go:nosplit 7938 func (ke *KernelIPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7939 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7940 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 7941 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7942 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7943 // partially unmarshalled struct. 7944 ke.UnmarshalBytes(buf) // escapes: fallback. 7945 return length, err 7946 } 7947 7948 // WriteTo implements io.WriterTo.WriteTo. 7949 func (ke *KernelIPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 7950 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 7951 buf := make([]byte, ke.SizeBytes()) 7952 ke.MarshalBytes(buf) 7953 length, err := writer.Write(buf) 7954 return int64(length), err 7955 } 7956 7957 // SizeBytes implements marshal.Marshallable.SizeBytes. 7958 func (n *NfNATIPV4MultiRangeCompat) SizeBytes() int { 7959 return 4 + 7960 (*NfNATIPV4Range)(nil).SizeBytes() 7961 } 7962 7963 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7964 func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) []byte { 7965 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.RangeSize)) 7966 dst = dst[4:] 7967 dst = n.RangeIPV4.MarshalUnsafe(dst) 7968 return dst 7969 } 7970 7971 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7972 func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) []byte { 7973 n.RangeSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7974 src = src[4:] 7975 src = n.RangeIPV4.UnmarshalUnsafe(src) 7976 return src 7977 } 7978 7979 // Packed implements marshal.Marshallable.Packed. 7980 //go:nosplit 7981 func (n *NfNATIPV4MultiRangeCompat) Packed() bool { 7982 return n.RangeIPV4.Packed() 7983 } 7984 7985 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7986 func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) []byte { 7987 if n.RangeIPV4.Packed() { 7988 size := n.SizeBytes() 7989 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 7990 return dst[size:] 7991 } 7992 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes. 7993 return n.MarshalBytes(dst) 7994 } 7995 7996 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7997 func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) []byte { 7998 if n.RangeIPV4.Packed() { 7999 size := n.SizeBytes() 8000 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 8001 return src[size:] 8002 } 8003 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8004 return n.UnmarshalBytes(src) 8005 } 8006 8007 // CopyOutN implements marshal.Marshallable.CopyOutN. 8008 //go:nosplit 8009 func (n *NfNATIPV4MultiRangeCompat) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8010 if !n.RangeIPV4.Packed() { 8011 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 8012 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 8013 n.MarshalBytes(buf) // escapes: fallback. 8014 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8015 } 8016 8017 // Construct a slice backed by dst's underlying memory. 8018 var buf []byte 8019 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8020 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8021 hdr.Len = n.SizeBytes() 8022 hdr.Cap = n.SizeBytes() 8023 8024 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8025 // Since we bypassed the compiler's escape analysis, indicate that n 8026 // must live until the use above. 8027 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8028 return length, err 8029 } 8030 8031 // CopyOut implements marshal.Marshallable.CopyOut. 8032 //go:nosplit 8033 func (n *NfNATIPV4MultiRangeCompat) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8034 return n.CopyOutN(cc, addr, n.SizeBytes()) 8035 } 8036 8037 // CopyIn implements marshal.Marshallable.CopyIn. 8038 //go:nosplit 8039 func (n *NfNATIPV4MultiRangeCompat) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8040 if !n.RangeIPV4.Packed() { 8041 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8042 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 8043 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8044 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8045 // partially unmarshalled struct. 8046 n.UnmarshalBytes(buf) // escapes: fallback. 8047 return length, err 8048 } 8049 8050 // Construct a slice backed by dst's underlying memory. 8051 var buf []byte 8052 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8053 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8054 hdr.Len = n.SizeBytes() 8055 hdr.Cap = n.SizeBytes() 8056 8057 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8058 // Since we bypassed the compiler's escape analysis, indicate that n 8059 // must live until the use above. 8060 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8061 return length, err 8062 } 8063 8064 // WriteTo implements io.WriterTo.WriteTo. 8065 func (n *NfNATIPV4MultiRangeCompat) WriteTo(writer io.Writer) (int64, error) { 8066 if !n.RangeIPV4.Packed() { 8067 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 8068 buf := make([]byte, n.SizeBytes()) 8069 n.MarshalBytes(buf) 8070 length, err := writer.Write(buf) 8071 return int64(length), err 8072 } 8073 8074 // Construct a slice backed by dst's underlying memory. 8075 var buf []byte 8076 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8077 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8078 hdr.Len = n.SizeBytes() 8079 hdr.Cap = n.SizeBytes() 8080 8081 length, err := writer.Write(buf) 8082 // Since we bypassed the compiler's escape analysis, indicate that n 8083 // must live until the use above. 8084 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8085 return int64(length), err 8086 } 8087 8088 // SizeBytes implements marshal.Marshallable.SizeBytes. 8089 func (n *NfNATIPV4Range) SizeBytes() int { 8090 return 8 + 8091 1*4 + 8092 1*4 8093 } 8094 8095 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8096 func (n *NfNATIPV4Range) MarshalBytes(dst []byte) []byte { 8097 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 8098 dst = dst[4:] 8099 for idx := 0; idx < 4; idx++ { 8100 dst[0] = byte(n.MinIP[idx]) 8101 dst = dst[1:] 8102 } 8103 for idx := 0; idx < 4; idx++ { 8104 dst[0] = byte(n.MaxIP[idx]) 8105 dst = dst[1:] 8106 } 8107 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinPort)) 8108 dst = dst[2:] 8109 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxPort)) 8110 dst = dst[2:] 8111 return dst 8112 } 8113 8114 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8115 func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) []byte { 8116 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8117 src = src[4:] 8118 for idx := 0; idx < 4; idx++ { 8119 n.MinIP[idx] = src[0] 8120 src = src[1:] 8121 } 8122 for idx := 0; idx < 4; idx++ { 8123 n.MaxIP[idx] = src[0] 8124 src = src[1:] 8125 } 8126 n.MinPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8127 src = src[2:] 8128 n.MaxPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8129 src = src[2:] 8130 return src 8131 } 8132 8133 // Packed implements marshal.Marshallable.Packed. 8134 //go:nosplit 8135 func (n *NfNATIPV4Range) Packed() bool { 8136 return true 8137 } 8138 8139 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8140 func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) []byte { 8141 size := n.SizeBytes() 8142 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 8143 return dst[size:] 8144 } 8145 8146 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8147 func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) []byte { 8148 size := n.SizeBytes() 8149 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 8150 return src[size:] 8151 } 8152 8153 // CopyOutN implements marshal.Marshallable.CopyOutN. 8154 //go:nosplit 8155 func (n *NfNATIPV4Range) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8156 // Construct a slice backed by dst's underlying memory. 8157 var buf []byte 8158 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8159 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8160 hdr.Len = n.SizeBytes() 8161 hdr.Cap = n.SizeBytes() 8162 8163 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8164 // Since we bypassed the compiler's escape analysis, indicate that n 8165 // must live until the use above. 8166 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8167 return length, err 8168 } 8169 8170 // CopyOut implements marshal.Marshallable.CopyOut. 8171 //go:nosplit 8172 func (n *NfNATIPV4Range) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8173 return n.CopyOutN(cc, addr, n.SizeBytes()) 8174 } 8175 8176 // CopyIn implements marshal.Marshallable.CopyIn. 8177 //go:nosplit 8178 func (n *NfNATIPV4Range) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8179 // Construct a slice backed by dst's underlying memory. 8180 var buf []byte 8181 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8182 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8183 hdr.Len = n.SizeBytes() 8184 hdr.Cap = n.SizeBytes() 8185 8186 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8187 // Since we bypassed the compiler's escape analysis, indicate that n 8188 // must live until the use above. 8189 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8190 return length, err 8191 } 8192 8193 // WriteTo implements io.WriterTo.WriteTo. 8194 func (n *NfNATIPV4Range) WriteTo(writer io.Writer) (int64, error) { 8195 // Construct a slice backed by dst's underlying memory. 8196 var buf []byte 8197 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8198 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8199 hdr.Len = n.SizeBytes() 8200 hdr.Cap = n.SizeBytes() 8201 8202 length, err := writer.Write(buf) 8203 // Since we bypassed the compiler's escape analysis, indicate that n 8204 // must live until the use above. 8205 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8206 return int64(length), err 8207 } 8208 8209 // SizeBytes implements marshal.Marshallable.SizeBytes. 8210 //go:nosplit 8211 func (tn *TableName) SizeBytes() int { 8212 return 1 * XT_TABLE_MAXNAMELEN 8213 } 8214 8215 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8216 func (tn *TableName) MarshalBytes(dst []byte) []byte { 8217 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 8218 dst[0] = byte(tn[idx]) 8219 dst = dst[1:] 8220 } 8221 return dst 8222 } 8223 8224 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8225 func (tn *TableName) UnmarshalBytes(src []byte) []byte { 8226 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 8227 tn[idx] = src[0] 8228 src = src[1:] 8229 } 8230 return src 8231 } 8232 8233 // Packed implements marshal.Marshallable.Packed. 8234 //go:nosplit 8235 func (tn *TableName) Packed() bool { 8236 // Array newtypes are always packed. 8237 return true 8238 } 8239 8240 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8241 func (tn *TableName) MarshalUnsafe(dst []byte) []byte { 8242 size := tn.SizeBytes() 8243 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(size)) 8244 return dst[size:] 8245 } 8246 8247 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8248 func (tn *TableName) UnmarshalUnsafe(src []byte) []byte { 8249 size := tn.SizeBytes() 8250 gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(size)) 8251 return src[size:] 8252 } 8253 8254 // CopyOutN implements marshal.Marshallable.CopyOutN. 8255 //go:nosplit 8256 func (tn *TableName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8257 // Construct a slice backed by dst's underlying memory. 8258 var buf []byte 8259 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8260 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 8261 hdr.Len = tn.SizeBytes() 8262 hdr.Cap = tn.SizeBytes() 8263 8264 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8265 // Since we bypassed the compiler's escape analysis, indicate that tn 8266 // must live until the use above. 8267 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 8268 return length, err 8269 } 8270 8271 // CopyOut implements marshal.Marshallable.CopyOut. 8272 //go:nosplit 8273 func (tn *TableName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8274 return tn.CopyOutN(cc, addr, tn.SizeBytes()) 8275 } 8276 8277 // CopyIn implements marshal.Marshallable.CopyIn. 8278 //go:nosplit 8279 func (tn *TableName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8280 // Construct a slice backed by dst's underlying memory. 8281 var buf []byte 8282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 8284 hdr.Len = tn.SizeBytes() 8285 hdr.Cap = tn.SizeBytes() 8286 8287 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8288 // Since we bypassed the compiler's escape analysis, indicate that tn 8289 // must live until the use above. 8290 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 8291 return length, err 8292 } 8293 8294 // WriteTo implements io.WriterTo.WriteTo. 8295 func (tn *TableName) WriteTo(writer io.Writer) (int64, error) { 8296 // Construct a slice backed by dst's underlying memory. 8297 var buf []byte 8298 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8299 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 8300 hdr.Len = tn.SizeBytes() 8301 hdr.Cap = tn.SizeBytes() 8302 8303 length, err := writer.Write(buf) 8304 // Since we bypassed the compiler's escape analysis, indicate that tn 8305 // must live until the use above. 8306 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 8307 return int64(length), err 8308 } 8309 8310 // SizeBytes implements marshal.Marshallable.SizeBytes. 8311 func (x *XTCounters) SizeBytes() int { 8312 return 16 8313 } 8314 8315 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8316 func (x *XTCounters) MarshalBytes(dst []byte) []byte { 8317 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Pcnt)) 8318 dst = dst[8:] 8319 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Bcnt)) 8320 dst = dst[8:] 8321 return dst 8322 } 8323 8324 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8325 func (x *XTCounters) UnmarshalBytes(src []byte) []byte { 8326 x.Pcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8327 src = src[8:] 8328 x.Bcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8329 src = src[8:] 8330 return src 8331 } 8332 8333 // Packed implements marshal.Marshallable.Packed. 8334 //go:nosplit 8335 func (x *XTCounters) Packed() bool { 8336 return true 8337 } 8338 8339 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8340 func (x *XTCounters) MarshalUnsafe(dst []byte) []byte { 8341 size := x.SizeBytes() 8342 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 8343 return dst[size:] 8344 } 8345 8346 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8347 func (x *XTCounters) UnmarshalUnsafe(src []byte) []byte { 8348 size := x.SizeBytes() 8349 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 8350 return src[size:] 8351 } 8352 8353 // CopyOutN implements marshal.Marshallable.CopyOutN. 8354 //go:nosplit 8355 func (x *XTCounters) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8356 // Construct a slice backed by dst's underlying memory. 8357 var buf []byte 8358 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8359 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8360 hdr.Len = x.SizeBytes() 8361 hdr.Cap = x.SizeBytes() 8362 8363 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8364 // Since we bypassed the compiler's escape analysis, indicate that x 8365 // must live until the use above. 8366 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8367 return length, err 8368 } 8369 8370 // CopyOut implements marshal.Marshallable.CopyOut. 8371 //go:nosplit 8372 func (x *XTCounters) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8373 return x.CopyOutN(cc, addr, x.SizeBytes()) 8374 } 8375 8376 // CopyIn implements marshal.Marshallable.CopyIn. 8377 //go:nosplit 8378 func (x *XTCounters) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8379 // Construct a slice backed by dst's underlying memory. 8380 var buf []byte 8381 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8382 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8383 hdr.Len = x.SizeBytes() 8384 hdr.Cap = x.SizeBytes() 8385 8386 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8387 // Since we bypassed the compiler's escape analysis, indicate that x 8388 // must live until the use above. 8389 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8390 return length, err 8391 } 8392 8393 // WriteTo implements io.WriterTo.WriteTo. 8394 func (x *XTCounters) WriteTo(writer io.Writer) (int64, error) { 8395 // Construct a slice backed by dst's underlying memory. 8396 var buf []byte 8397 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8398 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8399 hdr.Len = x.SizeBytes() 8400 hdr.Cap = x.SizeBytes() 8401 8402 length, err := writer.Write(buf) 8403 // Since we bypassed the compiler's escape analysis, indicate that x 8404 // must live until the use above. 8405 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8406 return int64(length), err 8407 } 8408 8409 // SizeBytes implements marshal.Marshallable.SizeBytes. 8410 func (x *XTEntryMatch) SizeBytes() int { 8411 return 3 + 8412 (*ExtensionName)(nil).SizeBytes() 8413 } 8414 8415 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8416 func (x *XTEntryMatch) MarshalBytes(dst []byte) []byte { 8417 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.MatchSize)) 8418 dst = dst[2:] 8419 dst = x.Name.MarshalUnsafe(dst) 8420 dst[0] = byte(x.Revision) 8421 dst = dst[1:] 8422 return dst 8423 } 8424 8425 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8426 func (x *XTEntryMatch) UnmarshalBytes(src []byte) []byte { 8427 x.MatchSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8428 src = src[2:] 8429 src = x.Name.UnmarshalUnsafe(src) 8430 x.Revision = uint8(src[0]) 8431 src = src[1:] 8432 return src 8433 } 8434 8435 // Packed implements marshal.Marshallable.Packed. 8436 //go:nosplit 8437 func (x *XTEntryMatch) Packed() bool { 8438 return x.Name.Packed() 8439 } 8440 8441 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8442 func (x *XTEntryMatch) MarshalUnsafe(dst []byte) []byte { 8443 if x.Name.Packed() { 8444 size := x.SizeBytes() 8445 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 8446 return dst[size:] 8447 } 8448 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes. 8449 return x.MarshalBytes(dst) 8450 } 8451 8452 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8453 func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) []byte { 8454 if x.Name.Packed() { 8455 size := x.SizeBytes() 8456 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 8457 return src[size:] 8458 } 8459 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8460 return x.UnmarshalBytes(src) 8461 } 8462 8463 // CopyOutN implements marshal.Marshallable.CopyOutN. 8464 //go:nosplit 8465 func (x *XTEntryMatch) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8466 if !x.Name.Packed() { 8467 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 8468 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8469 x.MarshalBytes(buf) // escapes: fallback. 8470 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8471 } 8472 8473 // Construct a slice backed by dst's underlying memory. 8474 var buf []byte 8475 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8476 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8477 hdr.Len = x.SizeBytes() 8478 hdr.Cap = x.SizeBytes() 8479 8480 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8481 // Since we bypassed the compiler's escape analysis, indicate that x 8482 // must live until the use above. 8483 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8484 return length, err 8485 } 8486 8487 // CopyOut implements marshal.Marshallable.CopyOut. 8488 //go:nosplit 8489 func (x *XTEntryMatch) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8490 return x.CopyOutN(cc, addr, x.SizeBytes()) 8491 } 8492 8493 // CopyIn implements marshal.Marshallable.CopyIn. 8494 //go:nosplit 8495 func (x *XTEntryMatch) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8496 if !x.Name.Packed() { 8497 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8498 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8499 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8500 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8501 // partially unmarshalled struct. 8502 x.UnmarshalBytes(buf) // escapes: fallback. 8503 return length, err 8504 } 8505 8506 // Construct a slice backed by dst's underlying memory. 8507 var buf []byte 8508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8510 hdr.Len = x.SizeBytes() 8511 hdr.Cap = x.SizeBytes() 8512 8513 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8514 // Since we bypassed the compiler's escape analysis, indicate that x 8515 // must live until the use above. 8516 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8517 return length, err 8518 } 8519 8520 // WriteTo implements io.WriterTo.WriteTo. 8521 func (x *XTEntryMatch) WriteTo(writer io.Writer) (int64, error) { 8522 if !x.Name.Packed() { 8523 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 8524 buf := make([]byte, x.SizeBytes()) 8525 x.MarshalBytes(buf) 8526 length, err := writer.Write(buf) 8527 return int64(length), err 8528 } 8529 8530 // Construct a slice backed by dst's underlying memory. 8531 var buf []byte 8532 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8533 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8534 hdr.Len = x.SizeBytes() 8535 hdr.Cap = x.SizeBytes() 8536 8537 length, err := writer.Write(buf) 8538 // Since we bypassed the compiler's escape analysis, indicate that x 8539 // must live until the use above. 8540 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8541 return int64(length), err 8542 } 8543 8544 // SizeBytes implements marshal.Marshallable.SizeBytes. 8545 func (x *XTEntryTarget) SizeBytes() int { 8546 return 3 + 8547 (*ExtensionName)(nil).SizeBytes() 8548 } 8549 8550 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8551 func (x *XTEntryTarget) MarshalBytes(dst []byte) []byte { 8552 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.TargetSize)) 8553 dst = dst[2:] 8554 dst = x.Name.MarshalUnsafe(dst) 8555 dst[0] = byte(x.Revision) 8556 dst = dst[1:] 8557 return dst 8558 } 8559 8560 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8561 func (x *XTEntryTarget) UnmarshalBytes(src []byte) []byte { 8562 x.TargetSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8563 src = src[2:] 8564 src = x.Name.UnmarshalUnsafe(src) 8565 x.Revision = uint8(src[0]) 8566 src = src[1:] 8567 return src 8568 } 8569 8570 // Packed implements marshal.Marshallable.Packed. 8571 //go:nosplit 8572 func (x *XTEntryTarget) Packed() bool { 8573 return x.Name.Packed() 8574 } 8575 8576 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8577 func (x *XTEntryTarget) MarshalUnsafe(dst []byte) []byte { 8578 if x.Name.Packed() { 8579 size := x.SizeBytes() 8580 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 8581 return dst[size:] 8582 } 8583 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 8584 return x.MarshalBytes(dst) 8585 } 8586 8587 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8588 func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) []byte { 8589 if x.Name.Packed() { 8590 size := x.SizeBytes() 8591 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 8592 return src[size:] 8593 } 8594 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8595 return x.UnmarshalBytes(src) 8596 } 8597 8598 // CopyOutN implements marshal.Marshallable.CopyOutN. 8599 //go:nosplit 8600 func (x *XTEntryTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8601 if !x.Name.Packed() { 8602 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 8603 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8604 x.MarshalBytes(buf) // escapes: fallback. 8605 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8606 } 8607 8608 // Construct a slice backed by dst's underlying memory. 8609 var buf []byte 8610 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8611 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8612 hdr.Len = x.SizeBytes() 8613 hdr.Cap = x.SizeBytes() 8614 8615 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8616 // Since we bypassed the compiler's escape analysis, indicate that x 8617 // must live until the use above. 8618 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8619 return length, err 8620 } 8621 8622 // CopyOut implements marshal.Marshallable.CopyOut. 8623 //go:nosplit 8624 func (x *XTEntryTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8625 return x.CopyOutN(cc, addr, x.SizeBytes()) 8626 } 8627 8628 // CopyIn implements marshal.Marshallable.CopyIn. 8629 //go:nosplit 8630 func (x *XTEntryTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8631 if !x.Name.Packed() { 8632 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8633 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8634 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8635 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8636 // partially unmarshalled struct. 8637 x.UnmarshalBytes(buf) // escapes: fallback. 8638 return length, err 8639 } 8640 8641 // Construct a slice backed by dst's underlying memory. 8642 var buf []byte 8643 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8644 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8645 hdr.Len = x.SizeBytes() 8646 hdr.Cap = x.SizeBytes() 8647 8648 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8649 // Since we bypassed the compiler's escape analysis, indicate that x 8650 // must live until the use above. 8651 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8652 return length, err 8653 } 8654 8655 // WriteTo implements io.WriterTo.WriteTo. 8656 func (x *XTEntryTarget) WriteTo(writer io.Writer) (int64, error) { 8657 if !x.Name.Packed() { 8658 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 8659 buf := make([]byte, x.SizeBytes()) 8660 x.MarshalBytes(buf) 8661 length, err := writer.Write(buf) 8662 return int64(length), err 8663 } 8664 8665 // Construct a slice backed by dst's underlying memory. 8666 var buf []byte 8667 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8668 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8669 hdr.Len = x.SizeBytes() 8670 hdr.Cap = x.SizeBytes() 8671 8672 length, err := writer.Write(buf) 8673 // Since we bypassed the compiler's escape analysis, indicate that x 8674 // must live until the use above. 8675 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8676 return int64(length), err 8677 } 8678 8679 // SizeBytes implements marshal.Marshallable.SizeBytes. 8680 func (x *XTErrorTarget) SizeBytes() int { 8681 return 0 + 8682 (*XTEntryTarget)(nil).SizeBytes() + 8683 (*ErrorName)(nil).SizeBytes() + 8684 1*2 8685 } 8686 8687 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8688 func (x *XTErrorTarget) MarshalBytes(dst []byte) []byte { 8689 dst = x.Target.MarshalUnsafe(dst) 8690 dst = x.Name.MarshalUnsafe(dst) 8691 // Padding: dst[:sizeof(byte)*2] ~= [2]byte{0} 8692 dst = dst[1*(2):] 8693 return dst 8694 } 8695 8696 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8697 func (x *XTErrorTarget) UnmarshalBytes(src []byte) []byte { 8698 src = x.Target.UnmarshalUnsafe(src) 8699 src = x.Name.UnmarshalUnsafe(src) 8700 // Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2]) 8701 src = src[1*(2):] 8702 return src 8703 } 8704 8705 // Packed implements marshal.Marshallable.Packed. 8706 //go:nosplit 8707 func (x *XTErrorTarget) Packed() bool { 8708 return x.Name.Packed() && x.Target.Packed() 8709 } 8710 8711 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8712 func (x *XTErrorTarget) MarshalUnsafe(dst []byte) []byte { 8713 if x.Name.Packed() && x.Target.Packed() { 8714 size := x.SizeBytes() 8715 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 8716 return dst[size:] 8717 } 8718 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 8719 return x.MarshalBytes(dst) 8720 } 8721 8722 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8723 func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) []byte { 8724 if x.Name.Packed() && x.Target.Packed() { 8725 size := x.SizeBytes() 8726 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 8727 return src[size:] 8728 } 8729 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8730 return x.UnmarshalBytes(src) 8731 } 8732 8733 // CopyOutN implements marshal.Marshallable.CopyOutN. 8734 //go:nosplit 8735 func (x *XTErrorTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8736 if !x.Name.Packed() && x.Target.Packed() { 8737 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 8738 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8739 x.MarshalBytes(buf) // escapes: fallback. 8740 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8741 } 8742 8743 // Construct a slice backed by dst's underlying memory. 8744 var buf []byte 8745 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8746 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8747 hdr.Len = x.SizeBytes() 8748 hdr.Cap = x.SizeBytes() 8749 8750 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8751 // Since we bypassed the compiler's escape analysis, indicate that x 8752 // must live until the use above. 8753 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8754 return length, err 8755 } 8756 8757 // CopyOut implements marshal.Marshallable.CopyOut. 8758 //go:nosplit 8759 func (x *XTErrorTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8760 return x.CopyOutN(cc, addr, x.SizeBytes()) 8761 } 8762 8763 // CopyIn implements marshal.Marshallable.CopyIn. 8764 //go:nosplit 8765 func (x *XTErrorTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8766 if !x.Name.Packed() && x.Target.Packed() { 8767 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8768 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8769 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8770 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8771 // partially unmarshalled struct. 8772 x.UnmarshalBytes(buf) // escapes: fallback. 8773 return length, err 8774 } 8775 8776 // Construct a slice backed by dst's underlying memory. 8777 var buf []byte 8778 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8779 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8780 hdr.Len = x.SizeBytes() 8781 hdr.Cap = x.SizeBytes() 8782 8783 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8784 // Since we bypassed the compiler's escape analysis, indicate that x 8785 // must live until the use above. 8786 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8787 return length, err 8788 } 8789 8790 // WriteTo implements io.WriterTo.WriteTo. 8791 func (x *XTErrorTarget) WriteTo(writer io.Writer) (int64, error) { 8792 if !x.Name.Packed() && x.Target.Packed() { 8793 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 8794 buf := make([]byte, x.SizeBytes()) 8795 x.MarshalBytes(buf) 8796 length, err := writer.Write(buf) 8797 return int64(length), err 8798 } 8799 8800 // Construct a slice backed by dst's underlying memory. 8801 var buf []byte 8802 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8803 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8804 hdr.Len = x.SizeBytes() 8805 hdr.Cap = x.SizeBytes() 8806 8807 length, err := writer.Write(buf) 8808 // Since we bypassed the compiler's escape analysis, indicate that x 8809 // must live until the use above. 8810 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8811 return int64(length), err 8812 } 8813 8814 // SizeBytes implements marshal.Marshallable.SizeBytes. 8815 func (x *XTGetRevision) SizeBytes() int { 8816 return 1 + 8817 (*ExtensionName)(nil).SizeBytes() 8818 } 8819 8820 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8821 func (x *XTGetRevision) MarshalBytes(dst []byte) []byte { 8822 dst = x.Name.MarshalUnsafe(dst) 8823 dst[0] = byte(x.Revision) 8824 dst = dst[1:] 8825 return dst 8826 } 8827 8828 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8829 func (x *XTGetRevision) UnmarshalBytes(src []byte) []byte { 8830 src = x.Name.UnmarshalUnsafe(src) 8831 x.Revision = uint8(src[0]) 8832 src = src[1:] 8833 return src 8834 } 8835 8836 // Packed implements marshal.Marshallable.Packed. 8837 //go:nosplit 8838 func (x *XTGetRevision) Packed() bool { 8839 return x.Name.Packed() 8840 } 8841 8842 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8843 func (x *XTGetRevision) MarshalUnsafe(dst []byte) []byte { 8844 if x.Name.Packed() { 8845 size := x.SizeBytes() 8846 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 8847 return dst[size:] 8848 } 8849 // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes. 8850 return x.MarshalBytes(dst) 8851 } 8852 8853 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8854 func (x *XTGetRevision) UnmarshalUnsafe(src []byte) []byte { 8855 if x.Name.Packed() { 8856 size := x.SizeBytes() 8857 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 8858 return src[size:] 8859 } 8860 // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8861 return x.UnmarshalBytes(src) 8862 } 8863 8864 // CopyOutN implements marshal.Marshallable.CopyOutN. 8865 //go:nosplit 8866 func (x *XTGetRevision) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8867 if !x.Name.Packed() { 8868 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 8869 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8870 x.MarshalBytes(buf) // escapes: fallback. 8871 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8872 } 8873 8874 // Construct a slice backed by dst's underlying memory. 8875 var buf []byte 8876 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8877 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8878 hdr.Len = x.SizeBytes() 8879 hdr.Cap = x.SizeBytes() 8880 8881 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8882 // Since we bypassed the compiler's escape analysis, indicate that x 8883 // must live until the use above. 8884 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8885 return length, err 8886 } 8887 8888 // CopyOut implements marshal.Marshallable.CopyOut. 8889 //go:nosplit 8890 func (x *XTGetRevision) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8891 return x.CopyOutN(cc, addr, x.SizeBytes()) 8892 } 8893 8894 // CopyIn implements marshal.Marshallable.CopyIn. 8895 //go:nosplit 8896 func (x *XTGetRevision) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8897 if !x.Name.Packed() { 8898 // Type XTGetRevision doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8899 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 8900 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8901 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8902 // partially unmarshalled struct. 8903 x.UnmarshalBytes(buf) // escapes: fallback. 8904 return length, err 8905 } 8906 8907 // Construct a slice backed by dst's underlying memory. 8908 var buf []byte 8909 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8910 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8911 hdr.Len = x.SizeBytes() 8912 hdr.Cap = x.SizeBytes() 8913 8914 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8915 // Since we bypassed the compiler's escape analysis, indicate that x 8916 // must live until the use above. 8917 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8918 return length, err 8919 } 8920 8921 // WriteTo implements io.WriterTo.WriteTo. 8922 func (x *XTGetRevision) WriteTo(writer io.Writer) (int64, error) { 8923 if !x.Name.Packed() { 8924 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 8925 buf := make([]byte, x.SizeBytes()) 8926 x.MarshalBytes(buf) 8927 length, err := writer.Write(buf) 8928 return int64(length), err 8929 } 8930 8931 // Construct a slice backed by dst's underlying memory. 8932 var buf []byte 8933 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8934 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 8935 hdr.Len = x.SizeBytes() 8936 hdr.Cap = x.SizeBytes() 8937 8938 length, err := writer.Write(buf) 8939 // Since we bypassed the compiler's escape analysis, indicate that x 8940 // must live until the use above. 8941 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 8942 return int64(length), err 8943 } 8944 8945 // SizeBytes implements marshal.Marshallable.SizeBytes. 8946 func (x *XTRedirectTarget) SizeBytes() int { 8947 return 0 + 8948 (*XTEntryTarget)(nil).SizeBytes() + 8949 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 8950 1*4 8951 } 8952 8953 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8954 func (x *XTRedirectTarget) MarshalBytes(dst []byte) []byte { 8955 dst = x.Target.MarshalUnsafe(dst) 8956 dst = x.NfRange.MarshalUnsafe(dst) 8957 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 8958 dst = dst[1*(4):] 8959 return dst 8960 } 8961 8962 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8963 func (x *XTRedirectTarget) UnmarshalBytes(src []byte) []byte { 8964 src = x.Target.UnmarshalUnsafe(src) 8965 src = x.NfRange.UnmarshalUnsafe(src) 8966 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 8967 src = src[1*(4):] 8968 return src 8969 } 8970 8971 // Packed implements marshal.Marshallable.Packed. 8972 //go:nosplit 8973 func (x *XTRedirectTarget) Packed() bool { 8974 return x.NfRange.Packed() && x.Target.Packed() 8975 } 8976 8977 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8978 func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) []byte { 8979 if x.NfRange.Packed() && x.Target.Packed() { 8980 size := x.SizeBytes() 8981 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 8982 return dst[size:] 8983 } 8984 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 8985 return x.MarshalBytes(dst) 8986 } 8987 8988 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8989 func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) []byte { 8990 if x.NfRange.Packed() && x.Target.Packed() { 8991 size := x.SizeBytes() 8992 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 8993 return src[size:] 8994 } 8995 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8996 return x.UnmarshalBytes(src) 8997 } 8998 8999 // CopyOutN implements marshal.Marshallable.CopyOutN. 9000 //go:nosplit 9001 func (x *XTRedirectTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9002 if !x.NfRange.Packed() && x.Target.Packed() { 9003 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 9004 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 9005 x.MarshalBytes(buf) // escapes: fallback. 9006 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9007 } 9008 9009 // Construct a slice backed by dst's underlying memory. 9010 var buf []byte 9011 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9012 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9013 hdr.Len = x.SizeBytes() 9014 hdr.Cap = x.SizeBytes() 9015 9016 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9017 // Since we bypassed the compiler's escape analysis, indicate that x 9018 // must live until the use above. 9019 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9020 return length, err 9021 } 9022 9023 // CopyOut implements marshal.Marshallable.CopyOut. 9024 //go:nosplit 9025 func (x *XTRedirectTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9026 return x.CopyOutN(cc, addr, x.SizeBytes()) 9027 } 9028 9029 // CopyIn implements marshal.Marshallable.CopyIn. 9030 //go:nosplit 9031 func (x *XTRedirectTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9032 if !x.NfRange.Packed() && x.Target.Packed() { 9033 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9034 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 9035 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9036 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9037 // partially unmarshalled struct. 9038 x.UnmarshalBytes(buf) // escapes: fallback. 9039 return length, err 9040 } 9041 9042 // Construct a slice backed by dst's underlying memory. 9043 var buf []byte 9044 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9045 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9046 hdr.Len = x.SizeBytes() 9047 hdr.Cap = x.SizeBytes() 9048 9049 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9050 // Since we bypassed the compiler's escape analysis, indicate that x 9051 // must live until the use above. 9052 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9053 return length, err 9054 } 9055 9056 // WriteTo implements io.WriterTo.WriteTo. 9057 func (x *XTRedirectTarget) WriteTo(writer io.Writer) (int64, error) { 9058 if !x.NfRange.Packed() && x.Target.Packed() { 9059 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 9060 buf := make([]byte, x.SizeBytes()) 9061 x.MarshalBytes(buf) 9062 length, err := writer.Write(buf) 9063 return int64(length), err 9064 } 9065 9066 // Construct a slice backed by dst's underlying memory. 9067 var buf []byte 9068 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9069 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9070 hdr.Len = x.SizeBytes() 9071 hdr.Cap = x.SizeBytes() 9072 9073 length, err := writer.Write(buf) 9074 // Since we bypassed the compiler's escape analysis, indicate that x 9075 // must live until the use above. 9076 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9077 return int64(length), err 9078 } 9079 9080 // SizeBytes implements marshal.Marshallable.SizeBytes. 9081 func (x *XTSNATTarget) SizeBytes() int { 9082 return 0 + 9083 (*XTEntryTarget)(nil).SizeBytes() + 9084 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 9085 1*4 9086 } 9087 9088 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9089 func (x *XTSNATTarget) MarshalBytes(dst []byte) []byte { 9090 dst = x.Target.MarshalUnsafe(dst) 9091 dst = x.NfRange.MarshalUnsafe(dst) 9092 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 9093 dst = dst[1*(4):] 9094 return dst 9095 } 9096 9097 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9098 func (x *XTSNATTarget) UnmarshalBytes(src []byte) []byte { 9099 src = x.Target.UnmarshalUnsafe(src) 9100 src = x.NfRange.UnmarshalUnsafe(src) 9101 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 9102 src = src[1*(4):] 9103 return src 9104 } 9105 9106 // Packed implements marshal.Marshallable.Packed. 9107 //go:nosplit 9108 func (x *XTSNATTarget) Packed() bool { 9109 return x.NfRange.Packed() && x.Target.Packed() 9110 } 9111 9112 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9113 func (x *XTSNATTarget) MarshalUnsafe(dst []byte) []byte { 9114 if x.NfRange.Packed() && x.Target.Packed() { 9115 size := x.SizeBytes() 9116 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 9117 return dst[size:] 9118 } 9119 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 9120 return x.MarshalBytes(dst) 9121 } 9122 9123 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9124 func (x *XTSNATTarget) UnmarshalUnsafe(src []byte) []byte { 9125 if x.NfRange.Packed() && x.Target.Packed() { 9126 size := x.SizeBytes() 9127 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 9128 return src[size:] 9129 } 9130 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9131 return x.UnmarshalBytes(src) 9132 } 9133 9134 // CopyOutN implements marshal.Marshallable.CopyOutN. 9135 //go:nosplit 9136 func (x *XTSNATTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9137 if !x.NfRange.Packed() && x.Target.Packed() { 9138 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 9139 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 9140 x.MarshalBytes(buf) // escapes: fallback. 9141 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9142 } 9143 9144 // Construct a slice backed by dst's underlying memory. 9145 var buf []byte 9146 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9147 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9148 hdr.Len = x.SizeBytes() 9149 hdr.Cap = x.SizeBytes() 9150 9151 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9152 // Since we bypassed the compiler's escape analysis, indicate that x 9153 // must live until the use above. 9154 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9155 return length, err 9156 } 9157 9158 // CopyOut implements marshal.Marshallable.CopyOut. 9159 //go:nosplit 9160 func (x *XTSNATTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9161 return x.CopyOutN(cc, addr, x.SizeBytes()) 9162 } 9163 9164 // CopyIn implements marshal.Marshallable.CopyIn. 9165 //go:nosplit 9166 func (x *XTSNATTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9167 if !x.NfRange.Packed() && x.Target.Packed() { 9168 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9169 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 9170 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9171 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9172 // partially unmarshalled struct. 9173 x.UnmarshalBytes(buf) // escapes: fallback. 9174 return length, err 9175 } 9176 9177 // Construct a slice backed by dst's underlying memory. 9178 var buf []byte 9179 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9180 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9181 hdr.Len = x.SizeBytes() 9182 hdr.Cap = x.SizeBytes() 9183 9184 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9185 // Since we bypassed the compiler's escape analysis, indicate that x 9186 // must live until the use above. 9187 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9188 return length, err 9189 } 9190 9191 // WriteTo implements io.WriterTo.WriteTo. 9192 func (x *XTSNATTarget) WriteTo(writer io.Writer) (int64, error) { 9193 if !x.NfRange.Packed() && x.Target.Packed() { 9194 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 9195 buf := make([]byte, x.SizeBytes()) 9196 x.MarshalBytes(buf) 9197 length, err := writer.Write(buf) 9198 return int64(length), err 9199 } 9200 9201 // Construct a slice backed by dst's underlying memory. 9202 var buf []byte 9203 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9204 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9205 hdr.Len = x.SizeBytes() 9206 hdr.Cap = x.SizeBytes() 9207 9208 length, err := writer.Write(buf) 9209 // Since we bypassed the compiler's escape analysis, indicate that x 9210 // must live until the use above. 9211 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9212 return int64(length), err 9213 } 9214 9215 // SizeBytes implements marshal.Marshallable.SizeBytes. 9216 func (x *XTStandardTarget) SizeBytes() int { 9217 return 4 + 9218 (*XTEntryTarget)(nil).SizeBytes() + 9219 1*4 9220 } 9221 9222 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9223 func (x *XTStandardTarget) MarshalBytes(dst []byte) []byte { 9224 dst = x.Target.MarshalUnsafe(dst) 9225 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.Verdict)) 9226 dst = dst[4:] 9227 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 9228 dst = dst[1*(4):] 9229 return dst 9230 } 9231 9232 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9233 func (x *XTStandardTarget) UnmarshalBytes(src []byte) []byte { 9234 src = x.Target.UnmarshalUnsafe(src) 9235 x.Verdict = int32(hostarch.ByteOrder.Uint32(src[:4])) 9236 src = src[4:] 9237 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 9238 src = src[1*(4):] 9239 return src 9240 } 9241 9242 // Packed implements marshal.Marshallable.Packed. 9243 //go:nosplit 9244 func (x *XTStandardTarget) Packed() bool { 9245 return x.Target.Packed() 9246 } 9247 9248 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9249 func (x *XTStandardTarget) MarshalUnsafe(dst []byte) []byte { 9250 if x.Target.Packed() { 9251 size := x.SizeBytes() 9252 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 9253 return dst[size:] 9254 } 9255 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 9256 return x.MarshalBytes(dst) 9257 } 9258 9259 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9260 func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) []byte { 9261 if x.Target.Packed() { 9262 size := x.SizeBytes() 9263 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 9264 return src[size:] 9265 } 9266 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9267 return x.UnmarshalBytes(src) 9268 } 9269 9270 // CopyOutN implements marshal.Marshallable.CopyOutN. 9271 //go:nosplit 9272 func (x *XTStandardTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9273 if !x.Target.Packed() { 9274 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 9275 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 9276 x.MarshalBytes(buf) // escapes: fallback. 9277 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9278 } 9279 9280 // Construct a slice backed by dst's underlying memory. 9281 var buf []byte 9282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9284 hdr.Len = x.SizeBytes() 9285 hdr.Cap = x.SizeBytes() 9286 9287 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9288 // Since we bypassed the compiler's escape analysis, indicate that x 9289 // must live until the use above. 9290 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9291 return length, err 9292 } 9293 9294 // CopyOut implements marshal.Marshallable.CopyOut. 9295 //go:nosplit 9296 func (x *XTStandardTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9297 return x.CopyOutN(cc, addr, x.SizeBytes()) 9298 } 9299 9300 // CopyIn implements marshal.Marshallable.CopyIn. 9301 //go:nosplit 9302 func (x *XTStandardTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9303 if !x.Target.Packed() { 9304 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9305 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 9306 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9307 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9308 // partially unmarshalled struct. 9309 x.UnmarshalBytes(buf) // escapes: fallback. 9310 return length, err 9311 } 9312 9313 // Construct a slice backed by dst's underlying memory. 9314 var buf []byte 9315 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9316 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9317 hdr.Len = x.SizeBytes() 9318 hdr.Cap = x.SizeBytes() 9319 9320 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9321 // Since we bypassed the compiler's escape analysis, indicate that x 9322 // must live until the use above. 9323 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9324 return length, err 9325 } 9326 9327 // WriteTo implements io.WriterTo.WriteTo. 9328 func (x *XTStandardTarget) WriteTo(writer io.Writer) (int64, error) { 9329 if !x.Target.Packed() { 9330 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 9331 buf := make([]byte, x.SizeBytes()) 9332 x.MarshalBytes(buf) 9333 length, err := writer.Write(buf) 9334 return int64(length), err 9335 } 9336 9337 // Construct a slice backed by dst's underlying memory. 9338 var buf []byte 9339 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9340 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9341 hdr.Len = x.SizeBytes() 9342 hdr.Cap = x.SizeBytes() 9343 9344 length, err := writer.Write(buf) 9345 // Since we bypassed the compiler's escape analysis, indicate that x 9346 // must live until the use above. 9347 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9348 return int64(length), err 9349 } 9350 9351 // SizeBytes implements marshal.Marshallable.SizeBytes. 9352 func (x *XTTCP) SizeBytes() int { 9353 return 12 9354 } 9355 9356 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9357 func (x *XTTCP) MarshalBytes(dst []byte) []byte { 9358 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 9359 dst = dst[2:] 9360 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 9361 dst = dst[2:] 9362 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 9363 dst = dst[2:] 9364 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 9365 dst = dst[2:] 9366 dst[0] = byte(x.Option) 9367 dst = dst[1:] 9368 dst[0] = byte(x.FlagMask) 9369 dst = dst[1:] 9370 dst[0] = byte(x.FlagCompare) 9371 dst = dst[1:] 9372 dst[0] = byte(x.InverseFlags) 9373 dst = dst[1:] 9374 return dst 9375 } 9376 9377 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9378 func (x *XTTCP) UnmarshalBytes(src []byte) []byte { 9379 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9380 src = src[2:] 9381 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9382 src = src[2:] 9383 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9384 src = src[2:] 9385 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9386 src = src[2:] 9387 x.Option = uint8(src[0]) 9388 src = src[1:] 9389 x.FlagMask = uint8(src[0]) 9390 src = src[1:] 9391 x.FlagCompare = uint8(src[0]) 9392 src = src[1:] 9393 x.InverseFlags = uint8(src[0]) 9394 src = src[1:] 9395 return src 9396 } 9397 9398 // Packed implements marshal.Marshallable.Packed. 9399 //go:nosplit 9400 func (x *XTTCP) Packed() bool { 9401 return true 9402 } 9403 9404 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9405 func (x *XTTCP) MarshalUnsafe(dst []byte) []byte { 9406 size := x.SizeBytes() 9407 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 9408 return dst[size:] 9409 } 9410 9411 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9412 func (x *XTTCP) UnmarshalUnsafe(src []byte) []byte { 9413 size := x.SizeBytes() 9414 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 9415 return src[size:] 9416 } 9417 9418 // CopyOutN implements marshal.Marshallable.CopyOutN. 9419 //go:nosplit 9420 func (x *XTTCP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9421 // Construct a slice backed by dst's underlying memory. 9422 var buf []byte 9423 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9424 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9425 hdr.Len = x.SizeBytes() 9426 hdr.Cap = x.SizeBytes() 9427 9428 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9429 // Since we bypassed the compiler's escape analysis, indicate that x 9430 // must live until the use above. 9431 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9432 return length, err 9433 } 9434 9435 // CopyOut implements marshal.Marshallable.CopyOut. 9436 //go:nosplit 9437 func (x *XTTCP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9438 return x.CopyOutN(cc, addr, x.SizeBytes()) 9439 } 9440 9441 // CopyIn implements marshal.Marshallable.CopyIn. 9442 //go:nosplit 9443 func (x *XTTCP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9444 // Construct a slice backed by dst's underlying memory. 9445 var buf []byte 9446 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9447 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9448 hdr.Len = x.SizeBytes() 9449 hdr.Cap = x.SizeBytes() 9450 9451 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9452 // Since we bypassed the compiler's escape analysis, indicate that x 9453 // must live until the use above. 9454 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9455 return length, err 9456 } 9457 9458 // WriteTo implements io.WriterTo.WriteTo. 9459 func (x *XTTCP) WriteTo(writer io.Writer) (int64, error) { 9460 // Construct a slice backed by dst's underlying memory. 9461 var buf []byte 9462 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9463 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9464 hdr.Len = x.SizeBytes() 9465 hdr.Cap = x.SizeBytes() 9466 9467 length, err := writer.Write(buf) 9468 // Since we bypassed the compiler's escape analysis, indicate that x 9469 // must live until the use above. 9470 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9471 return int64(length), err 9472 } 9473 9474 // SizeBytes implements marshal.Marshallable.SizeBytes. 9475 func (x *XTUDP) SizeBytes() int { 9476 return 10 9477 } 9478 9479 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9480 func (x *XTUDP) MarshalBytes(dst []byte) []byte { 9481 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 9482 dst = dst[2:] 9483 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 9484 dst = dst[2:] 9485 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 9486 dst = dst[2:] 9487 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 9488 dst = dst[2:] 9489 dst[0] = byte(x.InverseFlags) 9490 dst = dst[1:] 9491 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 9492 dst = dst[1:] 9493 return dst 9494 } 9495 9496 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9497 func (x *XTUDP) UnmarshalBytes(src []byte) []byte { 9498 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9499 src = src[2:] 9500 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9501 src = src[2:] 9502 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9503 src = src[2:] 9504 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9505 src = src[2:] 9506 x.InverseFlags = uint8(src[0]) 9507 src = src[1:] 9508 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 9509 src = src[1:] 9510 return src 9511 } 9512 9513 // Packed implements marshal.Marshallable.Packed. 9514 //go:nosplit 9515 func (x *XTUDP) Packed() bool { 9516 return true 9517 } 9518 9519 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9520 func (x *XTUDP) MarshalUnsafe(dst []byte) []byte { 9521 size := x.SizeBytes() 9522 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 9523 return dst[size:] 9524 } 9525 9526 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9527 func (x *XTUDP) UnmarshalUnsafe(src []byte) []byte { 9528 size := x.SizeBytes() 9529 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 9530 return src[size:] 9531 } 9532 9533 // CopyOutN implements marshal.Marshallable.CopyOutN. 9534 //go:nosplit 9535 func (x *XTUDP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9536 // Construct a slice backed by dst's underlying memory. 9537 var buf []byte 9538 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9539 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9540 hdr.Len = x.SizeBytes() 9541 hdr.Cap = x.SizeBytes() 9542 9543 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9544 // Since we bypassed the compiler's escape analysis, indicate that x 9545 // must live until the use above. 9546 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9547 return length, err 9548 } 9549 9550 // CopyOut implements marshal.Marshallable.CopyOut. 9551 //go:nosplit 9552 func (x *XTUDP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9553 return x.CopyOutN(cc, addr, x.SizeBytes()) 9554 } 9555 9556 // CopyIn implements marshal.Marshallable.CopyIn. 9557 //go:nosplit 9558 func (x *XTUDP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9559 // Construct a slice backed by dst's underlying memory. 9560 var buf []byte 9561 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9562 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9563 hdr.Len = x.SizeBytes() 9564 hdr.Cap = x.SizeBytes() 9565 9566 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9567 // Since we bypassed the compiler's escape analysis, indicate that x 9568 // must live until the use above. 9569 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9570 return length, err 9571 } 9572 9573 // WriteTo implements io.WriterTo.WriteTo. 9574 func (x *XTUDP) WriteTo(writer io.Writer) (int64, error) { 9575 // Construct a slice backed by dst's underlying memory. 9576 var buf []byte 9577 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9578 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 9579 hdr.Len = x.SizeBytes() 9580 hdr.Cap = x.SizeBytes() 9581 9582 length, err := writer.Write(buf) 9583 // Since we bypassed the compiler's escape analysis, indicate that x 9584 // must live until the use above. 9585 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 9586 return int64(length), err 9587 } 9588 9589 // SizeBytes implements marshal.Marshallable.SizeBytes. 9590 func (i *IP6TEntry) SizeBytes() int { 9591 return 12 + 9592 (*IP6TIP)(nil).SizeBytes() + 9593 1*4 + 9594 (*XTCounters)(nil).SizeBytes() 9595 } 9596 9597 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9598 func (i *IP6TEntry) MarshalBytes(dst []byte) []byte { 9599 dst = i.IPv6.MarshalUnsafe(dst) 9600 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 9601 dst = dst[4:] 9602 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 9603 dst = dst[2:] 9604 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 9605 dst = dst[2:] 9606 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 9607 dst = dst[4:] 9608 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 9609 dst = dst[1*(4):] 9610 dst = i.Counters.MarshalUnsafe(dst) 9611 return dst 9612 } 9613 9614 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9615 func (i *IP6TEntry) UnmarshalBytes(src []byte) []byte { 9616 src = i.IPv6.UnmarshalUnsafe(src) 9617 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9618 src = src[4:] 9619 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9620 src = src[2:] 9621 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9622 src = src[2:] 9623 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9624 src = src[4:] 9625 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 9626 src = src[1*(4):] 9627 src = i.Counters.UnmarshalUnsafe(src) 9628 return src 9629 } 9630 9631 // Packed implements marshal.Marshallable.Packed. 9632 //go:nosplit 9633 func (i *IP6TEntry) Packed() bool { 9634 return i.Counters.Packed() && i.IPv6.Packed() 9635 } 9636 9637 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9638 func (i *IP6TEntry) MarshalUnsafe(dst []byte) []byte { 9639 if i.Counters.Packed() && i.IPv6.Packed() { 9640 size := i.SizeBytes() 9641 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9642 return dst[size:] 9643 } 9644 // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 9645 return i.MarshalBytes(dst) 9646 } 9647 9648 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9649 func (i *IP6TEntry) UnmarshalUnsafe(src []byte) []byte { 9650 if i.Counters.Packed() && i.IPv6.Packed() { 9651 size := i.SizeBytes() 9652 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9653 return src[size:] 9654 } 9655 // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9656 return i.UnmarshalBytes(src) 9657 } 9658 9659 // CopyOutN implements marshal.Marshallable.CopyOutN. 9660 //go:nosplit 9661 func (i *IP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9662 if !i.Counters.Packed() && i.IPv6.Packed() { 9663 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9664 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9665 i.MarshalBytes(buf) // escapes: fallback. 9666 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9667 } 9668 9669 // Construct a slice backed by dst's underlying memory. 9670 var buf []byte 9671 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9672 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9673 hdr.Len = i.SizeBytes() 9674 hdr.Cap = i.SizeBytes() 9675 9676 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9677 // Since we bypassed the compiler's escape analysis, indicate that i 9678 // must live until the use above. 9679 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9680 return length, err 9681 } 9682 9683 // CopyOut implements marshal.Marshallable.CopyOut. 9684 //go:nosplit 9685 func (i *IP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9686 return i.CopyOutN(cc, addr, i.SizeBytes()) 9687 } 9688 9689 // CopyIn implements marshal.Marshallable.CopyIn. 9690 //go:nosplit 9691 func (i *IP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9692 if !i.Counters.Packed() && i.IPv6.Packed() { 9693 // Type IP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9694 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9695 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9696 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9697 // partially unmarshalled struct. 9698 i.UnmarshalBytes(buf) // escapes: fallback. 9699 return length, err 9700 } 9701 9702 // Construct a slice backed by dst's underlying memory. 9703 var buf []byte 9704 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9705 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9706 hdr.Len = i.SizeBytes() 9707 hdr.Cap = i.SizeBytes() 9708 9709 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9710 // Since we bypassed the compiler's escape analysis, indicate that i 9711 // must live until the use above. 9712 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9713 return length, err 9714 } 9715 9716 // WriteTo implements io.WriterTo.WriteTo. 9717 func (i *IP6TEntry) WriteTo(writer io.Writer) (int64, error) { 9718 if !i.Counters.Packed() && i.IPv6.Packed() { 9719 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9720 buf := make([]byte, i.SizeBytes()) 9721 i.MarshalBytes(buf) 9722 length, err := writer.Write(buf) 9723 return int64(length), err 9724 } 9725 9726 // Construct a slice backed by dst's underlying memory. 9727 var buf []byte 9728 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9729 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9730 hdr.Len = i.SizeBytes() 9731 hdr.Cap = i.SizeBytes() 9732 9733 length, err := writer.Write(buf) 9734 // Since we bypassed the compiler's escape analysis, indicate that i 9735 // must live until the use above. 9736 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9737 return int64(length), err 9738 } 9739 9740 // SizeBytes implements marshal.Marshallable.SizeBytes. 9741 func (i *IP6TIP) SizeBytes() int { 9742 return 5 + 9743 (*Inet6Addr)(nil).SizeBytes() + 9744 (*Inet6Addr)(nil).SizeBytes() + 9745 (*Inet6Addr)(nil).SizeBytes() + 9746 (*Inet6Addr)(nil).SizeBytes() + 9747 1*IFNAMSIZ + 9748 1*IFNAMSIZ + 9749 1*IFNAMSIZ + 9750 1*IFNAMSIZ + 9751 1*3 9752 } 9753 9754 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9755 func (i *IP6TIP) MarshalBytes(dst []byte) []byte { 9756 dst = i.Src.MarshalUnsafe(dst) 9757 dst = i.Dst.MarshalUnsafe(dst) 9758 dst = i.SrcMask.MarshalUnsafe(dst) 9759 dst = i.DstMask.MarshalUnsafe(dst) 9760 for idx := 0; idx < IFNAMSIZ; idx++ { 9761 dst[0] = byte(i.InputInterface[idx]) 9762 dst = dst[1:] 9763 } 9764 for idx := 0; idx < IFNAMSIZ; idx++ { 9765 dst[0] = byte(i.OutputInterface[idx]) 9766 dst = dst[1:] 9767 } 9768 for idx := 0; idx < IFNAMSIZ; idx++ { 9769 dst[0] = byte(i.InputInterfaceMask[idx]) 9770 dst = dst[1:] 9771 } 9772 for idx := 0; idx < IFNAMSIZ; idx++ { 9773 dst[0] = byte(i.OutputInterfaceMask[idx]) 9774 dst = dst[1:] 9775 } 9776 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 9777 dst = dst[2:] 9778 dst[0] = byte(i.TOS) 9779 dst = dst[1:] 9780 dst[0] = byte(i.Flags) 9781 dst = dst[1:] 9782 dst[0] = byte(i.InverseFlags) 9783 dst = dst[1:] 9784 // Padding: dst[:sizeof(byte)*3] ~= [3]byte{0} 9785 dst = dst[1*(3):] 9786 return dst 9787 } 9788 9789 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9790 func (i *IP6TIP) UnmarshalBytes(src []byte) []byte { 9791 src = i.Src.UnmarshalUnsafe(src) 9792 src = i.Dst.UnmarshalUnsafe(src) 9793 src = i.SrcMask.UnmarshalUnsafe(src) 9794 src = i.DstMask.UnmarshalUnsafe(src) 9795 for idx := 0; idx < IFNAMSIZ; idx++ { 9796 i.InputInterface[idx] = src[0] 9797 src = src[1:] 9798 } 9799 for idx := 0; idx < IFNAMSIZ; idx++ { 9800 i.OutputInterface[idx] = src[0] 9801 src = src[1:] 9802 } 9803 for idx := 0; idx < IFNAMSIZ; idx++ { 9804 i.InputInterfaceMask[idx] = src[0] 9805 src = src[1:] 9806 } 9807 for idx := 0; idx < IFNAMSIZ; idx++ { 9808 i.OutputInterfaceMask[idx] = src[0] 9809 src = src[1:] 9810 } 9811 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9812 src = src[2:] 9813 i.TOS = uint8(src[0]) 9814 src = src[1:] 9815 i.Flags = uint8(src[0]) 9816 src = src[1:] 9817 i.InverseFlags = uint8(src[0]) 9818 src = src[1:] 9819 // Padding: ~ copy([3]byte(i._), src[:sizeof(byte)*3]) 9820 src = src[1*(3):] 9821 return src 9822 } 9823 9824 // Packed implements marshal.Marshallable.Packed. 9825 //go:nosplit 9826 func (i *IP6TIP) Packed() bool { 9827 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 9828 } 9829 9830 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9831 func (i *IP6TIP) MarshalUnsafe(dst []byte) []byte { 9832 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9833 size := i.SizeBytes() 9834 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9835 return dst[size:] 9836 } 9837 // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes. 9838 return i.MarshalBytes(dst) 9839 } 9840 9841 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9842 func (i *IP6TIP) UnmarshalUnsafe(src []byte) []byte { 9843 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9844 size := i.SizeBytes() 9845 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9846 return src[size:] 9847 } 9848 // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9849 return i.UnmarshalBytes(src) 9850 } 9851 9852 // CopyOutN implements marshal.Marshallable.CopyOutN. 9853 //go:nosplit 9854 func (i *IP6TIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9855 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9856 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9857 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9858 i.MarshalBytes(buf) // escapes: fallback. 9859 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9860 } 9861 9862 // Construct a slice backed by dst's underlying memory. 9863 var buf []byte 9864 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9865 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9866 hdr.Len = i.SizeBytes() 9867 hdr.Cap = i.SizeBytes() 9868 9869 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9870 // Since we bypassed the compiler's escape analysis, indicate that i 9871 // must live until the use above. 9872 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9873 return length, err 9874 } 9875 9876 // CopyOut implements marshal.Marshallable.CopyOut. 9877 //go:nosplit 9878 func (i *IP6TIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9879 return i.CopyOutN(cc, addr, i.SizeBytes()) 9880 } 9881 9882 // CopyIn implements marshal.Marshallable.CopyIn. 9883 //go:nosplit 9884 func (i *IP6TIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9885 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9886 // Type IP6TIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9887 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9888 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9889 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9890 // partially unmarshalled struct. 9891 i.UnmarshalBytes(buf) // escapes: fallback. 9892 return length, err 9893 } 9894 9895 // Construct a slice backed by dst's underlying memory. 9896 var buf []byte 9897 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9898 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9899 hdr.Len = i.SizeBytes() 9900 hdr.Cap = i.SizeBytes() 9901 9902 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9903 // Since we bypassed the compiler's escape analysis, indicate that i 9904 // must live until the use above. 9905 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9906 return length, err 9907 } 9908 9909 // WriteTo implements io.WriterTo.WriteTo. 9910 func (i *IP6TIP) WriteTo(writer io.Writer) (int64, error) { 9911 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9912 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9913 buf := make([]byte, i.SizeBytes()) 9914 i.MarshalBytes(buf) 9915 length, err := writer.Write(buf) 9916 return int64(length), err 9917 } 9918 9919 // Construct a slice backed by dst's underlying memory. 9920 var buf []byte 9921 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9922 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9923 hdr.Len = i.SizeBytes() 9924 hdr.Cap = i.SizeBytes() 9925 9926 length, err := writer.Write(buf) 9927 // Since we bypassed the compiler's escape analysis, indicate that i 9928 // must live until the use above. 9929 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9930 return int64(length), err 9931 } 9932 9933 // SizeBytes implements marshal.Marshallable.SizeBytes. 9934 func (i *IP6TReplace) SizeBytes() int { 9935 return 24 + 9936 (*TableName)(nil).SizeBytes() + 9937 4*NF_INET_NUMHOOKS + 9938 4*NF_INET_NUMHOOKS 9939 } 9940 9941 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9942 func (i *IP6TReplace) MarshalBytes(dst []byte) []byte { 9943 dst = i.Name.MarshalUnsafe(dst) 9944 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9945 dst = dst[4:] 9946 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9947 dst = dst[4:] 9948 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9949 dst = dst[4:] 9950 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9951 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9952 dst = dst[4:] 9953 } 9954 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9955 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9956 dst = dst[4:] 9957 } 9958 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 9959 dst = dst[4:] 9960 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 9961 dst = dst[8:] 9962 return dst 9963 } 9964 9965 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9966 func (i *IP6TReplace) UnmarshalBytes(src []byte) []byte { 9967 src = i.Name.UnmarshalUnsafe(src) 9968 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9969 src = src[4:] 9970 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9971 src = src[4:] 9972 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9973 src = src[4:] 9974 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9975 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9976 src = src[4:] 9977 } 9978 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9979 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9980 src = src[4:] 9981 } 9982 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9983 src = src[4:] 9984 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 9985 src = src[8:] 9986 return src 9987 } 9988 9989 // Packed implements marshal.Marshallable.Packed. 9990 //go:nosplit 9991 func (i *IP6TReplace) Packed() bool { 9992 return i.Name.Packed() 9993 } 9994 9995 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9996 func (i *IP6TReplace) MarshalUnsafe(dst []byte) []byte { 9997 if i.Name.Packed() { 9998 size := i.SizeBytes() 9999 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 10000 return dst[size:] 10001 } 10002 // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 10003 return i.MarshalBytes(dst) 10004 } 10005 10006 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10007 func (i *IP6TReplace) UnmarshalUnsafe(src []byte) []byte { 10008 if i.Name.Packed() { 10009 size := i.SizeBytes() 10010 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 10011 return src[size:] 10012 } 10013 // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10014 return i.UnmarshalBytes(src) 10015 } 10016 10017 // CopyOutN implements marshal.Marshallable.CopyOutN. 10018 //go:nosplit 10019 func (i *IP6TReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10020 if !i.Name.Packed() { 10021 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 10022 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10023 i.MarshalBytes(buf) // escapes: fallback. 10024 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10025 } 10026 10027 // Construct a slice backed by dst's underlying memory. 10028 var buf []byte 10029 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10030 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10031 hdr.Len = i.SizeBytes() 10032 hdr.Cap = i.SizeBytes() 10033 10034 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10035 // Since we bypassed the compiler's escape analysis, indicate that i 10036 // must live until the use above. 10037 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10038 return length, err 10039 } 10040 10041 // CopyOut implements marshal.Marshallable.CopyOut. 10042 //go:nosplit 10043 func (i *IP6TReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10044 return i.CopyOutN(cc, addr, i.SizeBytes()) 10045 } 10046 10047 // CopyIn implements marshal.Marshallable.CopyIn. 10048 //go:nosplit 10049 func (i *IP6TReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10050 if !i.Name.Packed() { 10051 // Type IP6TReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10052 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10053 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10054 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10055 // partially unmarshalled struct. 10056 i.UnmarshalBytes(buf) // escapes: fallback. 10057 return length, err 10058 } 10059 10060 // Construct a slice backed by dst's underlying memory. 10061 var buf []byte 10062 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10063 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10064 hdr.Len = i.SizeBytes() 10065 hdr.Cap = i.SizeBytes() 10066 10067 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10068 // Since we bypassed the compiler's escape analysis, indicate that i 10069 // must live until the use above. 10070 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10071 return length, err 10072 } 10073 10074 // WriteTo implements io.WriterTo.WriteTo. 10075 func (i *IP6TReplace) WriteTo(writer io.Writer) (int64, error) { 10076 if !i.Name.Packed() { 10077 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 10078 buf := make([]byte, i.SizeBytes()) 10079 i.MarshalBytes(buf) 10080 length, err := writer.Write(buf) 10081 return int64(length), err 10082 } 10083 10084 // Construct a slice backed by dst's underlying memory. 10085 var buf []byte 10086 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10087 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10088 hdr.Len = i.SizeBytes() 10089 hdr.Cap = i.SizeBytes() 10090 10091 length, err := writer.Write(buf) 10092 // Since we bypassed the compiler's escape analysis, indicate that i 10093 // must live until the use above. 10094 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10095 return int64(length), err 10096 } 10097 10098 // Packed implements marshal.Marshallable.Packed. 10099 //go:nosplit 10100 func (ke *KernelIP6TEntry) Packed() bool { 10101 // Type KernelIP6TEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 10102 return false 10103 } 10104 10105 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10106 func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) []byte { 10107 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 10108 return ke.MarshalBytes(dst) 10109 } 10110 10111 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10112 func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) []byte { 10113 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10114 return ke.UnmarshalBytes(src) 10115 } 10116 10117 // CopyOutN implements marshal.Marshallable.CopyOutN. 10118 //go:nosplit 10119 func (ke *KernelIP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10120 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 10121 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10122 ke.MarshalBytes(buf) // escapes: fallback. 10123 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10124 } 10125 10126 // CopyOut implements marshal.Marshallable.CopyOut. 10127 //go:nosplit 10128 func (ke *KernelIP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10129 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 10130 } 10131 10132 // CopyIn implements marshal.Marshallable.CopyIn. 10133 //go:nosplit 10134 func (ke *KernelIP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10135 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10136 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10137 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10138 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10139 // partially unmarshalled struct. 10140 ke.UnmarshalBytes(buf) // escapes: fallback. 10141 return length, err 10142 } 10143 10144 // WriteTo implements io.WriterTo.WriteTo. 10145 func (ke *KernelIP6TEntry) WriteTo(writer io.Writer) (int64, error) { 10146 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 10147 buf := make([]byte, ke.SizeBytes()) 10148 ke.MarshalBytes(buf) 10149 length, err := writer.Write(buf) 10150 return int64(length), err 10151 } 10152 10153 // Packed implements marshal.Marshallable.Packed. 10154 //go:nosplit 10155 func (ke *KernelIP6TGetEntries) Packed() bool { 10156 // Type KernelIP6TGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 10157 return false 10158 } 10159 10160 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10161 func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) []byte { 10162 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 10163 return ke.MarshalBytes(dst) 10164 } 10165 10166 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10167 func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) []byte { 10168 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10169 return ke.UnmarshalBytes(src) 10170 } 10171 10172 // CopyOutN implements marshal.Marshallable.CopyOutN. 10173 //go:nosplit 10174 func (ke *KernelIP6TGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10175 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 10176 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10177 ke.MarshalBytes(buf) // escapes: fallback. 10178 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10179 } 10180 10181 // CopyOut implements marshal.Marshallable.CopyOut. 10182 //go:nosplit 10183 func (ke *KernelIP6TGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10184 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 10185 } 10186 10187 // CopyIn implements marshal.Marshallable.CopyIn. 10188 //go:nosplit 10189 func (ke *KernelIP6TGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10190 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10191 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10192 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10193 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10194 // partially unmarshalled struct. 10195 ke.UnmarshalBytes(buf) // escapes: fallback. 10196 return length, err 10197 } 10198 10199 // WriteTo implements io.WriterTo.WriteTo. 10200 func (ke *KernelIP6TGetEntries) WriteTo(writer io.Writer) (int64, error) { 10201 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 10202 buf := make([]byte, ke.SizeBytes()) 10203 ke.MarshalBytes(buf) 10204 length, err := writer.Write(buf) 10205 return int64(length), err 10206 } 10207 10208 // SizeBytes implements marshal.Marshallable.SizeBytes. 10209 func (n *NFNATRange) SizeBytes() int { 10210 return 8 + 10211 (*Inet6Addr)(nil).SizeBytes() + 10212 (*Inet6Addr)(nil).SizeBytes() 10213 } 10214 10215 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10216 func (n *NFNATRange) MarshalBytes(dst []byte) []byte { 10217 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 10218 dst = dst[4:] 10219 dst = n.MinAddr.MarshalUnsafe(dst) 10220 dst = n.MaxAddr.MarshalUnsafe(dst) 10221 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto)) 10222 dst = dst[2:] 10223 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto)) 10224 dst = dst[2:] 10225 return dst 10226 } 10227 10228 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10229 func (n *NFNATRange) UnmarshalBytes(src []byte) []byte { 10230 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10231 src = src[4:] 10232 src = n.MinAddr.UnmarshalUnsafe(src) 10233 src = n.MaxAddr.UnmarshalUnsafe(src) 10234 n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10235 src = src[2:] 10236 n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10237 src = src[2:] 10238 return src 10239 } 10240 10241 // Packed implements marshal.Marshallable.Packed. 10242 //go:nosplit 10243 func (n *NFNATRange) Packed() bool { 10244 return n.MaxAddr.Packed() && n.MinAddr.Packed() 10245 } 10246 10247 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10248 func (n *NFNATRange) MarshalUnsafe(dst []byte) []byte { 10249 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 10250 size := n.SizeBytes() 10251 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10252 return dst[size:] 10253 } 10254 // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes. 10255 return n.MarshalBytes(dst) 10256 } 10257 10258 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10259 func (n *NFNATRange) UnmarshalUnsafe(src []byte) []byte { 10260 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 10261 size := n.SizeBytes() 10262 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10263 return src[size:] 10264 } 10265 // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10266 return n.UnmarshalBytes(src) 10267 } 10268 10269 // CopyOutN implements marshal.Marshallable.CopyOutN. 10270 //go:nosplit 10271 func (n *NFNATRange) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10272 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 10273 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 10274 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10275 n.MarshalBytes(buf) // escapes: fallback. 10276 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10277 } 10278 10279 // Construct a slice backed by dst's underlying memory. 10280 var buf []byte 10281 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10282 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10283 hdr.Len = n.SizeBytes() 10284 hdr.Cap = n.SizeBytes() 10285 10286 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10287 // Since we bypassed the compiler's escape analysis, indicate that n 10288 // must live until the use above. 10289 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10290 return length, err 10291 } 10292 10293 // CopyOut implements marshal.Marshallable.CopyOut. 10294 //go:nosplit 10295 func (n *NFNATRange) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10296 return n.CopyOutN(cc, addr, n.SizeBytes()) 10297 } 10298 10299 // CopyIn implements marshal.Marshallable.CopyIn. 10300 //go:nosplit 10301 func (n *NFNATRange) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10302 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 10303 // Type NFNATRange doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10304 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10305 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10306 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10307 // partially unmarshalled struct. 10308 n.UnmarshalBytes(buf) // escapes: fallback. 10309 return length, err 10310 } 10311 10312 // Construct a slice backed by dst's underlying memory. 10313 var buf []byte 10314 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10315 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10316 hdr.Len = n.SizeBytes() 10317 hdr.Cap = n.SizeBytes() 10318 10319 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10320 // Since we bypassed the compiler's escape analysis, indicate that n 10321 // must live until the use above. 10322 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10323 return length, err 10324 } 10325 10326 // WriteTo implements io.WriterTo.WriteTo. 10327 func (n *NFNATRange) WriteTo(writer io.Writer) (int64, error) { 10328 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 10329 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 10330 buf := make([]byte, n.SizeBytes()) 10331 n.MarshalBytes(buf) 10332 length, err := writer.Write(buf) 10333 return int64(length), err 10334 } 10335 10336 // Construct a slice backed by dst's underlying memory. 10337 var buf []byte 10338 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10339 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10340 hdr.Len = n.SizeBytes() 10341 hdr.Cap = n.SizeBytes() 10342 10343 length, err := writer.Write(buf) 10344 // Since we bypassed the compiler's escape analysis, indicate that n 10345 // must live until the use above. 10346 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10347 return int64(length), err 10348 } 10349 10350 // SizeBytes implements marshal.Marshallable.SizeBytes. 10351 func (n *NetlinkAttrHeader) SizeBytes() int { 10352 return 4 10353 } 10354 10355 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10356 func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) []byte { 10357 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Length)) 10358 dst = dst[2:] 10359 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 10360 dst = dst[2:] 10361 return dst 10362 } 10363 10364 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10365 func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) []byte { 10366 n.Length = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10367 src = src[2:] 10368 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10369 src = src[2:] 10370 return src 10371 } 10372 10373 // Packed implements marshal.Marshallable.Packed. 10374 //go:nosplit 10375 func (n *NetlinkAttrHeader) Packed() bool { 10376 return true 10377 } 10378 10379 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10380 func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) []byte { 10381 size := n.SizeBytes() 10382 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10383 return dst[size:] 10384 } 10385 10386 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10387 func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) []byte { 10388 size := n.SizeBytes() 10389 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10390 return src[size:] 10391 } 10392 10393 // CopyOutN implements marshal.Marshallable.CopyOutN. 10394 //go:nosplit 10395 func (n *NetlinkAttrHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10396 // Construct a slice backed by dst's underlying memory. 10397 var buf []byte 10398 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10399 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10400 hdr.Len = n.SizeBytes() 10401 hdr.Cap = n.SizeBytes() 10402 10403 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10404 // Since we bypassed the compiler's escape analysis, indicate that n 10405 // must live until the use above. 10406 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10407 return length, err 10408 } 10409 10410 // CopyOut implements marshal.Marshallable.CopyOut. 10411 //go:nosplit 10412 func (n *NetlinkAttrHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10413 return n.CopyOutN(cc, addr, n.SizeBytes()) 10414 } 10415 10416 // CopyIn implements marshal.Marshallable.CopyIn. 10417 //go:nosplit 10418 func (n *NetlinkAttrHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10419 // Construct a slice backed by dst's underlying memory. 10420 var buf []byte 10421 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10422 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10423 hdr.Len = n.SizeBytes() 10424 hdr.Cap = n.SizeBytes() 10425 10426 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10427 // Since we bypassed the compiler's escape analysis, indicate that n 10428 // must live until the use above. 10429 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10430 return length, err 10431 } 10432 10433 // WriteTo implements io.WriterTo.WriteTo. 10434 func (n *NetlinkAttrHeader) WriteTo(writer io.Writer) (int64, error) { 10435 // Construct a slice backed by dst's underlying memory. 10436 var buf []byte 10437 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10438 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10439 hdr.Len = n.SizeBytes() 10440 hdr.Cap = n.SizeBytes() 10441 10442 length, err := writer.Write(buf) 10443 // Since we bypassed the compiler's escape analysis, indicate that n 10444 // must live until the use above. 10445 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10446 return int64(length), err 10447 } 10448 10449 // SizeBytes implements marshal.Marshallable.SizeBytes. 10450 func (n *NetlinkErrorMessage) SizeBytes() int { 10451 return 4 + 10452 (*NetlinkMessageHeader)(nil).SizeBytes() 10453 } 10454 10455 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10456 func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) []byte { 10457 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Error)) 10458 dst = dst[4:] 10459 dst = n.Header.MarshalUnsafe(dst) 10460 return dst 10461 } 10462 10463 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10464 func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) []byte { 10465 n.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 10466 src = src[4:] 10467 src = n.Header.UnmarshalUnsafe(src) 10468 return src 10469 } 10470 10471 // Packed implements marshal.Marshallable.Packed. 10472 //go:nosplit 10473 func (n *NetlinkErrorMessage) Packed() bool { 10474 return n.Header.Packed() 10475 } 10476 10477 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10478 func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) []byte { 10479 if n.Header.Packed() { 10480 size := n.SizeBytes() 10481 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10482 return dst[size:] 10483 } 10484 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes. 10485 return n.MarshalBytes(dst) 10486 } 10487 10488 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10489 func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) []byte { 10490 if n.Header.Packed() { 10491 size := n.SizeBytes() 10492 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10493 return src[size:] 10494 } 10495 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10496 return n.UnmarshalBytes(src) 10497 } 10498 10499 // CopyOutN implements marshal.Marshallable.CopyOutN. 10500 //go:nosplit 10501 func (n *NetlinkErrorMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10502 if !n.Header.Packed() { 10503 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 10504 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10505 n.MarshalBytes(buf) // escapes: fallback. 10506 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10507 } 10508 10509 // Construct a slice backed by dst's underlying memory. 10510 var buf []byte 10511 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10512 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10513 hdr.Len = n.SizeBytes() 10514 hdr.Cap = n.SizeBytes() 10515 10516 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10517 // Since we bypassed the compiler's escape analysis, indicate that n 10518 // must live until the use above. 10519 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10520 return length, err 10521 } 10522 10523 // CopyOut implements marshal.Marshallable.CopyOut. 10524 //go:nosplit 10525 func (n *NetlinkErrorMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10526 return n.CopyOutN(cc, addr, n.SizeBytes()) 10527 } 10528 10529 // CopyIn implements marshal.Marshallable.CopyIn. 10530 //go:nosplit 10531 func (n *NetlinkErrorMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10532 if !n.Header.Packed() { 10533 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10534 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10535 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10536 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10537 // partially unmarshalled struct. 10538 n.UnmarshalBytes(buf) // escapes: fallback. 10539 return length, err 10540 } 10541 10542 // Construct a slice backed by dst's underlying memory. 10543 var buf []byte 10544 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10545 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10546 hdr.Len = n.SizeBytes() 10547 hdr.Cap = n.SizeBytes() 10548 10549 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10550 // Since we bypassed the compiler's escape analysis, indicate that n 10551 // must live until the use above. 10552 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10553 return length, err 10554 } 10555 10556 // WriteTo implements io.WriterTo.WriteTo. 10557 func (n *NetlinkErrorMessage) WriteTo(writer io.Writer) (int64, error) { 10558 if !n.Header.Packed() { 10559 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 10560 buf := make([]byte, n.SizeBytes()) 10561 n.MarshalBytes(buf) 10562 length, err := writer.Write(buf) 10563 return int64(length), err 10564 } 10565 10566 // Construct a slice backed by dst's underlying memory. 10567 var buf []byte 10568 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10569 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10570 hdr.Len = n.SizeBytes() 10571 hdr.Cap = n.SizeBytes() 10572 10573 length, err := writer.Write(buf) 10574 // Since we bypassed the compiler's escape analysis, indicate that n 10575 // must live until the use above. 10576 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10577 return int64(length), err 10578 } 10579 10580 // SizeBytes implements marshal.Marshallable.SizeBytes. 10581 func (n *NetlinkMessageHeader) SizeBytes() int { 10582 return 16 10583 } 10584 10585 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10586 func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) []byte { 10587 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Length)) 10588 dst = dst[4:] 10589 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 10590 dst = dst[2:] 10591 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Flags)) 10592 dst = dst[2:] 10593 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Seq)) 10594 dst = dst[4:] 10595 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.PortID)) 10596 dst = dst[4:] 10597 return dst 10598 } 10599 10600 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10601 func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) []byte { 10602 n.Length = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10603 src = src[4:] 10604 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10605 src = src[2:] 10606 n.Flags = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10607 src = src[2:] 10608 n.Seq = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10609 src = src[4:] 10610 n.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10611 src = src[4:] 10612 return src 10613 } 10614 10615 // Packed implements marshal.Marshallable.Packed. 10616 //go:nosplit 10617 func (n *NetlinkMessageHeader) Packed() bool { 10618 return true 10619 } 10620 10621 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10622 func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) []byte { 10623 size := n.SizeBytes() 10624 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10625 return dst[size:] 10626 } 10627 10628 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10629 func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) []byte { 10630 size := n.SizeBytes() 10631 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10632 return src[size:] 10633 } 10634 10635 // CopyOutN implements marshal.Marshallable.CopyOutN. 10636 //go:nosplit 10637 func (n *NetlinkMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10638 // Construct a slice backed by dst's underlying memory. 10639 var buf []byte 10640 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10641 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10642 hdr.Len = n.SizeBytes() 10643 hdr.Cap = n.SizeBytes() 10644 10645 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10646 // Since we bypassed the compiler's escape analysis, indicate that n 10647 // must live until the use above. 10648 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10649 return length, err 10650 } 10651 10652 // CopyOut implements marshal.Marshallable.CopyOut. 10653 //go:nosplit 10654 func (n *NetlinkMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10655 return n.CopyOutN(cc, addr, n.SizeBytes()) 10656 } 10657 10658 // CopyIn implements marshal.Marshallable.CopyIn. 10659 //go:nosplit 10660 func (n *NetlinkMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10661 // Construct a slice backed by dst's underlying memory. 10662 var buf []byte 10663 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10664 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10665 hdr.Len = n.SizeBytes() 10666 hdr.Cap = n.SizeBytes() 10667 10668 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10669 // Since we bypassed the compiler's escape analysis, indicate that n 10670 // must live until the use above. 10671 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10672 return length, err 10673 } 10674 10675 // WriteTo implements io.WriterTo.WriteTo. 10676 func (n *NetlinkMessageHeader) WriteTo(writer io.Writer) (int64, error) { 10677 // Construct a slice backed by dst's underlying memory. 10678 var buf []byte 10679 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10680 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10681 hdr.Len = n.SizeBytes() 10682 hdr.Cap = n.SizeBytes() 10683 10684 length, err := writer.Write(buf) 10685 // Since we bypassed the compiler's escape analysis, indicate that n 10686 // must live until the use above. 10687 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10688 return int64(length), err 10689 } 10690 10691 // SizeBytes implements marshal.Marshallable.SizeBytes. 10692 func (s *SockAddrNetlink) SizeBytes() int { 10693 return 12 10694 } 10695 10696 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10697 func (s *SockAddrNetlink) MarshalBytes(dst []byte) []byte { 10698 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 10699 dst = dst[2:] 10700 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 10701 dst = dst[2:] 10702 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PortID)) 10703 dst = dst[4:] 10704 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Groups)) 10705 dst = dst[4:] 10706 return dst 10707 } 10708 10709 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10710 func (s *SockAddrNetlink) UnmarshalBytes(src []byte) []byte { 10711 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10712 src = src[2:] 10713 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 10714 src = src[2:] 10715 s.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10716 src = src[4:] 10717 s.Groups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10718 src = src[4:] 10719 return src 10720 } 10721 10722 // Packed implements marshal.Marshallable.Packed. 10723 //go:nosplit 10724 func (s *SockAddrNetlink) Packed() bool { 10725 return true 10726 } 10727 10728 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10729 func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) []byte { 10730 size := s.SizeBytes() 10731 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 10732 return dst[size:] 10733 } 10734 10735 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10736 func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) []byte { 10737 size := s.SizeBytes() 10738 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 10739 return src[size:] 10740 } 10741 10742 // CopyOutN implements marshal.Marshallable.CopyOutN. 10743 //go:nosplit 10744 func (s *SockAddrNetlink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10745 // Construct a slice backed by dst's underlying memory. 10746 var buf []byte 10747 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10748 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 10749 hdr.Len = s.SizeBytes() 10750 hdr.Cap = s.SizeBytes() 10751 10752 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10753 // Since we bypassed the compiler's escape analysis, indicate that s 10754 // must live until the use above. 10755 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 10756 return length, err 10757 } 10758 10759 // CopyOut implements marshal.Marshallable.CopyOut. 10760 //go:nosplit 10761 func (s *SockAddrNetlink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10762 return s.CopyOutN(cc, addr, s.SizeBytes()) 10763 } 10764 10765 // CopyIn implements marshal.Marshallable.CopyIn. 10766 //go:nosplit 10767 func (s *SockAddrNetlink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10768 // Construct a slice backed by dst's underlying memory. 10769 var buf []byte 10770 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10771 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 10772 hdr.Len = s.SizeBytes() 10773 hdr.Cap = s.SizeBytes() 10774 10775 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10776 // Since we bypassed the compiler's escape analysis, indicate that s 10777 // must live until the use above. 10778 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 10779 return length, err 10780 } 10781 10782 // WriteTo implements io.WriterTo.WriteTo. 10783 func (s *SockAddrNetlink) WriteTo(writer io.Writer) (int64, error) { 10784 // Construct a slice backed by dst's underlying memory. 10785 var buf []byte 10786 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10787 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 10788 hdr.Len = s.SizeBytes() 10789 hdr.Cap = s.SizeBytes() 10790 10791 length, err := writer.Write(buf) 10792 // Since we bypassed the compiler's escape analysis, indicate that s 10793 // must live until the use above. 10794 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 10795 return int64(length), err 10796 } 10797 10798 // SizeBytes implements marshal.Marshallable.SizeBytes. 10799 func (i *InterfaceAddrMessage) SizeBytes() int { 10800 return 8 10801 } 10802 10803 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10804 func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) []byte { 10805 dst[0] = byte(i.Family) 10806 dst = dst[1:] 10807 dst[0] = byte(i.PrefixLen) 10808 dst = dst[1:] 10809 dst[0] = byte(i.Flags) 10810 dst = dst[1:] 10811 dst[0] = byte(i.Scope) 10812 dst = dst[1:] 10813 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 10814 dst = dst[4:] 10815 return dst 10816 } 10817 10818 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10819 func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) []byte { 10820 i.Family = uint8(src[0]) 10821 src = src[1:] 10822 i.PrefixLen = uint8(src[0]) 10823 src = src[1:] 10824 i.Flags = uint8(src[0]) 10825 src = src[1:] 10826 i.Scope = uint8(src[0]) 10827 src = src[1:] 10828 i.Index = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10829 src = src[4:] 10830 return src 10831 } 10832 10833 // Packed implements marshal.Marshallable.Packed. 10834 //go:nosplit 10835 func (i *InterfaceAddrMessage) Packed() bool { 10836 return true 10837 } 10838 10839 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10840 func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) []byte { 10841 size := i.SizeBytes() 10842 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 10843 return dst[size:] 10844 } 10845 10846 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10847 func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) []byte { 10848 size := i.SizeBytes() 10849 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 10850 return src[size:] 10851 } 10852 10853 // CopyOutN implements marshal.Marshallable.CopyOutN. 10854 //go:nosplit 10855 func (i *InterfaceAddrMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10856 // Construct a slice backed by dst's underlying memory. 10857 var buf []byte 10858 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10859 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10860 hdr.Len = i.SizeBytes() 10861 hdr.Cap = i.SizeBytes() 10862 10863 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10864 // Since we bypassed the compiler's escape analysis, indicate that i 10865 // must live until the use above. 10866 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10867 return length, err 10868 } 10869 10870 // CopyOut implements marshal.Marshallable.CopyOut. 10871 //go:nosplit 10872 func (i *InterfaceAddrMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10873 return i.CopyOutN(cc, addr, i.SizeBytes()) 10874 } 10875 10876 // CopyIn implements marshal.Marshallable.CopyIn. 10877 //go:nosplit 10878 func (i *InterfaceAddrMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10879 // Construct a slice backed by dst's underlying memory. 10880 var buf []byte 10881 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10882 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10883 hdr.Len = i.SizeBytes() 10884 hdr.Cap = i.SizeBytes() 10885 10886 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10887 // Since we bypassed the compiler's escape analysis, indicate that i 10888 // must live until the use above. 10889 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10890 return length, err 10891 } 10892 10893 // WriteTo implements io.WriterTo.WriteTo. 10894 func (i *InterfaceAddrMessage) WriteTo(writer io.Writer) (int64, error) { 10895 // Construct a slice backed by dst's underlying memory. 10896 var buf []byte 10897 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10898 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10899 hdr.Len = i.SizeBytes() 10900 hdr.Cap = i.SizeBytes() 10901 10902 length, err := writer.Write(buf) 10903 // Since we bypassed the compiler's escape analysis, indicate that i 10904 // must live until the use above. 10905 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10906 return int64(length), err 10907 } 10908 10909 // SizeBytes implements marshal.Marshallable.SizeBytes. 10910 func (i *InterfaceInfoMessage) SizeBytes() int { 10911 return 16 10912 } 10913 10914 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10915 func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) []byte { 10916 dst[0] = byte(i.Family) 10917 dst = dst[1:] 10918 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 10919 dst = dst[1:] 10920 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Type)) 10921 dst = dst[2:] 10922 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 10923 dst = dst[4:] 10924 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 10925 dst = dst[4:] 10926 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Change)) 10927 dst = dst[4:] 10928 return dst 10929 } 10930 10931 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10932 func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) []byte { 10933 i.Family = uint8(src[0]) 10934 src = src[1:] 10935 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 10936 src = src[1:] 10937 i.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10938 src = src[2:] 10939 i.Index = int32(hostarch.ByteOrder.Uint32(src[:4])) 10940 src = src[4:] 10941 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10942 src = src[4:] 10943 i.Change = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10944 src = src[4:] 10945 return src 10946 } 10947 10948 // Packed implements marshal.Marshallable.Packed. 10949 //go:nosplit 10950 func (i *InterfaceInfoMessage) Packed() bool { 10951 return true 10952 } 10953 10954 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10955 func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) []byte { 10956 size := i.SizeBytes() 10957 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 10958 return dst[size:] 10959 } 10960 10961 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10962 func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) []byte { 10963 size := i.SizeBytes() 10964 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 10965 return src[size:] 10966 } 10967 10968 // CopyOutN implements marshal.Marshallable.CopyOutN. 10969 //go:nosplit 10970 func (i *InterfaceInfoMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 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(i))) 10975 hdr.Len = i.SizeBytes() 10976 hdr.Cap = i.SizeBytes() 10977 10978 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10979 // Since we bypassed the compiler's escape analysis, indicate that i 10980 // must live until the use above. 10981 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10982 return length, err 10983 } 10984 10985 // CopyOut implements marshal.Marshallable.CopyOut. 10986 //go:nosplit 10987 func (i *InterfaceInfoMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10988 return i.CopyOutN(cc, addr, i.SizeBytes()) 10989 } 10990 10991 // CopyIn implements marshal.Marshallable.CopyIn. 10992 //go:nosplit 10993 func (i *InterfaceInfoMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10994 // Construct a slice backed by dst's underlying memory. 10995 var buf []byte 10996 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10997 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10998 hdr.Len = i.SizeBytes() 10999 hdr.Cap = i.SizeBytes() 11000 11001 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11002 // Since we bypassed the compiler's escape analysis, indicate that i 11003 // must live until the use above. 11004 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11005 return length, err 11006 } 11007 11008 // WriteTo implements io.WriterTo.WriteTo. 11009 func (i *InterfaceInfoMessage) WriteTo(writer io.Writer) (int64, error) { 11010 // Construct a slice backed by dst's underlying memory. 11011 var buf []byte 11012 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11013 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11014 hdr.Len = i.SizeBytes() 11015 hdr.Cap = i.SizeBytes() 11016 11017 length, err := writer.Write(buf) 11018 // Since we bypassed the compiler's escape analysis, indicate that i 11019 // must live until the use above. 11020 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11021 return int64(length), err 11022 } 11023 11024 // SizeBytes implements marshal.Marshallable.SizeBytes. 11025 func (r *RouteMessage) SizeBytes() int { 11026 return 12 11027 } 11028 11029 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11030 func (r *RouteMessage) MarshalBytes(dst []byte) []byte { 11031 dst[0] = byte(r.Family) 11032 dst = dst[1:] 11033 dst[0] = byte(r.DstLen) 11034 dst = dst[1:] 11035 dst[0] = byte(r.SrcLen) 11036 dst = dst[1:] 11037 dst[0] = byte(r.TOS) 11038 dst = dst[1:] 11039 dst[0] = byte(r.Table) 11040 dst = dst[1:] 11041 dst[0] = byte(r.Protocol) 11042 dst = dst[1:] 11043 dst[0] = byte(r.Scope) 11044 dst = dst[1:] 11045 dst[0] = byte(r.Type) 11046 dst = dst[1:] 11047 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 11048 dst = dst[4:] 11049 return dst 11050 } 11051 11052 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11053 func (r *RouteMessage) UnmarshalBytes(src []byte) []byte { 11054 r.Family = uint8(src[0]) 11055 src = src[1:] 11056 r.DstLen = uint8(src[0]) 11057 src = src[1:] 11058 r.SrcLen = uint8(src[0]) 11059 src = src[1:] 11060 r.TOS = uint8(src[0]) 11061 src = src[1:] 11062 r.Table = uint8(src[0]) 11063 src = src[1:] 11064 r.Protocol = uint8(src[0]) 11065 src = src[1:] 11066 r.Scope = uint8(src[0]) 11067 src = src[1:] 11068 r.Type = uint8(src[0]) 11069 src = src[1:] 11070 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11071 src = src[4:] 11072 return src 11073 } 11074 11075 // Packed implements marshal.Marshallable.Packed. 11076 //go:nosplit 11077 func (r *RouteMessage) Packed() bool { 11078 return true 11079 } 11080 11081 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11082 func (r *RouteMessage) MarshalUnsafe(dst []byte) []byte { 11083 size := r.SizeBytes() 11084 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 11085 return dst[size:] 11086 } 11087 11088 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11089 func (r *RouteMessage) UnmarshalUnsafe(src []byte) []byte { 11090 size := r.SizeBytes() 11091 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 11092 return src[size:] 11093 } 11094 11095 // CopyOutN implements marshal.Marshallable.CopyOutN. 11096 //go:nosplit 11097 func (r *RouteMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11098 // Construct a slice backed by dst's underlying memory. 11099 var buf []byte 11100 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11101 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11102 hdr.Len = r.SizeBytes() 11103 hdr.Cap = r.SizeBytes() 11104 11105 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11106 // Since we bypassed the compiler's escape analysis, indicate that r 11107 // must live until the use above. 11108 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11109 return length, err 11110 } 11111 11112 // CopyOut implements marshal.Marshallable.CopyOut. 11113 //go:nosplit 11114 func (r *RouteMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11115 return r.CopyOutN(cc, addr, r.SizeBytes()) 11116 } 11117 11118 // CopyIn implements marshal.Marshallable.CopyIn. 11119 //go:nosplit 11120 func (r *RouteMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11121 // Construct a slice backed by dst's underlying memory. 11122 var buf []byte 11123 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11124 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11125 hdr.Len = r.SizeBytes() 11126 hdr.Cap = r.SizeBytes() 11127 11128 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11129 // Since we bypassed the compiler's escape analysis, indicate that r 11130 // must live until the use above. 11131 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11132 return length, err 11133 } 11134 11135 // WriteTo implements io.WriterTo.WriteTo. 11136 func (r *RouteMessage) WriteTo(writer io.Writer) (int64, error) { 11137 // Construct a slice backed by dst's underlying memory. 11138 var buf []byte 11139 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11140 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11141 hdr.Len = r.SizeBytes() 11142 hdr.Cap = r.SizeBytes() 11143 11144 length, err := writer.Write(buf) 11145 // Since we bypassed the compiler's escape analysis, indicate that r 11146 // must live until the use above. 11147 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11148 return int64(length), err 11149 } 11150 11151 // SizeBytes implements marshal.Marshallable.SizeBytes. 11152 func (p *PollFD) SizeBytes() int { 11153 return 8 11154 } 11155 11156 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11157 func (p *PollFD) MarshalBytes(dst []byte) []byte { 11158 hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.FD)) 11159 dst = dst[4:] 11160 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.Events)) 11161 dst = dst[2:] 11162 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.REvents)) 11163 dst = dst[2:] 11164 return dst 11165 } 11166 11167 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11168 func (p *PollFD) UnmarshalBytes(src []byte) []byte { 11169 p.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 11170 src = src[4:] 11171 p.Events = int16(hostarch.ByteOrder.Uint16(src[:2])) 11172 src = src[2:] 11173 p.REvents = int16(hostarch.ByteOrder.Uint16(src[:2])) 11174 src = src[2:] 11175 return src 11176 } 11177 11178 // Packed implements marshal.Marshallable.Packed. 11179 //go:nosplit 11180 func (p *PollFD) Packed() bool { 11181 return true 11182 } 11183 11184 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11185 func (p *PollFD) MarshalUnsafe(dst []byte) []byte { 11186 size := p.SizeBytes() 11187 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size)) 11188 return dst[size:] 11189 } 11190 11191 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11192 func (p *PollFD) UnmarshalUnsafe(src []byte) []byte { 11193 size := p.SizeBytes() 11194 gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size)) 11195 return src[size:] 11196 } 11197 11198 // CopyOutN implements marshal.Marshallable.CopyOutN. 11199 //go:nosplit 11200 func (p *PollFD) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11201 // Construct a slice backed by dst's underlying memory. 11202 var buf []byte 11203 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11204 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 11205 hdr.Len = p.SizeBytes() 11206 hdr.Cap = p.SizeBytes() 11207 11208 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11209 // Since we bypassed the compiler's escape analysis, indicate that p 11210 // must live until the use above. 11211 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 11212 return length, err 11213 } 11214 11215 // CopyOut implements marshal.Marshallable.CopyOut. 11216 //go:nosplit 11217 func (p *PollFD) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11218 return p.CopyOutN(cc, addr, p.SizeBytes()) 11219 } 11220 11221 // CopyIn implements marshal.Marshallable.CopyIn. 11222 //go:nosplit 11223 func (p *PollFD) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11224 // Construct a slice backed by dst's underlying memory. 11225 var buf []byte 11226 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11227 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 11228 hdr.Len = p.SizeBytes() 11229 hdr.Cap = p.SizeBytes() 11230 11231 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11232 // Since we bypassed the compiler's escape analysis, indicate that p 11233 // must live until the use above. 11234 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 11235 return length, err 11236 } 11237 11238 // WriteTo implements io.WriterTo.WriteTo. 11239 func (p *PollFD) WriteTo(writer io.Writer) (int64, error) { 11240 // Construct a slice backed by dst's underlying memory. 11241 var buf []byte 11242 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11243 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 11244 hdr.Len = p.SizeBytes() 11245 hdr.Cap = p.SizeBytes() 11246 11247 length, err := writer.Write(buf) 11248 // Since we bypassed the compiler's escape analysis, indicate that p 11249 // must live until the use above. 11250 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 11251 return int64(length), err 11252 } 11253 11254 // CopyPollFDSliceIn copies in a slice of PollFD objects from the task's memory. 11255 func CopyPollFDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []PollFD) (int, error) { 11256 count := len(dst) 11257 if count == 0 { 11258 return 0, nil 11259 } 11260 size := (*PollFD)(nil).SizeBytes() 11261 11262 ptr := unsafe.Pointer(&dst) 11263 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 11264 11265 // Construct a slice backed by dst's underlying memory. 11266 var buf []byte 11267 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11268 hdr.Data = uintptr(val) 11269 hdr.Len = size * count 11270 hdr.Cap = size * count 11271 11272 length, err := cc.CopyInBytes(addr, buf) 11273 // Since we bypassed the compiler's escape analysis, indicate that dst 11274 // must live until the use above. 11275 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 11276 return length, err 11277 } 11278 11279 // CopyPollFDSliceOut copies a slice of PollFD objects to the task's memory. 11280 func CopyPollFDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []PollFD) (int, error) { 11281 count := len(src) 11282 if count == 0 { 11283 return 0, nil 11284 } 11285 size := (*PollFD)(nil).SizeBytes() 11286 11287 ptr := unsafe.Pointer(&src) 11288 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 11289 11290 // Construct a slice backed by dst's underlying memory. 11291 var buf []byte 11292 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11293 hdr.Data = uintptr(val) 11294 hdr.Len = size * count 11295 hdr.Cap = size * count 11296 11297 length, err := cc.CopyOutBytes(addr, buf) 11298 // Since we bypassed the compiler's escape analysis, indicate that src 11299 // must live until the use above. 11300 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 11301 return length, err 11302 } 11303 11304 // MarshalUnsafePollFDSlice is like PollFD.MarshalUnsafe, but for a []PollFD. 11305 func MarshalUnsafePollFDSlice(src []PollFD, dst []byte) []byte { 11306 count := len(src) 11307 if count == 0 { 11308 return dst 11309 } 11310 11311 size := (*PollFD)(nil).SizeBytes() 11312 buf := dst[:size*count] 11313 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 11314 return dst[size*count:] 11315 } 11316 11317 // UnmarshalUnsafePollFDSlice is like PollFD.UnmarshalUnsafe, but for a []PollFD. 11318 func UnmarshalUnsafePollFDSlice(dst []PollFD, src []byte) []byte { 11319 count := len(dst) 11320 if count == 0 { 11321 return src 11322 } 11323 11324 size := (*PollFD)(nil).SizeBytes() 11325 buf := src[:size*count] 11326 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 11327 return src[size*count:] 11328 } 11329 11330 // SizeBytes implements marshal.Marshallable.SizeBytes. 11331 func (r *RSeqCriticalSection) SizeBytes() int { 11332 return 32 11333 } 11334 11335 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11336 func (r *RSeqCriticalSection) MarshalBytes(dst []byte) []byte { 11337 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Version)) 11338 dst = dst[4:] 11339 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 11340 dst = dst[4:] 11341 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Start)) 11342 dst = dst[8:] 11343 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.PostCommitOffset)) 11344 dst = dst[8:] 11345 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Abort)) 11346 dst = dst[8:] 11347 return dst 11348 } 11349 11350 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11351 func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) []byte { 11352 r.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11353 src = src[4:] 11354 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11355 src = src[4:] 11356 r.Start = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11357 src = src[8:] 11358 r.PostCommitOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11359 src = src[8:] 11360 r.Abort = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11361 src = src[8:] 11362 return src 11363 } 11364 11365 // Packed implements marshal.Marshallable.Packed. 11366 //go:nosplit 11367 func (r *RSeqCriticalSection) Packed() bool { 11368 return true 11369 } 11370 11371 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11372 func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) []byte { 11373 size := r.SizeBytes() 11374 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 11375 return dst[size:] 11376 } 11377 11378 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11379 func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) []byte { 11380 size := r.SizeBytes() 11381 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 11382 return src[size:] 11383 } 11384 11385 // CopyOutN implements marshal.Marshallable.CopyOutN. 11386 //go:nosplit 11387 func (r *RSeqCriticalSection) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11388 // Construct a slice backed by dst's underlying memory. 11389 var buf []byte 11390 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11391 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11392 hdr.Len = r.SizeBytes() 11393 hdr.Cap = r.SizeBytes() 11394 11395 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11396 // Since we bypassed the compiler's escape analysis, indicate that r 11397 // must live until the use above. 11398 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11399 return length, err 11400 } 11401 11402 // CopyOut implements marshal.Marshallable.CopyOut. 11403 //go:nosplit 11404 func (r *RSeqCriticalSection) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11405 return r.CopyOutN(cc, addr, r.SizeBytes()) 11406 } 11407 11408 // CopyIn implements marshal.Marshallable.CopyIn. 11409 //go:nosplit 11410 func (r *RSeqCriticalSection) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11411 // Construct a slice backed by dst's underlying memory. 11412 var buf []byte 11413 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11414 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11415 hdr.Len = r.SizeBytes() 11416 hdr.Cap = r.SizeBytes() 11417 11418 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11419 // Since we bypassed the compiler's escape analysis, indicate that r 11420 // must live until the use above. 11421 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11422 return length, err 11423 } 11424 11425 // WriteTo implements io.WriterTo.WriteTo. 11426 func (r *RSeqCriticalSection) WriteTo(writer io.Writer) (int64, error) { 11427 // Construct a slice backed by dst's underlying memory. 11428 var buf []byte 11429 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11430 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11431 hdr.Len = r.SizeBytes() 11432 hdr.Cap = r.SizeBytes() 11433 11434 length, err := writer.Write(buf) 11435 // Since we bypassed the compiler's escape analysis, indicate that r 11436 // must live until the use above. 11437 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11438 return int64(length), err 11439 } 11440 11441 // SizeBytes implements marshal.Marshallable.SizeBytes. 11442 func (r *Rusage) SizeBytes() int { 11443 return 112 + 11444 (*Timeval)(nil).SizeBytes() + 11445 (*Timeval)(nil).SizeBytes() 11446 } 11447 11448 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11449 func (r *Rusage) MarshalBytes(dst []byte) []byte { 11450 dst = r.UTime.MarshalUnsafe(dst) 11451 dst = r.STime.MarshalUnsafe(dst) 11452 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MaxRSS)) 11453 dst = dst[8:] 11454 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IXRSS)) 11455 dst = dst[8:] 11456 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IDRSS)) 11457 dst = dst[8:] 11458 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ISRSS)) 11459 dst = dst[8:] 11460 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MinFlt)) 11461 dst = dst[8:] 11462 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MajFlt)) 11463 dst = dst[8:] 11464 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSwap)) 11465 dst = dst[8:] 11466 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.InBlock)) 11467 dst = dst[8:] 11468 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.OuBlock)) 11469 dst = dst[8:] 11470 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgSnd)) 11471 dst = dst[8:] 11472 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgRcv)) 11473 dst = dst[8:] 11474 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSignals)) 11475 dst = dst[8:] 11476 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NVCSw)) 11477 dst = dst[8:] 11478 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NIvCSw)) 11479 dst = dst[8:] 11480 return dst 11481 } 11482 11483 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11484 func (r *Rusage) UnmarshalBytes(src []byte) []byte { 11485 src = r.UTime.UnmarshalUnsafe(src) 11486 src = r.STime.UnmarshalUnsafe(src) 11487 r.MaxRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 11488 src = src[8:] 11489 r.IXRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 11490 src = src[8:] 11491 r.IDRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 11492 src = src[8:] 11493 r.ISRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 11494 src = src[8:] 11495 r.MinFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 11496 src = src[8:] 11497 r.MajFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 11498 src = src[8:] 11499 r.NSwap = int64(hostarch.ByteOrder.Uint64(src[:8])) 11500 src = src[8:] 11501 r.InBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 11502 src = src[8:] 11503 r.OuBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 11504 src = src[8:] 11505 r.MsgSnd = int64(hostarch.ByteOrder.Uint64(src[:8])) 11506 src = src[8:] 11507 r.MsgRcv = int64(hostarch.ByteOrder.Uint64(src[:8])) 11508 src = src[8:] 11509 r.NSignals = int64(hostarch.ByteOrder.Uint64(src[:8])) 11510 src = src[8:] 11511 r.NVCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 11512 src = src[8:] 11513 r.NIvCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 11514 src = src[8:] 11515 return src 11516 } 11517 11518 // Packed implements marshal.Marshallable.Packed. 11519 //go:nosplit 11520 func (r *Rusage) Packed() bool { 11521 return r.STime.Packed() && r.UTime.Packed() 11522 } 11523 11524 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11525 func (r *Rusage) MarshalUnsafe(dst []byte) []byte { 11526 if r.STime.Packed() && r.UTime.Packed() { 11527 size := r.SizeBytes() 11528 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 11529 return dst[size:] 11530 } 11531 // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes. 11532 return r.MarshalBytes(dst) 11533 } 11534 11535 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11536 func (r *Rusage) UnmarshalUnsafe(src []byte) []byte { 11537 if r.STime.Packed() && r.UTime.Packed() { 11538 size := r.SizeBytes() 11539 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 11540 return src[size:] 11541 } 11542 // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11543 return r.UnmarshalBytes(src) 11544 } 11545 11546 // CopyOutN implements marshal.Marshallable.CopyOutN. 11547 //go:nosplit 11548 func (r *Rusage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11549 if !r.STime.Packed() && r.UTime.Packed() { 11550 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 11551 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 11552 r.MarshalBytes(buf) // escapes: fallback. 11553 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11554 } 11555 11556 // Construct a slice backed by dst's underlying memory. 11557 var buf []byte 11558 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11559 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11560 hdr.Len = r.SizeBytes() 11561 hdr.Cap = r.SizeBytes() 11562 11563 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11564 // Since we bypassed the compiler's escape analysis, indicate that r 11565 // must live until the use above. 11566 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11567 return length, err 11568 } 11569 11570 // CopyOut implements marshal.Marshallable.CopyOut. 11571 //go:nosplit 11572 func (r *Rusage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11573 return r.CopyOutN(cc, addr, r.SizeBytes()) 11574 } 11575 11576 // CopyIn implements marshal.Marshallable.CopyIn. 11577 //go:nosplit 11578 func (r *Rusage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11579 if !r.STime.Packed() && r.UTime.Packed() { 11580 // Type Rusage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11581 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 11582 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11583 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11584 // partially unmarshalled struct. 11585 r.UnmarshalBytes(buf) // escapes: fallback. 11586 return length, err 11587 } 11588 11589 // Construct a slice backed by dst's underlying memory. 11590 var buf []byte 11591 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11592 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11593 hdr.Len = r.SizeBytes() 11594 hdr.Cap = r.SizeBytes() 11595 11596 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11597 // Since we bypassed the compiler's escape analysis, indicate that r 11598 // must live until the use above. 11599 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11600 return length, err 11601 } 11602 11603 // WriteTo implements io.WriterTo.WriteTo. 11604 func (r *Rusage) WriteTo(writer io.Writer) (int64, error) { 11605 if !r.STime.Packed() && r.UTime.Packed() { 11606 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 11607 buf := make([]byte, r.SizeBytes()) 11608 r.MarshalBytes(buf) 11609 length, err := writer.Write(buf) 11610 return int64(length), err 11611 } 11612 11613 // Construct a slice backed by dst's underlying memory. 11614 var buf []byte 11615 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11616 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 11617 hdr.Len = r.SizeBytes() 11618 hdr.Cap = r.SizeBytes() 11619 11620 length, err := writer.Write(buf) 11621 // Since we bypassed the compiler's escape analysis, indicate that r 11622 // must live until the use above. 11623 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 11624 return int64(length), err 11625 } 11626 11627 // SizeBytes implements marshal.Marshallable.SizeBytes. 11628 func (s *SeccompData) SizeBytes() int { 11629 return 16 + 11630 8*6 11631 } 11632 11633 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11634 func (s *SeccompData) MarshalBytes(dst []byte) []byte { 11635 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nr)) 11636 dst = dst[4:] 11637 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Arch)) 11638 dst = dst[4:] 11639 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.InstructionPointer)) 11640 dst = dst[8:] 11641 for idx := 0; idx < 6; idx++ { 11642 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Args[idx])) 11643 dst = dst[8:] 11644 } 11645 return dst 11646 } 11647 11648 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11649 func (s *SeccompData) UnmarshalBytes(src []byte) []byte { 11650 s.Nr = int32(hostarch.ByteOrder.Uint32(src[:4])) 11651 src = src[4:] 11652 s.Arch = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11653 src = src[4:] 11654 s.InstructionPointer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11655 src = src[8:] 11656 for idx := 0; idx < 6; idx++ { 11657 s.Args[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11658 src = src[8:] 11659 } 11660 return src 11661 } 11662 11663 // Packed implements marshal.Marshallable.Packed. 11664 //go:nosplit 11665 func (s *SeccompData) Packed() bool { 11666 return true 11667 } 11668 11669 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11670 func (s *SeccompData) MarshalUnsafe(dst []byte) []byte { 11671 size := s.SizeBytes() 11672 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 11673 return dst[size:] 11674 } 11675 11676 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11677 func (s *SeccompData) UnmarshalUnsafe(src []byte) []byte { 11678 size := s.SizeBytes() 11679 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 11680 return src[size:] 11681 } 11682 11683 // CopyOutN implements marshal.Marshallable.CopyOutN. 11684 //go:nosplit 11685 func (s *SeccompData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11686 // Construct a slice backed by dst's underlying memory. 11687 var buf []byte 11688 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11689 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11690 hdr.Len = s.SizeBytes() 11691 hdr.Cap = s.SizeBytes() 11692 11693 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11694 // Since we bypassed the compiler's escape analysis, indicate that s 11695 // must live until the use above. 11696 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11697 return length, err 11698 } 11699 11700 // CopyOut implements marshal.Marshallable.CopyOut. 11701 //go:nosplit 11702 func (s *SeccompData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11703 return s.CopyOutN(cc, addr, s.SizeBytes()) 11704 } 11705 11706 // CopyIn implements marshal.Marshallable.CopyIn. 11707 //go:nosplit 11708 func (s *SeccompData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11709 // Construct a slice backed by dst's underlying memory. 11710 var buf []byte 11711 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11712 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11713 hdr.Len = s.SizeBytes() 11714 hdr.Cap = s.SizeBytes() 11715 11716 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11717 // Since we bypassed the compiler's escape analysis, indicate that s 11718 // must live until the use above. 11719 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11720 return length, err 11721 } 11722 11723 // WriteTo implements io.WriterTo.WriteTo. 11724 func (s *SeccompData) WriteTo(writer io.Writer) (int64, error) { 11725 // Construct a slice backed by dst's underlying memory. 11726 var buf []byte 11727 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11728 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11729 hdr.Len = s.SizeBytes() 11730 hdr.Cap = s.SizeBytes() 11731 11732 length, err := writer.Write(buf) 11733 // Since we bypassed the compiler's escape analysis, indicate that s 11734 // must live until the use above. 11735 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11736 return int64(length), err 11737 } 11738 11739 // SizeBytes implements marshal.Marshallable.SizeBytes. 11740 func (s *SemInfo) SizeBytes() int { 11741 return 40 11742 } 11743 11744 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11745 func (s *SemInfo) MarshalBytes(dst []byte) []byte { 11746 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMap)) 11747 dst = dst[4:] 11748 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMni)) 11749 dst = dst[4:] 11750 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMns)) 11751 dst = dst[4:] 11752 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMnu)) 11753 dst = dst[4:] 11754 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMsl)) 11755 dst = dst[4:] 11756 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemOpm)) 11757 dst = dst[4:] 11758 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUme)) 11759 dst = dst[4:] 11760 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUsz)) 11761 dst = dst[4:] 11762 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemVmx)) 11763 dst = dst[4:] 11764 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemAem)) 11765 dst = dst[4:] 11766 return dst 11767 } 11768 11769 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11770 func (s *SemInfo) UnmarshalBytes(src []byte) []byte { 11771 s.SemMap = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11772 src = src[4:] 11773 s.SemMni = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11774 src = src[4:] 11775 s.SemMns = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11776 src = src[4:] 11777 s.SemMnu = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11778 src = src[4:] 11779 s.SemMsl = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11780 src = src[4:] 11781 s.SemOpm = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11782 src = src[4:] 11783 s.SemUme = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11784 src = src[4:] 11785 s.SemUsz = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11786 src = src[4:] 11787 s.SemVmx = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11788 src = src[4:] 11789 s.SemAem = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11790 src = src[4:] 11791 return src 11792 } 11793 11794 // Packed implements marshal.Marshallable.Packed. 11795 //go:nosplit 11796 func (s *SemInfo) Packed() bool { 11797 return true 11798 } 11799 11800 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11801 func (s *SemInfo) MarshalUnsafe(dst []byte) []byte { 11802 size := s.SizeBytes() 11803 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 11804 return dst[size:] 11805 } 11806 11807 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11808 func (s *SemInfo) UnmarshalUnsafe(src []byte) []byte { 11809 size := s.SizeBytes() 11810 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 11811 return src[size:] 11812 } 11813 11814 // CopyOutN implements marshal.Marshallable.CopyOutN. 11815 //go:nosplit 11816 func (s *SemInfo) CopyOutN(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(s))) 11821 hdr.Len = s.SizeBytes() 11822 hdr.Cap = s.SizeBytes() 11823 11824 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11825 // Since we bypassed the compiler's escape analysis, indicate that s 11826 // must live until the use above. 11827 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11828 return length, err 11829 } 11830 11831 // CopyOut implements marshal.Marshallable.CopyOut. 11832 //go:nosplit 11833 func (s *SemInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11834 return s.CopyOutN(cc, addr, s.SizeBytes()) 11835 } 11836 11837 // CopyIn implements marshal.Marshallable.CopyIn. 11838 //go:nosplit 11839 func (s *SemInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11840 // Construct a slice backed by dst's underlying memory. 11841 var buf []byte 11842 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11843 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11844 hdr.Len = s.SizeBytes() 11845 hdr.Cap = s.SizeBytes() 11846 11847 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11848 // Since we bypassed the compiler's escape analysis, indicate that s 11849 // must live until the use above. 11850 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11851 return length, err 11852 } 11853 11854 // WriteTo implements io.WriterTo.WriteTo. 11855 func (s *SemInfo) WriteTo(writer io.Writer) (int64, error) { 11856 // Construct a slice backed by dst's underlying memory. 11857 var buf []byte 11858 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11859 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11860 hdr.Len = s.SizeBytes() 11861 hdr.Cap = s.SizeBytes() 11862 11863 length, err := writer.Write(buf) 11864 // Since we bypassed the compiler's escape analysis, indicate that s 11865 // must live until the use above. 11866 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11867 return int64(length), err 11868 } 11869 11870 // SizeBytes implements marshal.Marshallable.SizeBytes. 11871 func (s *Sembuf) SizeBytes() int { 11872 return 6 11873 } 11874 11875 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11876 func (s *Sembuf) MarshalBytes(dst []byte) []byte { 11877 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemNum)) 11878 dst = dst[2:] 11879 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemOp)) 11880 dst = dst[2:] 11881 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemFlg)) 11882 dst = dst[2:] 11883 return dst 11884 } 11885 11886 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11887 func (s *Sembuf) UnmarshalBytes(src []byte) []byte { 11888 s.SemNum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11889 src = src[2:] 11890 s.SemOp = int16(hostarch.ByteOrder.Uint16(src[:2])) 11891 src = src[2:] 11892 s.SemFlg = int16(hostarch.ByteOrder.Uint16(src[:2])) 11893 src = src[2:] 11894 return src 11895 } 11896 11897 // Packed implements marshal.Marshallable.Packed. 11898 //go:nosplit 11899 func (s *Sembuf) Packed() bool { 11900 return true 11901 } 11902 11903 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11904 func (s *Sembuf) MarshalUnsafe(dst []byte) []byte { 11905 size := s.SizeBytes() 11906 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 11907 return dst[size:] 11908 } 11909 11910 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11911 func (s *Sembuf) UnmarshalUnsafe(src []byte) []byte { 11912 size := s.SizeBytes() 11913 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 11914 return src[size:] 11915 } 11916 11917 // CopyOutN implements marshal.Marshallable.CopyOutN. 11918 //go:nosplit 11919 func (s *Sembuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11920 // Construct a slice backed by dst's underlying memory. 11921 var buf []byte 11922 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11923 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11924 hdr.Len = s.SizeBytes() 11925 hdr.Cap = s.SizeBytes() 11926 11927 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11928 // Since we bypassed the compiler's escape analysis, indicate that s 11929 // must live until the use above. 11930 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11931 return length, err 11932 } 11933 11934 // CopyOut implements marshal.Marshallable.CopyOut. 11935 //go:nosplit 11936 func (s *Sembuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11937 return s.CopyOutN(cc, addr, s.SizeBytes()) 11938 } 11939 11940 // CopyIn implements marshal.Marshallable.CopyIn. 11941 //go:nosplit 11942 func (s *Sembuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11943 // Construct a slice backed by dst's underlying memory. 11944 var buf []byte 11945 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11946 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11947 hdr.Len = s.SizeBytes() 11948 hdr.Cap = s.SizeBytes() 11949 11950 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11951 // Since we bypassed the compiler's escape analysis, indicate that s 11952 // must live until the use above. 11953 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11954 return length, err 11955 } 11956 11957 // WriteTo implements io.WriterTo.WriteTo. 11958 func (s *Sembuf) WriteTo(writer io.Writer) (int64, error) { 11959 // Construct a slice backed by dst's underlying memory. 11960 var buf []byte 11961 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11962 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 11963 hdr.Len = s.SizeBytes() 11964 hdr.Cap = s.SizeBytes() 11965 11966 length, err := writer.Write(buf) 11967 // Since we bypassed the compiler's escape analysis, indicate that s 11968 // must live until the use above. 11969 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 11970 return int64(length), err 11971 } 11972 11973 // CopySembufSliceIn copies in a slice of Sembuf objects from the task's memory. 11974 func CopySembufSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Sembuf) (int, error) { 11975 count := len(dst) 11976 if count == 0 { 11977 return 0, nil 11978 } 11979 size := (*Sembuf)(nil).SizeBytes() 11980 11981 ptr := unsafe.Pointer(&dst) 11982 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 11983 11984 // Construct a slice backed by dst's underlying memory. 11985 var buf []byte 11986 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11987 hdr.Data = uintptr(val) 11988 hdr.Len = size * count 11989 hdr.Cap = size * count 11990 11991 length, err := cc.CopyInBytes(addr, buf) 11992 // Since we bypassed the compiler's escape analysis, indicate that dst 11993 // must live until the use above. 11994 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 11995 return length, err 11996 } 11997 11998 // CopySembufSliceOut copies a slice of Sembuf objects to the task's memory. 11999 func CopySembufSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Sembuf) (int, error) { 12000 count := len(src) 12001 if count == 0 { 12002 return 0, nil 12003 } 12004 size := (*Sembuf)(nil).SizeBytes() 12005 12006 ptr := unsafe.Pointer(&src) 12007 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 12008 12009 // Construct a slice backed by dst's underlying memory. 12010 var buf []byte 12011 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12012 hdr.Data = uintptr(val) 12013 hdr.Len = size * count 12014 hdr.Cap = size * count 12015 12016 length, err := cc.CopyOutBytes(addr, buf) 12017 // Since we bypassed the compiler's escape analysis, indicate that src 12018 // must live until the use above. 12019 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 12020 return length, err 12021 } 12022 12023 // MarshalUnsafeSembufSlice is like Sembuf.MarshalUnsafe, but for a []Sembuf. 12024 func MarshalUnsafeSembufSlice(src []Sembuf, dst []byte) []byte { 12025 count := len(src) 12026 if count == 0 { 12027 return dst 12028 } 12029 12030 size := (*Sembuf)(nil).SizeBytes() 12031 buf := dst[:size*count] 12032 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 12033 return dst[size*count:] 12034 } 12035 12036 // UnmarshalUnsafeSembufSlice is like Sembuf.UnmarshalUnsafe, but for a []Sembuf. 12037 func UnmarshalUnsafeSembufSlice(dst []Sembuf, src []byte) []byte { 12038 count := len(dst) 12039 if count == 0 { 12040 return src 12041 } 12042 12043 size := (*Sembuf)(nil).SizeBytes() 12044 buf := src[:size*count] 12045 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 12046 return src[size*count:] 12047 } 12048 12049 // SizeBytes implements marshal.Marshallable.SizeBytes. 12050 func (s *ShmInfo) SizeBytes() int { 12051 return 44 + 12052 1*4 12053 } 12054 12055 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12056 func (s *ShmInfo) MarshalBytes(dst []byte) []byte { 12057 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UsedIDs)) 12058 dst = dst[4:] 12059 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 12060 dst = dst[1*(4):] 12061 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmTot)) 12062 dst = dst[8:] 12063 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmRss)) 12064 dst = dst[8:] 12065 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSwp)) 12066 dst = dst[8:] 12067 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapAttempts)) 12068 dst = dst[8:] 12069 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapSuccesses)) 12070 dst = dst[8:] 12071 return dst 12072 } 12073 12074 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12075 func (s *ShmInfo) UnmarshalBytes(src []byte) []byte { 12076 s.UsedIDs = int32(hostarch.ByteOrder.Uint32(src[:4])) 12077 src = src[4:] 12078 // Padding: ~ copy([4]byte(s._), src[:sizeof(byte)*4]) 12079 src = src[1*(4):] 12080 s.ShmTot = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12081 src = src[8:] 12082 s.ShmRss = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12083 src = src[8:] 12084 s.ShmSwp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12085 src = src[8:] 12086 s.SwapAttempts = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12087 src = src[8:] 12088 s.SwapSuccesses = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12089 src = src[8:] 12090 return src 12091 } 12092 12093 // Packed implements marshal.Marshallable.Packed. 12094 //go:nosplit 12095 func (s *ShmInfo) Packed() bool { 12096 return true 12097 } 12098 12099 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12100 func (s *ShmInfo) MarshalUnsafe(dst []byte) []byte { 12101 size := s.SizeBytes() 12102 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12103 return dst[size:] 12104 } 12105 12106 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12107 func (s *ShmInfo) UnmarshalUnsafe(src []byte) []byte { 12108 size := s.SizeBytes() 12109 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12110 return src[size:] 12111 } 12112 12113 // CopyOutN implements marshal.Marshallable.CopyOutN. 12114 //go:nosplit 12115 func (s *ShmInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12116 // Construct a slice backed by dst's underlying memory. 12117 var buf []byte 12118 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12119 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12120 hdr.Len = s.SizeBytes() 12121 hdr.Cap = s.SizeBytes() 12122 12123 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12124 // Since we bypassed the compiler's escape analysis, indicate that s 12125 // must live until the use above. 12126 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12127 return length, err 12128 } 12129 12130 // CopyOut implements marshal.Marshallable.CopyOut. 12131 //go:nosplit 12132 func (s *ShmInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12133 return s.CopyOutN(cc, addr, s.SizeBytes()) 12134 } 12135 12136 // CopyIn implements marshal.Marshallable.CopyIn. 12137 //go:nosplit 12138 func (s *ShmInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12139 // Construct a slice backed by dst's underlying memory. 12140 var buf []byte 12141 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12142 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12143 hdr.Len = s.SizeBytes() 12144 hdr.Cap = s.SizeBytes() 12145 12146 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12147 // Since we bypassed the compiler's escape analysis, indicate that s 12148 // must live until the use above. 12149 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12150 return length, err 12151 } 12152 12153 // WriteTo implements io.WriterTo.WriteTo. 12154 func (s *ShmInfo) WriteTo(writer io.Writer) (int64, error) { 12155 // Construct a slice backed by dst's underlying memory. 12156 var buf []byte 12157 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12158 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12159 hdr.Len = s.SizeBytes() 12160 hdr.Cap = s.SizeBytes() 12161 12162 length, err := writer.Write(buf) 12163 // Since we bypassed the compiler's escape analysis, indicate that s 12164 // must live until the use above. 12165 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12166 return int64(length), err 12167 } 12168 12169 // SizeBytes implements marshal.Marshallable.SizeBytes. 12170 func (s *ShmParams) SizeBytes() int { 12171 return 40 12172 } 12173 12174 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12175 func (s *ShmParams) MarshalBytes(dst []byte) []byte { 12176 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMax)) 12177 dst = dst[8:] 12178 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMin)) 12179 dst = dst[8:] 12180 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMni)) 12181 dst = dst[8:] 12182 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSeg)) 12183 dst = dst[8:] 12184 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmAll)) 12185 dst = dst[8:] 12186 return dst 12187 } 12188 12189 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12190 func (s *ShmParams) UnmarshalBytes(src []byte) []byte { 12191 s.ShmMax = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12192 src = src[8:] 12193 s.ShmMin = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12194 src = src[8:] 12195 s.ShmMni = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12196 src = src[8:] 12197 s.ShmSeg = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12198 src = src[8:] 12199 s.ShmAll = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12200 src = src[8:] 12201 return src 12202 } 12203 12204 // Packed implements marshal.Marshallable.Packed. 12205 //go:nosplit 12206 func (s *ShmParams) Packed() bool { 12207 return true 12208 } 12209 12210 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12211 func (s *ShmParams) MarshalUnsafe(dst []byte) []byte { 12212 size := s.SizeBytes() 12213 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12214 return dst[size:] 12215 } 12216 12217 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12218 func (s *ShmParams) UnmarshalUnsafe(src []byte) []byte { 12219 size := s.SizeBytes() 12220 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12221 return src[size:] 12222 } 12223 12224 // CopyOutN implements marshal.Marshallable.CopyOutN. 12225 //go:nosplit 12226 func (s *ShmParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12227 // Construct a slice backed by dst's underlying memory. 12228 var buf []byte 12229 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12230 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12231 hdr.Len = s.SizeBytes() 12232 hdr.Cap = s.SizeBytes() 12233 12234 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12235 // Since we bypassed the compiler's escape analysis, indicate that s 12236 // must live until the use above. 12237 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12238 return length, err 12239 } 12240 12241 // CopyOut implements marshal.Marshallable.CopyOut. 12242 //go:nosplit 12243 func (s *ShmParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12244 return s.CopyOutN(cc, addr, s.SizeBytes()) 12245 } 12246 12247 // CopyIn implements marshal.Marshallable.CopyIn. 12248 //go:nosplit 12249 func (s *ShmParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12250 // Construct a slice backed by dst's underlying memory. 12251 var buf []byte 12252 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12253 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12254 hdr.Len = s.SizeBytes() 12255 hdr.Cap = s.SizeBytes() 12256 12257 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12258 // Since we bypassed the compiler's escape analysis, indicate that s 12259 // must live until the use above. 12260 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12261 return length, err 12262 } 12263 12264 // WriteTo implements io.WriterTo.WriteTo. 12265 func (s *ShmParams) WriteTo(writer io.Writer) (int64, error) { 12266 // Construct a slice backed by dst's underlying memory. 12267 var buf []byte 12268 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12269 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12270 hdr.Len = s.SizeBytes() 12271 hdr.Cap = s.SizeBytes() 12272 12273 length, err := writer.Write(buf) 12274 // Since we bypassed the compiler's escape analysis, indicate that s 12275 // must live until the use above. 12276 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12277 return int64(length), err 12278 } 12279 12280 // SizeBytes implements marshal.Marshallable.SizeBytes. 12281 func (s *ShmidDS) SizeBytes() int { 12282 return 40 + 12283 (*IPCPerm)(nil).SizeBytes() + 12284 (*TimeT)(nil).SizeBytes() + 12285 (*TimeT)(nil).SizeBytes() + 12286 (*TimeT)(nil).SizeBytes() 12287 } 12288 12289 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12290 func (s *ShmidDS) MarshalBytes(dst []byte) []byte { 12291 dst = s.ShmPerm.MarshalUnsafe(dst) 12292 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSegsz)) 12293 dst = dst[8:] 12294 dst = s.ShmAtime.MarshalUnsafe(dst) 12295 dst = s.ShmDtime.MarshalUnsafe(dst) 12296 dst = s.ShmCtime.MarshalUnsafe(dst) 12297 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmCpid)) 12298 dst = dst[4:] 12299 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmLpid)) 12300 dst = dst[4:] 12301 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmNattach)) 12302 dst = dst[8:] 12303 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused4)) 12304 dst = dst[8:] 12305 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused5)) 12306 dst = dst[8:] 12307 return dst 12308 } 12309 12310 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12311 func (s *ShmidDS) UnmarshalBytes(src []byte) []byte { 12312 src = s.ShmPerm.UnmarshalUnsafe(src) 12313 s.ShmSegsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12314 src = src[8:] 12315 src = s.ShmAtime.UnmarshalUnsafe(src) 12316 src = s.ShmDtime.UnmarshalUnsafe(src) 12317 src = s.ShmCtime.UnmarshalUnsafe(src) 12318 s.ShmCpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 12319 src = src[4:] 12320 s.ShmLpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 12321 src = src[4:] 12322 s.ShmNattach = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12323 src = src[8:] 12324 s.Unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12325 src = src[8:] 12326 s.Unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12327 src = src[8:] 12328 return src 12329 } 12330 12331 // Packed implements marshal.Marshallable.Packed. 12332 //go:nosplit 12333 func (s *ShmidDS) Packed() bool { 12334 return s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() 12335 } 12336 12337 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12338 func (s *ShmidDS) MarshalUnsafe(dst []byte) []byte { 12339 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 12340 size := s.SizeBytes() 12341 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12342 return dst[size:] 12343 } 12344 // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 12345 return s.MarshalBytes(dst) 12346 } 12347 12348 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12349 func (s *ShmidDS) UnmarshalUnsafe(src []byte) []byte { 12350 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 12351 size := s.SizeBytes() 12352 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12353 return src[size:] 12354 } 12355 // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12356 return s.UnmarshalBytes(src) 12357 } 12358 12359 // CopyOutN implements marshal.Marshallable.CopyOutN. 12360 //go:nosplit 12361 func (s *ShmidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12362 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 12363 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 12364 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 12365 s.MarshalBytes(buf) // escapes: fallback. 12366 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12367 } 12368 12369 // Construct a slice backed by dst's underlying memory. 12370 var buf []byte 12371 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12372 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12373 hdr.Len = s.SizeBytes() 12374 hdr.Cap = s.SizeBytes() 12375 12376 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12377 // Since we bypassed the compiler's escape analysis, indicate that s 12378 // must live until the use above. 12379 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12380 return length, err 12381 } 12382 12383 // CopyOut implements marshal.Marshallable.CopyOut. 12384 //go:nosplit 12385 func (s *ShmidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12386 return s.CopyOutN(cc, addr, s.SizeBytes()) 12387 } 12388 12389 // CopyIn implements marshal.Marshallable.CopyIn. 12390 //go:nosplit 12391 func (s *ShmidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12392 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 12393 // Type ShmidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12394 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 12395 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12396 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12397 // partially unmarshalled struct. 12398 s.UnmarshalBytes(buf) // escapes: fallback. 12399 return length, err 12400 } 12401 12402 // Construct a slice backed by dst's underlying memory. 12403 var buf []byte 12404 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12405 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12406 hdr.Len = s.SizeBytes() 12407 hdr.Cap = s.SizeBytes() 12408 12409 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12410 // Since we bypassed the compiler's escape analysis, indicate that s 12411 // must live until the use above. 12412 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12413 return length, err 12414 } 12415 12416 // WriteTo implements io.WriterTo.WriteTo. 12417 func (s *ShmidDS) WriteTo(writer io.Writer) (int64, error) { 12418 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 12419 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 12420 buf := make([]byte, s.SizeBytes()) 12421 s.MarshalBytes(buf) 12422 length, err := writer.Write(buf) 12423 return int64(length), err 12424 } 12425 12426 // Construct a slice backed by dst's underlying memory. 12427 var buf []byte 12428 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12429 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12430 hdr.Len = s.SizeBytes() 12431 hdr.Cap = s.SizeBytes() 12432 12433 length, err := writer.Write(buf) 12434 // Since we bypassed the compiler's escape analysis, indicate that s 12435 // must live until the use above. 12436 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12437 return int64(length), err 12438 } 12439 12440 // SizeBytes implements marshal.Marshallable.SizeBytes. 12441 func (s *SigAction) SizeBytes() int { 12442 return 24 + 12443 (*SignalSet)(nil).SizeBytes() 12444 } 12445 12446 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12447 func (s *SigAction) MarshalBytes(dst []byte) []byte { 12448 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Handler)) 12449 dst = dst[8:] 12450 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 12451 dst = dst[8:] 12452 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Restorer)) 12453 dst = dst[8:] 12454 dst = s.Mask.MarshalUnsafe(dst) 12455 return dst 12456 } 12457 12458 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12459 func (s *SigAction) UnmarshalBytes(src []byte) []byte { 12460 s.Handler = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12461 src = src[8:] 12462 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12463 src = src[8:] 12464 s.Restorer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12465 src = src[8:] 12466 src = s.Mask.UnmarshalUnsafe(src) 12467 return src 12468 } 12469 12470 // Packed implements marshal.Marshallable.Packed. 12471 //go:nosplit 12472 func (s *SigAction) Packed() bool { 12473 return s.Mask.Packed() 12474 } 12475 12476 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12477 func (s *SigAction) MarshalUnsafe(dst []byte) []byte { 12478 if s.Mask.Packed() { 12479 size := s.SizeBytes() 12480 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12481 return dst[size:] 12482 } 12483 // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes. 12484 return s.MarshalBytes(dst) 12485 } 12486 12487 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12488 func (s *SigAction) UnmarshalUnsafe(src []byte) []byte { 12489 if s.Mask.Packed() { 12490 size := s.SizeBytes() 12491 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12492 return src[size:] 12493 } 12494 // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12495 return s.UnmarshalBytes(src) 12496 } 12497 12498 // CopyOutN implements marshal.Marshallable.CopyOutN. 12499 //go:nosplit 12500 func (s *SigAction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12501 if !s.Mask.Packed() { 12502 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 12503 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 12504 s.MarshalBytes(buf) // escapes: fallback. 12505 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12506 } 12507 12508 // Construct a slice backed by dst's underlying memory. 12509 var buf []byte 12510 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12511 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12512 hdr.Len = s.SizeBytes() 12513 hdr.Cap = s.SizeBytes() 12514 12515 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12516 // Since we bypassed the compiler's escape analysis, indicate that s 12517 // must live until the use above. 12518 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12519 return length, err 12520 } 12521 12522 // CopyOut implements marshal.Marshallable.CopyOut. 12523 //go:nosplit 12524 func (s *SigAction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12525 return s.CopyOutN(cc, addr, s.SizeBytes()) 12526 } 12527 12528 // CopyIn implements marshal.Marshallable.CopyIn. 12529 //go:nosplit 12530 func (s *SigAction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12531 if !s.Mask.Packed() { 12532 // Type SigAction doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12533 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 12534 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12535 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12536 // partially unmarshalled struct. 12537 s.UnmarshalBytes(buf) // escapes: fallback. 12538 return length, err 12539 } 12540 12541 // Construct a slice backed by dst's underlying memory. 12542 var buf []byte 12543 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12544 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12545 hdr.Len = s.SizeBytes() 12546 hdr.Cap = s.SizeBytes() 12547 12548 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12549 // Since we bypassed the compiler's escape analysis, indicate that s 12550 // must live until the use above. 12551 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12552 return length, err 12553 } 12554 12555 // WriteTo implements io.WriterTo.WriteTo. 12556 func (s *SigAction) WriteTo(writer io.Writer) (int64, error) { 12557 if !s.Mask.Packed() { 12558 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 12559 buf := make([]byte, s.SizeBytes()) 12560 s.MarshalBytes(buf) 12561 length, err := writer.Write(buf) 12562 return int64(length), err 12563 } 12564 12565 // Construct a slice backed by dst's underlying memory. 12566 var buf []byte 12567 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12568 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12569 hdr.Len = s.SizeBytes() 12570 hdr.Cap = s.SizeBytes() 12571 12572 length, err := writer.Write(buf) 12573 // Since we bypassed the compiler's escape analysis, indicate that s 12574 // must live until the use above. 12575 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12576 return int64(length), err 12577 } 12578 12579 // SizeBytes implements marshal.Marshallable.SizeBytes. 12580 func (s *Sigevent) SizeBytes() int { 12581 return 20 + 12582 1*44 12583 } 12584 12585 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12586 func (s *Sigevent) MarshalBytes(dst []byte) []byte { 12587 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Value)) 12588 dst = dst[8:] 12589 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 12590 dst = dst[4:] 12591 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Notify)) 12592 dst = dst[4:] 12593 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Tid)) 12594 dst = dst[4:] 12595 for idx := 0; idx < 44; idx++ { 12596 dst[0] = byte(s.UnRemainder[idx]) 12597 dst = dst[1:] 12598 } 12599 return dst 12600 } 12601 12602 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12603 func (s *Sigevent) UnmarshalBytes(src []byte) []byte { 12604 s.Value = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12605 src = src[8:] 12606 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 12607 src = src[4:] 12608 s.Notify = int32(hostarch.ByteOrder.Uint32(src[:4])) 12609 src = src[4:] 12610 s.Tid = int32(hostarch.ByteOrder.Uint32(src[:4])) 12611 src = src[4:] 12612 for idx := 0; idx < 44; idx++ { 12613 s.UnRemainder[idx] = src[0] 12614 src = src[1:] 12615 } 12616 return src 12617 } 12618 12619 // Packed implements marshal.Marshallable.Packed. 12620 //go:nosplit 12621 func (s *Sigevent) Packed() bool { 12622 return true 12623 } 12624 12625 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12626 func (s *Sigevent) MarshalUnsafe(dst []byte) []byte { 12627 size := s.SizeBytes() 12628 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12629 return dst[size:] 12630 } 12631 12632 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12633 func (s *Sigevent) UnmarshalUnsafe(src []byte) []byte { 12634 size := s.SizeBytes() 12635 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12636 return src[size:] 12637 } 12638 12639 // CopyOutN implements marshal.Marshallable.CopyOutN. 12640 //go:nosplit 12641 func (s *Sigevent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12642 // Construct a slice backed by dst's underlying memory. 12643 var buf []byte 12644 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12645 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12646 hdr.Len = s.SizeBytes() 12647 hdr.Cap = s.SizeBytes() 12648 12649 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12650 // Since we bypassed the compiler's escape analysis, indicate that s 12651 // must live until the use above. 12652 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12653 return length, err 12654 } 12655 12656 // CopyOut implements marshal.Marshallable.CopyOut. 12657 //go:nosplit 12658 func (s *Sigevent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12659 return s.CopyOutN(cc, addr, s.SizeBytes()) 12660 } 12661 12662 // CopyIn implements marshal.Marshallable.CopyIn. 12663 //go:nosplit 12664 func (s *Sigevent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12665 // Construct a slice backed by dst's underlying memory. 12666 var buf []byte 12667 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12668 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12669 hdr.Len = s.SizeBytes() 12670 hdr.Cap = s.SizeBytes() 12671 12672 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12673 // Since we bypassed the compiler's escape analysis, indicate that s 12674 // must live until the use above. 12675 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12676 return length, err 12677 } 12678 12679 // WriteTo implements io.WriterTo.WriteTo. 12680 func (s *Sigevent) WriteTo(writer io.Writer) (int64, error) { 12681 // Construct a slice backed by dst's underlying memory. 12682 var buf []byte 12683 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12684 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12685 hdr.Len = s.SizeBytes() 12686 hdr.Cap = s.SizeBytes() 12687 12688 length, err := writer.Write(buf) 12689 // Since we bypassed the compiler's escape analysis, indicate that s 12690 // must live until the use above. 12691 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12692 return int64(length), err 12693 } 12694 12695 // SizeBytes implements marshal.Marshallable.SizeBytes. 12696 func (s *SignalInfo) SizeBytes() int { 12697 return 16 + 12698 1*(128-16) 12699 } 12700 12701 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12702 func (s *SignalInfo) MarshalBytes(dst []byte) []byte { 12703 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 12704 dst = dst[4:] 12705 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 12706 dst = dst[4:] 12707 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 12708 dst = dst[4:] 12709 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 12710 dst = dst[4:] 12711 for idx := 0; idx < (128-16); idx++ { 12712 dst[0] = byte(s.Fields[idx]) 12713 dst = dst[1:] 12714 } 12715 return dst 12716 } 12717 12718 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12719 func (s *SignalInfo) UnmarshalBytes(src []byte) []byte { 12720 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 12721 src = src[4:] 12722 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 12723 src = src[4:] 12724 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 12725 src = src[4:] 12726 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 12727 src = src[4:] 12728 for idx := 0; idx < (128-16); idx++ { 12729 s.Fields[idx] = src[0] 12730 src = src[1:] 12731 } 12732 return src 12733 } 12734 12735 // Packed implements marshal.Marshallable.Packed. 12736 //go:nosplit 12737 func (s *SignalInfo) Packed() bool { 12738 return true 12739 } 12740 12741 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12742 func (s *SignalInfo) MarshalUnsafe(dst []byte) []byte { 12743 size := s.SizeBytes() 12744 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12745 return dst[size:] 12746 } 12747 12748 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12749 func (s *SignalInfo) UnmarshalUnsafe(src []byte) []byte { 12750 size := s.SizeBytes() 12751 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12752 return src[size:] 12753 } 12754 12755 // CopyOutN implements marshal.Marshallable.CopyOutN. 12756 //go:nosplit 12757 func (s *SignalInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12758 // Construct a slice backed by dst's underlying memory. 12759 var buf []byte 12760 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12761 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12762 hdr.Len = s.SizeBytes() 12763 hdr.Cap = s.SizeBytes() 12764 12765 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12766 // Since we bypassed the compiler's escape analysis, indicate that s 12767 // must live until the use above. 12768 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12769 return length, err 12770 } 12771 12772 // CopyOut implements marshal.Marshallable.CopyOut. 12773 //go:nosplit 12774 func (s *SignalInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12775 return s.CopyOutN(cc, addr, s.SizeBytes()) 12776 } 12777 12778 // CopyIn implements marshal.Marshallable.CopyIn. 12779 //go:nosplit 12780 func (s *SignalInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12781 // Construct a slice backed by dst's underlying memory. 12782 var buf []byte 12783 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12784 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12785 hdr.Len = s.SizeBytes() 12786 hdr.Cap = s.SizeBytes() 12787 12788 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12789 // Since we bypassed the compiler's escape analysis, indicate that s 12790 // must live until the use above. 12791 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12792 return length, err 12793 } 12794 12795 // WriteTo implements io.WriterTo.WriteTo. 12796 func (s *SignalInfo) WriteTo(writer io.Writer) (int64, error) { 12797 // Construct a slice backed by dst's underlying memory. 12798 var buf []byte 12799 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12800 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12801 hdr.Len = s.SizeBytes() 12802 hdr.Cap = s.SizeBytes() 12803 12804 length, err := writer.Write(buf) 12805 // Since we bypassed the compiler's escape analysis, indicate that s 12806 // must live until the use above. 12807 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12808 return int64(length), err 12809 } 12810 12811 // SizeBytes implements marshal.Marshallable.SizeBytes. 12812 //go:nosplit 12813 func (s *SignalSet) SizeBytes() int { 12814 return 8 12815 } 12816 12817 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12818 func (s *SignalSet) MarshalBytes(dst []byte) []byte { 12819 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*s)) 12820 return dst[8:] 12821 } 12822 12823 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12824 func (s *SignalSet) UnmarshalBytes(src []byte) []byte { 12825 *s = SignalSet(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 12826 return src[8:] 12827 } 12828 12829 // Packed implements marshal.Marshallable.Packed. 12830 //go:nosplit 12831 func (s *SignalSet) Packed() bool { 12832 // Scalar newtypes are always packed. 12833 return true 12834 } 12835 12836 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12837 func (s *SignalSet) MarshalUnsafe(dst []byte) []byte { 12838 size := s.SizeBytes() 12839 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12840 return dst[size:] 12841 } 12842 12843 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12844 func (s *SignalSet) UnmarshalUnsafe(src []byte) []byte { 12845 size := s.SizeBytes() 12846 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12847 return src[size:] 12848 } 12849 12850 // CopyOutN implements marshal.Marshallable.CopyOutN. 12851 //go:nosplit 12852 func (s *SignalSet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12853 // Construct a slice backed by dst's underlying memory. 12854 var buf []byte 12855 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12856 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12857 hdr.Len = s.SizeBytes() 12858 hdr.Cap = s.SizeBytes() 12859 12860 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12861 // Since we bypassed the compiler's escape analysis, indicate that s 12862 // must live until the use above. 12863 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12864 return length, err 12865 } 12866 12867 // CopyOut implements marshal.Marshallable.CopyOut. 12868 //go:nosplit 12869 func (s *SignalSet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12870 return s.CopyOutN(cc, addr, s.SizeBytes()) 12871 } 12872 12873 // CopyIn implements marshal.Marshallable.CopyIn. 12874 //go:nosplit 12875 func (s *SignalSet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12876 // Construct a slice backed by dst's underlying memory. 12877 var buf []byte 12878 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12879 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12880 hdr.Len = s.SizeBytes() 12881 hdr.Cap = s.SizeBytes() 12882 12883 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12884 // Since we bypassed the compiler's escape analysis, indicate that s 12885 // must live until the use above. 12886 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12887 return length, err 12888 } 12889 12890 // WriteTo implements io.WriterTo.WriteTo. 12891 func (s *SignalSet) WriteTo(writer io.Writer) (int64, error) { 12892 // Construct a slice backed by dst's underlying memory. 12893 var buf []byte 12894 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12895 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12896 hdr.Len = s.SizeBytes() 12897 hdr.Cap = s.SizeBytes() 12898 12899 length, err := writer.Write(buf) 12900 // Since we bypassed the compiler's escape analysis, indicate that s 12901 // must live until the use above. 12902 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12903 return int64(length), err 12904 } 12905 12906 // SizeBytes implements marshal.Marshallable.SizeBytes. 12907 func (s *SignalStack) SizeBytes() int { 12908 return 24 12909 } 12910 12911 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12912 func (s *SignalStack) MarshalBytes(dst []byte) []byte { 12913 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 12914 dst = dst[8:] 12915 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flags)) 12916 dst = dst[4:] 12917 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 12918 dst = dst[4:] 12919 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 12920 dst = dst[8:] 12921 return dst 12922 } 12923 12924 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12925 func (s *SignalStack) UnmarshalBytes(src []byte) []byte { 12926 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12927 src = src[8:] 12928 s.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12929 src = src[4:] 12930 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 12931 src = src[4:] 12932 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12933 src = src[8:] 12934 return src 12935 } 12936 12937 // Packed implements marshal.Marshallable.Packed. 12938 //go:nosplit 12939 func (s *SignalStack) Packed() bool { 12940 return true 12941 } 12942 12943 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12944 func (s *SignalStack) MarshalUnsafe(dst []byte) []byte { 12945 size := s.SizeBytes() 12946 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12947 return dst[size:] 12948 } 12949 12950 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12951 func (s *SignalStack) UnmarshalUnsafe(src []byte) []byte { 12952 size := s.SizeBytes() 12953 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12954 return src[size:] 12955 } 12956 12957 // CopyOutN implements marshal.Marshallable.CopyOutN. 12958 //go:nosplit 12959 func (s *SignalStack) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12960 // Construct a slice backed by dst's underlying memory. 12961 var buf []byte 12962 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12963 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12964 hdr.Len = s.SizeBytes() 12965 hdr.Cap = s.SizeBytes() 12966 12967 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12968 // Since we bypassed the compiler's escape analysis, indicate that s 12969 // must live until the use above. 12970 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12971 return length, err 12972 } 12973 12974 // CopyOut implements marshal.Marshallable.CopyOut. 12975 //go:nosplit 12976 func (s *SignalStack) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12977 return s.CopyOutN(cc, addr, s.SizeBytes()) 12978 } 12979 12980 // CopyIn implements marshal.Marshallable.CopyIn. 12981 //go:nosplit 12982 func (s *SignalStack) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12983 // Construct a slice backed by dst's underlying memory. 12984 var buf []byte 12985 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12986 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12987 hdr.Len = s.SizeBytes() 12988 hdr.Cap = s.SizeBytes() 12989 12990 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12991 // Since we bypassed the compiler's escape analysis, indicate that s 12992 // must live until the use above. 12993 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12994 return length, err 12995 } 12996 12997 // WriteTo implements io.WriterTo.WriteTo. 12998 func (s *SignalStack) WriteTo(writer io.Writer) (int64, error) { 12999 // Construct a slice backed by dst's underlying memory. 13000 var buf []byte 13001 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13002 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13003 hdr.Len = s.SizeBytes() 13004 hdr.Cap = s.SizeBytes() 13005 13006 length, err := writer.Write(buf) 13007 // Since we bypassed the compiler's escape analysis, indicate that s 13008 // must live until the use above. 13009 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13010 return int64(length), err 13011 } 13012 13013 // SizeBytes implements marshal.Marshallable.SizeBytes. 13014 func (s *SignalfdSiginfo) SizeBytes() int { 13015 return 82 + 13016 1*48 13017 } 13018 13019 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13020 func (s *SignalfdSiginfo) MarshalBytes(dst []byte) []byte { 13021 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 13022 dst = dst[4:] 13023 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 13024 dst = dst[4:] 13025 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 13026 dst = dst[4:] 13027 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PID)) 13028 dst = dst[4:] 13029 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 13030 dst = dst[4:] 13031 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FD)) 13032 dst = dst[4:] 13033 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TID)) 13034 dst = dst[4:] 13035 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Band)) 13036 dst = dst[4:] 13037 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Overrun)) 13038 dst = dst[4:] 13039 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TrapNo)) 13040 dst = dst[4:] 13041 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Status)) 13042 dst = dst[4:] 13043 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Int)) 13044 dst = dst[4:] 13045 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ptr)) 13046 dst = dst[8:] 13047 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.UTime)) 13048 dst = dst[8:] 13049 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.STime)) 13050 dst = dst[8:] 13051 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 13052 dst = dst[8:] 13053 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.AddrLSB)) 13054 dst = dst[2:] 13055 // Padding: dst[:sizeof(uint8)*48] ~= [48]uint8{0} 13056 dst = dst[1*(48):] 13057 return dst 13058 } 13059 13060 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13061 func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) []byte { 13062 s.Signo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13063 src = src[4:] 13064 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 13065 src = src[4:] 13066 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 13067 src = src[4:] 13068 s.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13069 src = src[4:] 13070 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13071 src = src[4:] 13072 s.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 13073 src = src[4:] 13074 s.TID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13075 src = src[4:] 13076 s.Band = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13077 src = src[4:] 13078 s.Overrun = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13079 src = src[4:] 13080 s.TrapNo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13081 src = src[4:] 13082 s.Status = int32(hostarch.ByteOrder.Uint32(src[:4])) 13083 src = src[4:] 13084 s.Int = int32(hostarch.ByteOrder.Uint32(src[:4])) 13085 src = src[4:] 13086 s.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13087 src = src[8:] 13088 s.UTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13089 src = src[8:] 13090 s.STime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13091 src = src[8:] 13092 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13093 src = src[8:] 13094 s.AddrLSB = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13095 src = src[2:] 13096 // Padding: ~ copy([48]uint8(s._), src[:sizeof(uint8)*48]) 13097 src = src[1*(48):] 13098 return src 13099 } 13100 13101 // Packed implements marshal.Marshallable.Packed. 13102 //go:nosplit 13103 func (s *SignalfdSiginfo) Packed() bool { 13104 return false 13105 } 13106 13107 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13108 func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) []byte { 13109 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to MarshalBytes. 13110 return s.MarshalBytes(dst) 13111 } 13112 13113 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13114 func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) []byte { 13115 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13116 return s.UnmarshalBytes(src) 13117 } 13118 13119 // CopyOutN implements marshal.Marshallable.CopyOutN. 13120 //go:nosplit 13121 func (s *SignalfdSiginfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13122 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 13123 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 13124 s.MarshalBytes(buf) // escapes: fallback. 13125 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13126 } 13127 13128 // CopyOut implements marshal.Marshallable.CopyOut. 13129 //go:nosplit 13130 func (s *SignalfdSiginfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13131 return s.CopyOutN(cc, addr, s.SizeBytes()) 13132 } 13133 13134 // CopyIn implements marshal.Marshallable.CopyIn. 13135 //go:nosplit 13136 func (s *SignalfdSiginfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13137 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13138 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 13139 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13140 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13141 // partially unmarshalled struct. 13142 s.UnmarshalBytes(buf) // escapes: fallback. 13143 return length, err 13144 } 13145 13146 // WriteTo implements io.WriterTo.WriteTo. 13147 func (s *SignalfdSiginfo) WriteTo(writer io.Writer) (int64, error) { 13148 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 13149 buf := make([]byte, s.SizeBytes()) 13150 s.MarshalBytes(buf) 13151 length, err := writer.Write(buf) 13152 return int64(length), err 13153 } 13154 13155 // SizeBytes implements marshal.Marshallable.SizeBytes. 13156 func (c *ControlMessageCredentials) SizeBytes() int { 13157 return 12 13158 } 13159 13160 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13161 func (c *ControlMessageCredentials) MarshalBytes(dst []byte) []byte { 13162 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.PID)) 13163 dst = dst[4:] 13164 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.UID)) 13165 dst = dst[4:] 13166 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.GID)) 13167 dst = dst[4:] 13168 return dst 13169 } 13170 13171 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13172 func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) []byte { 13173 c.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 13174 src = src[4:] 13175 c.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13176 src = src[4:] 13177 c.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13178 src = src[4:] 13179 return src 13180 } 13181 13182 // Packed implements marshal.Marshallable.Packed. 13183 //go:nosplit 13184 func (c *ControlMessageCredentials) Packed() bool { 13185 return true 13186 } 13187 13188 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13189 func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) []byte { 13190 size := c.SizeBytes() 13191 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 13192 return dst[size:] 13193 } 13194 13195 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13196 func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) []byte { 13197 size := c.SizeBytes() 13198 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 13199 return src[size:] 13200 } 13201 13202 // CopyOutN implements marshal.Marshallable.CopyOutN. 13203 //go:nosplit 13204 func (c *ControlMessageCredentials) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13205 // Construct a slice backed by dst's underlying memory. 13206 var buf []byte 13207 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13208 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13209 hdr.Len = c.SizeBytes() 13210 hdr.Cap = c.SizeBytes() 13211 13212 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13213 // Since we bypassed the compiler's escape analysis, indicate that c 13214 // must live until the use above. 13215 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13216 return length, err 13217 } 13218 13219 // CopyOut implements marshal.Marshallable.CopyOut. 13220 //go:nosplit 13221 func (c *ControlMessageCredentials) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13222 return c.CopyOutN(cc, addr, c.SizeBytes()) 13223 } 13224 13225 // CopyIn implements marshal.Marshallable.CopyIn. 13226 //go:nosplit 13227 func (c *ControlMessageCredentials) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13228 // Construct a slice backed by dst's underlying memory. 13229 var buf []byte 13230 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13231 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13232 hdr.Len = c.SizeBytes() 13233 hdr.Cap = c.SizeBytes() 13234 13235 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13236 // Since we bypassed the compiler's escape analysis, indicate that c 13237 // must live until the use above. 13238 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13239 return length, err 13240 } 13241 13242 // WriteTo implements io.WriterTo.WriteTo. 13243 func (c *ControlMessageCredentials) WriteTo(writer io.Writer) (int64, error) { 13244 // Construct a slice backed by dst's underlying memory. 13245 var buf []byte 13246 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13247 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13248 hdr.Len = c.SizeBytes() 13249 hdr.Cap = c.SizeBytes() 13250 13251 length, err := writer.Write(buf) 13252 // Since we bypassed the compiler's escape analysis, indicate that c 13253 // must live until the use above. 13254 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13255 return int64(length), err 13256 } 13257 13258 // SizeBytes implements marshal.Marshallable.SizeBytes. 13259 func (c *ControlMessageHeader) SizeBytes() int { 13260 return 16 13261 } 13262 13263 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13264 func (c *ControlMessageHeader) MarshalBytes(dst []byte) []byte { 13265 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Length)) 13266 dst = dst[8:] 13267 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Level)) 13268 dst = dst[4:] 13269 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Type)) 13270 dst = dst[4:] 13271 return dst 13272 } 13273 13274 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13275 func (c *ControlMessageHeader) UnmarshalBytes(src []byte) []byte { 13276 c.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13277 src = src[8:] 13278 c.Level = int32(hostarch.ByteOrder.Uint32(src[:4])) 13279 src = src[4:] 13280 c.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 13281 src = src[4:] 13282 return src 13283 } 13284 13285 // Packed implements marshal.Marshallable.Packed. 13286 //go:nosplit 13287 func (c *ControlMessageHeader) Packed() bool { 13288 return true 13289 } 13290 13291 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13292 func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) []byte { 13293 size := c.SizeBytes() 13294 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 13295 return dst[size:] 13296 } 13297 13298 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13299 func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) []byte { 13300 size := c.SizeBytes() 13301 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 13302 return src[size:] 13303 } 13304 13305 // CopyOutN implements marshal.Marshallable.CopyOutN. 13306 //go:nosplit 13307 func (c *ControlMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13308 // Construct a slice backed by dst's underlying memory. 13309 var buf []byte 13310 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13311 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13312 hdr.Len = c.SizeBytes() 13313 hdr.Cap = c.SizeBytes() 13314 13315 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13316 // Since we bypassed the compiler's escape analysis, indicate that c 13317 // must live until the use above. 13318 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13319 return length, err 13320 } 13321 13322 // CopyOut implements marshal.Marshallable.CopyOut. 13323 //go:nosplit 13324 func (c *ControlMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13325 return c.CopyOutN(cc, addr, c.SizeBytes()) 13326 } 13327 13328 // CopyIn implements marshal.Marshallable.CopyIn. 13329 //go:nosplit 13330 func (c *ControlMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13331 // Construct a slice backed by dst's underlying memory. 13332 var buf []byte 13333 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13334 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13335 hdr.Len = c.SizeBytes() 13336 hdr.Cap = c.SizeBytes() 13337 13338 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13339 // Since we bypassed the compiler's escape analysis, indicate that c 13340 // must live until the use above. 13341 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13342 return length, err 13343 } 13344 13345 // WriteTo implements io.WriterTo.WriteTo. 13346 func (c *ControlMessageHeader) WriteTo(writer io.Writer) (int64, error) { 13347 // Construct a slice backed by dst's underlying memory. 13348 var buf []byte 13349 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13350 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13351 hdr.Len = c.SizeBytes() 13352 hdr.Cap = c.SizeBytes() 13353 13354 length, err := writer.Write(buf) 13355 // Since we bypassed the compiler's escape analysis, indicate that c 13356 // must live until the use above. 13357 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13358 return int64(length), err 13359 } 13360 13361 // SizeBytes implements marshal.Marshallable.SizeBytes. 13362 func (c *ControlMessageIPPacketInfo) SizeBytes() int { 13363 return 4 + 13364 (*InetAddr)(nil).SizeBytes() + 13365 (*InetAddr)(nil).SizeBytes() 13366 } 13367 13368 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13369 func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) []byte { 13370 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 13371 dst = dst[4:] 13372 dst = c.LocalAddr.MarshalUnsafe(dst) 13373 dst = c.DestinationAddr.MarshalUnsafe(dst) 13374 return dst 13375 } 13376 13377 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13378 func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) []byte { 13379 c.NIC = int32(hostarch.ByteOrder.Uint32(src[:4])) 13380 src = src[4:] 13381 src = c.LocalAddr.UnmarshalUnsafe(src) 13382 src = c.DestinationAddr.UnmarshalUnsafe(src) 13383 return src 13384 } 13385 13386 // Packed implements marshal.Marshallable.Packed. 13387 //go:nosplit 13388 func (c *ControlMessageIPPacketInfo) Packed() bool { 13389 return c.DestinationAddr.Packed() && c.LocalAddr.Packed() 13390 } 13391 13392 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13393 func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) []byte { 13394 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 13395 size := c.SizeBytes() 13396 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 13397 return dst[size:] 13398 } 13399 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 13400 return c.MarshalBytes(dst) 13401 } 13402 13403 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13404 func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) []byte { 13405 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 13406 size := c.SizeBytes() 13407 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 13408 return src[size:] 13409 } 13410 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13411 return c.UnmarshalBytes(src) 13412 } 13413 13414 // CopyOutN implements marshal.Marshallable.CopyOutN. 13415 //go:nosplit 13416 func (c *ControlMessageIPPacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13417 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 13418 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 13419 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 13420 c.MarshalBytes(buf) // escapes: fallback. 13421 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13422 } 13423 13424 // Construct a slice backed by dst's underlying memory. 13425 var buf []byte 13426 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13427 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13428 hdr.Len = c.SizeBytes() 13429 hdr.Cap = c.SizeBytes() 13430 13431 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13432 // Since we bypassed the compiler's escape analysis, indicate that c 13433 // must live until the use above. 13434 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13435 return length, err 13436 } 13437 13438 // CopyOut implements marshal.Marshallable.CopyOut. 13439 //go:nosplit 13440 func (c *ControlMessageIPPacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13441 return c.CopyOutN(cc, addr, c.SizeBytes()) 13442 } 13443 13444 // CopyIn implements marshal.Marshallable.CopyIn. 13445 //go:nosplit 13446 func (c *ControlMessageIPPacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13447 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 13448 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13449 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 13450 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13451 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13452 // partially unmarshalled struct. 13453 c.UnmarshalBytes(buf) // escapes: fallback. 13454 return length, err 13455 } 13456 13457 // Construct a slice backed by dst's underlying memory. 13458 var buf []byte 13459 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13460 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13461 hdr.Len = c.SizeBytes() 13462 hdr.Cap = c.SizeBytes() 13463 13464 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13465 // Since we bypassed the compiler's escape analysis, indicate that c 13466 // must live until the use above. 13467 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13468 return length, err 13469 } 13470 13471 // WriteTo implements io.WriterTo.WriteTo. 13472 func (c *ControlMessageIPPacketInfo) WriteTo(writer io.Writer) (int64, error) { 13473 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 13474 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 13475 buf := make([]byte, c.SizeBytes()) 13476 c.MarshalBytes(buf) 13477 length, err := writer.Write(buf) 13478 return int64(length), err 13479 } 13480 13481 // Construct a slice backed by dst's underlying memory. 13482 var buf []byte 13483 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13484 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13485 hdr.Len = c.SizeBytes() 13486 hdr.Cap = c.SizeBytes() 13487 13488 length, err := writer.Write(buf) 13489 // Since we bypassed the compiler's escape analysis, indicate that c 13490 // must live until the use above. 13491 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13492 return int64(length), err 13493 } 13494 13495 // SizeBytes implements marshal.Marshallable.SizeBytes. 13496 func (c *ControlMessageIPv6PacketInfo) SizeBytes() int { 13497 return 4 + 13498 (*Inet6Addr)(nil).SizeBytes() 13499 } 13500 13501 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13502 func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) []byte { 13503 dst = c.Addr.MarshalUnsafe(dst) 13504 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 13505 dst = dst[4:] 13506 return dst 13507 } 13508 13509 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13510 func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) []byte { 13511 src = c.Addr.UnmarshalUnsafe(src) 13512 c.NIC = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13513 src = src[4:] 13514 return src 13515 } 13516 13517 // Packed implements marshal.Marshallable.Packed. 13518 //go:nosplit 13519 func (c *ControlMessageIPv6PacketInfo) Packed() bool { 13520 return c.Addr.Packed() 13521 } 13522 13523 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13524 func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) []byte { 13525 if c.Addr.Packed() { 13526 size := c.SizeBytes() 13527 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 13528 return dst[size:] 13529 } 13530 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 13531 return c.MarshalBytes(dst) 13532 } 13533 13534 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13535 func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) []byte { 13536 if c.Addr.Packed() { 13537 size := c.SizeBytes() 13538 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 13539 return src[size:] 13540 } 13541 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13542 return c.UnmarshalBytes(src) 13543 } 13544 13545 // CopyOutN implements marshal.Marshallable.CopyOutN. 13546 //go:nosplit 13547 func (c *ControlMessageIPv6PacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13548 if !c.Addr.Packed() { 13549 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 13550 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 13551 c.MarshalBytes(buf) // escapes: fallback. 13552 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13553 } 13554 13555 // Construct a slice backed by dst's underlying memory. 13556 var buf []byte 13557 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13558 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13559 hdr.Len = c.SizeBytes() 13560 hdr.Cap = c.SizeBytes() 13561 13562 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13563 // Since we bypassed the compiler's escape analysis, indicate that c 13564 // must live until the use above. 13565 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13566 return length, err 13567 } 13568 13569 // CopyOut implements marshal.Marshallable.CopyOut. 13570 //go:nosplit 13571 func (c *ControlMessageIPv6PacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13572 return c.CopyOutN(cc, addr, c.SizeBytes()) 13573 } 13574 13575 // CopyIn implements marshal.Marshallable.CopyIn. 13576 //go:nosplit 13577 func (c *ControlMessageIPv6PacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13578 if !c.Addr.Packed() { 13579 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13580 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 13581 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13582 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13583 // partially unmarshalled struct. 13584 c.UnmarshalBytes(buf) // escapes: fallback. 13585 return length, err 13586 } 13587 13588 // Construct a slice backed by dst's underlying memory. 13589 var buf []byte 13590 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13591 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13592 hdr.Len = c.SizeBytes() 13593 hdr.Cap = c.SizeBytes() 13594 13595 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13596 // Since we bypassed the compiler's escape analysis, indicate that c 13597 // must live until the use above. 13598 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13599 return length, err 13600 } 13601 13602 // WriteTo implements io.WriterTo.WriteTo. 13603 func (c *ControlMessageIPv6PacketInfo) WriteTo(writer io.Writer) (int64, error) { 13604 if !c.Addr.Packed() { 13605 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 13606 buf := make([]byte, c.SizeBytes()) 13607 c.MarshalBytes(buf) 13608 length, err := writer.Write(buf) 13609 return int64(length), err 13610 } 13611 13612 // Construct a slice backed by dst's underlying memory. 13613 var buf []byte 13614 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13615 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 13616 hdr.Len = c.SizeBytes() 13617 hdr.Cap = c.SizeBytes() 13618 13619 length, err := writer.Write(buf) 13620 // Since we bypassed the compiler's escape analysis, indicate that c 13621 // must live until the use above. 13622 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 13623 return int64(length), err 13624 } 13625 13626 // SizeBytes implements marshal.Marshallable.SizeBytes. 13627 //go:nosplit 13628 func (i *Inet6Addr) SizeBytes() int { 13629 return 1 * 16 13630 } 13631 13632 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13633 func (i *Inet6Addr) MarshalBytes(dst []byte) []byte { 13634 for idx := 0; idx < 16; idx++ { 13635 dst[0] = byte(i[idx]) 13636 dst = dst[1:] 13637 } 13638 return dst 13639 } 13640 13641 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13642 func (i *Inet6Addr) UnmarshalBytes(src []byte) []byte { 13643 for idx := 0; idx < 16; idx++ { 13644 i[idx] = src[0] 13645 src = src[1:] 13646 } 13647 return src 13648 } 13649 13650 // Packed implements marshal.Marshallable.Packed. 13651 //go:nosplit 13652 func (i *Inet6Addr) Packed() bool { 13653 // Array newtypes are always packed. 13654 return true 13655 } 13656 13657 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13658 func (i *Inet6Addr) MarshalUnsafe(dst []byte) []byte { 13659 size := i.SizeBytes() 13660 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 13661 return dst[size:] 13662 } 13663 13664 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13665 func (i *Inet6Addr) UnmarshalUnsafe(src []byte) []byte { 13666 size := i.SizeBytes() 13667 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 13668 return src[size:] 13669 } 13670 13671 // CopyOutN implements marshal.Marshallable.CopyOutN. 13672 //go:nosplit 13673 func (i *Inet6Addr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13674 // Construct a slice backed by dst's underlying memory. 13675 var buf []byte 13676 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13677 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13678 hdr.Len = i.SizeBytes() 13679 hdr.Cap = i.SizeBytes() 13680 13681 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13682 // Since we bypassed the compiler's escape analysis, indicate that i 13683 // must live until the use above. 13684 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13685 return length, err 13686 } 13687 13688 // CopyOut implements marshal.Marshallable.CopyOut. 13689 //go:nosplit 13690 func (i *Inet6Addr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13691 return i.CopyOutN(cc, addr, i.SizeBytes()) 13692 } 13693 13694 // CopyIn implements marshal.Marshallable.CopyIn. 13695 //go:nosplit 13696 func (i *Inet6Addr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13697 // Construct a slice backed by dst's underlying memory. 13698 var buf []byte 13699 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13700 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13701 hdr.Len = i.SizeBytes() 13702 hdr.Cap = i.SizeBytes() 13703 13704 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13705 // Since we bypassed the compiler's escape analysis, indicate that i 13706 // must live until the use above. 13707 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13708 return length, err 13709 } 13710 13711 // WriteTo implements io.WriterTo.WriteTo. 13712 func (i *Inet6Addr) WriteTo(writer io.Writer) (int64, error) { 13713 // Construct a slice backed by dst's underlying memory. 13714 var buf []byte 13715 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13716 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13717 hdr.Len = i.SizeBytes() 13718 hdr.Cap = i.SizeBytes() 13719 13720 length, err := writer.Write(buf) 13721 // Since we bypassed the compiler's escape analysis, indicate that i 13722 // must live until the use above. 13723 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13724 return int64(length), err 13725 } 13726 13727 // SizeBytes implements marshal.Marshallable.SizeBytes. 13728 func (i *Inet6MulticastRequest) SizeBytes() int { 13729 return 4 + 13730 (*Inet6Addr)(nil).SizeBytes() 13731 } 13732 13733 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13734 func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) []byte { 13735 dst = i.MulticastAddr.MarshalUnsafe(dst) 13736 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 13737 dst = dst[4:] 13738 return dst 13739 } 13740 13741 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13742 func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) []byte { 13743 src = i.MulticastAddr.UnmarshalUnsafe(src) 13744 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 13745 src = src[4:] 13746 return src 13747 } 13748 13749 // Packed implements marshal.Marshallable.Packed. 13750 //go:nosplit 13751 func (i *Inet6MulticastRequest) Packed() bool { 13752 return i.MulticastAddr.Packed() 13753 } 13754 13755 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13756 func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) []byte { 13757 if i.MulticastAddr.Packed() { 13758 size := i.SizeBytes() 13759 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 13760 return dst[size:] 13761 } 13762 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 13763 return i.MarshalBytes(dst) 13764 } 13765 13766 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13767 func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) []byte { 13768 if i.MulticastAddr.Packed() { 13769 size := i.SizeBytes() 13770 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 13771 return src[size:] 13772 } 13773 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13774 return i.UnmarshalBytes(src) 13775 } 13776 13777 // CopyOutN implements marshal.Marshallable.CopyOutN. 13778 //go:nosplit 13779 func (i *Inet6MulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13780 if !i.MulticastAddr.Packed() { 13781 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 13782 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 13783 i.MarshalBytes(buf) // escapes: fallback. 13784 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13785 } 13786 13787 // Construct a slice backed by dst's underlying memory. 13788 var buf []byte 13789 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13790 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13791 hdr.Len = i.SizeBytes() 13792 hdr.Cap = i.SizeBytes() 13793 13794 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13795 // Since we bypassed the compiler's escape analysis, indicate that i 13796 // must live until the use above. 13797 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13798 return length, err 13799 } 13800 13801 // CopyOut implements marshal.Marshallable.CopyOut. 13802 //go:nosplit 13803 func (i *Inet6MulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13804 return i.CopyOutN(cc, addr, i.SizeBytes()) 13805 } 13806 13807 // CopyIn implements marshal.Marshallable.CopyIn. 13808 //go:nosplit 13809 func (i *Inet6MulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13810 if !i.MulticastAddr.Packed() { 13811 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13812 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 13813 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13814 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13815 // partially unmarshalled struct. 13816 i.UnmarshalBytes(buf) // escapes: fallback. 13817 return length, err 13818 } 13819 13820 // Construct a slice backed by dst's underlying memory. 13821 var buf []byte 13822 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13823 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13824 hdr.Len = i.SizeBytes() 13825 hdr.Cap = i.SizeBytes() 13826 13827 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13828 // Since we bypassed the compiler's escape analysis, indicate that i 13829 // must live until the use above. 13830 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13831 return length, err 13832 } 13833 13834 // WriteTo implements io.WriterTo.WriteTo. 13835 func (i *Inet6MulticastRequest) WriteTo(writer io.Writer) (int64, error) { 13836 if !i.MulticastAddr.Packed() { 13837 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 13838 buf := make([]byte, i.SizeBytes()) 13839 i.MarshalBytes(buf) 13840 length, err := writer.Write(buf) 13841 return int64(length), err 13842 } 13843 13844 // Construct a slice backed by dst's underlying memory. 13845 var buf []byte 13846 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13847 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13848 hdr.Len = i.SizeBytes() 13849 hdr.Cap = i.SizeBytes() 13850 13851 length, err := writer.Write(buf) 13852 // Since we bypassed the compiler's escape analysis, indicate that i 13853 // must live until the use above. 13854 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13855 return int64(length), err 13856 } 13857 13858 // SizeBytes implements marshal.Marshallable.SizeBytes. 13859 //go:nosplit 13860 func (i *InetAddr) SizeBytes() int { 13861 return 1 * 4 13862 } 13863 13864 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13865 func (i *InetAddr) MarshalBytes(dst []byte) []byte { 13866 for idx := 0; idx < 4; idx++ { 13867 dst[0] = byte(i[idx]) 13868 dst = dst[1:] 13869 } 13870 return dst 13871 } 13872 13873 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13874 func (i *InetAddr) UnmarshalBytes(src []byte) []byte { 13875 for idx := 0; idx < 4; idx++ { 13876 i[idx] = src[0] 13877 src = src[1:] 13878 } 13879 return src 13880 } 13881 13882 // Packed implements marshal.Marshallable.Packed. 13883 //go:nosplit 13884 func (i *InetAddr) Packed() bool { 13885 // Array newtypes are always packed. 13886 return true 13887 } 13888 13889 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13890 func (i *InetAddr) MarshalUnsafe(dst []byte) []byte { 13891 size := i.SizeBytes() 13892 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 13893 return dst[size:] 13894 } 13895 13896 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13897 func (i *InetAddr) UnmarshalUnsafe(src []byte) []byte { 13898 size := i.SizeBytes() 13899 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 13900 return src[size:] 13901 } 13902 13903 // CopyOutN implements marshal.Marshallable.CopyOutN. 13904 //go:nosplit 13905 func (i *InetAddr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13906 // Construct a slice backed by dst's underlying memory. 13907 var buf []byte 13908 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13909 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13910 hdr.Len = i.SizeBytes() 13911 hdr.Cap = i.SizeBytes() 13912 13913 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13914 // Since we bypassed the compiler's escape analysis, indicate that i 13915 // must live until the use above. 13916 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13917 return length, err 13918 } 13919 13920 // CopyOut implements marshal.Marshallable.CopyOut. 13921 //go:nosplit 13922 func (i *InetAddr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13923 return i.CopyOutN(cc, addr, i.SizeBytes()) 13924 } 13925 13926 // CopyIn implements marshal.Marshallable.CopyIn. 13927 //go:nosplit 13928 func (i *InetAddr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13929 // Construct a slice backed by dst's underlying memory. 13930 var buf []byte 13931 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13932 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13933 hdr.Len = i.SizeBytes() 13934 hdr.Cap = i.SizeBytes() 13935 13936 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13937 // Since we bypassed the compiler's escape analysis, indicate that i 13938 // must live until the use above. 13939 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13940 return length, err 13941 } 13942 13943 // WriteTo implements io.WriterTo.WriteTo. 13944 func (i *InetAddr) WriteTo(writer io.Writer) (int64, error) { 13945 // Construct a slice backed by dst's underlying memory. 13946 var buf []byte 13947 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13948 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13949 hdr.Len = i.SizeBytes() 13950 hdr.Cap = i.SizeBytes() 13951 13952 length, err := writer.Write(buf) 13953 // Since we bypassed the compiler's escape analysis, indicate that i 13954 // must live until the use above. 13955 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13956 return int64(length), err 13957 } 13958 13959 // SizeBytes implements marshal.Marshallable.SizeBytes. 13960 func (i *InetMulticastRequest) SizeBytes() int { 13961 return 0 + 13962 (*InetAddr)(nil).SizeBytes() + 13963 (*InetAddr)(nil).SizeBytes() 13964 } 13965 13966 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13967 func (i *InetMulticastRequest) MarshalBytes(dst []byte) []byte { 13968 dst = i.MulticastAddr.MarshalUnsafe(dst) 13969 dst = i.InterfaceAddr.MarshalUnsafe(dst) 13970 return dst 13971 } 13972 13973 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13974 func (i *InetMulticastRequest) UnmarshalBytes(src []byte) []byte { 13975 src = i.MulticastAddr.UnmarshalUnsafe(src) 13976 src = i.InterfaceAddr.UnmarshalUnsafe(src) 13977 return src 13978 } 13979 13980 // Packed implements marshal.Marshallable.Packed. 13981 //go:nosplit 13982 func (i *InetMulticastRequest) Packed() bool { 13983 return i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() 13984 } 13985 13986 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13987 func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) []byte { 13988 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 13989 size := i.SizeBytes() 13990 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 13991 return dst[size:] 13992 } 13993 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 13994 return i.MarshalBytes(dst) 13995 } 13996 13997 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13998 func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) []byte { 13999 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 14000 size := i.SizeBytes() 14001 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 14002 return src[size:] 14003 } 14004 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14005 return i.UnmarshalBytes(src) 14006 } 14007 14008 // CopyOutN implements marshal.Marshallable.CopyOutN. 14009 //go:nosplit 14010 func (i *InetMulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14011 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 14012 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 14013 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 14014 i.MarshalBytes(buf) // escapes: fallback. 14015 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14016 } 14017 14018 // Construct a slice backed by dst's underlying memory. 14019 var buf []byte 14020 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14021 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14022 hdr.Len = i.SizeBytes() 14023 hdr.Cap = i.SizeBytes() 14024 14025 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14026 // Since we bypassed the compiler's escape analysis, indicate that i 14027 // must live until the use above. 14028 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14029 return length, err 14030 } 14031 14032 // CopyOut implements marshal.Marshallable.CopyOut. 14033 //go:nosplit 14034 func (i *InetMulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14035 return i.CopyOutN(cc, addr, i.SizeBytes()) 14036 } 14037 14038 // CopyIn implements marshal.Marshallable.CopyIn. 14039 //go:nosplit 14040 func (i *InetMulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14041 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 14042 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14043 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 14044 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14045 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14046 // partially unmarshalled struct. 14047 i.UnmarshalBytes(buf) // escapes: fallback. 14048 return length, err 14049 } 14050 14051 // Construct a slice backed by dst's underlying memory. 14052 var buf []byte 14053 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14054 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14055 hdr.Len = i.SizeBytes() 14056 hdr.Cap = i.SizeBytes() 14057 14058 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14059 // Since we bypassed the compiler's escape analysis, indicate that i 14060 // must live until the use above. 14061 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14062 return length, err 14063 } 14064 14065 // WriteTo implements io.WriterTo.WriteTo. 14066 func (i *InetMulticastRequest) WriteTo(writer io.Writer) (int64, error) { 14067 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 14068 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 14069 buf := make([]byte, i.SizeBytes()) 14070 i.MarshalBytes(buf) 14071 length, err := writer.Write(buf) 14072 return int64(length), err 14073 } 14074 14075 // Construct a slice backed by dst's underlying memory. 14076 var buf []byte 14077 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14078 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14079 hdr.Len = i.SizeBytes() 14080 hdr.Cap = i.SizeBytes() 14081 14082 length, err := writer.Write(buf) 14083 // Since we bypassed the compiler's escape analysis, indicate that i 14084 // must live until the use above. 14085 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14086 return int64(length), err 14087 } 14088 14089 // SizeBytes implements marshal.Marshallable.SizeBytes. 14090 func (i *InetMulticastRequestWithNIC) SizeBytes() int { 14091 return 4 + 14092 (*InetMulticastRequest)(nil).SizeBytes() 14093 } 14094 14095 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14096 func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) []byte { 14097 dst = i.InetMulticastRequest.MarshalUnsafe(dst) 14098 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 14099 dst = dst[4:] 14100 return dst 14101 } 14102 14103 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14104 func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) []byte { 14105 src = i.InetMulticastRequest.UnmarshalUnsafe(src) 14106 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 14107 src = src[4:] 14108 return src 14109 } 14110 14111 // Packed implements marshal.Marshallable.Packed. 14112 //go:nosplit 14113 func (i *InetMulticastRequestWithNIC) Packed() bool { 14114 return i.InetMulticastRequest.Packed() 14115 } 14116 14117 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14118 func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) []byte { 14119 if i.InetMulticastRequest.Packed() { 14120 size := i.SizeBytes() 14121 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 14122 return dst[size:] 14123 } 14124 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes. 14125 return i.MarshalBytes(dst) 14126 } 14127 14128 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14129 func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) []byte { 14130 if i.InetMulticastRequest.Packed() { 14131 size := i.SizeBytes() 14132 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 14133 return src[size:] 14134 } 14135 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14136 return i.UnmarshalBytes(src) 14137 } 14138 14139 // CopyOutN implements marshal.Marshallable.CopyOutN. 14140 //go:nosplit 14141 func (i *InetMulticastRequestWithNIC) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14142 if !i.InetMulticastRequest.Packed() { 14143 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 14144 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 14145 i.MarshalBytes(buf) // escapes: fallback. 14146 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14147 } 14148 14149 // Construct a slice backed by dst's underlying memory. 14150 var buf []byte 14151 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14152 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14153 hdr.Len = i.SizeBytes() 14154 hdr.Cap = i.SizeBytes() 14155 14156 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14157 // Since we bypassed the compiler's escape analysis, indicate that i 14158 // must live until the use above. 14159 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14160 return length, err 14161 } 14162 14163 // CopyOut implements marshal.Marshallable.CopyOut. 14164 //go:nosplit 14165 func (i *InetMulticastRequestWithNIC) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14166 return i.CopyOutN(cc, addr, i.SizeBytes()) 14167 } 14168 14169 // CopyIn implements marshal.Marshallable.CopyIn. 14170 //go:nosplit 14171 func (i *InetMulticastRequestWithNIC) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14172 if !i.InetMulticastRequest.Packed() { 14173 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14174 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 14175 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14176 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14177 // partially unmarshalled struct. 14178 i.UnmarshalBytes(buf) // escapes: fallback. 14179 return length, err 14180 } 14181 14182 // Construct a slice backed by dst's underlying memory. 14183 var buf []byte 14184 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14185 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14186 hdr.Len = i.SizeBytes() 14187 hdr.Cap = i.SizeBytes() 14188 14189 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14190 // Since we bypassed the compiler's escape analysis, indicate that i 14191 // must live until the use above. 14192 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14193 return length, err 14194 } 14195 14196 // WriteTo implements io.WriterTo.WriteTo. 14197 func (i *InetMulticastRequestWithNIC) WriteTo(writer io.Writer) (int64, error) { 14198 if !i.InetMulticastRequest.Packed() { 14199 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 14200 buf := make([]byte, i.SizeBytes()) 14201 i.MarshalBytes(buf) 14202 length, err := writer.Write(buf) 14203 return int64(length), err 14204 } 14205 14206 // Construct a slice backed by dst's underlying memory. 14207 var buf []byte 14208 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14209 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14210 hdr.Len = i.SizeBytes() 14211 hdr.Cap = i.SizeBytes() 14212 14213 length, err := writer.Write(buf) 14214 // Since we bypassed the compiler's escape analysis, indicate that i 14215 // must live until the use above. 14216 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14217 return int64(length), err 14218 } 14219 14220 // SizeBytes implements marshal.Marshallable.SizeBytes. 14221 func (l *Linger) SizeBytes() int { 14222 return 8 14223 } 14224 14225 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14226 func (l *Linger) MarshalBytes(dst []byte) []byte { 14227 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.OnOff)) 14228 dst = dst[4:] 14229 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Linger)) 14230 dst = dst[4:] 14231 return dst 14232 } 14233 14234 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14235 func (l *Linger) UnmarshalBytes(src []byte) []byte { 14236 l.OnOff = int32(hostarch.ByteOrder.Uint32(src[:4])) 14237 src = src[4:] 14238 l.Linger = int32(hostarch.ByteOrder.Uint32(src[:4])) 14239 src = src[4:] 14240 return src 14241 } 14242 14243 // Packed implements marshal.Marshallable.Packed. 14244 //go:nosplit 14245 func (l *Linger) Packed() bool { 14246 return true 14247 } 14248 14249 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14250 func (l *Linger) MarshalUnsafe(dst []byte) []byte { 14251 size := l.SizeBytes() 14252 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 14253 return dst[size:] 14254 } 14255 14256 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14257 func (l *Linger) UnmarshalUnsafe(src []byte) []byte { 14258 size := l.SizeBytes() 14259 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 14260 return src[size:] 14261 } 14262 14263 // CopyOutN implements marshal.Marshallable.CopyOutN. 14264 //go:nosplit 14265 func (l *Linger) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14266 // Construct a slice backed by dst's underlying memory. 14267 var buf []byte 14268 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14269 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 14270 hdr.Len = l.SizeBytes() 14271 hdr.Cap = l.SizeBytes() 14272 14273 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14274 // Since we bypassed the compiler's escape analysis, indicate that l 14275 // must live until the use above. 14276 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 14277 return length, err 14278 } 14279 14280 // CopyOut implements marshal.Marshallable.CopyOut. 14281 //go:nosplit 14282 func (l *Linger) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14283 return l.CopyOutN(cc, addr, l.SizeBytes()) 14284 } 14285 14286 // CopyIn implements marshal.Marshallable.CopyIn. 14287 //go:nosplit 14288 func (l *Linger) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14289 // Construct a slice backed by dst's underlying memory. 14290 var buf []byte 14291 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14292 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 14293 hdr.Len = l.SizeBytes() 14294 hdr.Cap = l.SizeBytes() 14295 14296 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14297 // Since we bypassed the compiler's escape analysis, indicate that l 14298 // must live until the use above. 14299 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 14300 return length, err 14301 } 14302 14303 // WriteTo implements io.WriterTo.WriteTo. 14304 func (l *Linger) WriteTo(writer io.Writer) (int64, error) { 14305 // Construct a slice backed by dst's underlying memory. 14306 var buf []byte 14307 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14308 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 14309 hdr.Len = l.SizeBytes() 14310 hdr.Cap = l.SizeBytes() 14311 14312 length, err := writer.Write(buf) 14313 // Since we bypassed the compiler's escape analysis, indicate that l 14314 // must live until the use above. 14315 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 14316 return int64(length), err 14317 } 14318 14319 // SizeBytes implements marshal.Marshallable.SizeBytes. 14320 func (s *SockAddrInet) SizeBytes() int { 14321 return 4 + 14322 (*InetAddr)(nil).SizeBytes() + 14323 1*8 14324 } 14325 14326 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14327 func (s *SockAddrInet) MarshalBytes(dst []byte) []byte { 14328 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 14329 dst = dst[2:] 14330 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 14331 dst = dst[2:] 14332 dst = s.Addr.MarshalUnsafe(dst) 14333 // Padding: dst[:sizeof(uint8)*8] ~= [8]uint8{0} 14334 dst = dst[1*(8):] 14335 return dst 14336 } 14337 14338 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14339 func (s *SockAddrInet) UnmarshalBytes(src []byte) []byte { 14340 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14341 src = src[2:] 14342 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14343 src = src[2:] 14344 src = s.Addr.UnmarshalUnsafe(src) 14345 // Padding: ~ copy([8]uint8(s._), src[:sizeof(uint8)*8]) 14346 src = src[1*(8):] 14347 return src 14348 } 14349 14350 // Packed implements marshal.Marshallable.Packed. 14351 //go:nosplit 14352 func (s *SockAddrInet) Packed() bool { 14353 return s.Addr.Packed() 14354 } 14355 14356 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14357 func (s *SockAddrInet) MarshalUnsafe(dst []byte) []byte { 14358 if s.Addr.Packed() { 14359 size := s.SizeBytes() 14360 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14361 return dst[size:] 14362 } 14363 // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes. 14364 return s.MarshalBytes(dst) 14365 } 14366 14367 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14368 func (s *SockAddrInet) UnmarshalUnsafe(src []byte) []byte { 14369 if s.Addr.Packed() { 14370 size := s.SizeBytes() 14371 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14372 return src[size:] 14373 } 14374 // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14375 return s.UnmarshalBytes(src) 14376 } 14377 14378 // CopyOutN implements marshal.Marshallable.CopyOutN. 14379 //go:nosplit 14380 func (s *SockAddrInet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14381 if !s.Addr.Packed() { 14382 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 14383 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14384 s.MarshalBytes(buf) // escapes: fallback. 14385 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14386 } 14387 14388 // Construct a slice backed by dst's underlying memory. 14389 var buf []byte 14390 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14391 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14392 hdr.Len = s.SizeBytes() 14393 hdr.Cap = s.SizeBytes() 14394 14395 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14396 // Since we bypassed the compiler's escape analysis, indicate that s 14397 // must live until the use above. 14398 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14399 return length, err 14400 } 14401 14402 // CopyOut implements marshal.Marshallable.CopyOut. 14403 //go:nosplit 14404 func (s *SockAddrInet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14405 return s.CopyOutN(cc, addr, s.SizeBytes()) 14406 } 14407 14408 // CopyIn implements marshal.Marshallable.CopyIn. 14409 //go:nosplit 14410 func (s *SockAddrInet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14411 if !s.Addr.Packed() { 14412 // Type SockAddrInet doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14413 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14414 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14415 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14416 // partially unmarshalled struct. 14417 s.UnmarshalBytes(buf) // escapes: fallback. 14418 return length, err 14419 } 14420 14421 // Construct a slice backed by dst's underlying memory. 14422 var buf []byte 14423 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14424 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14425 hdr.Len = s.SizeBytes() 14426 hdr.Cap = s.SizeBytes() 14427 14428 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14429 // Since we bypassed the compiler's escape analysis, indicate that s 14430 // must live until the use above. 14431 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14432 return length, err 14433 } 14434 14435 // WriteTo implements io.WriterTo.WriteTo. 14436 func (s *SockAddrInet) WriteTo(writer io.Writer) (int64, error) { 14437 if !s.Addr.Packed() { 14438 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 14439 buf := make([]byte, s.SizeBytes()) 14440 s.MarshalBytes(buf) 14441 length, err := writer.Write(buf) 14442 return int64(length), err 14443 } 14444 14445 // Construct a slice backed by dst's underlying memory. 14446 var buf []byte 14447 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14448 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14449 hdr.Len = s.SizeBytes() 14450 hdr.Cap = s.SizeBytes() 14451 14452 length, err := writer.Write(buf) 14453 // Since we bypassed the compiler's escape analysis, indicate that s 14454 // must live until the use above. 14455 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14456 return int64(length), err 14457 } 14458 14459 // SizeBytes implements marshal.Marshallable.SizeBytes. 14460 func (s *SockAddrInet6) SizeBytes() int { 14461 return 12 + 14462 1*16 14463 } 14464 14465 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14466 func (s *SockAddrInet6) MarshalBytes(dst []byte) []byte { 14467 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 14468 dst = dst[2:] 14469 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 14470 dst = dst[2:] 14471 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flowinfo)) 14472 dst = dst[4:] 14473 for idx := 0; idx < 16; idx++ { 14474 dst[0] = byte(s.Addr[idx]) 14475 dst = dst[1:] 14476 } 14477 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Scope_id)) 14478 dst = dst[4:] 14479 return dst 14480 } 14481 14482 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14483 func (s *SockAddrInet6) UnmarshalBytes(src []byte) []byte { 14484 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14485 src = src[2:] 14486 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14487 src = src[2:] 14488 s.Flowinfo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14489 src = src[4:] 14490 for idx := 0; idx < 16; idx++ { 14491 s.Addr[idx] = src[0] 14492 src = src[1:] 14493 } 14494 s.Scope_id = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14495 src = src[4:] 14496 return src 14497 } 14498 14499 // Packed implements marshal.Marshallable.Packed. 14500 //go:nosplit 14501 func (s *SockAddrInet6) Packed() bool { 14502 return true 14503 } 14504 14505 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14506 func (s *SockAddrInet6) MarshalUnsafe(dst []byte) []byte { 14507 size := s.SizeBytes() 14508 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14509 return dst[size:] 14510 } 14511 14512 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14513 func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) []byte { 14514 size := s.SizeBytes() 14515 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14516 return src[size:] 14517 } 14518 14519 // CopyOutN implements marshal.Marshallable.CopyOutN. 14520 //go:nosplit 14521 func (s *SockAddrInet6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14522 // Construct a slice backed by dst's underlying memory. 14523 var buf []byte 14524 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14525 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14526 hdr.Len = s.SizeBytes() 14527 hdr.Cap = s.SizeBytes() 14528 14529 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14530 // Since we bypassed the compiler's escape analysis, indicate that s 14531 // must live until the use above. 14532 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14533 return length, err 14534 } 14535 14536 // CopyOut implements marshal.Marshallable.CopyOut. 14537 //go:nosplit 14538 func (s *SockAddrInet6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14539 return s.CopyOutN(cc, addr, s.SizeBytes()) 14540 } 14541 14542 // CopyIn implements marshal.Marshallable.CopyIn. 14543 //go:nosplit 14544 func (s *SockAddrInet6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14545 // Construct a slice backed by dst's underlying memory. 14546 var buf []byte 14547 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14548 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14549 hdr.Len = s.SizeBytes() 14550 hdr.Cap = s.SizeBytes() 14551 14552 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14553 // Since we bypassed the compiler's escape analysis, indicate that s 14554 // must live until the use above. 14555 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14556 return length, err 14557 } 14558 14559 // WriteTo implements io.WriterTo.WriteTo. 14560 func (s *SockAddrInet6) WriteTo(writer io.Writer) (int64, error) { 14561 // Construct a slice backed by dst's underlying memory. 14562 var buf []byte 14563 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14564 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14565 hdr.Len = s.SizeBytes() 14566 hdr.Cap = s.SizeBytes() 14567 14568 length, err := writer.Write(buf) 14569 // Since we bypassed the compiler's escape analysis, indicate that s 14570 // must live until the use above. 14571 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14572 return int64(length), err 14573 } 14574 14575 // SizeBytes implements marshal.Marshallable.SizeBytes. 14576 func (s *SockAddrLink) SizeBytes() int { 14577 return 12 + 14578 1*8 14579 } 14580 14581 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14582 func (s *SockAddrLink) MarshalBytes(dst []byte) []byte { 14583 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 14584 dst = dst[2:] 14585 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Protocol)) 14586 dst = dst[2:] 14587 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.InterfaceIndex)) 14588 dst = dst[4:] 14589 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.ARPHardwareType)) 14590 dst = dst[2:] 14591 dst[0] = byte(s.PacketType) 14592 dst = dst[1:] 14593 dst[0] = byte(s.HardwareAddrLen) 14594 dst = dst[1:] 14595 for idx := 0; idx < 8; idx++ { 14596 dst[0] = byte(s.HardwareAddr[idx]) 14597 dst = dst[1:] 14598 } 14599 return dst 14600 } 14601 14602 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14603 func (s *SockAddrLink) UnmarshalBytes(src []byte) []byte { 14604 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14605 src = src[2:] 14606 s.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14607 src = src[2:] 14608 s.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 14609 src = src[4:] 14610 s.ARPHardwareType = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14611 src = src[2:] 14612 s.PacketType = src[0] 14613 src = src[1:] 14614 s.HardwareAddrLen = src[0] 14615 src = src[1:] 14616 for idx := 0; idx < 8; idx++ { 14617 s.HardwareAddr[idx] = src[0] 14618 src = src[1:] 14619 } 14620 return src 14621 } 14622 14623 // Packed implements marshal.Marshallable.Packed. 14624 //go:nosplit 14625 func (s *SockAddrLink) Packed() bool { 14626 return true 14627 } 14628 14629 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14630 func (s *SockAddrLink) MarshalUnsafe(dst []byte) []byte { 14631 size := s.SizeBytes() 14632 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14633 return dst[size:] 14634 } 14635 14636 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14637 func (s *SockAddrLink) UnmarshalUnsafe(src []byte) []byte { 14638 size := s.SizeBytes() 14639 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14640 return src[size:] 14641 } 14642 14643 // CopyOutN implements marshal.Marshallable.CopyOutN. 14644 //go:nosplit 14645 func (s *SockAddrLink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14646 // Construct a slice backed by dst's underlying memory. 14647 var buf []byte 14648 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14649 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14650 hdr.Len = s.SizeBytes() 14651 hdr.Cap = s.SizeBytes() 14652 14653 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14654 // Since we bypassed the compiler's escape analysis, indicate that s 14655 // must live until the use above. 14656 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14657 return length, err 14658 } 14659 14660 // CopyOut implements marshal.Marshallable.CopyOut. 14661 //go:nosplit 14662 func (s *SockAddrLink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14663 return s.CopyOutN(cc, addr, s.SizeBytes()) 14664 } 14665 14666 // CopyIn implements marshal.Marshallable.CopyIn. 14667 //go:nosplit 14668 func (s *SockAddrLink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14669 // Construct a slice backed by dst's underlying memory. 14670 var buf []byte 14671 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14672 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14673 hdr.Len = s.SizeBytes() 14674 hdr.Cap = s.SizeBytes() 14675 14676 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14677 // Since we bypassed the compiler's escape analysis, indicate that s 14678 // must live until the use above. 14679 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14680 return length, err 14681 } 14682 14683 // WriteTo implements io.WriterTo.WriteTo. 14684 func (s *SockAddrLink) WriteTo(writer io.Writer) (int64, error) { 14685 // Construct a slice backed by dst's underlying memory. 14686 var buf []byte 14687 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14688 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14689 hdr.Len = s.SizeBytes() 14690 hdr.Cap = s.SizeBytes() 14691 14692 length, err := writer.Write(buf) 14693 // Since we bypassed the compiler's escape analysis, indicate that s 14694 // must live until the use above. 14695 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14696 return int64(length), err 14697 } 14698 14699 // SizeBytes implements marshal.Marshallable.SizeBytes. 14700 func (s *SockAddrUnix) SizeBytes() int { 14701 return 2 + 14702 1*UnixPathMax 14703 } 14704 14705 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14706 func (s *SockAddrUnix) MarshalBytes(dst []byte) []byte { 14707 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 14708 dst = dst[2:] 14709 for idx := 0; idx < UnixPathMax; idx++ { 14710 dst[0] = byte(s.Path[idx]) 14711 dst = dst[1:] 14712 } 14713 return dst 14714 } 14715 14716 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14717 func (s *SockAddrUnix) UnmarshalBytes(src []byte) []byte { 14718 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14719 src = src[2:] 14720 for idx := 0; idx < UnixPathMax; idx++ { 14721 s.Path[idx] = int8(src[0]) 14722 src = src[1:] 14723 } 14724 return src 14725 } 14726 14727 // Packed implements marshal.Marshallable.Packed. 14728 //go:nosplit 14729 func (s *SockAddrUnix) Packed() bool { 14730 return true 14731 } 14732 14733 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14734 func (s *SockAddrUnix) MarshalUnsafe(dst []byte) []byte { 14735 size := s.SizeBytes() 14736 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14737 return dst[size:] 14738 } 14739 14740 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14741 func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) []byte { 14742 size := s.SizeBytes() 14743 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14744 return src[size:] 14745 } 14746 14747 // CopyOutN implements marshal.Marshallable.CopyOutN. 14748 //go:nosplit 14749 func (s *SockAddrUnix) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14750 // Construct a slice backed by dst's underlying memory. 14751 var buf []byte 14752 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14753 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14754 hdr.Len = s.SizeBytes() 14755 hdr.Cap = s.SizeBytes() 14756 14757 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14758 // Since we bypassed the compiler's escape analysis, indicate that s 14759 // must live until the use above. 14760 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14761 return length, err 14762 } 14763 14764 // CopyOut implements marshal.Marshallable.CopyOut. 14765 //go:nosplit 14766 func (s *SockAddrUnix) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14767 return s.CopyOutN(cc, addr, s.SizeBytes()) 14768 } 14769 14770 // CopyIn implements marshal.Marshallable.CopyIn. 14771 //go:nosplit 14772 func (s *SockAddrUnix) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14773 // Construct a slice backed by dst's underlying memory. 14774 var buf []byte 14775 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14776 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14777 hdr.Len = s.SizeBytes() 14778 hdr.Cap = s.SizeBytes() 14779 14780 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14781 // Since we bypassed the compiler's escape analysis, indicate that s 14782 // must live until the use above. 14783 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14784 return length, err 14785 } 14786 14787 // WriteTo implements io.WriterTo.WriteTo. 14788 func (s *SockAddrUnix) WriteTo(writer io.Writer) (int64, error) { 14789 // Construct a slice backed by dst's underlying memory. 14790 var buf []byte 14791 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14792 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14793 hdr.Len = s.SizeBytes() 14794 hdr.Cap = s.SizeBytes() 14795 14796 length, err := writer.Write(buf) 14797 // Since we bypassed the compiler's escape analysis, indicate that s 14798 // must live until the use above. 14799 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14800 return int64(length), err 14801 } 14802 14803 // SizeBytes implements marshal.Marshallable.SizeBytes. 14804 func (t *TCPInfo) SizeBytes() int { 14805 return 224 14806 } 14807 14808 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14809 func (t *TCPInfo) MarshalBytes(dst []byte) []byte { 14810 dst[0] = byte(t.State) 14811 dst = dst[1:] 14812 dst[0] = byte(t.CaState) 14813 dst = dst[1:] 14814 dst[0] = byte(t.Retransmits) 14815 dst = dst[1:] 14816 dst[0] = byte(t.Probes) 14817 dst = dst[1:] 14818 dst[0] = byte(t.Backoff) 14819 dst = dst[1:] 14820 dst[0] = byte(t.Options) 14821 dst = dst[1:] 14822 dst[0] = byte(t.WindowScale) 14823 dst = dst[1:] 14824 dst[0] = byte(t.DeliveryRateAppLimited) 14825 dst = dst[1:] 14826 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTO)) 14827 dst = dst[4:] 14828 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ATO)) 14829 dst = dst[4:] 14830 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndMss)) 14831 dst = dst[4:] 14832 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvMss)) 14833 dst = dst[4:] 14834 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Unacked)) 14835 dst = dst[4:] 14836 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Sacked)) 14837 dst = dst[4:] 14838 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Lost)) 14839 dst = dst[4:] 14840 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Retrans)) 14841 dst = dst[4:] 14842 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Fackets)) 14843 dst = dst[4:] 14844 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataSent)) 14845 dst = dst[4:] 14846 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckSent)) 14847 dst = dst[4:] 14848 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataRecv)) 14849 dst = dst[4:] 14850 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckRecv)) 14851 dst = dst[4:] 14852 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.PMTU)) 14853 dst = dst[4:] 14854 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSsthresh)) 14855 dst = dst[4:] 14856 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTT)) 14857 dst = dst[4:] 14858 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTTVar)) 14859 dst = dst[4:] 14860 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndSsthresh)) 14861 dst = dst[4:] 14862 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndCwnd)) 14863 dst = dst[4:] 14864 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Advmss)) 14865 dst = dst[4:] 14866 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Reordering)) 14867 dst = dst[4:] 14868 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvRTT)) 14869 dst = dst[4:] 14870 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSpace)) 14871 dst = dst[4:] 14872 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.TotalRetrans)) 14873 dst = dst[4:] 14874 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.PacingRate)) 14875 dst = dst[8:] 14876 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.MaxPacingRate)) 14877 dst = dst[8:] 14878 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesAcked)) 14879 dst = dst[8:] 14880 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesReceived)) 14881 dst = dst[8:] 14882 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsOut)) 14883 dst = dst[4:] 14884 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsIn)) 14885 dst = dst[4:] 14886 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.NotSentBytes)) 14887 dst = dst[4:] 14888 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.MinRTT)) 14889 dst = dst[4:] 14890 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsIn)) 14891 dst = dst[4:] 14892 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsOut)) 14893 dst = dst[4:] 14894 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.DeliveryRate)) 14895 dst = dst[8:] 14896 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BusyTime)) 14897 dst = dst[8:] 14898 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.RwndLimited)) 14899 dst = dst[8:] 14900 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.SndBufLimited)) 14901 dst = dst[8:] 14902 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Delivered)) 14903 dst = dst[4:] 14904 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DeliveredCE)) 14905 dst = dst[4:] 14906 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesSent)) 14907 dst = dst[8:] 14908 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesRetrans)) 14909 dst = dst[8:] 14910 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DSACKDups)) 14911 dst = dst[4:] 14912 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ReordSeen)) 14913 dst = dst[4:] 14914 return dst 14915 } 14916 14917 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14918 func (t *TCPInfo) UnmarshalBytes(src []byte) []byte { 14919 t.State = uint8(src[0]) 14920 src = src[1:] 14921 t.CaState = uint8(src[0]) 14922 src = src[1:] 14923 t.Retransmits = uint8(src[0]) 14924 src = src[1:] 14925 t.Probes = uint8(src[0]) 14926 src = src[1:] 14927 t.Backoff = uint8(src[0]) 14928 src = src[1:] 14929 t.Options = uint8(src[0]) 14930 src = src[1:] 14931 t.WindowScale = uint8(src[0]) 14932 src = src[1:] 14933 t.DeliveryRateAppLimited = uint8(src[0]) 14934 src = src[1:] 14935 t.RTO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14936 src = src[4:] 14937 t.ATO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14938 src = src[4:] 14939 t.SndMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14940 src = src[4:] 14941 t.RcvMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14942 src = src[4:] 14943 t.Unacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14944 src = src[4:] 14945 t.Sacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14946 src = src[4:] 14947 t.Lost = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14948 src = src[4:] 14949 t.Retrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14950 src = src[4:] 14951 t.Fackets = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14952 src = src[4:] 14953 t.LastDataSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14954 src = src[4:] 14955 t.LastAckSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14956 src = src[4:] 14957 t.LastDataRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14958 src = src[4:] 14959 t.LastAckRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14960 src = src[4:] 14961 t.PMTU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14962 src = src[4:] 14963 t.RcvSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14964 src = src[4:] 14965 t.RTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14966 src = src[4:] 14967 t.RTTVar = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14968 src = src[4:] 14969 t.SndSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14970 src = src[4:] 14971 t.SndCwnd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14972 src = src[4:] 14973 t.Advmss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14974 src = src[4:] 14975 t.Reordering = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14976 src = src[4:] 14977 t.RcvRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14978 src = src[4:] 14979 t.RcvSpace = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14980 src = src[4:] 14981 t.TotalRetrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14982 src = src[4:] 14983 t.PacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14984 src = src[8:] 14985 t.MaxPacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14986 src = src[8:] 14987 t.BytesAcked = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14988 src = src[8:] 14989 t.BytesReceived = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14990 src = src[8:] 14991 t.SegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14992 src = src[4:] 14993 t.SegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14994 src = src[4:] 14995 t.NotSentBytes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14996 src = src[4:] 14997 t.MinRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14998 src = src[4:] 14999 t.DataSegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15000 src = src[4:] 15001 t.DataSegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15002 src = src[4:] 15003 t.DeliveryRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15004 src = src[8:] 15005 t.BusyTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15006 src = src[8:] 15007 t.RwndLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15008 src = src[8:] 15009 t.SndBufLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15010 src = src[8:] 15011 t.Delivered = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15012 src = src[4:] 15013 t.DeliveredCE = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15014 src = src[4:] 15015 t.BytesSent = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15016 src = src[8:] 15017 t.BytesRetrans = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15018 src = src[8:] 15019 t.DSACKDups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15020 src = src[4:] 15021 t.ReordSeen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15022 src = src[4:] 15023 return src 15024 } 15025 15026 // Packed implements marshal.Marshallable.Packed. 15027 //go:nosplit 15028 func (t *TCPInfo) Packed() bool { 15029 return true 15030 } 15031 15032 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15033 func (t *TCPInfo) MarshalUnsafe(dst []byte) []byte { 15034 size := t.SizeBytes() 15035 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 15036 return dst[size:] 15037 } 15038 15039 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15040 func (t *TCPInfo) UnmarshalUnsafe(src []byte) []byte { 15041 size := t.SizeBytes() 15042 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 15043 return src[size:] 15044 } 15045 15046 // CopyOutN implements marshal.Marshallable.CopyOutN. 15047 //go:nosplit 15048 func (t *TCPInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15049 // Construct a slice backed by dst's underlying memory. 15050 var buf []byte 15051 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15052 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15053 hdr.Len = t.SizeBytes() 15054 hdr.Cap = t.SizeBytes() 15055 15056 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15057 // Since we bypassed the compiler's escape analysis, indicate that t 15058 // must live until the use above. 15059 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15060 return length, err 15061 } 15062 15063 // CopyOut implements marshal.Marshallable.CopyOut. 15064 //go:nosplit 15065 func (t *TCPInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15066 return t.CopyOutN(cc, addr, t.SizeBytes()) 15067 } 15068 15069 // CopyIn implements marshal.Marshallable.CopyIn. 15070 //go:nosplit 15071 func (t *TCPInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15072 // Construct a slice backed by dst's underlying memory. 15073 var buf []byte 15074 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15075 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15076 hdr.Len = t.SizeBytes() 15077 hdr.Cap = t.SizeBytes() 15078 15079 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15080 // Since we bypassed the compiler's escape analysis, indicate that t 15081 // must live until the use above. 15082 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15083 return length, err 15084 } 15085 15086 // WriteTo implements io.WriterTo.WriteTo. 15087 func (t *TCPInfo) WriteTo(writer io.Writer) (int64, error) { 15088 // Construct a slice backed by dst's underlying memory. 15089 var buf []byte 15090 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15091 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15092 hdr.Len = t.SizeBytes() 15093 hdr.Cap = t.SizeBytes() 15094 15095 length, err := writer.Write(buf) 15096 // Since we bypassed the compiler's escape analysis, indicate that t 15097 // must live until the use above. 15098 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15099 return int64(length), err 15100 } 15101 15102 // SizeBytes implements marshal.Marshallable.SizeBytes. 15103 //go:nosplit 15104 func (c *ClockT) SizeBytes() int { 15105 return 8 15106 } 15107 15108 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15109 func (c *ClockT) MarshalBytes(dst []byte) []byte { 15110 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*c)) 15111 return dst[8:] 15112 } 15113 15114 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15115 func (c *ClockT) UnmarshalBytes(src []byte) []byte { 15116 *c = ClockT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 15117 return src[8:] 15118 } 15119 15120 // Packed implements marshal.Marshallable.Packed. 15121 //go:nosplit 15122 func (c *ClockT) Packed() bool { 15123 // Scalar newtypes are always packed. 15124 return true 15125 } 15126 15127 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15128 func (c *ClockT) MarshalUnsafe(dst []byte) []byte { 15129 size := c.SizeBytes() 15130 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15131 return dst[size:] 15132 } 15133 15134 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15135 func (c *ClockT) UnmarshalUnsafe(src []byte) []byte { 15136 size := c.SizeBytes() 15137 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15138 return src[size:] 15139 } 15140 15141 // CopyOutN implements marshal.Marshallable.CopyOutN. 15142 //go:nosplit 15143 func (c *ClockT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15144 // Construct a slice backed by dst's underlying memory. 15145 var buf []byte 15146 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15147 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15148 hdr.Len = c.SizeBytes() 15149 hdr.Cap = c.SizeBytes() 15150 15151 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15152 // Since we bypassed the compiler's escape analysis, indicate that c 15153 // must live until the use above. 15154 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15155 return length, err 15156 } 15157 15158 // CopyOut implements marshal.Marshallable.CopyOut. 15159 //go:nosplit 15160 func (c *ClockT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15161 return c.CopyOutN(cc, addr, c.SizeBytes()) 15162 } 15163 15164 // CopyIn implements marshal.Marshallable.CopyIn. 15165 //go:nosplit 15166 func (c *ClockT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15167 // Construct a slice backed by dst's underlying memory. 15168 var buf []byte 15169 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15170 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15171 hdr.Len = c.SizeBytes() 15172 hdr.Cap = c.SizeBytes() 15173 15174 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15175 // Since we bypassed the compiler's escape analysis, indicate that c 15176 // must live until the use above. 15177 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15178 return length, err 15179 } 15180 15181 // WriteTo implements io.WriterTo.WriteTo. 15182 func (c *ClockT) WriteTo(writer io.Writer) (int64, error) { 15183 // Construct a slice backed by dst's underlying memory. 15184 var buf []byte 15185 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15186 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15187 hdr.Len = c.SizeBytes() 15188 hdr.Cap = c.SizeBytes() 15189 15190 length, err := writer.Write(buf) 15191 // Since we bypassed the compiler's escape analysis, indicate that c 15192 // must live until the use above. 15193 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15194 return int64(length), err 15195 } 15196 15197 // SizeBytes implements marshal.Marshallable.SizeBytes. 15198 func (i *ItimerVal) SizeBytes() int { 15199 return 0 + 15200 (*Timeval)(nil).SizeBytes() + 15201 (*Timeval)(nil).SizeBytes() 15202 } 15203 15204 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15205 func (i *ItimerVal) MarshalBytes(dst []byte) []byte { 15206 dst = i.Interval.MarshalUnsafe(dst) 15207 dst = i.Value.MarshalUnsafe(dst) 15208 return dst 15209 } 15210 15211 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15212 func (i *ItimerVal) UnmarshalBytes(src []byte) []byte { 15213 src = i.Interval.UnmarshalUnsafe(src) 15214 src = i.Value.UnmarshalUnsafe(src) 15215 return src 15216 } 15217 15218 // Packed implements marshal.Marshallable.Packed. 15219 //go:nosplit 15220 func (i *ItimerVal) Packed() bool { 15221 return i.Interval.Packed() && i.Value.Packed() 15222 } 15223 15224 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15225 func (i *ItimerVal) MarshalUnsafe(dst []byte) []byte { 15226 if i.Interval.Packed() && i.Value.Packed() { 15227 size := i.SizeBytes() 15228 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15229 return dst[size:] 15230 } 15231 // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes. 15232 return i.MarshalBytes(dst) 15233 } 15234 15235 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15236 func (i *ItimerVal) UnmarshalUnsafe(src []byte) []byte { 15237 if i.Interval.Packed() && i.Value.Packed() { 15238 size := i.SizeBytes() 15239 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15240 return src[size:] 15241 } 15242 // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15243 return i.UnmarshalBytes(src) 15244 } 15245 15246 // CopyOutN implements marshal.Marshallable.CopyOutN. 15247 //go:nosplit 15248 func (i *ItimerVal) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15249 if !i.Interval.Packed() && i.Value.Packed() { 15250 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 15251 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15252 i.MarshalBytes(buf) // escapes: fallback. 15253 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15254 } 15255 15256 // Construct a slice backed by dst's underlying memory. 15257 var buf []byte 15258 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15259 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15260 hdr.Len = i.SizeBytes() 15261 hdr.Cap = i.SizeBytes() 15262 15263 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15264 // Since we bypassed the compiler's escape analysis, indicate that i 15265 // must live until the use above. 15266 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15267 return length, err 15268 } 15269 15270 // CopyOut implements marshal.Marshallable.CopyOut. 15271 //go:nosplit 15272 func (i *ItimerVal) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15273 return i.CopyOutN(cc, addr, i.SizeBytes()) 15274 } 15275 15276 // CopyIn implements marshal.Marshallable.CopyIn. 15277 //go:nosplit 15278 func (i *ItimerVal) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15279 if !i.Interval.Packed() && i.Value.Packed() { 15280 // Type ItimerVal doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15281 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15282 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15283 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15284 // partially unmarshalled struct. 15285 i.UnmarshalBytes(buf) // escapes: fallback. 15286 return length, err 15287 } 15288 15289 // Construct a slice backed by dst's underlying memory. 15290 var buf []byte 15291 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15292 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15293 hdr.Len = i.SizeBytes() 15294 hdr.Cap = i.SizeBytes() 15295 15296 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15297 // Since we bypassed the compiler's escape analysis, indicate that i 15298 // must live until the use above. 15299 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15300 return length, err 15301 } 15302 15303 // WriteTo implements io.WriterTo.WriteTo. 15304 func (i *ItimerVal) WriteTo(writer io.Writer) (int64, error) { 15305 if !i.Interval.Packed() && i.Value.Packed() { 15306 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 15307 buf := make([]byte, i.SizeBytes()) 15308 i.MarshalBytes(buf) 15309 length, err := writer.Write(buf) 15310 return int64(length), err 15311 } 15312 15313 // Construct a slice backed by dst's underlying memory. 15314 var buf []byte 15315 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15316 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15317 hdr.Len = i.SizeBytes() 15318 hdr.Cap = i.SizeBytes() 15319 15320 length, err := writer.Write(buf) 15321 // Since we bypassed the compiler's escape analysis, indicate that i 15322 // must live until the use above. 15323 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15324 return int64(length), err 15325 } 15326 15327 // SizeBytes implements marshal.Marshallable.SizeBytes. 15328 func (i *Itimerspec) SizeBytes() int { 15329 return 0 + 15330 (*Timespec)(nil).SizeBytes() + 15331 (*Timespec)(nil).SizeBytes() 15332 } 15333 15334 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15335 func (i *Itimerspec) MarshalBytes(dst []byte) []byte { 15336 dst = i.Interval.MarshalUnsafe(dst) 15337 dst = i.Value.MarshalUnsafe(dst) 15338 return dst 15339 } 15340 15341 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15342 func (i *Itimerspec) UnmarshalBytes(src []byte) []byte { 15343 src = i.Interval.UnmarshalUnsafe(src) 15344 src = i.Value.UnmarshalUnsafe(src) 15345 return src 15346 } 15347 15348 // Packed implements marshal.Marshallable.Packed. 15349 //go:nosplit 15350 func (i *Itimerspec) Packed() bool { 15351 return i.Interval.Packed() && i.Value.Packed() 15352 } 15353 15354 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15355 func (i *Itimerspec) MarshalUnsafe(dst []byte) []byte { 15356 if i.Interval.Packed() && i.Value.Packed() { 15357 size := i.SizeBytes() 15358 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15359 return dst[size:] 15360 } 15361 // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes. 15362 return i.MarshalBytes(dst) 15363 } 15364 15365 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15366 func (i *Itimerspec) UnmarshalUnsafe(src []byte) []byte { 15367 if i.Interval.Packed() && i.Value.Packed() { 15368 size := i.SizeBytes() 15369 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15370 return src[size:] 15371 } 15372 // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15373 return i.UnmarshalBytes(src) 15374 } 15375 15376 // CopyOutN implements marshal.Marshallable.CopyOutN. 15377 //go:nosplit 15378 func (i *Itimerspec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15379 if !i.Interval.Packed() && i.Value.Packed() { 15380 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 15381 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15382 i.MarshalBytes(buf) // escapes: fallback. 15383 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15384 } 15385 15386 // Construct a slice backed by dst's underlying memory. 15387 var buf []byte 15388 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15389 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15390 hdr.Len = i.SizeBytes() 15391 hdr.Cap = i.SizeBytes() 15392 15393 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15394 // Since we bypassed the compiler's escape analysis, indicate that i 15395 // must live until the use above. 15396 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15397 return length, err 15398 } 15399 15400 // CopyOut implements marshal.Marshallable.CopyOut. 15401 //go:nosplit 15402 func (i *Itimerspec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15403 return i.CopyOutN(cc, addr, i.SizeBytes()) 15404 } 15405 15406 // CopyIn implements marshal.Marshallable.CopyIn. 15407 //go:nosplit 15408 func (i *Itimerspec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15409 if !i.Interval.Packed() && i.Value.Packed() { 15410 // Type Itimerspec doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15411 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15412 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15413 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15414 // partially unmarshalled struct. 15415 i.UnmarshalBytes(buf) // escapes: fallback. 15416 return length, err 15417 } 15418 15419 // Construct a slice backed by dst's underlying memory. 15420 var buf []byte 15421 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15422 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15423 hdr.Len = i.SizeBytes() 15424 hdr.Cap = i.SizeBytes() 15425 15426 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15427 // Since we bypassed the compiler's escape analysis, indicate that i 15428 // must live until the use above. 15429 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15430 return length, err 15431 } 15432 15433 // WriteTo implements io.WriterTo.WriteTo. 15434 func (i *Itimerspec) WriteTo(writer io.Writer) (int64, error) { 15435 if !i.Interval.Packed() && i.Value.Packed() { 15436 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 15437 buf := make([]byte, i.SizeBytes()) 15438 i.MarshalBytes(buf) 15439 length, err := writer.Write(buf) 15440 return int64(length), err 15441 } 15442 15443 // Construct a slice backed by dst's underlying memory. 15444 var buf []byte 15445 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15446 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15447 hdr.Len = i.SizeBytes() 15448 hdr.Cap = i.SizeBytes() 15449 15450 length, err := writer.Write(buf) 15451 // Since we bypassed the compiler's escape analysis, indicate that i 15452 // must live until the use above. 15453 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15454 return int64(length), err 15455 } 15456 15457 // SizeBytes implements marshal.Marshallable.SizeBytes. 15458 func (sxts *StatxTimestamp) SizeBytes() int { 15459 return 16 15460 } 15461 15462 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15463 func (sxts *StatxTimestamp) MarshalBytes(dst []byte) []byte { 15464 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sxts.Sec)) 15465 dst = dst[8:] 15466 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sxts.Nsec)) 15467 dst = dst[4:] 15468 // Padding: dst[:sizeof(int32)] ~= int32(0) 15469 dst = dst[4:] 15470 return dst 15471 } 15472 15473 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15474 func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) []byte { 15475 sxts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 15476 src = src[8:] 15477 sxts.Nsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15478 src = src[4:] 15479 // Padding: var _ int32 ~= src[:sizeof(int32)] 15480 src = src[4:] 15481 return src 15482 } 15483 15484 // Packed implements marshal.Marshallable.Packed. 15485 //go:nosplit 15486 func (sxts *StatxTimestamp) Packed() bool { 15487 return true 15488 } 15489 15490 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15491 func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) []byte { 15492 size := sxts.SizeBytes() 15493 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(size)) 15494 return dst[size:] 15495 } 15496 15497 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15498 func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) []byte { 15499 size := sxts.SizeBytes() 15500 gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(size)) 15501 return src[size:] 15502 } 15503 15504 // CopyOutN implements marshal.Marshallable.CopyOutN. 15505 //go:nosplit 15506 func (sxts *StatxTimestamp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15507 // Construct a slice backed by dst's underlying memory. 15508 var buf []byte 15509 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15510 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 15511 hdr.Len = sxts.SizeBytes() 15512 hdr.Cap = sxts.SizeBytes() 15513 15514 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15515 // Since we bypassed the compiler's escape analysis, indicate that sxts 15516 // must live until the use above. 15517 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 15518 return length, err 15519 } 15520 15521 // CopyOut implements marshal.Marshallable.CopyOut. 15522 //go:nosplit 15523 func (sxts *StatxTimestamp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15524 return sxts.CopyOutN(cc, addr, sxts.SizeBytes()) 15525 } 15526 15527 // CopyIn implements marshal.Marshallable.CopyIn. 15528 //go:nosplit 15529 func (sxts *StatxTimestamp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15530 // Construct a slice backed by dst's underlying memory. 15531 var buf []byte 15532 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15533 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 15534 hdr.Len = sxts.SizeBytes() 15535 hdr.Cap = sxts.SizeBytes() 15536 15537 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15538 // Since we bypassed the compiler's escape analysis, indicate that sxts 15539 // must live until the use above. 15540 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 15541 return length, err 15542 } 15543 15544 // WriteTo implements io.WriterTo.WriteTo. 15545 func (sxts *StatxTimestamp) WriteTo(writer io.Writer) (int64, error) { 15546 // Construct a slice backed by dst's underlying memory. 15547 var buf []byte 15548 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15549 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 15550 hdr.Len = sxts.SizeBytes() 15551 hdr.Cap = sxts.SizeBytes() 15552 15553 length, err := writer.Write(buf) 15554 // Since we bypassed the compiler's escape analysis, indicate that sxts 15555 // must live until the use above. 15556 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 15557 return int64(length), err 15558 } 15559 15560 // SizeBytes implements marshal.Marshallable.SizeBytes. 15561 //go:nosplit 15562 func (t *TimeT) SizeBytes() int { 15563 return 8 15564 } 15565 15566 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15567 func (t *TimeT) MarshalBytes(dst []byte) []byte { 15568 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*t)) 15569 return dst[8:] 15570 } 15571 15572 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15573 func (t *TimeT) UnmarshalBytes(src []byte) []byte { 15574 *t = TimeT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 15575 return src[8:] 15576 } 15577 15578 // Packed implements marshal.Marshallable.Packed. 15579 //go:nosplit 15580 func (t *TimeT) Packed() bool { 15581 // Scalar newtypes are always packed. 15582 return true 15583 } 15584 15585 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15586 func (t *TimeT) MarshalUnsafe(dst []byte) []byte { 15587 size := t.SizeBytes() 15588 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 15589 return dst[size:] 15590 } 15591 15592 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15593 func (t *TimeT) UnmarshalUnsafe(src []byte) []byte { 15594 size := t.SizeBytes() 15595 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 15596 return src[size:] 15597 } 15598 15599 // CopyOutN implements marshal.Marshallable.CopyOutN. 15600 //go:nosplit 15601 func (t *TimeT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15602 // Construct a slice backed by dst's underlying memory. 15603 var buf []byte 15604 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15605 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15606 hdr.Len = t.SizeBytes() 15607 hdr.Cap = t.SizeBytes() 15608 15609 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15610 // Since we bypassed the compiler's escape analysis, indicate that t 15611 // must live until the use above. 15612 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15613 return length, err 15614 } 15615 15616 // CopyOut implements marshal.Marshallable.CopyOut. 15617 //go:nosplit 15618 func (t *TimeT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15619 return t.CopyOutN(cc, addr, t.SizeBytes()) 15620 } 15621 15622 // CopyIn implements marshal.Marshallable.CopyIn. 15623 //go:nosplit 15624 func (t *TimeT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15625 // Construct a slice backed by dst's underlying memory. 15626 var buf []byte 15627 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15628 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15629 hdr.Len = t.SizeBytes() 15630 hdr.Cap = t.SizeBytes() 15631 15632 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15633 // Since we bypassed the compiler's escape analysis, indicate that t 15634 // must live until the use above. 15635 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15636 return length, err 15637 } 15638 15639 // WriteTo implements io.WriterTo.WriteTo. 15640 func (t *TimeT) WriteTo(writer io.Writer) (int64, error) { 15641 // Construct a slice backed by dst's underlying memory. 15642 var buf []byte 15643 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15644 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15645 hdr.Len = t.SizeBytes() 15646 hdr.Cap = t.SizeBytes() 15647 15648 length, err := writer.Write(buf) 15649 // Since we bypassed the compiler's escape analysis, indicate that t 15650 // must live until the use above. 15651 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15652 return int64(length), err 15653 } 15654 15655 // SizeBytes implements marshal.Marshallable.SizeBytes. 15656 //go:nosplit 15657 func (t *TimerID) SizeBytes() int { 15658 return 4 15659 } 15660 15661 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15662 func (t *TimerID) MarshalBytes(dst []byte) []byte { 15663 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*t)) 15664 return dst[4:] 15665 } 15666 15667 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15668 func (t *TimerID) UnmarshalBytes(src []byte) []byte { 15669 *t = TimerID(int32(hostarch.ByteOrder.Uint32(src[:4]))) 15670 return src[4:] 15671 } 15672 15673 // Packed implements marshal.Marshallable.Packed. 15674 //go:nosplit 15675 func (t *TimerID) Packed() bool { 15676 // Scalar newtypes are always packed. 15677 return true 15678 } 15679 15680 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15681 func (t *TimerID) MarshalUnsafe(dst []byte) []byte { 15682 size := t.SizeBytes() 15683 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 15684 return dst[size:] 15685 } 15686 15687 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15688 func (t *TimerID) UnmarshalUnsafe(src []byte) []byte { 15689 size := t.SizeBytes() 15690 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 15691 return src[size:] 15692 } 15693 15694 // CopyOutN implements marshal.Marshallable.CopyOutN. 15695 //go:nosplit 15696 func (t *TimerID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15697 // Construct a slice backed by dst's underlying memory. 15698 var buf []byte 15699 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15700 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15701 hdr.Len = t.SizeBytes() 15702 hdr.Cap = t.SizeBytes() 15703 15704 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15705 // Since we bypassed the compiler's escape analysis, indicate that t 15706 // must live until the use above. 15707 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15708 return length, err 15709 } 15710 15711 // CopyOut implements marshal.Marshallable.CopyOut. 15712 //go:nosplit 15713 func (t *TimerID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15714 return t.CopyOutN(cc, addr, t.SizeBytes()) 15715 } 15716 15717 // CopyIn implements marshal.Marshallable.CopyIn. 15718 //go:nosplit 15719 func (t *TimerID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15720 // Construct a slice backed by dst's underlying memory. 15721 var buf []byte 15722 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15723 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15724 hdr.Len = t.SizeBytes() 15725 hdr.Cap = t.SizeBytes() 15726 15727 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15728 // Since we bypassed the compiler's escape analysis, indicate that t 15729 // must live until the use above. 15730 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15731 return length, err 15732 } 15733 15734 // WriteTo implements io.WriterTo.WriteTo. 15735 func (t *TimerID) WriteTo(writer io.Writer) (int64, error) { 15736 // Construct a slice backed by dst's underlying memory. 15737 var buf []byte 15738 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15739 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 15740 hdr.Len = t.SizeBytes() 15741 hdr.Cap = t.SizeBytes() 15742 15743 length, err := writer.Write(buf) 15744 // Since we bypassed the compiler's escape analysis, indicate that t 15745 // must live until the use above. 15746 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 15747 return int64(length), err 15748 } 15749 15750 // SizeBytes implements marshal.Marshallable.SizeBytes. 15751 func (ts *Timespec) SizeBytes() int { 15752 return 16 15753 } 15754 15755 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15756 func (ts *Timespec) MarshalBytes(dst []byte) []byte { 15757 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Sec)) 15758 dst = dst[8:] 15759 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Nsec)) 15760 dst = dst[8:] 15761 return dst 15762 } 15763 15764 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15765 func (ts *Timespec) UnmarshalBytes(src []byte) []byte { 15766 ts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 15767 src = src[8:] 15768 ts.Nsec = int64(hostarch.ByteOrder.Uint64(src[:8])) 15769 src = src[8:] 15770 return src 15771 } 15772 15773 // Packed implements marshal.Marshallable.Packed. 15774 //go:nosplit 15775 func (ts *Timespec) Packed() bool { 15776 return true 15777 } 15778 15779 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15780 func (ts *Timespec) MarshalUnsafe(dst []byte) []byte { 15781 size := ts.SizeBytes() 15782 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(size)) 15783 return dst[size:] 15784 } 15785 15786 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15787 func (ts *Timespec) UnmarshalUnsafe(src []byte) []byte { 15788 size := ts.SizeBytes() 15789 gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(size)) 15790 return src[size:] 15791 } 15792 15793 // CopyOutN implements marshal.Marshallable.CopyOutN. 15794 //go:nosplit 15795 func (ts *Timespec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15796 // Construct a slice backed by dst's underlying memory. 15797 var buf []byte 15798 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15799 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 15800 hdr.Len = ts.SizeBytes() 15801 hdr.Cap = ts.SizeBytes() 15802 15803 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15804 // Since we bypassed the compiler's escape analysis, indicate that ts 15805 // must live until the use above. 15806 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 15807 return length, err 15808 } 15809 15810 // CopyOut implements marshal.Marshallable.CopyOut. 15811 //go:nosplit 15812 func (ts *Timespec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15813 return ts.CopyOutN(cc, addr, ts.SizeBytes()) 15814 } 15815 15816 // CopyIn implements marshal.Marshallable.CopyIn. 15817 //go:nosplit 15818 func (ts *Timespec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15819 // Construct a slice backed by dst's underlying memory. 15820 var buf []byte 15821 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15822 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 15823 hdr.Len = ts.SizeBytes() 15824 hdr.Cap = ts.SizeBytes() 15825 15826 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15827 // Since we bypassed the compiler's escape analysis, indicate that ts 15828 // must live until the use above. 15829 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 15830 return length, err 15831 } 15832 15833 // WriteTo implements io.WriterTo.WriteTo. 15834 func (ts *Timespec) WriteTo(writer io.Writer) (int64, error) { 15835 // Construct a slice backed by dst's underlying memory. 15836 var buf []byte 15837 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15838 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 15839 hdr.Len = ts.SizeBytes() 15840 hdr.Cap = ts.SizeBytes() 15841 15842 length, err := writer.Write(buf) 15843 // Since we bypassed the compiler's escape analysis, indicate that ts 15844 // must live until the use above. 15845 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 15846 return int64(length), err 15847 } 15848 15849 // CopyTimespecSliceIn copies in a slice of Timespec objects from the task's memory. 15850 func CopyTimespecSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timespec) (int, error) { 15851 count := len(dst) 15852 if count == 0 { 15853 return 0, nil 15854 } 15855 size := (*Timespec)(nil).SizeBytes() 15856 15857 ptr := unsafe.Pointer(&dst) 15858 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 15859 15860 // Construct a slice backed by dst's underlying memory. 15861 var buf []byte 15862 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15863 hdr.Data = uintptr(val) 15864 hdr.Len = size * count 15865 hdr.Cap = size * count 15866 15867 length, err := cc.CopyInBytes(addr, buf) 15868 // Since we bypassed the compiler's escape analysis, indicate that dst 15869 // must live until the use above. 15870 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 15871 return length, err 15872 } 15873 15874 // CopyTimespecSliceOut copies a slice of Timespec objects to the task's memory. 15875 func CopyTimespecSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timespec) (int, error) { 15876 count := len(src) 15877 if count == 0 { 15878 return 0, nil 15879 } 15880 size := (*Timespec)(nil).SizeBytes() 15881 15882 ptr := unsafe.Pointer(&src) 15883 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 15884 15885 // Construct a slice backed by dst's underlying memory. 15886 var buf []byte 15887 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15888 hdr.Data = uintptr(val) 15889 hdr.Len = size * count 15890 hdr.Cap = size * count 15891 15892 length, err := cc.CopyOutBytes(addr, buf) 15893 // Since we bypassed the compiler's escape analysis, indicate that src 15894 // must live until the use above. 15895 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 15896 return length, err 15897 } 15898 15899 // MarshalUnsafeTimespecSlice is like Timespec.MarshalUnsafe, but for a []Timespec. 15900 func MarshalUnsafeTimespecSlice(src []Timespec, dst []byte) []byte { 15901 count := len(src) 15902 if count == 0 { 15903 return dst 15904 } 15905 15906 size := (*Timespec)(nil).SizeBytes() 15907 buf := dst[:size*count] 15908 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 15909 return dst[size*count:] 15910 } 15911 15912 // UnmarshalUnsafeTimespecSlice is like Timespec.UnmarshalUnsafe, but for a []Timespec. 15913 func UnmarshalUnsafeTimespecSlice(dst []Timespec, src []byte) []byte { 15914 count := len(dst) 15915 if count == 0 { 15916 return src 15917 } 15918 15919 size := (*Timespec)(nil).SizeBytes() 15920 buf := src[:size*count] 15921 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 15922 return src[size*count:] 15923 } 15924 15925 // SizeBytes implements marshal.Marshallable.SizeBytes. 15926 func (tv *Timeval) SizeBytes() int { 15927 return 16 15928 } 15929 15930 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15931 func (tv *Timeval) MarshalBytes(dst []byte) []byte { 15932 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Sec)) 15933 dst = dst[8:] 15934 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Usec)) 15935 dst = dst[8:] 15936 return dst 15937 } 15938 15939 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15940 func (tv *Timeval) UnmarshalBytes(src []byte) []byte { 15941 tv.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 15942 src = src[8:] 15943 tv.Usec = int64(hostarch.ByteOrder.Uint64(src[:8])) 15944 src = src[8:] 15945 return src 15946 } 15947 15948 // Packed implements marshal.Marshallable.Packed. 15949 //go:nosplit 15950 func (tv *Timeval) Packed() bool { 15951 return true 15952 } 15953 15954 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15955 func (tv *Timeval) MarshalUnsafe(dst []byte) []byte { 15956 size := tv.SizeBytes() 15957 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(size)) 15958 return dst[size:] 15959 } 15960 15961 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15962 func (tv *Timeval) UnmarshalUnsafe(src []byte) []byte { 15963 size := tv.SizeBytes() 15964 gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(size)) 15965 return src[size:] 15966 } 15967 15968 // CopyOutN implements marshal.Marshallable.CopyOutN. 15969 //go:nosplit 15970 func (tv *Timeval) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15971 // Construct a slice backed by dst's underlying memory. 15972 var buf []byte 15973 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15974 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 15975 hdr.Len = tv.SizeBytes() 15976 hdr.Cap = tv.SizeBytes() 15977 15978 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15979 // Since we bypassed the compiler's escape analysis, indicate that tv 15980 // must live until the use above. 15981 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 15982 return length, err 15983 } 15984 15985 // CopyOut implements marshal.Marshallable.CopyOut. 15986 //go:nosplit 15987 func (tv *Timeval) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15988 return tv.CopyOutN(cc, addr, tv.SizeBytes()) 15989 } 15990 15991 // CopyIn implements marshal.Marshallable.CopyIn. 15992 //go:nosplit 15993 func (tv *Timeval) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15994 // Construct a slice backed by dst's underlying memory. 15995 var buf []byte 15996 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15997 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 15998 hdr.Len = tv.SizeBytes() 15999 hdr.Cap = tv.SizeBytes() 16000 16001 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16002 // Since we bypassed the compiler's escape analysis, indicate that tv 16003 // must live until the use above. 16004 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 16005 return length, err 16006 } 16007 16008 // WriteTo implements io.WriterTo.WriteTo. 16009 func (tv *Timeval) WriteTo(writer io.Writer) (int64, error) { 16010 // Construct a slice backed by dst's underlying memory. 16011 var buf []byte 16012 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16013 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 16014 hdr.Len = tv.SizeBytes() 16015 hdr.Cap = tv.SizeBytes() 16016 16017 length, err := writer.Write(buf) 16018 // Since we bypassed the compiler's escape analysis, indicate that tv 16019 // must live until the use above. 16020 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 16021 return int64(length), err 16022 } 16023 16024 // CopyTimevalSliceIn copies in a slice of Timeval objects from the task's memory. 16025 func CopyTimevalSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timeval) (int, error) { 16026 count := len(dst) 16027 if count == 0 { 16028 return 0, nil 16029 } 16030 size := (*Timeval)(nil).SizeBytes() 16031 16032 ptr := unsafe.Pointer(&dst) 16033 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 16034 16035 // Construct a slice backed by dst's underlying memory. 16036 var buf []byte 16037 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16038 hdr.Data = uintptr(val) 16039 hdr.Len = size * count 16040 hdr.Cap = size * count 16041 16042 length, err := cc.CopyInBytes(addr, buf) 16043 // Since we bypassed the compiler's escape analysis, indicate that dst 16044 // must live until the use above. 16045 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 16046 return length, err 16047 } 16048 16049 // CopyTimevalSliceOut copies a slice of Timeval objects to the task's memory. 16050 func CopyTimevalSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timeval) (int, error) { 16051 count := len(src) 16052 if count == 0 { 16053 return 0, nil 16054 } 16055 size := (*Timeval)(nil).SizeBytes() 16056 16057 ptr := unsafe.Pointer(&src) 16058 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 16059 16060 // Construct a slice backed by dst's underlying memory. 16061 var buf []byte 16062 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16063 hdr.Data = uintptr(val) 16064 hdr.Len = size * count 16065 hdr.Cap = size * count 16066 16067 length, err := cc.CopyOutBytes(addr, buf) 16068 // Since we bypassed the compiler's escape analysis, indicate that src 16069 // must live until the use above. 16070 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 16071 return length, err 16072 } 16073 16074 // MarshalUnsafeTimevalSlice is like Timeval.MarshalUnsafe, but for a []Timeval. 16075 func MarshalUnsafeTimevalSlice(src []Timeval, dst []byte) []byte { 16076 count := len(src) 16077 if count == 0 { 16078 return dst 16079 } 16080 16081 size := (*Timeval)(nil).SizeBytes() 16082 buf := dst[:size*count] 16083 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 16084 return dst[size*count:] 16085 } 16086 16087 // UnmarshalUnsafeTimevalSlice is like Timeval.UnmarshalUnsafe, but for a []Timeval. 16088 func UnmarshalUnsafeTimevalSlice(dst []Timeval, src []byte) []byte { 16089 count := len(dst) 16090 if count == 0 { 16091 return src 16092 } 16093 16094 size := (*Timeval)(nil).SizeBytes() 16095 buf := src[:size*count] 16096 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 16097 return src[size*count:] 16098 } 16099 16100 // SizeBytes implements marshal.Marshallable.SizeBytes. 16101 func (t *Tms) SizeBytes() int { 16102 return 0 + 16103 (*ClockT)(nil).SizeBytes() + 16104 (*ClockT)(nil).SizeBytes() + 16105 (*ClockT)(nil).SizeBytes() + 16106 (*ClockT)(nil).SizeBytes() 16107 } 16108 16109 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16110 func (t *Tms) MarshalBytes(dst []byte) []byte { 16111 dst = t.UTime.MarshalUnsafe(dst) 16112 dst = t.STime.MarshalUnsafe(dst) 16113 dst = t.CUTime.MarshalUnsafe(dst) 16114 dst = t.CSTime.MarshalUnsafe(dst) 16115 return dst 16116 } 16117 16118 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16119 func (t *Tms) UnmarshalBytes(src []byte) []byte { 16120 src = t.UTime.UnmarshalUnsafe(src) 16121 src = t.STime.UnmarshalUnsafe(src) 16122 src = t.CUTime.UnmarshalUnsafe(src) 16123 src = t.CSTime.UnmarshalUnsafe(src) 16124 return src 16125 } 16126 16127 // Packed implements marshal.Marshallable.Packed. 16128 //go:nosplit 16129 func (t *Tms) Packed() bool { 16130 return t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() 16131 } 16132 16133 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16134 func (t *Tms) MarshalUnsafe(dst []byte) []byte { 16135 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 16136 size := t.SizeBytes() 16137 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 16138 return dst[size:] 16139 } 16140 // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes. 16141 return t.MarshalBytes(dst) 16142 } 16143 16144 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16145 func (t *Tms) UnmarshalUnsafe(src []byte) []byte { 16146 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 16147 size := t.SizeBytes() 16148 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 16149 return src[size:] 16150 } 16151 // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16152 return t.UnmarshalBytes(src) 16153 } 16154 16155 // CopyOutN implements marshal.Marshallable.CopyOutN. 16156 //go:nosplit 16157 func (t *Tms) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16158 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 16159 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 16160 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 16161 t.MarshalBytes(buf) // escapes: fallback. 16162 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16163 } 16164 16165 // Construct a slice backed by dst's underlying memory. 16166 var buf []byte 16167 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16168 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16169 hdr.Len = t.SizeBytes() 16170 hdr.Cap = t.SizeBytes() 16171 16172 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16173 // Since we bypassed the compiler's escape analysis, indicate that t 16174 // must live until the use above. 16175 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16176 return length, err 16177 } 16178 16179 // CopyOut implements marshal.Marshallable.CopyOut. 16180 //go:nosplit 16181 func (t *Tms) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16182 return t.CopyOutN(cc, addr, t.SizeBytes()) 16183 } 16184 16185 // CopyIn implements marshal.Marshallable.CopyIn. 16186 //go:nosplit 16187 func (t *Tms) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16188 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 16189 // Type Tms doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16190 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 16191 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16192 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16193 // partially unmarshalled struct. 16194 t.UnmarshalBytes(buf) // escapes: fallback. 16195 return length, err 16196 } 16197 16198 // Construct a slice backed by dst's underlying memory. 16199 var buf []byte 16200 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16201 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16202 hdr.Len = t.SizeBytes() 16203 hdr.Cap = t.SizeBytes() 16204 16205 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16206 // Since we bypassed the compiler's escape analysis, indicate that t 16207 // must live until the use above. 16208 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16209 return length, err 16210 } 16211 16212 // WriteTo implements io.WriterTo.WriteTo. 16213 func (t *Tms) WriteTo(writer io.Writer) (int64, error) { 16214 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 16215 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 16216 buf := make([]byte, t.SizeBytes()) 16217 t.MarshalBytes(buf) 16218 length, err := writer.Write(buf) 16219 return int64(length), err 16220 } 16221 16222 // Construct a slice backed by dst's underlying memory. 16223 var buf []byte 16224 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16225 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16226 hdr.Len = t.SizeBytes() 16227 hdr.Cap = t.SizeBytes() 16228 16229 length, err := writer.Write(buf) 16230 // Since we bypassed the compiler's escape analysis, indicate that t 16231 // must live until the use above. 16232 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16233 return int64(length), err 16234 } 16235 16236 // SizeBytes implements marshal.Marshallable.SizeBytes. 16237 func (u *Utime) SizeBytes() int { 16238 return 16 16239 } 16240 16241 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16242 func (u *Utime) MarshalBytes(dst []byte) []byte { 16243 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Actime)) 16244 dst = dst[8:] 16245 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Modtime)) 16246 dst = dst[8:] 16247 return dst 16248 } 16249 16250 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16251 func (u *Utime) UnmarshalBytes(src []byte) []byte { 16252 u.Actime = int64(hostarch.ByteOrder.Uint64(src[:8])) 16253 src = src[8:] 16254 u.Modtime = int64(hostarch.ByteOrder.Uint64(src[:8])) 16255 src = src[8:] 16256 return src 16257 } 16258 16259 // Packed implements marshal.Marshallable.Packed. 16260 //go:nosplit 16261 func (u *Utime) Packed() bool { 16262 return true 16263 } 16264 16265 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16266 func (u *Utime) MarshalUnsafe(dst []byte) []byte { 16267 size := u.SizeBytes() 16268 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 16269 return dst[size:] 16270 } 16271 16272 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16273 func (u *Utime) UnmarshalUnsafe(src []byte) []byte { 16274 size := u.SizeBytes() 16275 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 16276 return src[size:] 16277 } 16278 16279 // CopyOutN implements marshal.Marshallable.CopyOutN. 16280 //go:nosplit 16281 func (u *Utime) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16282 // Construct a slice backed by dst's underlying memory. 16283 var buf []byte 16284 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16285 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 16286 hdr.Len = u.SizeBytes() 16287 hdr.Cap = u.SizeBytes() 16288 16289 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16290 // Since we bypassed the compiler's escape analysis, indicate that u 16291 // must live until the use above. 16292 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 16293 return length, err 16294 } 16295 16296 // CopyOut implements marshal.Marshallable.CopyOut. 16297 //go:nosplit 16298 func (u *Utime) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16299 return u.CopyOutN(cc, addr, u.SizeBytes()) 16300 } 16301 16302 // CopyIn implements marshal.Marshallable.CopyIn. 16303 //go:nosplit 16304 func (u *Utime) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16305 // Construct a slice backed by dst's underlying memory. 16306 var buf []byte 16307 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16308 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 16309 hdr.Len = u.SizeBytes() 16310 hdr.Cap = u.SizeBytes() 16311 16312 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16313 // Since we bypassed the compiler's escape analysis, indicate that u 16314 // must live until the use above. 16315 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 16316 return length, err 16317 } 16318 16319 // WriteTo implements io.WriterTo.WriteTo. 16320 func (u *Utime) WriteTo(writer io.Writer) (int64, error) { 16321 // Construct a slice backed by dst's underlying memory. 16322 var buf []byte 16323 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16324 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 16325 hdr.Len = u.SizeBytes() 16326 hdr.Cap = u.SizeBytes() 16327 16328 length, err := writer.Write(buf) 16329 // Since we bypassed the compiler's escape analysis, indicate that u 16330 // must live until the use above. 16331 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 16332 return int64(length), err 16333 } 16334 16335 // SizeBytes implements marshal.Marshallable.SizeBytes. 16336 func (t *Termios) SizeBytes() int { 16337 return 17 + 16338 1*NumControlCharacters 16339 } 16340 16341 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16342 func (t *Termios) MarshalBytes(dst []byte) []byte { 16343 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.InputFlags)) 16344 dst = dst[4:] 16345 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.OutputFlags)) 16346 dst = dst[4:] 16347 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ControlFlags)) 16348 dst = dst[4:] 16349 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LocalFlags)) 16350 dst = dst[4:] 16351 dst[0] = byte(t.LineDiscipline) 16352 dst = dst[1:] 16353 for idx := 0; idx < NumControlCharacters; idx++ { 16354 dst[0] = byte(t.ControlCharacters[idx]) 16355 dst = dst[1:] 16356 } 16357 return dst 16358 } 16359 16360 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16361 func (t *Termios) UnmarshalBytes(src []byte) []byte { 16362 t.InputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16363 src = src[4:] 16364 t.OutputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16365 src = src[4:] 16366 t.ControlFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16367 src = src[4:] 16368 t.LocalFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16369 src = src[4:] 16370 t.LineDiscipline = uint8(src[0]) 16371 src = src[1:] 16372 for idx := 0; idx < NumControlCharacters; idx++ { 16373 t.ControlCharacters[idx] = uint8(src[0]) 16374 src = src[1:] 16375 } 16376 return src 16377 } 16378 16379 // Packed implements marshal.Marshallable.Packed. 16380 //go:nosplit 16381 func (t *Termios) Packed() bool { 16382 return true 16383 } 16384 16385 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16386 func (t *Termios) MarshalUnsafe(dst []byte) []byte { 16387 size := t.SizeBytes() 16388 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 16389 return dst[size:] 16390 } 16391 16392 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16393 func (t *Termios) UnmarshalUnsafe(src []byte) []byte { 16394 size := t.SizeBytes() 16395 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 16396 return src[size:] 16397 } 16398 16399 // CopyOutN implements marshal.Marshallable.CopyOutN. 16400 //go:nosplit 16401 func (t *Termios) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16402 // Construct a slice backed by dst's underlying memory. 16403 var buf []byte 16404 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16405 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16406 hdr.Len = t.SizeBytes() 16407 hdr.Cap = t.SizeBytes() 16408 16409 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16410 // Since we bypassed the compiler's escape analysis, indicate that t 16411 // must live until the use above. 16412 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16413 return length, err 16414 } 16415 16416 // CopyOut implements marshal.Marshallable.CopyOut. 16417 //go:nosplit 16418 func (t *Termios) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16419 return t.CopyOutN(cc, addr, t.SizeBytes()) 16420 } 16421 16422 // CopyIn implements marshal.Marshallable.CopyIn. 16423 //go:nosplit 16424 func (t *Termios) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16425 // Construct a slice backed by dst's underlying memory. 16426 var buf []byte 16427 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16428 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16429 hdr.Len = t.SizeBytes() 16430 hdr.Cap = t.SizeBytes() 16431 16432 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16433 // Since we bypassed the compiler's escape analysis, indicate that t 16434 // must live until the use above. 16435 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16436 return length, err 16437 } 16438 16439 // WriteTo implements io.WriterTo.WriteTo. 16440 func (t *Termios) WriteTo(writer io.Writer) (int64, error) { 16441 // Construct a slice backed by dst's underlying memory. 16442 var buf []byte 16443 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16444 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 16445 hdr.Len = t.SizeBytes() 16446 hdr.Cap = t.SizeBytes() 16447 16448 length, err := writer.Write(buf) 16449 // Since we bypassed the compiler's escape analysis, indicate that t 16450 // must live until the use above. 16451 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 16452 return int64(length), err 16453 } 16454 16455 // SizeBytes implements marshal.Marshallable.SizeBytes. 16456 func (w *WindowSize) SizeBytes() int { 16457 return 4 + 16458 1*4 16459 } 16460 16461 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16462 func (w *WindowSize) MarshalBytes(dst []byte) []byte { 16463 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Rows)) 16464 dst = dst[2:] 16465 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Cols)) 16466 dst = dst[2:] 16467 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 16468 dst = dst[1*(4):] 16469 return dst 16470 } 16471 16472 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16473 func (w *WindowSize) UnmarshalBytes(src []byte) []byte { 16474 w.Rows = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16475 src = src[2:] 16476 w.Cols = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16477 src = src[2:] 16478 // Padding: ~ copy([4]byte(w._), src[:sizeof(byte)*4]) 16479 src = src[1*(4):] 16480 return src 16481 } 16482 16483 // Packed implements marshal.Marshallable.Packed. 16484 //go:nosplit 16485 func (w *WindowSize) Packed() bool { 16486 return true 16487 } 16488 16489 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16490 func (w *WindowSize) MarshalUnsafe(dst []byte) []byte { 16491 size := w.SizeBytes() 16492 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 16493 return dst[size:] 16494 } 16495 16496 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16497 func (w *WindowSize) UnmarshalUnsafe(src []byte) []byte { 16498 size := w.SizeBytes() 16499 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 16500 return src[size:] 16501 } 16502 16503 // CopyOutN implements marshal.Marshallable.CopyOutN. 16504 //go:nosplit 16505 func (w *WindowSize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16506 // Construct a slice backed by dst's underlying memory. 16507 var buf []byte 16508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 16510 hdr.Len = w.SizeBytes() 16511 hdr.Cap = w.SizeBytes() 16512 16513 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16514 // Since we bypassed the compiler's escape analysis, indicate that w 16515 // must live until the use above. 16516 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 16517 return length, err 16518 } 16519 16520 // CopyOut implements marshal.Marshallable.CopyOut. 16521 //go:nosplit 16522 func (w *WindowSize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16523 return w.CopyOutN(cc, addr, w.SizeBytes()) 16524 } 16525 16526 // CopyIn implements marshal.Marshallable.CopyIn. 16527 //go:nosplit 16528 func (w *WindowSize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16529 // Construct a slice backed by dst's underlying memory. 16530 var buf []byte 16531 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16532 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 16533 hdr.Len = w.SizeBytes() 16534 hdr.Cap = w.SizeBytes() 16535 16536 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16537 // Since we bypassed the compiler's escape analysis, indicate that w 16538 // must live until the use above. 16539 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 16540 return length, err 16541 } 16542 16543 // WriteTo implements io.WriterTo.WriteTo. 16544 func (w *WindowSize) WriteTo(writer io.Writer) (int64, error) { 16545 // Construct a slice backed by dst's underlying memory. 16546 var buf []byte 16547 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16548 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 16549 hdr.Len = w.SizeBytes() 16550 hdr.Cap = w.SizeBytes() 16551 16552 length, err := writer.Write(buf) 16553 // Since we bypassed the compiler's escape analysis, indicate that w 16554 // must live until the use above. 16555 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 16556 return int64(length), err 16557 } 16558 16559 // SizeBytes implements marshal.Marshallable.SizeBytes. 16560 func (w *Winsize) SizeBytes() int { 16561 return 8 16562 } 16563 16564 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16565 func (w *Winsize) MarshalBytes(dst []byte) []byte { 16566 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Row)) 16567 dst = dst[2:] 16568 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Col)) 16569 dst = dst[2:] 16570 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Xpixel)) 16571 dst = dst[2:] 16572 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Ypixel)) 16573 dst = dst[2:] 16574 return dst 16575 } 16576 16577 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16578 func (w *Winsize) UnmarshalBytes(src []byte) []byte { 16579 w.Row = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16580 src = src[2:] 16581 w.Col = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16582 src = src[2:] 16583 w.Xpixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16584 src = src[2:] 16585 w.Ypixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16586 src = src[2:] 16587 return src 16588 } 16589 16590 // Packed implements marshal.Marshallable.Packed. 16591 //go:nosplit 16592 func (w *Winsize) Packed() bool { 16593 return true 16594 } 16595 16596 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16597 func (w *Winsize) MarshalUnsafe(dst []byte) []byte { 16598 size := w.SizeBytes() 16599 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 16600 return dst[size:] 16601 } 16602 16603 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16604 func (w *Winsize) UnmarshalUnsafe(src []byte) []byte { 16605 size := w.SizeBytes() 16606 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 16607 return src[size:] 16608 } 16609 16610 // CopyOutN implements marshal.Marshallable.CopyOutN. 16611 //go:nosplit 16612 func (w *Winsize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16613 // Construct a slice backed by dst's underlying memory. 16614 var buf []byte 16615 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16616 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 16617 hdr.Len = w.SizeBytes() 16618 hdr.Cap = w.SizeBytes() 16619 16620 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16621 // Since we bypassed the compiler's escape analysis, indicate that w 16622 // must live until the use above. 16623 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 16624 return length, err 16625 } 16626 16627 // CopyOut implements marshal.Marshallable.CopyOut. 16628 //go:nosplit 16629 func (w *Winsize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16630 return w.CopyOutN(cc, addr, w.SizeBytes()) 16631 } 16632 16633 // CopyIn implements marshal.Marshallable.CopyIn. 16634 //go:nosplit 16635 func (w *Winsize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16636 // Construct a slice backed by dst's underlying memory. 16637 var buf []byte 16638 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16639 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 16640 hdr.Len = w.SizeBytes() 16641 hdr.Cap = w.SizeBytes() 16642 16643 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16644 // Since we bypassed the compiler's escape analysis, indicate that w 16645 // must live until the use above. 16646 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 16647 return length, err 16648 } 16649 16650 // WriteTo implements io.WriterTo.WriteTo. 16651 func (w *Winsize) WriteTo(writer io.Writer) (int64, error) { 16652 // Construct a slice backed by dst's underlying memory. 16653 var buf []byte 16654 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16655 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 16656 hdr.Len = w.SizeBytes() 16657 hdr.Cap = w.SizeBytes() 16658 16659 length, err := writer.Write(buf) 16660 // Since we bypassed the compiler's escape analysis, indicate that w 16661 // must live until the use above. 16662 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 16663 return int64(length), err 16664 } 16665 16666 // SizeBytes implements marshal.Marshallable.SizeBytes. 16667 func (u *UtsName) SizeBytes() int { 16668 return 0 + 16669 1*(UTSLen+1) + 16670 1*(UTSLen+1) + 16671 1*(UTSLen+1) + 16672 1*(UTSLen+1) + 16673 1*(UTSLen+1) + 16674 1*(UTSLen+1) 16675 } 16676 16677 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16678 func (u *UtsName) MarshalBytes(dst []byte) []byte { 16679 for idx := 0; idx < (UTSLen+1); idx++ { 16680 dst[0] = byte(u.Sysname[idx]) 16681 dst = dst[1:] 16682 } 16683 for idx := 0; idx < (UTSLen+1); idx++ { 16684 dst[0] = byte(u.Nodename[idx]) 16685 dst = dst[1:] 16686 } 16687 for idx := 0; idx < (UTSLen+1); idx++ { 16688 dst[0] = byte(u.Release[idx]) 16689 dst = dst[1:] 16690 } 16691 for idx := 0; idx < (UTSLen+1); idx++ { 16692 dst[0] = byte(u.Version[idx]) 16693 dst = dst[1:] 16694 } 16695 for idx := 0; idx < (UTSLen+1); idx++ { 16696 dst[0] = byte(u.Machine[idx]) 16697 dst = dst[1:] 16698 } 16699 for idx := 0; idx < (UTSLen+1); idx++ { 16700 dst[0] = byte(u.Domainname[idx]) 16701 dst = dst[1:] 16702 } 16703 return dst 16704 } 16705 16706 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16707 func (u *UtsName) UnmarshalBytes(src []byte) []byte { 16708 for idx := 0; idx < (UTSLen+1); idx++ { 16709 u.Sysname[idx] = src[0] 16710 src = src[1:] 16711 } 16712 for idx := 0; idx < (UTSLen+1); idx++ { 16713 u.Nodename[idx] = src[0] 16714 src = src[1:] 16715 } 16716 for idx := 0; idx < (UTSLen+1); idx++ { 16717 u.Release[idx] = src[0] 16718 src = src[1:] 16719 } 16720 for idx := 0; idx < (UTSLen+1); idx++ { 16721 u.Version[idx] = src[0] 16722 src = src[1:] 16723 } 16724 for idx := 0; idx < (UTSLen+1); idx++ { 16725 u.Machine[idx] = src[0] 16726 src = src[1:] 16727 } 16728 for idx := 0; idx < (UTSLen+1); idx++ { 16729 u.Domainname[idx] = src[0] 16730 src = src[1:] 16731 } 16732 return src 16733 } 16734 16735 // Packed implements marshal.Marshallable.Packed. 16736 //go:nosplit 16737 func (u *UtsName) Packed() bool { 16738 return true 16739 } 16740 16741 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16742 func (u *UtsName) MarshalUnsafe(dst []byte) []byte { 16743 size := u.SizeBytes() 16744 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 16745 return dst[size:] 16746 } 16747 16748 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16749 func (u *UtsName) UnmarshalUnsafe(src []byte) []byte { 16750 size := u.SizeBytes() 16751 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 16752 return src[size:] 16753 } 16754 16755 // CopyOutN implements marshal.Marshallable.CopyOutN. 16756 //go:nosplit 16757 func (u *UtsName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16758 // Construct a slice backed by dst's underlying memory. 16759 var buf []byte 16760 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16761 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 16762 hdr.Len = u.SizeBytes() 16763 hdr.Cap = u.SizeBytes() 16764 16765 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16766 // Since we bypassed the compiler's escape analysis, indicate that u 16767 // must live until the use above. 16768 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 16769 return length, err 16770 } 16771 16772 // CopyOut implements marshal.Marshallable.CopyOut. 16773 //go:nosplit 16774 func (u *UtsName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16775 return u.CopyOutN(cc, addr, u.SizeBytes()) 16776 } 16777 16778 // CopyIn implements marshal.Marshallable.CopyIn. 16779 //go:nosplit 16780 func (u *UtsName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16781 // Construct a slice backed by dst's underlying memory. 16782 var buf []byte 16783 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16784 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 16785 hdr.Len = u.SizeBytes() 16786 hdr.Cap = u.SizeBytes() 16787 16788 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16789 // Since we bypassed the compiler's escape analysis, indicate that u 16790 // must live until the use above. 16791 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 16792 return length, err 16793 } 16794 16795 // WriteTo implements io.WriterTo.WriteTo. 16796 func (u *UtsName) WriteTo(writer io.Writer) (int64, error) { 16797 // Construct a slice backed by dst's underlying memory. 16798 var buf []byte 16799 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16800 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 16801 hdr.Len = u.SizeBytes() 16802 hdr.Cap = u.SizeBytes() 16803 16804 length, err := writer.Write(buf) 16805 // Since we bypassed the compiler's escape analysis, indicate that u 16806 // must live until the use above. 16807 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 16808 return int64(length), err 16809 } 16810