github.com/ttpreport/gvisor-ligolo@v0.0.0-20240123134145-a858404967ba/pkg/abi/linux/linux_abi_autogen_unsafe.go (about) 1 // Automatically generated marshal implementation. See tools/go_marshal. 2 3 package linux 4 5 import ( 6 "github.com/ttpreport/gvisor-ligolo/pkg/gohacks" 7 "github.com/ttpreport/gvisor-ligolo/pkg/hostarch" 8 "github.com/ttpreport/gvisor-ligolo/pkg/marshal" 9 "io" 10 "reflect" 11 "runtime" 12 "unsafe" 13 ) 14 15 // Marshallable types used by this file. 16 var _ marshal.Marshallable = (*BPFInstruction)(nil) 17 var _ marshal.Marshallable = (*CString)(nil) 18 var _ marshal.Marshallable = (*CapUserData)(nil) 19 var _ marshal.Marshallable = (*CapUserHeader)(nil) 20 var _ marshal.Marshallable = (*ClockT)(nil) 21 var _ marshal.Marshallable = (*ControlMessageCredentials)(nil) 22 var _ marshal.Marshallable = (*ControlMessageHeader)(nil) 23 var _ marshal.Marshallable = (*ControlMessageIPPacketInfo)(nil) 24 var _ marshal.Marshallable = (*ControlMessageIPv6PacketInfo)(nil) 25 var _ marshal.Marshallable = (*ElfHeader64)(nil) 26 var _ marshal.Marshallable = (*ElfProg64)(nil) 27 var _ marshal.Marshallable = (*ElfSection64)(nil) 28 var _ marshal.Marshallable = (*ErrorName)(nil) 29 var _ marshal.Marshallable = (*EthtoolCmd)(nil) 30 var _ marshal.Marshallable = (*EthtoolGFeatures)(nil) 31 var _ marshal.Marshallable = (*EthtoolGetFeaturesBlock)(nil) 32 var _ marshal.Marshallable = (*ExtensionName)(nil) 33 var _ marshal.Marshallable = (*FOwnerEx)(nil) 34 var _ marshal.Marshallable = (*FUSEAccessIn)(nil) 35 var _ marshal.Marshallable = (*FUSEAttr)(nil) 36 var _ marshal.Marshallable = (*FUSEAttrOut)(nil) 37 var _ marshal.Marshallable = (*FUSECreateIn)(nil) 38 var _ marshal.Marshallable = (*FUSECreateMeta)(nil) 39 var _ marshal.Marshallable = (*FUSECreateOut)(nil) 40 var _ marshal.Marshallable = (*FUSEDirent)(nil) 41 var _ marshal.Marshallable = (*FUSEDirentMeta)(nil) 42 var _ marshal.Marshallable = (*FUSEDirents)(nil) 43 var _ marshal.Marshallable = (*FUSEEmptyIn)(nil) 44 var _ marshal.Marshallable = (*FUSEEntryOut)(nil) 45 var _ marshal.Marshallable = (*FUSEFallocateIn)(nil) 46 var _ marshal.Marshallable = (*FUSEFsyncIn)(nil) 47 var _ marshal.Marshallable = (*FUSEGetAttrIn)(nil) 48 var _ marshal.Marshallable = (*FUSEHeaderIn)(nil) 49 var _ marshal.Marshallable = (*FUSEHeaderOut)(nil) 50 var _ marshal.Marshallable = (*FUSEInitIn)(nil) 51 var _ marshal.Marshallable = (*FUSEInitOut)(nil) 52 var _ marshal.Marshallable = (*FUSELinkIn)(nil) 53 var _ marshal.Marshallable = (*FUSELookupIn)(nil) 54 var _ marshal.Marshallable = (*FUSEMkdirIn)(nil) 55 var _ marshal.Marshallable = (*FUSEMkdirMeta)(nil) 56 var _ marshal.Marshallable = (*FUSEMknodIn)(nil) 57 var _ marshal.Marshallable = (*FUSEMknodMeta)(nil) 58 var _ marshal.Marshallable = (*FUSEOpID)(nil) 59 var _ marshal.Marshallable = (*FUSEOpcode)(nil) 60 var _ marshal.Marshallable = (*FUSEOpenIn)(nil) 61 var _ marshal.Marshallable = (*FUSEOpenOut)(nil) 62 var _ marshal.Marshallable = (*FUSEReadIn)(nil) 63 var _ marshal.Marshallable = (*FUSEReleaseIn)(nil) 64 var _ marshal.Marshallable = (*FUSERenameIn)(nil) 65 var _ marshal.Marshallable = (*FUSERmDirIn)(nil) 66 var _ marshal.Marshallable = (*FUSESetAttrIn)(nil) 67 var _ marshal.Marshallable = (*FUSEStatfsOut)(nil) 68 var _ marshal.Marshallable = (*FUSESymlinkIn)(nil) 69 var _ marshal.Marshallable = (*FUSEUnlinkIn)(nil) 70 var _ marshal.Marshallable = (*FUSEWriteIn)(nil) 71 var _ marshal.Marshallable = (*FUSEWriteOut)(nil) 72 var _ marshal.Marshallable = (*FUSEWritePayloadIn)(nil) 73 var _ marshal.Marshallable = (*FileMode)(nil) 74 var _ marshal.Marshallable = (*Flock)(nil) 75 var _ marshal.Marshallable = (*ICMP6Filter)(nil) 76 var _ marshal.Marshallable = (*IFConf)(nil) 77 var _ marshal.Marshallable = (*IFReq)(nil) 78 var _ marshal.Marshallable = (*IOCallback)(nil) 79 var _ marshal.Marshallable = (*IOCqRingOffsets)(nil) 80 var _ marshal.Marshallable = (*IOEvent)(nil) 81 var _ marshal.Marshallable = (*IORingIndex)(nil) 82 var _ marshal.Marshallable = (*IORings)(nil) 83 var _ marshal.Marshallable = (*IOSqRingOffsets)(nil) 84 var _ marshal.Marshallable = (*IOUring)(nil) 85 var _ marshal.Marshallable = (*IOUringCqe)(nil) 86 var _ marshal.Marshallable = (*IOUringParams)(nil) 87 var _ marshal.Marshallable = (*IOUringSqe)(nil) 88 var _ marshal.Marshallable = (*IP6TEntry)(nil) 89 var _ marshal.Marshallable = (*IP6TIP)(nil) 90 var _ marshal.Marshallable = (*IP6TReplace)(nil) 91 var _ marshal.Marshallable = (*IPCPerm)(nil) 92 var _ marshal.Marshallable = (*IPTEntry)(nil) 93 var _ marshal.Marshallable = (*IPTGetEntries)(nil) 94 var _ marshal.Marshallable = (*IPTGetinfo)(nil) 95 var _ marshal.Marshallable = (*IPTIP)(nil) 96 var _ marshal.Marshallable = (*IPTOwnerInfo)(nil) 97 var _ marshal.Marshallable = (*IPTReplace)(nil) 98 var _ marshal.Marshallable = (*Inet6Addr)(nil) 99 var _ marshal.Marshallable = (*Inet6MulticastRequest)(nil) 100 var _ marshal.Marshallable = (*InetAddr)(nil) 101 var _ marshal.Marshallable = (*InetMulticastRequest)(nil) 102 var _ marshal.Marshallable = (*InetMulticastRequestWithNIC)(nil) 103 var _ marshal.Marshallable = (*InterfaceAddrMessage)(nil) 104 var _ marshal.Marshallable = (*InterfaceInfoMessage)(nil) 105 var _ marshal.Marshallable = (*ItimerVal)(nil) 106 var _ marshal.Marshallable = (*Itimerspec)(nil) 107 var _ marshal.Marshallable = (*KernelIP6TEntry)(nil) 108 var _ marshal.Marshallable = (*KernelIP6TGetEntries)(nil) 109 var _ marshal.Marshallable = (*KernelIPTEntry)(nil) 110 var _ marshal.Marshallable = (*KernelIPTGetEntries)(nil) 111 var _ marshal.Marshallable = (*Linger)(nil) 112 var _ marshal.Marshallable = (*MqAttr)(nil) 113 var _ marshal.Marshallable = (*MsgBuf)(nil) 114 var _ marshal.Marshallable = (*MsgInfo)(nil) 115 var _ marshal.Marshallable = (*MsqidDS)(nil) 116 var _ marshal.Marshallable = (*NFNATRange)(nil) 117 var _ marshal.Marshallable = (*NetlinkAttrHeader)(nil) 118 var _ marshal.Marshallable = (*NetlinkErrorMessage)(nil) 119 var _ marshal.Marshallable = (*NetlinkMessageHeader)(nil) 120 var _ marshal.Marshallable = (*NfNATIPV4MultiRangeCompat)(nil) 121 var _ marshal.Marshallable = (*NfNATIPV4Range)(nil) 122 var _ marshal.Marshallable = (*NumaPolicy)(nil) 123 var _ marshal.Marshallable = (*PollFD)(nil) 124 var _ marshal.Marshallable = (*RSeqCriticalSection)(nil) 125 var _ marshal.Marshallable = (*RobustListHead)(nil) 126 var _ marshal.Marshallable = (*RouteMessage)(nil) 127 var _ marshal.Marshallable = (*RtAttr)(nil) 128 var _ marshal.Marshallable = (*Rusage)(nil) 129 var _ marshal.Marshallable = (*SeccompData)(nil) 130 var _ marshal.Marshallable = (*SemInfo)(nil) 131 var _ marshal.Marshallable = (*Sembuf)(nil) 132 var _ marshal.Marshallable = (*ShmInfo)(nil) 133 var _ marshal.Marshallable = (*ShmParams)(nil) 134 var _ marshal.Marshallable = (*ShmidDS)(nil) 135 var _ marshal.Marshallable = (*SigAction)(nil) 136 var _ marshal.Marshallable = (*Sigevent)(nil) 137 var _ marshal.Marshallable = (*SignalInfo)(nil) 138 var _ marshal.Marshallable = (*SignalSet)(nil) 139 var _ marshal.Marshallable = (*SignalStack)(nil) 140 var _ marshal.Marshallable = (*SignalfdSiginfo)(nil) 141 var _ marshal.Marshallable = (*SockAddrInet)(nil) 142 var _ marshal.Marshallable = (*SockAddrInet6)(nil) 143 var _ marshal.Marshallable = (*SockAddrLink)(nil) 144 var _ marshal.Marshallable = (*SockAddrNetlink)(nil) 145 var _ marshal.Marshallable = (*SockAddrUnix)(nil) 146 var _ marshal.Marshallable = (*SockErrCMsgIPv4)(nil) 147 var _ marshal.Marshallable = (*SockErrCMsgIPv6)(nil) 148 var _ marshal.Marshallable = (*SockExtendedErr)(nil) 149 var _ marshal.Marshallable = (*Statfs)(nil) 150 var _ marshal.Marshallable = (*Statx)(nil) 151 var _ marshal.Marshallable = (*StatxTimestamp)(nil) 152 var _ marshal.Marshallable = (*Sysinfo)(nil) 153 var _ marshal.Marshallable = (*TCPInfo)(nil) 154 var _ marshal.Marshallable = (*TableName)(nil) 155 var _ marshal.Marshallable = (*Termios)(nil) 156 var _ marshal.Marshallable = (*TimeT)(nil) 157 var _ marshal.Marshallable = (*TimerID)(nil) 158 var _ marshal.Marshallable = (*Timespec)(nil) 159 var _ marshal.Marshallable = (*Timeval)(nil) 160 var _ marshal.Marshallable = (*Tms)(nil) 161 var _ marshal.Marshallable = (*Utime)(nil) 162 var _ marshal.Marshallable = (*UtsName)(nil) 163 var _ marshal.Marshallable = (*WindowSize)(nil) 164 var _ marshal.Marshallable = (*Winsize)(nil) 165 var _ marshal.Marshallable = (*XTCounters)(nil) 166 var _ marshal.Marshallable = (*XTEntryMatch)(nil) 167 var _ marshal.Marshallable = (*XTEntryTarget)(nil) 168 var _ marshal.Marshallable = (*XTErrorTarget)(nil) 169 var _ marshal.Marshallable = (*XTGetRevision)(nil) 170 var _ marshal.Marshallable = (*XTRedirectTarget)(nil) 171 var _ marshal.Marshallable = (*XTSNATTarget)(nil) 172 var _ marshal.Marshallable = (*XTStandardTarget)(nil) 173 var _ marshal.Marshallable = (*XTTCP)(nil) 174 var _ marshal.Marshallable = (*XTUDP)(nil) 175 176 // SizeBytes implements marshal.Marshallable.SizeBytes. 177 func (i *IOCallback) SizeBytes() int { 178 return 64 179 } 180 181 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 182 func (i *IOCallback) MarshalBytes(dst []byte) []byte { 183 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 184 dst = dst[8:] 185 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 186 dst = dst[4:] 187 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 188 dst = dst[4:] 189 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.OpCode)) 190 dst = dst[2:] 191 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.ReqPrio)) 192 dst = dst[2:] 193 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.FD)) 194 dst = dst[4:] 195 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Buf)) 196 dst = dst[8:] 197 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Bytes)) 198 dst = dst[8:] 199 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Offset)) 200 dst = dst[8:] 201 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Reserved2)) 202 dst = dst[8:] 203 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 204 dst = dst[4:] 205 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ResFD)) 206 dst = dst[4:] 207 return dst 208 } 209 210 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 211 func (i *IOCallback) UnmarshalBytes(src []byte) []byte { 212 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 213 src = src[8:] 214 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 215 src = src[4:] 216 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 217 src = src[4:] 218 i.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 219 src = src[2:] 220 i.ReqPrio = int16(hostarch.ByteOrder.Uint16(src[:2])) 221 src = src[2:] 222 i.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 223 src = src[4:] 224 i.Buf = uint64(hostarch.ByteOrder.Uint64(src[:8])) 225 src = src[8:] 226 i.Bytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 227 src = src[8:] 228 i.Offset = int64(hostarch.ByteOrder.Uint64(src[:8])) 229 src = src[8:] 230 i.Reserved2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 231 src = src[8:] 232 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 233 src = src[4:] 234 i.ResFD = int32(hostarch.ByteOrder.Uint32(src[:4])) 235 src = src[4:] 236 return src 237 } 238 239 // Packed implements marshal.Marshallable.Packed. 240 // 241 //go:nosplit 242 func (i *IOCallback) Packed() bool { 243 return true 244 } 245 246 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 247 func (i *IOCallback) MarshalUnsafe(dst []byte) []byte { 248 size := i.SizeBytes() 249 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 250 return dst[size:] 251 } 252 253 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 254 func (i *IOCallback) UnmarshalUnsafe(src []byte) []byte { 255 size := i.SizeBytes() 256 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 257 return src[size:] 258 } 259 260 // CopyOutN implements marshal.Marshallable.CopyOutN. 261 func (i *IOCallback) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 262 // Construct a slice backed by dst's underlying memory. 263 var buf []byte 264 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 265 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 266 hdr.Len = i.SizeBytes() 267 hdr.Cap = i.SizeBytes() 268 269 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 270 // Since we bypassed the compiler's escape analysis, indicate that i 271 // must live until the use above. 272 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 273 return length, err 274 } 275 276 // CopyOut implements marshal.Marshallable.CopyOut. 277 func (i *IOCallback) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 278 return i.CopyOutN(cc, addr, i.SizeBytes()) 279 } 280 281 // CopyIn implements marshal.Marshallable.CopyIn. 282 func (i *IOCallback) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 283 // Construct a slice backed by dst's underlying memory. 284 var buf []byte 285 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 286 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 287 hdr.Len = i.SizeBytes() 288 hdr.Cap = i.SizeBytes() 289 290 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 291 // Since we bypassed the compiler's escape analysis, indicate that i 292 // must live until the use above. 293 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 294 return length, err 295 } 296 297 // WriteTo implements io.WriterTo.WriteTo. 298 func (i *IOCallback) WriteTo(writer io.Writer) (int64, error) { 299 // Construct a slice backed by dst's underlying memory. 300 var buf []byte 301 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 302 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 303 hdr.Len = i.SizeBytes() 304 hdr.Cap = i.SizeBytes() 305 306 length, err := writer.Write(buf) 307 // Since we bypassed the compiler's escape analysis, indicate that i 308 // must live until the use above. 309 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 310 return int64(length), err 311 } 312 313 // SizeBytes implements marshal.Marshallable.SizeBytes. 314 func (i *IOEvent) SizeBytes() int { 315 return 32 316 } 317 318 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 319 func (i *IOEvent) MarshalBytes(dst []byte) []byte { 320 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 321 dst = dst[8:] 322 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Obj)) 323 dst = dst[8:] 324 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result)) 325 dst = dst[8:] 326 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result2)) 327 dst = dst[8:] 328 return dst 329 } 330 331 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 332 func (i *IOEvent) UnmarshalBytes(src []byte) []byte { 333 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 334 src = src[8:] 335 i.Obj = uint64(hostarch.ByteOrder.Uint64(src[:8])) 336 src = src[8:] 337 i.Result = int64(hostarch.ByteOrder.Uint64(src[:8])) 338 src = src[8:] 339 i.Result2 = int64(hostarch.ByteOrder.Uint64(src[:8])) 340 src = src[8:] 341 return src 342 } 343 344 // Packed implements marshal.Marshallable.Packed. 345 // 346 //go:nosplit 347 func (i *IOEvent) Packed() bool { 348 return true 349 } 350 351 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 352 func (i *IOEvent) MarshalUnsafe(dst []byte) []byte { 353 size := i.SizeBytes() 354 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 355 return dst[size:] 356 } 357 358 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 359 func (i *IOEvent) UnmarshalUnsafe(src []byte) []byte { 360 size := i.SizeBytes() 361 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 362 return src[size:] 363 } 364 365 // CopyOutN implements marshal.Marshallable.CopyOutN. 366 func (i *IOEvent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 367 // Construct a slice backed by dst's underlying memory. 368 var buf []byte 369 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 370 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 371 hdr.Len = i.SizeBytes() 372 hdr.Cap = i.SizeBytes() 373 374 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 375 // Since we bypassed the compiler's escape analysis, indicate that i 376 // must live until the use above. 377 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 378 return length, err 379 } 380 381 // CopyOut implements marshal.Marshallable.CopyOut. 382 func (i *IOEvent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 383 return i.CopyOutN(cc, addr, i.SizeBytes()) 384 } 385 386 // CopyIn implements marshal.Marshallable.CopyIn. 387 func (i *IOEvent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, 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 := cc.CopyInBytes(addr, buf) // escapes: okay. 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 length, err 400 } 401 402 // WriteTo implements io.WriterTo.WriteTo. 403 func (i *IOEvent) WriteTo(writer io.Writer) (int64, error) { 404 // Construct a slice backed by dst's underlying memory. 405 var buf []byte 406 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 407 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 408 hdr.Len = i.SizeBytes() 409 hdr.Cap = i.SizeBytes() 410 411 length, err := writer.Write(buf) 412 // Since we bypassed the compiler's escape analysis, indicate that i 413 // must live until the use above. 414 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 415 return int64(length), err 416 } 417 418 // SizeBytes implements marshal.Marshallable.SizeBytes. 419 func (b *BPFInstruction) SizeBytes() int { 420 return 8 421 } 422 423 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 424 func (b *BPFInstruction) MarshalBytes(dst []byte) []byte { 425 hostarch.ByteOrder.PutUint16(dst[:2], uint16(b.OpCode)) 426 dst = dst[2:] 427 dst[0] = byte(b.JumpIfTrue) 428 dst = dst[1:] 429 dst[0] = byte(b.JumpIfFalse) 430 dst = dst[1:] 431 hostarch.ByteOrder.PutUint32(dst[:4], uint32(b.K)) 432 dst = dst[4:] 433 return dst 434 } 435 436 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 437 func (b *BPFInstruction) UnmarshalBytes(src []byte) []byte { 438 b.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 439 src = src[2:] 440 b.JumpIfTrue = uint8(src[0]) 441 src = src[1:] 442 b.JumpIfFalse = uint8(src[0]) 443 src = src[1:] 444 b.K = uint32(hostarch.ByteOrder.Uint32(src[:4])) 445 src = src[4:] 446 return src 447 } 448 449 // Packed implements marshal.Marshallable.Packed. 450 // 451 //go:nosplit 452 func (b *BPFInstruction) Packed() bool { 453 return true 454 } 455 456 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 457 func (b *BPFInstruction) MarshalUnsafe(dst []byte) []byte { 458 size := b.SizeBytes() 459 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size)) 460 return dst[size:] 461 } 462 463 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 464 func (b *BPFInstruction) UnmarshalUnsafe(src []byte) []byte { 465 size := b.SizeBytes() 466 gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size)) 467 return src[size:] 468 } 469 470 // CopyOutN implements marshal.Marshallable.CopyOutN. 471 func (b *BPFInstruction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 472 // Construct a slice backed by dst's underlying memory. 473 var buf []byte 474 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 475 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 476 hdr.Len = b.SizeBytes() 477 hdr.Cap = b.SizeBytes() 478 479 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 480 // Since we bypassed the compiler's escape analysis, indicate that b 481 // must live until the use above. 482 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 483 return length, err 484 } 485 486 // CopyOut implements marshal.Marshallable.CopyOut. 487 func (b *BPFInstruction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 488 return b.CopyOutN(cc, addr, b.SizeBytes()) 489 } 490 491 // CopyIn implements marshal.Marshallable.CopyIn. 492 func (b *BPFInstruction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 493 // Construct a slice backed by dst's underlying memory. 494 var buf []byte 495 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 496 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 497 hdr.Len = b.SizeBytes() 498 hdr.Cap = b.SizeBytes() 499 500 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 501 // Since we bypassed the compiler's escape analysis, indicate that b 502 // must live until the use above. 503 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 504 return length, err 505 } 506 507 // WriteTo implements io.WriterTo.WriteTo. 508 func (b *BPFInstruction) WriteTo(writer io.Writer) (int64, error) { 509 // Construct a slice backed by dst's underlying memory. 510 var buf []byte 511 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 512 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 513 hdr.Len = b.SizeBytes() 514 hdr.Cap = b.SizeBytes() 515 516 length, err := writer.Write(buf) 517 // Since we bypassed the compiler's escape analysis, indicate that b 518 // must live until the use above. 519 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 520 return int64(length), err 521 } 522 523 // CopyBPFInstructionSliceIn copies in a slice of BPFInstruction objects from the task's memory. 524 func CopyBPFInstructionSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []BPFInstruction) (int, error) { 525 count := len(dst) 526 if count == 0 { 527 return 0, nil 528 } 529 size := (*BPFInstruction)(nil).SizeBytes() 530 531 ptr := unsafe.Pointer(&dst) 532 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 533 534 // Construct a slice backed by dst's underlying memory. 535 var buf []byte 536 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 537 hdr.Data = uintptr(val) 538 hdr.Len = size * count 539 hdr.Cap = size * count 540 541 length, err := cc.CopyInBytes(addr, buf) 542 // Since we bypassed the compiler's escape analysis, indicate that dst 543 // must live until the use above. 544 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 545 return length, err 546 } 547 548 // CopyBPFInstructionSliceOut copies a slice of BPFInstruction objects to the task's memory. 549 func CopyBPFInstructionSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []BPFInstruction) (int, error) { 550 count := len(src) 551 if count == 0 { 552 return 0, nil 553 } 554 size := (*BPFInstruction)(nil).SizeBytes() 555 556 ptr := unsafe.Pointer(&src) 557 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 558 559 // Construct a slice backed by dst's underlying memory. 560 var buf []byte 561 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 562 hdr.Data = uintptr(val) 563 hdr.Len = size * count 564 hdr.Cap = size * count 565 566 length, err := cc.CopyOutBytes(addr, buf) 567 // Since we bypassed the compiler's escape analysis, indicate that src 568 // must live until the use above. 569 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 570 return length, err 571 } 572 573 // MarshalUnsafeBPFInstructionSlice is like BPFInstruction.MarshalUnsafe, but for a []BPFInstruction. 574 func MarshalUnsafeBPFInstructionSlice(src []BPFInstruction, dst []byte) []byte { 575 count := len(src) 576 if count == 0 { 577 return dst 578 } 579 580 size := (*BPFInstruction)(nil).SizeBytes() 581 buf := dst[:size*count] 582 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 583 return dst[size*count:] 584 } 585 586 // UnmarshalUnsafeBPFInstructionSlice is like BPFInstruction.UnmarshalUnsafe, but for a []BPFInstruction. 587 func UnmarshalUnsafeBPFInstructionSlice(dst []BPFInstruction, src []byte) []byte { 588 count := len(dst) 589 if count == 0 { 590 return src 591 } 592 593 size := (*BPFInstruction)(nil).SizeBytes() 594 buf := src[:size*count] 595 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 596 return src[size*count:] 597 } 598 599 // SizeBytes implements marshal.Marshallable.SizeBytes. 600 func (c *CapUserData) SizeBytes() int { 601 return 12 602 } 603 604 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 605 func (c *CapUserData) MarshalBytes(dst []byte) []byte { 606 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Effective)) 607 dst = dst[4:] 608 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Permitted)) 609 dst = dst[4:] 610 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Inheritable)) 611 dst = dst[4:] 612 return dst 613 } 614 615 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 616 func (c *CapUserData) UnmarshalBytes(src []byte) []byte { 617 c.Effective = uint32(hostarch.ByteOrder.Uint32(src[:4])) 618 src = src[4:] 619 c.Permitted = uint32(hostarch.ByteOrder.Uint32(src[:4])) 620 src = src[4:] 621 c.Inheritable = uint32(hostarch.ByteOrder.Uint32(src[:4])) 622 src = src[4:] 623 return src 624 } 625 626 // Packed implements marshal.Marshallable.Packed. 627 // 628 //go:nosplit 629 func (c *CapUserData) Packed() bool { 630 return true 631 } 632 633 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 634 func (c *CapUserData) MarshalUnsafe(dst []byte) []byte { 635 size := c.SizeBytes() 636 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 637 return dst[size:] 638 } 639 640 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 641 func (c *CapUserData) UnmarshalUnsafe(src []byte) []byte { 642 size := c.SizeBytes() 643 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 644 return src[size:] 645 } 646 647 // CopyOutN implements marshal.Marshallable.CopyOutN. 648 func (c *CapUserData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 649 // Construct a slice backed by dst's underlying memory. 650 var buf []byte 651 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 652 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 653 hdr.Len = c.SizeBytes() 654 hdr.Cap = c.SizeBytes() 655 656 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 657 // Since we bypassed the compiler's escape analysis, indicate that c 658 // must live until the use above. 659 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 660 return length, err 661 } 662 663 // CopyOut implements marshal.Marshallable.CopyOut. 664 func (c *CapUserData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 665 return c.CopyOutN(cc, addr, c.SizeBytes()) 666 } 667 668 // CopyIn implements marshal.Marshallable.CopyIn. 669 func (c *CapUserData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 670 // Construct a slice backed by dst's underlying memory. 671 var buf []byte 672 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 673 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 674 hdr.Len = c.SizeBytes() 675 hdr.Cap = c.SizeBytes() 676 677 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 678 // Since we bypassed the compiler's escape analysis, indicate that c 679 // must live until the use above. 680 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 681 return length, err 682 } 683 684 // WriteTo implements io.WriterTo.WriteTo. 685 func (c *CapUserData) WriteTo(writer io.Writer) (int64, error) { 686 // Construct a slice backed by dst's underlying memory. 687 var buf []byte 688 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 689 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 690 hdr.Len = c.SizeBytes() 691 hdr.Cap = c.SizeBytes() 692 693 length, err := writer.Write(buf) 694 // Since we bypassed the compiler's escape analysis, indicate that c 695 // must live until the use above. 696 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 697 return int64(length), err 698 } 699 700 // CopyCapUserDataSliceIn copies in a slice of CapUserData objects from the task's memory. 701 func CopyCapUserDataSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []CapUserData) (int, error) { 702 count := len(dst) 703 if count == 0 { 704 return 0, nil 705 } 706 size := (*CapUserData)(nil).SizeBytes() 707 708 ptr := unsafe.Pointer(&dst) 709 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 710 711 // Construct a slice backed by dst's underlying memory. 712 var buf []byte 713 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 714 hdr.Data = uintptr(val) 715 hdr.Len = size * count 716 hdr.Cap = size * count 717 718 length, err := cc.CopyInBytes(addr, buf) 719 // Since we bypassed the compiler's escape analysis, indicate that dst 720 // must live until the use above. 721 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 722 return length, err 723 } 724 725 // CopyCapUserDataSliceOut copies a slice of CapUserData objects to the task's memory. 726 func CopyCapUserDataSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []CapUserData) (int, error) { 727 count := len(src) 728 if count == 0 { 729 return 0, nil 730 } 731 size := (*CapUserData)(nil).SizeBytes() 732 733 ptr := unsafe.Pointer(&src) 734 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 735 736 // Construct a slice backed by dst's underlying memory. 737 var buf []byte 738 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 739 hdr.Data = uintptr(val) 740 hdr.Len = size * count 741 hdr.Cap = size * count 742 743 length, err := cc.CopyOutBytes(addr, buf) 744 // Since we bypassed the compiler's escape analysis, indicate that src 745 // must live until the use above. 746 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 747 return length, err 748 } 749 750 // MarshalUnsafeCapUserDataSlice is like CapUserData.MarshalUnsafe, but for a []CapUserData. 751 func MarshalUnsafeCapUserDataSlice(src []CapUserData, dst []byte) []byte { 752 count := len(src) 753 if count == 0 { 754 return dst 755 } 756 757 size := (*CapUserData)(nil).SizeBytes() 758 buf := dst[:size*count] 759 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 760 return dst[size*count:] 761 } 762 763 // UnmarshalUnsafeCapUserDataSlice is like CapUserData.UnmarshalUnsafe, but for a []CapUserData. 764 func UnmarshalUnsafeCapUserDataSlice(dst []CapUserData, src []byte) []byte { 765 count := len(dst) 766 if count == 0 { 767 return src 768 } 769 770 size := (*CapUserData)(nil).SizeBytes() 771 buf := src[:size*count] 772 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 773 return src[size*count:] 774 } 775 776 // SizeBytes implements marshal.Marshallable.SizeBytes. 777 func (c *CapUserHeader) SizeBytes() int { 778 return 8 779 } 780 781 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 782 func (c *CapUserHeader) MarshalBytes(dst []byte) []byte { 783 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Version)) 784 dst = dst[4:] 785 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Pid)) 786 dst = dst[4:] 787 return dst 788 } 789 790 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 791 func (c *CapUserHeader) UnmarshalBytes(src []byte) []byte { 792 c.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 793 src = src[4:] 794 c.Pid = int32(hostarch.ByteOrder.Uint32(src[:4])) 795 src = src[4:] 796 return src 797 } 798 799 // Packed implements marshal.Marshallable.Packed. 800 // 801 //go:nosplit 802 func (c *CapUserHeader) Packed() bool { 803 return true 804 } 805 806 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 807 func (c *CapUserHeader) MarshalUnsafe(dst []byte) []byte { 808 size := c.SizeBytes() 809 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 810 return dst[size:] 811 } 812 813 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 814 func (c *CapUserHeader) UnmarshalUnsafe(src []byte) []byte { 815 size := c.SizeBytes() 816 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 817 return src[size:] 818 } 819 820 // CopyOutN implements marshal.Marshallable.CopyOutN. 821 func (c *CapUserHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 822 // Construct a slice backed by dst's underlying memory. 823 var buf []byte 824 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 825 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 826 hdr.Len = c.SizeBytes() 827 hdr.Cap = c.SizeBytes() 828 829 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 830 // Since we bypassed the compiler's escape analysis, indicate that c 831 // must live until the use above. 832 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 833 return length, err 834 } 835 836 // CopyOut implements marshal.Marshallable.CopyOut. 837 func (c *CapUserHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 838 return c.CopyOutN(cc, addr, c.SizeBytes()) 839 } 840 841 // CopyIn implements marshal.Marshallable.CopyIn. 842 func (c *CapUserHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 843 // Construct a slice backed by dst's underlying memory. 844 var buf []byte 845 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 846 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 847 hdr.Len = c.SizeBytes() 848 hdr.Cap = c.SizeBytes() 849 850 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 851 // Since we bypassed the compiler's escape analysis, indicate that c 852 // must live until the use above. 853 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 854 return length, err 855 } 856 857 // WriteTo implements io.WriterTo.WriteTo. 858 func (c *CapUserHeader) WriteTo(writer io.Writer) (int64, error) { 859 // Construct a slice backed by dst's underlying memory. 860 var buf []byte 861 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 862 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 863 hdr.Len = c.SizeBytes() 864 hdr.Cap = c.SizeBytes() 865 866 length, err := writer.Write(buf) 867 // Since we bypassed the compiler's escape analysis, indicate that c 868 // must live until the use above. 869 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 870 return int64(length), err 871 } 872 873 // SizeBytes implements marshal.Marshallable.SizeBytes. 874 func (e *ElfHeader64) SizeBytes() int { 875 return 48 + 876 1*16 877 } 878 879 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 880 func (e *ElfHeader64) MarshalBytes(dst []byte) []byte { 881 for idx := 0; idx < 16; idx++ { 882 dst[0] = byte(e.Ident[idx]) 883 dst = dst[1:] 884 } 885 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Type)) 886 dst = dst[2:] 887 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Machine)) 888 dst = dst[2:] 889 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Version)) 890 dst = dst[4:] 891 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entry)) 892 dst = dst[8:] 893 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Phoff)) 894 dst = dst[8:] 895 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Shoff)) 896 dst = dst[8:] 897 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 898 dst = dst[4:] 899 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Ehsize)) 900 dst = dst[2:] 901 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phentsize)) 902 dst = dst[2:] 903 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phnum)) 904 dst = dst[2:] 905 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shentsize)) 906 dst = dst[2:] 907 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shnum)) 908 dst = dst[2:] 909 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shstrndx)) 910 dst = dst[2:] 911 return dst 912 } 913 914 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 915 func (e *ElfHeader64) UnmarshalBytes(src []byte) []byte { 916 for idx := 0; idx < 16; idx++ { 917 e.Ident[idx] = src[0] 918 src = src[1:] 919 } 920 e.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 921 src = src[2:] 922 e.Machine = uint16(hostarch.ByteOrder.Uint16(src[:2])) 923 src = src[2:] 924 e.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 925 src = src[4:] 926 e.Entry = uint64(hostarch.ByteOrder.Uint64(src[:8])) 927 src = src[8:] 928 e.Phoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 929 src = src[8:] 930 e.Shoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 931 src = src[8:] 932 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 933 src = src[4:] 934 e.Ehsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 935 src = src[2:] 936 e.Phentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 937 src = src[2:] 938 e.Phnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 939 src = src[2:] 940 e.Shentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 941 src = src[2:] 942 e.Shnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 943 src = src[2:] 944 e.Shstrndx = uint16(hostarch.ByteOrder.Uint16(src[:2])) 945 src = src[2:] 946 return src 947 } 948 949 // Packed implements marshal.Marshallable.Packed. 950 // 951 //go:nosplit 952 func (e *ElfHeader64) Packed() bool { 953 return true 954 } 955 956 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 957 func (e *ElfHeader64) MarshalUnsafe(dst []byte) []byte { 958 size := e.SizeBytes() 959 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 960 return dst[size:] 961 } 962 963 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 964 func (e *ElfHeader64) UnmarshalUnsafe(src []byte) []byte { 965 size := e.SizeBytes() 966 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 967 return src[size:] 968 } 969 970 // CopyOutN implements marshal.Marshallable.CopyOutN. 971 func (e *ElfHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 972 // Construct a slice backed by dst's underlying memory. 973 var buf []byte 974 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 975 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 976 hdr.Len = e.SizeBytes() 977 hdr.Cap = e.SizeBytes() 978 979 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 980 // Since we bypassed the compiler's escape analysis, indicate that e 981 // must live until the use above. 982 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 983 return length, err 984 } 985 986 // CopyOut implements marshal.Marshallable.CopyOut. 987 func (e *ElfHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 988 return e.CopyOutN(cc, addr, e.SizeBytes()) 989 } 990 991 // CopyIn implements marshal.Marshallable.CopyIn. 992 func (e *ElfHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 993 // Construct a slice backed by dst's underlying memory. 994 var buf []byte 995 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 996 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 997 hdr.Len = e.SizeBytes() 998 hdr.Cap = e.SizeBytes() 999 1000 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1001 // Since we bypassed the compiler's escape analysis, indicate that e 1002 // must live until the use above. 1003 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1004 return length, err 1005 } 1006 1007 // WriteTo implements io.WriterTo.WriteTo. 1008 func (e *ElfHeader64) WriteTo(writer io.Writer) (int64, error) { 1009 // Construct a slice backed by dst's underlying memory. 1010 var buf []byte 1011 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1012 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1013 hdr.Len = e.SizeBytes() 1014 hdr.Cap = e.SizeBytes() 1015 1016 length, err := writer.Write(buf) 1017 // Since we bypassed the compiler's escape analysis, indicate that e 1018 // must live until the use above. 1019 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1020 return int64(length), err 1021 } 1022 1023 // SizeBytes implements marshal.Marshallable.SizeBytes. 1024 func (e *ElfProg64) SizeBytes() int { 1025 return 56 1026 } 1027 1028 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1029 func (e *ElfProg64) MarshalBytes(dst []byte) []byte { 1030 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1031 dst = dst[4:] 1032 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1033 dst = dst[4:] 1034 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1035 dst = dst[8:] 1036 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Vaddr)) 1037 dst = dst[8:] 1038 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Paddr)) 1039 dst = dst[8:] 1040 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Filesz)) 1041 dst = dst[8:] 1042 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Memsz)) 1043 dst = dst[8:] 1044 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Align)) 1045 dst = dst[8:] 1046 return dst 1047 } 1048 1049 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1050 func (e *ElfProg64) UnmarshalBytes(src []byte) []byte { 1051 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1052 src = src[4:] 1053 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1054 src = src[4:] 1055 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1056 src = src[8:] 1057 e.Vaddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1058 src = src[8:] 1059 e.Paddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1060 src = src[8:] 1061 e.Filesz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1062 src = src[8:] 1063 e.Memsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1064 src = src[8:] 1065 e.Align = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1066 src = src[8:] 1067 return src 1068 } 1069 1070 // Packed implements marshal.Marshallable.Packed. 1071 // 1072 //go:nosplit 1073 func (e *ElfProg64) Packed() bool { 1074 return true 1075 } 1076 1077 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1078 func (e *ElfProg64) MarshalUnsafe(dst []byte) []byte { 1079 size := e.SizeBytes() 1080 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1081 return dst[size:] 1082 } 1083 1084 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1085 func (e *ElfProg64) UnmarshalUnsafe(src []byte) []byte { 1086 size := e.SizeBytes() 1087 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1088 return src[size:] 1089 } 1090 1091 // CopyOutN implements marshal.Marshallable.CopyOutN. 1092 func (e *ElfProg64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1093 // Construct a slice backed by dst's underlying memory. 1094 var buf []byte 1095 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1096 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1097 hdr.Len = e.SizeBytes() 1098 hdr.Cap = e.SizeBytes() 1099 1100 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1101 // Since we bypassed the compiler's escape analysis, indicate that e 1102 // must live until the use above. 1103 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1104 return length, err 1105 } 1106 1107 // CopyOut implements marshal.Marshallable.CopyOut. 1108 func (e *ElfProg64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1109 return e.CopyOutN(cc, addr, e.SizeBytes()) 1110 } 1111 1112 // CopyIn implements marshal.Marshallable.CopyIn. 1113 func (e *ElfProg64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1114 // Construct a slice backed by dst's underlying memory. 1115 var buf []byte 1116 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1117 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1118 hdr.Len = e.SizeBytes() 1119 hdr.Cap = e.SizeBytes() 1120 1121 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1122 // Since we bypassed the compiler's escape analysis, indicate that e 1123 // must live until the use above. 1124 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1125 return length, err 1126 } 1127 1128 // WriteTo implements io.WriterTo.WriteTo. 1129 func (e *ElfProg64) WriteTo(writer io.Writer) (int64, error) { 1130 // Construct a slice backed by dst's underlying memory. 1131 var buf []byte 1132 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1133 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1134 hdr.Len = e.SizeBytes() 1135 hdr.Cap = e.SizeBytes() 1136 1137 length, err := writer.Write(buf) 1138 // Since we bypassed the compiler's escape analysis, indicate that e 1139 // must live until the use above. 1140 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1141 return int64(length), err 1142 } 1143 1144 // SizeBytes implements marshal.Marshallable.SizeBytes. 1145 func (e *ElfSection64) SizeBytes() int { 1146 return 64 1147 } 1148 1149 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1150 func (e *ElfSection64) MarshalBytes(dst []byte) []byte { 1151 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Name)) 1152 dst = dst[4:] 1153 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1154 dst = dst[4:] 1155 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Flags)) 1156 dst = dst[8:] 1157 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addr)) 1158 dst = dst[8:] 1159 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1160 dst = dst[8:] 1161 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Size)) 1162 dst = dst[8:] 1163 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Link)) 1164 dst = dst[4:] 1165 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Info)) 1166 dst = dst[4:] 1167 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addralign)) 1168 dst = dst[8:] 1169 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entsize)) 1170 dst = dst[8:] 1171 return dst 1172 } 1173 1174 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1175 func (e *ElfSection64) UnmarshalBytes(src []byte) []byte { 1176 e.Name = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1177 src = src[4:] 1178 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1179 src = src[4:] 1180 e.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1181 src = src[8:] 1182 e.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1183 src = src[8:] 1184 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1185 src = src[8:] 1186 e.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1187 src = src[8:] 1188 e.Link = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1189 src = src[4:] 1190 e.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1191 src = src[4:] 1192 e.Addralign = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1193 src = src[8:] 1194 e.Entsize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1195 src = src[8:] 1196 return src 1197 } 1198 1199 // Packed implements marshal.Marshallable.Packed. 1200 // 1201 //go:nosplit 1202 func (e *ElfSection64) Packed() bool { 1203 return true 1204 } 1205 1206 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1207 func (e *ElfSection64) MarshalUnsafe(dst []byte) []byte { 1208 size := e.SizeBytes() 1209 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1210 return dst[size:] 1211 } 1212 1213 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1214 func (e *ElfSection64) UnmarshalUnsafe(src []byte) []byte { 1215 size := e.SizeBytes() 1216 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1217 return src[size:] 1218 } 1219 1220 // CopyOutN implements marshal.Marshallable.CopyOutN. 1221 func (e *ElfSection64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1222 // Construct a slice backed by dst's underlying memory. 1223 var buf []byte 1224 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1225 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1226 hdr.Len = e.SizeBytes() 1227 hdr.Cap = e.SizeBytes() 1228 1229 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1230 // Since we bypassed the compiler's escape analysis, indicate that e 1231 // must live until the use above. 1232 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1233 return length, err 1234 } 1235 1236 // CopyOut implements marshal.Marshallable.CopyOut. 1237 func (e *ElfSection64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1238 return e.CopyOutN(cc, addr, e.SizeBytes()) 1239 } 1240 1241 // CopyIn implements marshal.Marshallable.CopyIn. 1242 func (e *ElfSection64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1243 // Construct a slice backed by dst's underlying memory. 1244 var buf []byte 1245 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1246 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1247 hdr.Len = e.SizeBytes() 1248 hdr.Cap = e.SizeBytes() 1249 1250 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1251 // Since we bypassed the compiler's escape analysis, indicate that e 1252 // must live until the use above. 1253 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1254 return length, err 1255 } 1256 1257 // WriteTo implements io.WriterTo.WriteTo. 1258 func (e *ElfSection64) WriteTo(writer io.Writer) (int64, error) { 1259 // Construct a slice backed by dst's underlying memory. 1260 var buf []byte 1261 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1262 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1263 hdr.Len = e.SizeBytes() 1264 hdr.Cap = e.SizeBytes() 1265 1266 length, err := writer.Write(buf) 1267 // Since we bypassed the compiler's escape analysis, indicate that e 1268 // must live until the use above. 1269 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1270 return int64(length), err 1271 } 1272 1273 // SizeBytes implements marshal.Marshallable.SizeBytes. 1274 func (s *SockErrCMsgIPv4) SizeBytes() int { 1275 return 0 + 1276 (*SockExtendedErr)(nil).SizeBytes() + 1277 (*SockAddrInet)(nil).SizeBytes() 1278 } 1279 1280 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1281 func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) []byte { 1282 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1283 dst = s.Offender.MarshalUnsafe(dst) 1284 return dst 1285 } 1286 1287 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1288 func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) []byte { 1289 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1290 src = s.Offender.UnmarshalUnsafe(src) 1291 return src 1292 } 1293 1294 // Packed implements marshal.Marshallable.Packed. 1295 // 1296 //go:nosplit 1297 func (s *SockErrCMsgIPv4) Packed() bool { 1298 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1299 } 1300 1301 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1302 func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) []byte { 1303 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1304 size := s.SizeBytes() 1305 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1306 return dst[size:] 1307 } 1308 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes. 1309 return s.MarshalBytes(dst) 1310 } 1311 1312 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1313 func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) []byte { 1314 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1315 size := s.SizeBytes() 1316 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1317 return src[size:] 1318 } 1319 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1320 return s.UnmarshalBytes(src) 1321 } 1322 1323 // CopyOutN implements marshal.Marshallable.CopyOutN. 1324 func (s *SockErrCMsgIPv4) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1325 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1326 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1327 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1328 s.MarshalBytes(buf) // escapes: fallback. 1329 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1330 } 1331 1332 // Construct a slice backed by dst's underlying memory. 1333 var buf []byte 1334 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1335 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1336 hdr.Len = s.SizeBytes() 1337 hdr.Cap = s.SizeBytes() 1338 1339 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1340 // Since we bypassed the compiler's escape analysis, indicate that s 1341 // must live until the use above. 1342 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1343 return length, err 1344 } 1345 1346 // CopyOut implements marshal.Marshallable.CopyOut. 1347 func (s *SockErrCMsgIPv4) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1348 return s.CopyOutN(cc, addr, s.SizeBytes()) 1349 } 1350 1351 // CopyIn implements marshal.Marshallable.CopyIn. 1352 func (s *SockErrCMsgIPv4) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1353 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1354 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1355 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1356 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1357 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1358 // partially unmarshalled struct. 1359 s.UnmarshalBytes(buf) // escapes: fallback. 1360 return length, err 1361 } 1362 1363 // Construct a slice backed by dst's underlying memory. 1364 var buf []byte 1365 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1366 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1367 hdr.Len = s.SizeBytes() 1368 hdr.Cap = s.SizeBytes() 1369 1370 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1371 // Since we bypassed the compiler's escape analysis, indicate that s 1372 // must live until the use above. 1373 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1374 return length, err 1375 } 1376 1377 // WriteTo implements io.WriterTo.WriteTo. 1378 func (s *SockErrCMsgIPv4) WriteTo(writer io.Writer) (int64, error) { 1379 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1380 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1381 buf := make([]byte, s.SizeBytes()) 1382 s.MarshalBytes(buf) 1383 length, err := writer.Write(buf) 1384 return int64(length), err 1385 } 1386 1387 // Construct a slice backed by dst's underlying memory. 1388 var buf []byte 1389 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1390 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1391 hdr.Len = s.SizeBytes() 1392 hdr.Cap = s.SizeBytes() 1393 1394 length, err := writer.Write(buf) 1395 // Since we bypassed the compiler's escape analysis, indicate that s 1396 // must live until the use above. 1397 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1398 return int64(length), err 1399 } 1400 1401 // SizeBytes implements marshal.Marshallable.SizeBytes. 1402 func (s *SockErrCMsgIPv6) SizeBytes() int { 1403 return 0 + 1404 (*SockExtendedErr)(nil).SizeBytes() + 1405 (*SockAddrInet6)(nil).SizeBytes() 1406 } 1407 1408 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1409 func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) []byte { 1410 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1411 dst = s.Offender.MarshalUnsafe(dst) 1412 return dst 1413 } 1414 1415 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1416 func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) []byte { 1417 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1418 src = s.Offender.UnmarshalUnsafe(src) 1419 return src 1420 } 1421 1422 // Packed implements marshal.Marshallable.Packed. 1423 // 1424 //go:nosplit 1425 func (s *SockErrCMsgIPv6) Packed() bool { 1426 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1427 } 1428 1429 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1430 func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) []byte { 1431 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1432 size := s.SizeBytes() 1433 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1434 return dst[size:] 1435 } 1436 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes. 1437 return s.MarshalBytes(dst) 1438 } 1439 1440 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1441 func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) []byte { 1442 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1443 size := s.SizeBytes() 1444 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1445 return src[size:] 1446 } 1447 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1448 return s.UnmarshalBytes(src) 1449 } 1450 1451 // CopyOutN implements marshal.Marshallable.CopyOutN. 1452 func (s *SockErrCMsgIPv6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1453 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1454 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1455 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1456 s.MarshalBytes(buf) // escapes: fallback. 1457 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1458 } 1459 1460 // Construct a slice backed by dst's underlying memory. 1461 var buf []byte 1462 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1463 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1464 hdr.Len = s.SizeBytes() 1465 hdr.Cap = s.SizeBytes() 1466 1467 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1468 // Since we bypassed the compiler's escape analysis, indicate that s 1469 // must live until the use above. 1470 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1471 return length, err 1472 } 1473 1474 // CopyOut implements marshal.Marshallable.CopyOut. 1475 func (s *SockErrCMsgIPv6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1476 return s.CopyOutN(cc, addr, s.SizeBytes()) 1477 } 1478 1479 // CopyIn implements marshal.Marshallable.CopyIn. 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 // 1574 //go:nosplit 1575 func (s *SockExtendedErr) Packed() bool { 1576 return true 1577 } 1578 1579 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1580 func (s *SockExtendedErr) MarshalUnsafe(dst []byte) []byte { 1581 size := s.SizeBytes() 1582 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1583 return dst[size:] 1584 } 1585 1586 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1587 func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) []byte { 1588 size := s.SizeBytes() 1589 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1590 return src[size:] 1591 } 1592 1593 // CopyOutN implements marshal.Marshallable.CopyOutN. 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 func (s *SockExtendedErr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1611 return s.CopyOutN(cc, addr, s.SizeBytes()) 1612 } 1613 1614 // CopyIn implements marshal.Marshallable.CopyIn. 1615 func (s *SockExtendedErr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1616 // Construct a slice backed by dst's underlying memory. 1617 var buf []byte 1618 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1619 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1620 hdr.Len = s.SizeBytes() 1621 hdr.Cap = s.SizeBytes() 1622 1623 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1624 // Since we bypassed the compiler's escape analysis, indicate that s 1625 // must live until the use above. 1626 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1627 return length, err 1628 } 1629 1630 // WriteTo implements io.WriterTo.WriteTo. 1631 func (s *SockExtendedErr) WriteTo(writer io.Writer) (int64, error) { 1632 // Construct a slice backed by dst's underlying memory. 1633 var buf []byte 1634 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1635 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1636 hdr.Len = s.SizeBytes() 1637 hdr.Cap = s.SizeBytes() 1638 1639 length, err := writer.Write(buf) 1640 // Since we bypassed the compiler's escape analysis, indicate that s 1641 // must live until the use above. 1642 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1643 return int64(length), err 1644 } 1645 1646 // SizeBytes implements marshal.Marshallable.SizeBytes. 1647 func (f *FOwnerEx) SizeBytes() int { 1648 return 8 1649 } 1650 1651 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1652 func (f *FOwnerEx) MarshalBytes(dst []byte) []byte { 1653 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 1654 dst = dst[4:] 1655 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1656 dst = dst[4:] 1657 return dst 1658 } 1659 1660 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1661 func (f *FOwnerEx) UnmarshalBytes(src []byte) []byte { 1662 f.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 1663 src = src[4:] 1664 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1665 src = src[4:] 1666 return src 1667 } 1668 1669 // Packed implements marshal.Marshallable.Packed. 1670 // 1671 //go:nosplit 1672 func (f *FOwnerEx) Packed() bool { 1673 return true 1674 } 1675 1676 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1677 func (f *FOwnerEx) MarshalUnsafe(dst []byte) []byte { 1678 size := f.SizeBytes() 1679 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1680 return dst[size:] 1681 } 1682 1683 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1684 func (f *FOwnerEx) UnmarshalUnsafe(src []byte) []byte { 1685 size := f.SizeBytes() 1686 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1687 return src[size:] 1688 } 1689 1690 // CopyOutN implements marshal.Marshallable.CopyOutN. 1691 func (f *FOwnerEx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1692 // Construct a slice backed by dst's underlying memory. 1693 var buf []byte 1694 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1695 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1696 hdr.Len = f.SizeBytes() 1697 hdr.Cap = f.SizeBytes() 1698 1699 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1700 // Since we bypassed the compiler's escape analysis, indicate that f 1701 // must live until the use above. 1702 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1703 return length, err 1704 } 1705 1706 // CopyOut implements marshal.Marshallable.CopyOut. 1707 func (f *FOwnerEx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1708 return f.CopyOutN(cc, addr, f.SizeBytes()) 1709 } 1710 1711 // CopyIn implements marshal.Marshallable.CopyIn. 1712 func (f *FOwnerEx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1713 // Construct a slice backed by dst's underlying memory. 1714 var buf []byte 1715 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1716 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1717 hdr.Len = f.SizeBytes() 1718 hdr.Cap = f.SizeBytes() 1719 1720 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1721 // Since we bypassed the compiler's escape analysis, indicate that f 1722 // must live until the use above. 1723 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1724 return length, err 1725 } 1726 1727 // WriteTo implements io.WriterTo.WriteTo. 1728 func (f *FOwnerEx) WriteTo(writer io.Writer) (int64, error) { 1729 // Construct a slice backed by dst's underlying memory. 1730 var buf []byte 1731 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1732 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1733 hdr.Len = f.SizeBytes() 1734 hdr.Cap = f.SizeBytes() 1735 1736 length, err := writer.Write(buf) 1737 // Since we bypassed the compiler's escape analysis, indicate that f 1738 // must live until the use above. 1739 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1740 return int64(length), err 1741 } 1742 1743 // SizeBytes implements marshal.Marshallable.SizeBytes. 1744 func (f *Flock) SizeBytes() int { 1745 return 24 + 1746 1*4 + 1747 1*4 1748 } 1749 1750 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1751 func (f *Flock) MarshalBytes(dst []byte) []byte { 1752 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Type)) 1753 dst = dst[2:] 1754 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Whence)) 1755 dst = dst[2:] 1756 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1757 dst = dst[1*(4):] 1758 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Start)) 1759 dst = dst[8:] 1760 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Len)) 1761 dst = dst[8:] 1762 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1763 dst = dst[4:] 1764 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1765 dst = dst[1*(4):] 1766 return dst 1767 } 1768 1769 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1770 func (f *Flock) UnmarshalBytes(src []byte) []byte { 1771 f.Type = int16(hostarch.ByteOrder.Uint16(src[:2])) 1772 src = src[2:] 1773 f.Whence = int16(hostarch.ByteOrder.Uint16(src[:2])) 1774 src = src[2:] 1775 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1776 src = src[1*(4):] 1777 f.Start = int64(hostarch.ByteOrder.Uint64(src[:8])) 1778 src = src[8:] 1779 f.Len = int64(hostarch.ByteOrder.Uint64(src[:8])) 1780 src = src[8:] 1781 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1782 src = src[4:] 1783 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1784 src = src[1*(4):] 1785 return src 1786 } 1787 1788 // Packed implements marshal.Marshallable.Packed. 1789 // 1790 //go:nosplit 1791 func (f *Flock) Packed() bool { 1792 return true 1793 } 1794 1795 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1796 func (f *Flock) MarshalUnsafe(dst []byte) []byte { 1797 size := f.SizeBytes() 1798 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1799 return dst[size:] 1800 } 1801 1802 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1803 func (f *Flock) UnmarshalUnsafe(src []byte) []byte { 1804 size := f.SizeBytes() 1805 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1806 return src[size:] 1807 } 1808 1809 // CopyOutN implements marshal.Marshallable.CopyOutN. 1810 func (f *Flock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1811 // Construct a slice backed by dst's underlying memory. 1812 var buf []byte 1813 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1814 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1815 hdr.Len = f.SizeBytes() 1816 hdr.Cap = f.SizeBytes() 1817 1818 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1819 // Since we bypassed the compiler's escape analysis, indicate that f 1820 // must live until the use above. 1821 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1822 return length, err 1823 } 1824 1825 // CopyOut implements marshal.Marshallable.CopyOut. 1826 func (f *Flock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1827 return f.CopyOutN(cc, addr, f.SizeBytes()) 1828 } 1829 1830 // CopyIn implements marshal.Marshallable.CopyIn. 1831 func (f *Flock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1832 // Construct a slice backed by dst's underlying memory. 1833 var buf []byte 1834 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1835 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1836 hdr.Len = f.SizeBytes() 1837 hdr.Cap = f.SizeBytes() 1838 1839 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1840 // Since we bypassed the compiler's escape analysis, indicate that f 1841 // must live until the use above. 1842 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1843 return length, err 1844 } 1845 1846 // WriteTo implements io.WriterTo.WriteTo. 1847 func (f *Flock) WriteTo(writer io.Writer) (int64, error) { 1848 // Construct a slice backed by dst's underlying memory. 1849 var buf []byte 1850 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1851 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1852 hdr.Len = f.SizeBytes() 1853 hdr.Cap = f.SizeBytes() 1854 1855 length, err := writer.Write(buf) 1856 // Since we bypassed the compiler's escape analysis, indicate that f 1857 // must live until the use above. 1858 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1859 return int64(length), err 1860 } 1861 1862 // SizeBytes implements marshal.Marshallable.SizeBytes. 1863 // 1864 //go:nosplit 1865 func (m *FileMode) SizeBytes() int { 1866 return 2 1867 } 1868 1869 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1870 func (m *FileMode) MarshalBytes(dst []byte) []byte { 1871 hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m)) 1872 return dst[2:] 1873 } 1874 1875 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1876 func (m *FileMode) UnmarshalBytes(src []byte) []byte { 1877 *m = FileMode(uint16(hostarch.ByteOrder.Uint16(src[:2]))) 1878 return src[2:] 1879 } 1880 1881 // Packed implements marshal.Marshallable.Packed. 1882 // 1883 //go:nosplit 1884 func (m *FileMode) Packed() bool { 1885 // Scalar newtypes are always packed. 1886 return true 1887 } 1888 1889 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1890 func (m *FileMode) MarshalUnsafe(dst []byte) []byte { 1891 size := m.SizeBytes() 1892 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 1893 return dst[size:] 1894 } 1895 1896 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1897 func (m *FileMode) UnmarshalUnsafe(src []byte) []byte { 1898 size := m.SizeBytes() 1899 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 1900 return src[size:] 1901 } 1902 1903 // CopyOutN implements marshal.Marshallable.CopyOutN. 1904 func (m *FileMode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1905 // Construct a slice backed by dst's underlying memory. 1906 var buf []byte 1907 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1908 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1909 hdr.Len = m.SizeBytes() 1910 hdr.Cap = m.SizeBytes() 1911 1912 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1913 // Since we bypassed the compiler's escape analysis, indicate that m 1914 // must live until the use above. 1915 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1916 return length, err 1917 } 1918 1919 // CopyOut implements marshal.Marshallable.CopyOut. 1920 func (m *FileMode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1921 return m.CopyOutN(cc, addr, m.SizeBytes()) 1922 } 1923 1924 // CopyIn implements marshal.Marshallable.CopyIn. 1925 func (m *FileMode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1926 // Construct a slice backed by dst's underlying memory. 1927 var buf []byte 1928 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1929 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1930 hdr.Len = m.SizeBytes() 1931 hdr.Cap = m.SizeBytes() 1932 1933 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1934 // Since we bypassed the compiler's escape analysis, indicate that m 1935 // must live until the use above. 1936 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1937 return length, err 1938 } 1939 1940 // WriteTo implements io.WriterTo.WriteTo. 1941 func (m *FileMode) WriteTo(writer io.Writer) (int64, error) { 1942 // Construct a slice backed by dst's underlying memory. 1943 var buf []byte 1944 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1945 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 1946 hdr.Len = m.SizeBytes() 1947 hdr.Cap = m.SizeBytes() 1948 1949 length, err := writer.Write(buf) 1950 // Since we bypassed the compiler's escape analysis, indicate that m 1951 // must live until the use above. 1952 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 1953 return int64(length), err 1954 } 1955 1956 // SizeBytes implements marshal.Marshallable.SizeBytes. 1957 func (s *Statx) SizeBytes() int { 1958 return 80 + 1959 (*StatxTimestamp)(nil).SizeBytes() + 1960 (*StatxTimestamp)(nil).SizeBytes() + 1961 (*StatxTimestamp)(nil).SizeBytes() + 1962 (*StatxTimestamp)(nil).SizeBytes() 1963 } 1964 1965 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1966 func (s *Statx) MarshalBytes(dst []byte) []byte { 1967 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask)) 1968 dst = dst[4:] 1969 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Blksize)) 1970 dst = dst[4:] 1971 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Attributes)) 1972 dst = dst[8:] 1973 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nlink)) 1974 dst = dst[4:] 1975 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 1976 dst = dst[4:] 1977 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.GID)) 1978 dst = dst[4:] 1979 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Mode)) 1980 dst = dst[2:] 1981 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 1982 dst = dst[2:] 1983 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino)) 1984 dst = dst[8:] 1985 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 1986 dst = dst[8:] 1987 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 1988 dst = dst[8:] 1989 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.AttributesMask)) 1990 dst = dst[8:] 1991 dst = s.Atime.MarshalUnsafe(dst) 1992 dst = s.Btime.MarshalUnsafe(dst) 1993 dst = s.Ctime.MarshalUnsafe(dst) 1994 dst = s.Mtime.MarshalUnsafe(dst) 1995 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMajor)) 1996 dst = dst[4:] 1997 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMinor)) 1998 dst = dst[4:] 1999 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMajor)) 2000 dst = dst[4:] 2001 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMinor)) 2002 dst = dst[4:] 2003 return dst 2004 } 2005 2006 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2007 func (s *Statx) UnmarshalBytes(src []byte) []byte { 2008 s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2009 src = src[4:] 2010 s.Blksize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2011 src = src[4:] 2012 s.Attributes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2013 src = src[8:] 2014 s.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2015 src = src[4:] 2016 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2017 src = src[4:] 2018 s.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2019 src = src[4:] 2020 s.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 2021 src = src[2:] 2022 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 2023 src = src[2:] 2024 s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2025 src = src[8:] 2026 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2027 src = src[8:] 2028 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2029 src = src[8:] 2030 s.AttributesMask = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2031 src = src[8:] 2032 src = s.Atime.UnmarshalUnsafe(src) 2033 src = s.Btime.UnmarshalUnsafe(src) 2034 src = s.Ctime.UnmarshalUnsafe(src) 2035 src = s.Mtime.UnmarshalUnsafe(src) 2036 s.RdevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2037 src = src[4:] 2038 s.RdevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2039 src = src[4:] 2040 s.DevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2041 src = src[4:] 2042 s.DevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2043 src = src[4:] 2044 return src 2045 } 2046 2047 // Packed implements marshal.Marshallable.Packed. 2048 // 2049 //go:nosplit 2050 func (s *Statx) Packed() bool { 2051 return s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() 2052 } 2053 2054 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2055 func (s *Statx) MarshalUnsafe(dst []byte) []byte { 2056 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2057 size := s.SizeBytes() 2058 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2059 return dst[size:] 2060 } 2061 // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes. 2062 return s.MarshalBytes(dst) 2063 } 2064 2065 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2066 func (s *Statx) UnmarshalUnsafe(src []byte) []byte { 2067 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2068 size := s.SizeBytes() 2069 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2070 return src[size:] 2071 } 2072 // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2073 return s.UnmarshalBytes(src) 2074 } 2075 2076 // CopyOutN implements marshal.Marshallable.CopyOutN. 2077 func (s *Statx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2078 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2079 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2080 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2081 s.MarshalBytes(buf) // escapes: fallback. 2082 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2083 } 2084 2085 // Construct a slice backed by dst's underlying memory. 2086 var buf []byte 2087 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2088 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2089 hdr.Len = s.SizeBytes() 2090 hdr.Cap = s.SizeBytes() 2091 2092 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2093 // Since we bypassed the compiler's escape analysis, indicate that s 2094 // must live until the use above. 2095 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2096 return length, err 2097 } 2098 2099 // CopyOut implements marshal.Marshallable.CopyOut. 2100 func (s *Statx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2101 return s.CopyOutN(cc, addr, s.SizeBytes()) 2102 } 2103 2104 // CopyIn implements marshal.Marshallable.CopyIn. 2105 func (s *Statx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2106 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2107 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2108 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2109 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2110 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2111 // partially unmarshalled struct. 2112 s.UnmarshalBytes(buf) // escapes: fallback. 2113 return length, err 2114 } 2115 2116 // Construct a slice backed by dst's underlying memory. 2117 var buf []byte 2118 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2119 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2120 hdr.Len = s.SizeBytes() 2121 hdr.Cap = s.SizeBytes() 2122 2123 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2124 // Since we bypassed the compiler's escape analysis, indicate that s 2125 // must live until the use above. 2126 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2127 return length, err 2128 } 2129 2130 // WriteTo implements io.WriterTo.WriteTo. 2131 func (s *Statx) WriteTo(writer io.Writer) (int64, error) { 2132 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2133 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2134 buf := make([]byte, s.SizeBytes()) 2135 s.MarshalBytes(buf) 2136 length, err := writer.Write(buf) 2137 return int64(length), err 2138 } 2139 2140 // Construct a slice backed by dst's underlying memory. 2141 var buf []byte 2142 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2143 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2144 hdr.Len = s.SizeBytes() 2145 hdr.Cap = s.SizeBytes() 2146 2147 length, err := writer.Write(buf) 2148 // Since we bypassed the compiler's escape analysis, indicate that s 2149 // must live until the use above. 2150 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2151 return int64(length), err 2152 } 2153 2154 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2155 func (s *Statx) CheckedMarshal(dst []byte) ([]byte, bool) { 2156 if s.SizeBytes() > len(dst) { 2157 return dst, false 2158 } 2159 return s.MarshalUnsafe(dst), true 2160 } 2161 2162 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2163 func (s *Statx) CheckedUnmarshal(src []byte) ([]byte, bool) { 2164 if s.SizeBytes() > len(src) { 2165 return src, false 2166 } 2167 return s.UnmarshalUnsafe(src), true 2168 } 2169 2170 // CopyStatxSliceIn copies in a slice of Statx objects from the task's memory. 2171 func CopyStatxSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Statx) (int, error) { 2172 count := len(dst) 2173 if count == 0 { 2174 return 0, nil 2175 } 2176 size := (*Statx)(nil).SizeBytes() 2177 2178 if !dst[0].Packed() { 2179 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2180 buf := cc.CopyScratchBuffer(size * count) 2181 length, err := cc.CopyInBytes(addr, buf) 2182 2183 // Unmarshal as much as possible, even on error. First handle full objects. 2184 limit := length / size 2185 for idx := 0; idx < limit; idx++ { 2186 buf = dst[idx].UnmarshalBytes(buf) 2187 } 2188 2189 // Handle any final partial object. buf is guaranteed to be long enough for the 2190 // final element, but may not contain valid data for the entire range. This may 2191 // result in unmarshalling zero values for some parts of the object. 2192 if length%size != 0 { 2193 dst[limit].UnmarshalBytes(buf) 2194 } 2195 2196 return length, err 2197 } 2198 2199 ptr := unsafe.Pointer(&dst) 2200 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2201 2202 // Construct a slice backed by dst's underlying memory. 2203 var buf []byte 2204 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2205 hdr.Data = uintptr(val) 2206 hdr.Len = size * count 2207 hdr.Cap = size * count 2208 2209 length, err := cc.CopyInBytes(addr, buf) 2210 // Since we bypassed the compiler's escape analysis, indicate that dst 2211 // must live until the use above. 2212 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 2213 return length, err 2214 } 2215 2216 // CopyStatxSliceOut copies a slice of Statx objects to the task's memory. 2217 func CopyStatxSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Statx) (int, error) { 2218 count := len(src) 2219 if count == 0 { 2220 return 0, nil 2221 } 2222 size := (*Statx)(nil).SizeBytes() 2223 2224 if !src[0].Packed() { 2225 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2226 buf := cc.CopyScratchBuffer(size * count) 2227 curBuf := buf 2228 for idx := 0; idx < count; idx++ { 2229 curBuf = src[idx].MarshalBytes(curBuf) 2230 } 2231 return cc.CopyOutBytes(addr, buf) 2232 } 2233 2234 ptr := unsafe.Pointer(&src) 2235 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2236 2237 // Construct a slice backed by dst's underlying memory. 2238 var buf []byte 2239 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2240 hdr.Data = uintptr(val) 2241 hdr.Len = size * count 2242 hdr.Cap = size * count 2243 2244 length, err := cc.CopyOutBytes(addr, buf) 2245 // Since we bypassed the compiler's escape analysis, indicate that src 2246 // must live until the use above. 2247 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2248 return length, err 2249 } 2250 2251 // MarshalUnsafeStatxSlice is like Statx.MarshalUnsafe, but for a []Statx. 2252 func MarshalUnsafeStatxSlice(src []Statx, dst []byte) []byte { 2253 count := len(src) 2254 if count == 0 { 2255 return dst 2256 } 2257 2258 if !src[0].Packed() { 2259 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2260 for idx := 0; idx < count; idx++ { 2261 dst = src[idx].MarshalBytes(dst) 2262 } 2263 return dst 2264 } 2265 2266 size := (*Statx)(nil).SizeBytes() 2267 buf := dst[:size*count] 2268 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2269 return dst[size*count:] 2270 } 2271 2272 // UnmarshalUnsafeStatxSlice is like Statx.UnmarshalUnsafe, but for a []Statx. 2273 func UnmarshalUnsafeStatxSlice(dst []Statx, src []byte) []byte { 2274 count := len(dst) 2275 if count == 0 { 2276 return src 2277 } 2278 2279 if !dst[0].Packed() { 2280 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2281 for idx := 0; idx < count; idx++ { 2282 src = dst[idx].UnmarshalBytes(src) 2283 } 2284 return src 2285 } 2286 2287 size := (*Statx)(nil).SizeBytes() 2288 buf := src[:size*count] 2289 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2290 return src[size*count:] 2291 } 2292 2293 // SizeBytes implements marshal.Marshallable.SizeBytes. 2294 func (s *Statfs) SizeBytes() int { 2295 return 80 + 2296 4*2 + 2297 8*4 2298 } 2299 2300 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2301 func (s *Statfs) MarshalBytes(dst []byte) []byte { 2302 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type)) 2303 dst = dst[8:] 2304 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize)) 2305 dst = dst[8:] 2306 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2307 dst = dst[8:] 2308 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksFree)) 2309 dst = dst[8:] 2310 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksAvailable)) 2311 dst = dst[8:] 2312 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Files)) 2313 dst = dst[8:] 2314 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FilesFree)) 2315 dst = dst[8:] 2316 for idx := 0; idx < 2; idx++ { 2317 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FSID[idx])) 2318 dst = dst[4:] 2319 } 2320 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength)) 2321 dst = dst[8:] 2322 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FragmentSize)) 2323 dst = dst[8:] 2324 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 2325 dst = dst[8:] 2326 for idx := 0; idx < 4; idx++ { 2327 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Spare[idx])) 2328 dst = dst[8:] 2329 } 2330 return dst 2331 } 2332 2333 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2334 func (s *Statfs) UnmarshalBytes(src []byte) []byte { 2335 s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2336 src = src[8:] 2337 s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2338 src = src[8:] 2339 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2340 src = src[8:] 2341 s.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2342 src = src[8:] 2343 s.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2344 src = src[8:] 2345 s.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2346 src = src[8:] 2347 s.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2348 src = src[8:] 2349 for idx := 0; idx < 2; idx++ { 2350 s.FSID[idx] = int32(hostarch.ByteOrder.Uint32(src[:4])) 2351 src = src[4:] 2352 } 2353 s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2354 src = src[8:] 2355 s.FragmentSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2356 src = src[8:] 2357 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2358 src = src[8:] 2359 for idx := 0; idx < 4; idx++ { 2360 s.Spare[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2361 src = src[8:] 2362 } 2363 return src 2364 } 2365 2366 // Packed implements marshal.Marshallable.Packed. 2367 // 2368 //go:nosplit 2369 func (s *Statfs) Packed() bool { 2370 return true 2371 } 2372 2373 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2374 func (s *Statfs) MarshalUnsafe(dst []byte) []byte { 2375 size := s.SizeBytes() 2376 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2377 return dst[size:] 2378 } 2379 2380 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2381 func (s *Statfs) UnmarshalUnsafe(src []byte) []byte { 2382 size := s.SizeBytes() 2383 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2384 return src[size:] 2385 } 2386 2387 // CopyOutN implements marshal.Marshallable.CopyOutN. 2388 func (s *Statfs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2389 // Construct a slice backed by dst's underlying memory. 2390 var buf []byte 2391 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2392 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2393 hdr.Len = s.SizeBytes() 2394 hdr.Cap = s.SizeBytes() 2395 2396 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2397 // Since we bypassed the compiler's escape analysis, indicate that s 2398 // must live until the use above. 2399 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2400 return length, err 2401 } 2402 2403 // CopyOut implements marshal.Marshallable.CopyOut. 2404 func (s *Statfs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2405 return s.CopyOutN(cc, addr, s.SizeBytes()) 2406 } 2407 2408 // CopyIn implements marshal.Marshallable.CopyIn. 2409 func (s *Statfs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2410 // Construct a slice backed by dst's underlying memory. 2411 var buf []byte 2412 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2413 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2414 hdr.Len = s.SizeBytes() 2415 hdr.Cap = s.SizeBytes() 2416 2417 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2418 // Since we bypassed the compiler's escape analysis, indicate that s 2419 // must live until the use above. 2420 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2421 return length, err 2422 } 2423 2424 // WriteTo implements io.WriterTo.WriteTo. 2425 func (s *Statfs) WriteTo(writer io.Writer) (int64, error) { 2426 // Construct a slice backed by dst's underlying memory. 2427 var buf []byte 2428 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2429 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2430 hdr.Len = s.SizeBytes() 2431 hdr.Cap = s.SizeBytes() 2432 2433 length, err := writer.Write(buf) 2434 // Since we bypassed the compiler's escape analysis, indicate that s 2435 // must live until the use above. 2436 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2437 return int64(length), err 2438 } 2439 2440 // Packed implements marshal.Marshallable.Packed. 2441 // 2442 //go:nosplit 2443 func (s *CString) Packed() bool { 2444 // Type CString is dynamic so it might have slice/string headers. Hence, it is not packed. 2445 return false 2446 } 2447 2448 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2449 func (s *CString) MarshalUnsafe(dst []byte) []byte { 2450 // Type CString doesn't have a packed layout in memory, fallback to MarshalBytes. 2451 return s.MarshalBytes(dst) 2452 } 2453 2454 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2455 func (s *CString) UnmarshalUnsafe(src []byte) []byte { 2456 // Type CString doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2457 return s.UnmarshalBytes(src) 2458 } 2459 2460 // CopyOutN implements marshal.Marshallable.CopyOutN. 2461 // 2462 //go:nosplit 2463 func (s *CString) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2464 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2465 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2466 s.MarshalBytes(buf) // escapes: fallback. 2467 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2468 } 2469 2470 // CopyOut implements marshal.Marshallable.CopyOut. 2471 func (s *CString) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2472 return s.CopyOutN(cc, addr, s.SizeBytes()) 2473 } 2474 2475 // CopyIn implements marshal.Marshallable.CopyIn. 2476 func (s *CString) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2477 // Type CString doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2478 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2479 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2480 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2481 // partially unmarshalled struct. 2482 s.UnmarshalBytes(buf) // escapes: fallback. 2483 return length, err 2484 } 2485 2486 // WriteTo implements io.WriterTo.WriteTo. 2487 func (s *CString) WriteTo(writer io.Writer) (int64, error) { 2488 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2489 buf := make([]byte, s.SizeBytes()) 2490 s.MarshalBytes(buf) 2491 length, err := writer.Write(buf) 2492 return int64(length), err 2493 } 2494 2495 // SizeBytes implements marshal.Marshallable.SizeBytes. 2496 func (f *FUSEAccessIn) SizeBytes() int { 2497 return 8 2498 } 2499 2500 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2501 func (f *FUSEAccessIn) MarshalBytes(dst []byte) []byte { 2502 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mask)) 2503 dst = dst[4:] 2504 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2505 dst = dst[4:] 2506 return dst 2507 } 2508 2509 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2510 func (f *FUSEAccessIn) UnmarshalBytes(src []byte) []byte { 2511 f.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2512 src = src[4:] 2513 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2514 src = src[4:] 2515 return src 2516 } 2517 2518 // Packed implements marshal.Marshallable.Packed. 2519 // 2520 //go:nosplit 2521 func (f *FUSEAccessIn) Packed() bool { 2522 return true 2523 } 2524 2525 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2526 func (f *FUSEAccessIn) MarshalUnsafe(dst []byte) []byte { 2527 size := f.SizeBytes() 2528 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2529 return dst[size:] 2530 } 2531 2532 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2533 func (f *FUSEAccessIn) UnmarshalUnsafe(src []byte) []byte { 2534 size := f.SizeBytes() 2535 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2536 return src[size:] 2537 } 2538 2539 // CopyOutN implements marshal.Marshallable.CopyOutN. 2540 func (f *FUSEAccessIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2541 // Construct a slice backed by dst's underlying memory. 2542 var buf []byte 2543 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2544 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2545 hdr.Len = f.SizeBytes() 2546 hdr.Cap = f.SizeBytes() 2547 2548 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2549 // Since we bypassed the compiler's escape analysis, indicate that f 2550 // must live until the use above. 2551 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2552 return length, err 2553 } 2554 2555 // CopyOut implements marshal.Marshallable.CopyOut. 2556 func (f *FUSEAccessIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2557 return f.CopyOutN(cc, addr, f.SizeBytes()) 2558 } 2559 2560 // CopyIn implements marshal.Marshallable.CopyIn. 2561 func (f *FUSEAccessIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2562 // Construct a slice backed by dst's underlying memory. 2563 var buf []byte 2564 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2565 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2566 hdr.Len = f.SizeBytes() 2567 hdr.Cap = f.SizeBytes() 2568 2569 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2570 // Since we bypassed the compiler's escape analysis, indicate that f 2571 // must live until the use above. 2572 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2573 return length, err 2574 } 2575 2576 // WriteTo implements io.WriterTo.WriteTo. 2577 func (f *FUSEAccessIn) WriteTo(writer io.Writer) (int64, error) { 2578 // Construct a slice backed by dst's underlying memory. 2579 var buf []byte 2580 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2581 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2582 hdr.Len = f.SizeBytes() 2583 hdr.Cap = f.SizeBytes() 2584 2585 length, err := writer.Write(buf) 2586 // Since we bypassed the compiler's escape analysis, indicate that f 2587 // must live until the use above. 2588 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2589 return int64(length), err 2590 } 2591 2592 // SizeBytes implements marshal.Marshallable.SizeBytes. 2593 func (a *FUSEAttr) SizeBytes() int { 2594 return 88 2595 } 2596 2597 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2598 func (a *FUSEAttr) MarshalBytes(dst []byte) []byte { 2599 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ino)) 2600 dst = dst[8:] 2601 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Size)) 2602 dst = dst[8:] 2603 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Blocks)) 2604 dst = dst[8:] 2605 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Atime)) 2606 dst = dst[8:] 2607 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Mtime)) 2608 dst = dst[8:] 2609 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ctime)) 2610 dst = dst[8:] 2611 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.AtimeNsec)) 2612 dst = dst[4:] 2613 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.MtimeNsec)) 2614 dst = dst[4:] 2615 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.CtimeNsec)) 2616 dst = dst[4:] 2617 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Mode)) 2618 dst = dst[4:] 2619 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Nlink)) 2620 dst = dst[4:] 2621 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.UID)) 2622 dst = dst[4:] 2623 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.GID)) 2624 dst = dst[4:] 2625 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Rdev)) 2626 dst = dst[4:] 2627 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.BlkSize)) 2628 dst = dst[4:] 2629 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2630 dst = dst[4:] 2631 return dst 2632 } 2633 2634 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2635 func (a *FUSEAttr) UnmarshalBytes(src []byte) []byte { 2636 a.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2637 src = src[8:] 2638 a.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2639 src = src[8:] 2640 a.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2641 src = src[8:] 2642 a.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2643 src = src[8:] 2644 a.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2645 src = src[8:] 2646 a.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2647 src = src[8:] 2648 a.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2649 src = src[4:] 2650 a.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2651 src = src[4:] 2652 a.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2653 src = src[4:] 2654 a.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2655 src = src[4:] 2656 a.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2657 src = src[4:] 2658 a.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2659 src = src[4:] 2660 a.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2661 src = src[4:] 2662 a.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2663 src = src[4:] 2664 a.BlkSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2665 src = src[4:] 2666 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2667 src = src[4:] 2668 return src 2669 } 2670 2671 // Packed implements marshal.Marshallable.Packed. 2672 // 2673 //go:nosplit 2674 func (a *FUSEAttr) Packed() bool { 2675 return true 2676 } 2677 2678 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2679 func (a *FUSEAttr) MarshalUnsafe(dst []byte) []byte { 2680 size := a.SizeBytes() 2681 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size)) 2682 return dst[size:] 2683 } 2684 2685 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2686 func (a *FUSEAttr) UnmarshalUnsafe(src []byte) []byte { 2687 size := a.SizeBytes() 2688 gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size)) 2689 return src[size:] 2690 } 2691 2692 // CopyOutN implements marshal.Marshallable.CopyOutN. 2693 func (a *FUSEAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2694 // Construct a slice backed by dst's underlying memory. 2695 var buf []byte 2696 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2697 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2698 hdr.Len = a.SizeBytes() 2699 hdr.Cap = a.SizeBytes() 2700 2701 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2702 // Since we bypassed the compiler's escape analysis, indicate that a 2703 // must live until the use above. 2704 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2705 return length, err 2706 } 2707 2708 // CopyOut implements marshal.Marshallable.CopyOut. 2709 func (a *FUSEAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2710 return a.CopyOutN(cc, addr, a.SizeBytes()) 2711 } 2712 2713 // CopyIn implements marshal.Marshallable.CopyIn. 2714 func (a *FUSEAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2715 // Construct a slice backed by dst's underlying memory. 2716 var buf []byte 2717 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2718 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2719 hdr.Len = a.SizeBytes() 2720 hdr.Cap = a.SizeBytes() 2721 2722 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2723 // Since we bypassed the compiler's escape analysis, indicate that a 2724 // must live until the use above. 2725 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2726 return length, err 2727 } 2728 2729 // WriteTo implements io.WriterTo.WriteTo. 2730 func (a *FUSEAttr) WriteTo(writer io.Writer) (int64, error) { 2731 // Construct a slice backed by dst's underlying memory. 2732 var buf []byte 2733 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2734 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2735 hdr.Len = a.SizeBytes() 2736 hdr.Cap = a.SizeBytes() 2737 2738 length, err := writer.Write(buf) 2739 // Since we bypassed the compiler's escape analysis, indicate that a 2740 // must live until the use above. 2741 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2742 return int64(length), err 2743 } 2744 2745 // SizeBytes implements marshal.Marshallable.SizeBytes. 2746 func (f *FUSEAttrOut) SizeBytes() int { 2747 return 16 + 2748 (*FUSEAttr)(nil).SizeBytes() 2749 } 2750 2751 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2752 func (f *FUSEAttrOut) MarshalBytes(dst []byte) []byte { 2753 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 2754 dst = dst[8:] 2755 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNsec)) 2756 dst = dst[4:] 2757 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2758 dst = dst[4:] 2759 dst = f.Attr.MarshalUnsafe(dst) 2760 return dst 2761 } 2762 2763 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2764 func (f *FUSEAttrOut) UnmarshalBytes(src []byte) []byte { 2765 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2766 src = src[8:] 2767 f.AttrValidNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2768 src = src[4:] 2769 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2770 src = src[4:] 2771 src = f.Attr.UnmarshalUnsafe(src) 2772 return src 2773 } 2774 2775 // Packed implements marshal.Marshallable.Packed. 2776 // 2777 //go:nosplit 2778 func (f *FUSEAttrOut) Packed() bool { 2779 return f.Attr.Packed() 2780 } 2781 2782 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2783 func (f *FUSEAttrOut) MarshalUnsafe(dst []byte) []byte { 2784 if f.Attr.Packed() { 2785 size := f.SizeBytes() 2786 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2787 return dst[size:] 2788 } 2789 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes. 2790 return f.MarshalBytes(dst) 2791 } 2792 2793 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2794 func (f *FUSEAttrOut) UnmarshalUnsafe(src []byte) []byte { 2795 if f.Attr.Packed() { 2796 size := f.SizeBytes() 2797 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2798 return src[size:] 2799 } 2800 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2801 return f.UnmarshalBytes(src) 2802 } 2803 2804 // CopyOutN implements marshal.Marshallable.CopyOutN. 2805 func (f *FUSEAttrOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2806 if !f.Attr.Packed() { 2807 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 2808 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 2809 f.MarshalBytes(buf) // escapes: fallback. 2810 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2811 } 2812 2813 // Construct a slice backed by dst's underlying memory. 2814 var buf []byte 2815 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2816 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2817 hdr.Len = f.SizeBytes() 2818 hdr.Cap = f.SizeBytes() 2819 2820 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2821 // Since we bypassed the compiler's escape analysis, indicate that f 2822 // must live until the use above. 2823 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2824 return length, err 2825 } 2826 2827 // CopyOut implements marshal.Marshallable.CopyOut. 2828 func (f *FUSEAttrOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2829 return f.CopyOutN(cc, addr, f.SizeBytes()) 2830 } 2831 2832 // CopyIn implements marshal.Marshallable.CopyIn. 2833 func (f *FUSEAttrOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2834 if !f.Attr.Packed() { 2835 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2836 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 2837 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2838 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2839 // partially unmarshalled struct. 2840 f.UnmarshalBytes(buf) // escapes: fallback. 2841 return length, err 2842 } 2843 2844 // Construct a slice backed by dst's underlying memory. 2845 var buf []byte 2846 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2847 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2848 hdr.Len = f.SizeBytes() 2849 hdr.Cap = f.SizeBytes() 2850 2851 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2852 // Since we bypassed the compiler's escape analysis, indicate that f 2853 // must live until the use above. 2854 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2855 return length, err 2856 } 2857 2858 // WriteTo implements io.WriterTo.WriteTo. 2859 func (f *FUSEAttrOut) WriteTo(writer io.Writer) (int64, error) { 2860 if !f.Attr.Packed() { 2861 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 2862 buf := make([]byte, f.SizeBytes()) 2863 f.MarshalBytes(buf) 2864 length, err := writer.Write(buf) 2865 return int64(length), err 2866 } 2867 2868 // Construct a slice backed by dst's underlying memory. 2869 var buf []byte 2870 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2871 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2872 hdr.Len = f.SizeBytes() 2873 hdr.Cap = f.SizeBytes() 2874 2875 length, err := writer.Write(buf) 2876 // Since we bypassed the compiler's escape analysis, indicate that f 2877 // must live until the use above. 2878 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2879 return int64(length), err 2880 } 2881 2882 // Packed implements marshal.Marshallable.Packed. 2883 // 2884 //go:nosplit 2885 func (r *FUSECreateIn) Packed() bool { 2886 // Type FUSECreateIn is dynamic so it might have slice/string headers. Hence, it is not packed. 2887 return false 2888 } 2889 2890 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2891 func (r *FUSECreateIn) MarshalUnsafe(dst []byte) []byte { 2892 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to MarshalBytes. 2893 return r.MarshalBytes(dst) 2894 } 2895 2896 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2897 func (r *FUSECreateIn) UnmarshalUnsafe(src []byte) []byte { 2898 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2899 return r.UnmarshalBytes(src) 2900 } 2901 2902 // CopyOutN implements marshal.Marshallable.CopyOutN. 2903 // 2904 //go:nosplit 2905 func (r *FUSECreateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2906 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 2907 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2908 r.MarshalBytes(buf) // escapes: fallback. 2909 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2910 } 2911 2912 // CopyOut implements marshal.Marshallable.CopyOut. 2913 func (r *FUSECreateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2914 return r.CopyOutN(cc, addr, r.SizeBytes()) 2915 } 2916 2917 // CopyIn implements marshal.Marshallable.CopyIn. 2918 func (r *FUSECreateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2919 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2920 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 2921 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2922 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2923 // partially unmarshalled struct. 2924 r.UnmarshalBytes(buf) // escapes: fallback. 2925 return length, err 2926 } 2927 2928 // WriteTo implements io.WriterTo.WriteTo. 2929 func (r *FUSECreateIn) WriteTo(writer io.Writer) (int64, error) { 2930 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 2931 buf := make([]byte, r.SizeBytes()) 2932 r.MarshalBytes(buf) 2933 length, err := writer.Write(buf) 2934 return int64(length), err 2935 } 2936 2937 // SizeBytes implements marshal.Marshallable.SizeBytes. 2938 func (f *FUSECreateMeta) SizeBytes() int { 2939 return 16 2940 } 2941 2942 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2943 func (f *FUSECreateMeta) MarshalBytes(dst []byte) []byte { 2944 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 2945 dst = dst[4:] 2946 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 2947 dst = dst[4:] 2948 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 2949 dst = dst[4:] 2950 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2951 dst = dst[4:] 2952 return dst 2953 } 2954 2955 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2956 func (f *FUSECreateMeta) UnmarshalBytes(src []byte) []byte { 2957 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2958 src = src[4:] 2959 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2960 src = src[4:] 2961 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2962 src = src[4:] 2963 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2964 src = src[4:] 2965 return src 2966 } 2967 2968 // Packed implements marshal.Marshallable.Packed. 2969 // 2970 //go:nosplit 2971 func (f *FUSECreateMeta) Packed() bool { 2972 return true 2973 } 2974 2975 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2976 func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) []byte { 2977 size := f.SizeBytes() 2978 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2979 return dst[size:] 2980 } 2981 2982 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2983 func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) []byte { 2984 size := f.SizeBytes() 2985 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2986 return src[size:] 2987 } 2988 2989 // CopyOutN implements marshal.Marshallable.CopyOutN. 2990 func (f *FUSECreateMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2991 // Construct a slice backed by dst's underlying memory. 2992 var buf []byte 2993 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2994 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2995 hdr.Len = f.SizeBytes() 2996 hdr.Cap = f.SizeBytes() 2997 2998 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2999 // Since we bypassed the compiler's escape analysis, indicate that f 3000 // must live until the use above. 3001 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3002 return length, err 3003 } 3004 3005 // CopyOut implements marshal.Marshallable.CopyOut. 3006 func (f *FUSECreateMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3007 return f.CopyOutN(cc, addr, f.SizeBytes()) 3008 } 3009 3010 // CopyIn implements marshal.Marshallable.CopyIn. 3011 func (f *FUSECreateMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3012 // Construct a slice backed by dst's underlying memory. 3013 var buf []byte 3014 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3015 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3016 hdr.Len = f.SizeBytes() 3017 hdr.Cap = f.SizeBytes() 3018 3019 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3020 // Since we bypassed the compiler's escape analysis, indicate that f 3021 // must live until the use above. 3022 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3023 return length, err 3024 } 3025 3026 // WriteTo implements io.WriterTo.WriteTo. 3027 func (f *FUSECreateMeta) WriteTo(writer io.Writer) (int64, error) { 3028 // Construct a slice backed by dst's underlying memory. 3029 var buf []byte 3030 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3031 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3032 hdr.Len = f.SizeBytes() 3033 hdr.Cap = f.SizeBytes() 3034 3035 length, err := writer.Write(buf) 3036 // Since we bypassed the compiler's escape analysis, indicate that f 3037 // must live until the use above. 3038 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3039 return int64(length), err 3040 } 3041 3042 // SizeBytes implements marshal.Marshallable.SizeBytes. 3043 func (f *FUSECreateOut) SizeBytes() int { 3044 return 0 + 3045 (*FUSEEntryOut)(nil).SizeBytes() + 3046 (*FUSEOpenOut)(nil).SizeBytes() 3047 } 3048 3049 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3050 func (f *FUSECreateOut) MarshalBytes(dst []byte) []byte { 3051 dst = f.FUSEEntryOut.MarshalUnsafe(dst) 3052 dst = f.FUSEOpenOut.MarshalUnsafe(dst) 3053 return dst 3054 } 3055 3056 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3057 func (f *FUSECreateOut) UnmarshalBytes(src []byte) []byte { 3058 src = f.FUSEEntryOut.UnmarshalUnsafe(src) 3059 src = f.FUSEOpenOut.UnmarshalUnsafe(src) 3060 return src 3061 } 3062 3063 // Packed implements marshal.Marshallable.Packed. 3064 // 3065 //go:nosplit 3066 func (f *FUSECreateOut) Packed() bool { 3067 return f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() 3068 } 3069 3070 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3071 func (f *FUSECreateOut) MarshalUnsafe(dst []byte) []byte { 3072 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3073 size := f.SizeBytes() 3074 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3075 return dst[size:] 3076 } 3077 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3078 return f.MarshalBytes(dst) 3079 } 3080 3081 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3082 func (f *FUSECreateOut) UnmarshalUnsafe(src []byte) []byte { 3083 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3084 size := f.SizeBytes() 3085 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3086 return src[size:] 3087 } 3088 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3089 return f.UnmarshalBytes(src) 3090 } 3091 3092 // CopyOutN implements marshal.Marshallable.CopyOutN. 3093 func (f *FUSECreateOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3094 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3095 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3096 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3097 f.MarshalBytes(buf) // escapes: fallback. 3098 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3099 } 3100 3101 // Construct a slice backed by dst's underlying memory. 3102 var buf []byte 3103 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3104 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3105 hdr.Len = f.SizeBytes() 3106 hdr.Cap = f.SizeBytes() 3107 3108 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3109 // Since we bypassed the compiler's escape analysis, indicate that f 3110 // must live until the use above. 3111 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3112 return length, err 3113 } 3114 3115 // CopyOut implements marshal.Marshallable.CopyOut. 3116 func (f *FUSECreateOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3117 return f.CopyOutN(cc, addr, f.SizeBytes()) 3118 } 3119 3120 // CopyIn implements marshal.Marshallable.CopyIn. 3121 func (f *FUSECreateOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3122 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3123 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3124 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3125 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3126 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3127 // partially unmarshalled struct. 3128 f.UnmarshalBytes(buf) // escapes: fallback. 3129 return length, err 3130 } 3131 3132 // Construct a slice backed by dst's underlying memory. 3133 var buf []byte 3134 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3135 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3136 hdr.Len = f.SizeBytes() 3137 hdr.Cap = f.SizeBytes() 3138 3139 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3140 // Since we bypassed the compiler's escape analysis, indicate that f 3141 // must live until the use above. 3142 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3143 return length, err 3144 } 3145 3146 // WriteTo implements io.WriterTo.WriteTo. 3147 func (f *FUSECreateOut) WriteTo(writer io.Writer) (int64, error) { 3148 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3149 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3150 buf := make([]byte, f.SizeBytes()) 3151 f.MarshalBytes(buf) 3152 length, err := writer.Write(buf) 3153 return int64(length), err 3154 } 3155 3156 // Construct a slice backed by dst's underlying memory. 3157 var buf []byte 3158 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3159 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3160 hdr.Len = f.SizeBytes() 3161 hdr.Cap = f.SizeBytes() 3162 3163 length, err := writer.Write(buf) 3164 // Since we bypassed the compiler's escape analysis, indicate that f 3165 // must live until the use above. 3166 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3167 return int64(length), err 3168 } 3169 3170 // Packed implements marshal.Marshallable.Packed. 3171 // 3172 //go:nosplit 3173 func (r *FUSEDirent) Packed() bool { 3174 // Type FUSEDirent is dynamic so it might have slice/string headers. Hence, it is not packed. 3175 return false 3176 } 3177 3178 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3179 func (r *FUSEDirent) MarshalUnsafe(dst []byte) []byte { 3180 // Type FUSEDirent doesn't have a packed layout in memory, fallback to MarshalBytes. 3181 return r.MarshalBytes(dst) 3182 } 3183 3184 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3185 func (r *FUSEDirent) UnmarshalUnsafe(src []byte) []byte { 3186 // Type FUSEDirent doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3187 return r.UnmarshalBytes(src) 3188 } 3189 3190 // CopyOutN implements marshal.Marshallable.CopyOutN. 3191 // 3192 //go:nosplit 3193 func (r *FUSEDirent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3194 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3195 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3196 r.MarshalBytes(buf) // escapes: fallback. 3197 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3198 } 3199 3200 // CopyOut implements marshal.Marshallable.CopyOut. 3201 func (r *FUSEDirent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3202 return r.CopyOutN(cc, addr, r.SizeBytes()) 3203 } 3204 3205 // CopyIn implements marshal.Marshallable.CopyIn. 3206 func (r *FUSEDirent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3207 // Type FUSEDirent doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3208 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3209 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3210 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3211 // partially unmarshalled struct. 3212 r.UnmarshalBytes(buf) // escapes: fallback. 3213 return length, err 3214 } 3215 3216 // WriteTo implements io.WriterTo.WriteTo. 3217 func (r *FUSEDirent) WriteTo(writer io.Writer) (int64, error) { 3218 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3219 buf := make([]byte, r.SizeBytes()) 3220 r.MarshalBytes(buf) 3221 length, err := writer.Write(buf) 3222 return int64(length), err 3223 } 3224 3225 // SizeBytes implements marshal.Marshallable.SizeBytes. 3226 func (f *FUSEDirentMeta) SizeBytes() int { 3227 return 24 3228 } 3229 3230 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3231 func (f *FUSEDirentMeta) MarshalBytes(dst []byte) []byte { 3232 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino)) 3233 dst = dst[8:] 3234 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Off)) 3235 dst = dst[8:] 3236 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLen)) 3237 dst = dst[4:] 3238 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 3239 dst = dst[4:] 3240 return dst 3241 } 3242 3243 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3244 func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) []byte { 3245 f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3246 src = src[8:] 3247 f.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3248 src = src[8:] 3249 f.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3250 src = src[4:] 3251 f.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3252 src = src[4:] 3253 return src 3254 } 3255 3256 // Packed implements marshal.Marshallable.Packed. 3257 // 3258 //go:nosplit 3259 func (f *FUSEDirentMeta) Packed() bool { 3260 return true 3261 } 3262 3263 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3264 func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) []byte { 3265 size := f.SizeBytes() 3266 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3267 return dst[size:] 3268 } 3269 3270 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3271 func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) []byte { 3272 size := f.SizeBytes() 3273 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3274 return src[size:] 3275 } 3276 3277 // CopyOutN implements marshal.Marshallable.CopyOutN. 3278 func (f *FUSEDirentMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3279 // Construct a slice backed by dst's underlying memory. 3280 var buf []byte 3281 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3282 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3283 hdr.Len = f.SizeBytes() 3284 hdr.Cap = f.SizeBytes() 3285 3286 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3287 // Since we bypassed the compiler's escape analysis, indicate that f 3288 // must live until the use above. 3289 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3290 return length, err 3291 } 3292 3293 // CopyOut implements marshal.Marshallable.CopyOut. 3294 func (f *FUSEDirentMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3295 return f.CopyOutN(cc, addr, f.SizeBytes()) 3296 } 3297 3298 // CopyIn implements marshal.Marshallable.CopyIn. 3299 func (f *FUSEDirentMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3300 // Construct a slice backed by dst's underlying memory. 3301 var buf []byte 3302 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3303 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3304 hdr.Len = f.SizeBytes() 3305 hdr.Cap = f.SizeBytes() 3306 3307 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3308 // Since we bypassed the compiler's escape analysis, indicate that f 3309 // must live until the use above. 3310 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3311 return length, err 3312 } 3313 3314 // WriteTo implements io.WriterTo.WriteTo. 3315 func (f *FUSEDirentMeta) WriteTo(writer io.Writer) (int64, error) { 3316 // Construct a slice backed by dst's underlying memory. 3317 var buf []byte 3318 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3319 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3320 hdr.Len = f.SizeBytes() 3321 hdr.Cap = f.SizeBytes() 3322 3323 length, err := writer.Write(buf) 3324 // Since we bypassed the compiler's escape analysis, indicate that f 3325 // must live until the use above. 3326 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3327 return int64(length), err 3328 } 3329 3330 // Packed implements marshal.Marshallable.Packed. 3331 // 3332 //go:nosplit 3333 func (r *FUSEDirents) Packed() bool { 3334 // Type FUSEDirents is dynamic so it might have slice/string headers. Hence, it is not packed. 3335 return false 3336 } 3337 3338 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3339 func (r *FUSEDirents) MarshalUnsafe(dst []byte) []byte { 3340 // Type FUSEDirents doesn't have a packed layout in memory, fallback to MarshalBytes. 3341 return r.MarshalBytes(dst) 3342 } 3343 3344 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3345 func (r *FUSEDirents) UnmarshalUnsafe(src []byte) []byte { 3346 // Type FUSEDirents doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3347 return r.UnmarshalBytes(src) 3348 } 3349 3350 // CopyOutN implements marshal.Marshallable.CopyOutN. 3351 // 3352 //go:nosplit 3353 func (r *FUSEDirents) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3354 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3355 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3356 r.MarshalBytes(buf) // escapes: fallback. 3357 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3358 } 3359 3360 // CopyOut implements marshal.Marshallable.CopyOut. 3361 func (r *FUSEDirents) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3362 return r.CopyOutN(cc, addr, r.SizeBytes()) 3363 } 3364 3365 // CopyIn implements marshal.Marshallable.CopyIn. 3366 func (r *FUSEDirents) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3367 // Type FUSEDirents doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3368 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3369 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3370 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3371 // partially unmarshalled struct. 3372 r.UnmarshalBytes(buf) // escapes: fallback. 3373 return length, err 3374 } 3375 3376 // WriteTo implements io.WriterTo.WriteTo. 3377 func (r *FUSEDirents) WriteTo(writer io.Writer) (int64, error) { 3378 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3379 buf := make([]byte, r.SizeBytes()) 3380 r.MarshalBytes(buf) 3381 length, err := writer.Write(buf) 3382 return int64(length), err 3383 } 3384 3385 // Packed implements marshal.Marshallable.Packed. 3386 // 3387 //go:nosplit 3388 func (r *FUSEEmptyIn) Packed() bool { 3389 // Type FUSEEmptyIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3390 return false 3391 } 3392 3393 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3394 func (r *FUSEEmptyIn) MarshalUnsafe(dst []byte) []byte { 3395 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3396 return r.MarshalBytes(dst) 3397 } 3398 3399 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3400 func (r *FUSEEmptyIn) UnmarshalUnsafe(src []byte) []byte { 3401 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3402 return r.UnmarshalBytes(src) 3403 } 3404 3405 // CopyOutN implements marshal.Marshallable.CopyOutN. 3406 // 3407 //go:nosplit 3408 func (r *FUSEEmptyIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3409 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3410 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3411 r.MarshalBytes(buf) // escapes: fallback. 3412 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3413 } 3414 3415 // CopyOut implements marshal.Marshallable.CopyOut. 3416 func (r *FUSEEmptyIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3417 return r.CopyOutN(cc, addr, r.SizeBytes()) 3418 } 3419 3420 // CopyIn implements marshal.Marshallable.CopyIn. 3421 func (r *FUSEEmptyIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3422 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3423 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3424 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3425 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3426 // partially unmarshalled struct. 3427 r.UnmarshalBytes(buf) // escapes: fallback. 3428 return length, err 3429 } 3430 3431 // WriteTo implements io.WriterTo.WriteTo. 3432 func (r *FUSEEmptyIn) WriteTo(writer io.Writer) (int64, error) { 3433 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3434 buf := make([]byte, r.SizeBytes()) 3435 r.MarshalBytes(buf) 3436 length, err := writer.Write(buf) 3437 return int64(length), err 3438 } 3439 3440 // SizeBytes implements marshal.Marshallable.SizeBytes. 3441 func (f *FUSEEntryOut) SizeBytes() int { 3442 return 40 + 3443 (*FUSEAttr)(nil).SizeBytes() 3444 } 3445 3446 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3447 func (f *FUSEEntryOut) MarshalBytes(dst []byte) []byte { 3448 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3449 dst = dst[8:] 3450 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Generation)) 3451 dst = dst[8:] 3452 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.EntryValid)) 3453 dst = dst[8:] 3454 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 3455 dst = dst[8:] 3456 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.EntryValidNSec)) 3457 dst = dst[4:] 3458 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNSec)) 3459 dst = dst[4:] 3460 dst = f.Attr.MarshalUnsafe(dst) 3461 return dst 3462 } 3463 3464 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3465 func (f *FUSEEntryOut) UnmarshalBytes(src []byte) []byte { 3466 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3467 src = src[8:] 3468 f.Generation = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3469 src = src[8:] 3470 f.EntryValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3471 src = src[8:] 3472 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3473 src = src[8:] 3474 f.EntryValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3475 src = src[4:] 3476 f.AttrValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3477 src = src[4:] 3478 src = f.Attr.UnmarshalUnsafe(src) 3479 return src 3480 } 3481 3482 // Packed implements marshal.Marshallable.Packed. 3483 // 3484 //go:nosplit 3485 func (f *FUSEEntryOut) Packed() bool { 3486 return f.Attr.Packed() 3487 } 3488 3489 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3490 func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) []byte { 3491 if f.Attr.Packed() { 3492 size := f.SizeBytes() 3493 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3494 return dst[size:] 3495 } 3496 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3497 return f.MarshalBytes(dst) 3498 } 3499 3500 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3501 func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) []byte { 3502 if f.Attr.Packed() { 3503 size := f.SizeBytes() 3504 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3505 return src[size:] 3506 } 3507 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3508 return f.UnmarshalBytes(src) 3509 } 3510 3511 // CopyOutN implements marshal.Marshallable.CopyOutN. 3512 func (f *FUSEEntryOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3513 if !f.Attr.Packed() { 3514 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3515 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3516 f.MarshalBytes(buf) // escapes: fallback. 3517 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3518 } 3519 3520 // Construct a slice backed by dst's underlying memory. 3521 var buf []byte 3522 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3523 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3524 hdr.Len = f.SizeBytes() 3525 hdr.Cap = f.SizeBytes() 3526 3527 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3528 // Since we bypassed the compiler's escape analysis, indicate that f 3529 // must live until the use above. 3530 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3531 return length, err 3532 } 3533 3534 // CopyOut implements marshal.Marshallable.CopyOut. 3535 func (f *FUSEEntryOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3536 return f.CopyOutN(cc, addr, f.SizeBytes()) 3537 } 3538 3539 // CopyIn implements marshal.Marshallable.CopyIn. 3540 func (f *FUSEEntryOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3541 if !f.Attr.Packed() { 3542 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3543 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3544 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3545 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3546 // partially unmarshalled struct. 3547 f.UnmarshalBytes(buf) // escapes: fallback. 3548 return length, err 3549 } 3550 3551 // Construct a slice backed by dst's underlying memory. 3552 var buf []byte 3553 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3554 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3555 hdr.Len = f.SizeBytes() 3556 hdr.Cap = f.SizeBytes() 3557 3558 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3559 // Since we bypassed the compiler's escape analysis, indicate that f 3560 // must live until the use above. 3561 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3562 return length, err 3563 } 3564 3565 // WriteTo implements io.WriterTo.WriteTo. 3566 func (f *FUSEEntryOut) WriteTo(writer io.Writer) (int64, error) { 3567 if !f.Attr.Packed() { 3568 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3569 buf := make([]byte, f.SizeBytes()) 3570 f.MarshalBytes(buf) 3571 length, err := writer.Write(buf) 3572 return int64(length), err 3573 } 3574 3575 // Construct a slice backed by dst's underlying memory. 3576 var buf []byte 3577 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3578 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3579 hdr.Len = f.SizeBytes() 3580 hdr.Cap = f.SizeBytes() 3581 3582 length, err := writer.Write(buf) 3583 // Since we bypassed the compiler's escape analysis, indicate that f 3584 // must live until the use above. 3585 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3586 return int64(length), err 3587 } 3588 3589 // SizeBytes implements marshal.Marshallable.SizeBytes. 3590 func (f *FUSEFallocateIn) SizeBytes() int { 3591 return 32 3592 } 3593 3594 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3595 func (f *FUSEFallocateIn) MarshalBytes(dst []byte) []byte { 3596 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3597 dst = dst[8:] 3598 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 3599 dst = dst[8:] 3600 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Length)) 3601 dst = dst[8:] 3602 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 3603 dst = dst[4:] 3604 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3605 dst = dst[4:] 3606 return dst 3607 } 3608 3609 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3610 func (f *FUSEFallocateIn) UnmarshalBytes(src []byte) []byte { 3611 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3612 src = src[8:] 3613 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3614 src = src[8:] 3615 f.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3616 src = src[8:] 3617 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3618 src = src[4:] 3619 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3620 src = src[4:] 3621 return src 3622 } 3623 3624 // Packed implements marshal.Marshallable.Packed. 3625 // 3626 //go:nosplit 3627 func (f *FUSEFallocateIn) Packed() bool { 3628 return true 3629 } 3630 3631 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3632 func (f *FUSEFallocateIn) MarshalUnsafe(dst []byte) []byte { 3633 size := f.SizeBytes() 3634 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3635 return dst[size:] 3636 } 3637 3638 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3639 func (f *FUSEFallocateIn) UnmarshalUnsafe(src []byte) []byte { 3640 size := f.SizeBytes() 3641 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3642 return src[size:] 3643 } 3644 3645 // CopyOutN implements marshal.Marshallable.CopyOutN. 3646 func (f *FUSEFallocateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3647 // Construct a slice backed by dst's underlying memory. 3648 var buf []byte 3649 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3650 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3651 hdr.Len = f.SizeBytes() 3652 hdr.Cap = f.SizeBytes() 3653 3654 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3655 // Since we bypassed the compiler's escape analysis, indicate that f 3656 // must live until the use above. 3657 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3658 return length, err 3659 } 3660 3661 // CopyOut implements marshal.Marshallable.CopyOut. 3662 func (f *FUSEFallocateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3663 return f.CopyOutN(cc, addr, f.SizeBytes()) 3664 } 3665 3666 // CopyIn implements marshal.Marshallable.CopyIn. 3667 func (f *FUSEFallocateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3668 // Construct a slice backed by dst's underlying memory. 3669 var buf []byte 3670 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3671 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3672 hdr.Len = f.SizeBytes() 3673 hdr.Cap = f.SizeBytes() 3674 3675 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3676 // Since we bypassed the compiler's escape analysis, indicate that f 3677 // must live until the use above. 3678 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3679 return length, err 3680 } 3681 3682 // WriteTo implements io.WriterTo.WriteTo. 3683 func (f *FUSEFallocateIn) WriteTo(writer io.Writer) (int64, error) { 3684 // Construct a slice backed by dst's underlying memory. 3685 var buf []byte 3686 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3687 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3688 hdr.Len = f.SizeBytes() 3689 hdr.Cap = f.SizeBytes() 3690 3691 length, err := writer.Write(buf) 3692 // Since we bypassed the compiler's escape analysis, indicate that f 3693 // must live until the use above. 3694 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3695 return int64(length), err 3696 } 3697 3698 // SizeBytes implements marshal.Marshallable.SizeBytes. 3699 func (f *FUSEFsyncIn) SizeBytes() int { 3700 return 16 3701 } 3702 3703 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3704 func (f *FUSEFsyncIn) MarshalBytes(dst []byte) []byte { 3705 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3706 dst = dst[8:] 3707 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FsyncFlags)) 3708 dst = dst[4:] 3709 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3710 dst = dst[4:] 3711 return dst 3712 } 3713 3714 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3715 func (f *FUSEFsyncIn) UnmarshalBytes(src []byte) []byte { 3716 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3717 src = src[8:] 3718 f.FsyncFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3719 src = src[4:] 3720 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3721 src = src[4:] 3722 return src 3723 } 3724 3725 // Packed implements marshal.Marshallable.Packed. 3726 // 3727 //go:nosplit 3728 func (f *FUSEFsyncIn) Packed() bool { 3729 return true 3730 } 3731 3732 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3733 func (f *FUSEFsyncIn) MarshalUnsafe(dst []byte) []byte { 3734 size := f.SizeBytes() 3735 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3736 return dst[size:] 3737 } 3738 3739 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3740 func (f *FUSEFsyncIn) UnmarshalUnsafe(src []byte) []byte { 3741 size := f.SizeBytes() 3742 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3743 return src[size:] 3744 } 3745 3746 // CopyOutN implements marshal.Marshallable.CopyOutN. 3747 func (f *FUSEFsyncIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3748 // Construct a slice backed by dst's underlying memory. 3749 var buf []byte 3750 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3751 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3752 hdr.Len = f.SizeBytes() 3753 hdr.Cap = f.SizeBytes() 3754 3755 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3756 // Since we bypassed the compiler's escape analysis, indicate that f 3757 // must live until the use above. 3758 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3759 return length, err 3760 } 3761 3762 // CopyOut implements marshal.Marshallable.CopyOut. 3763 func (f *FUSEFsyncIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3764 return f.CopyOutN(cc, addr, f.SizeBytes()) 3765 } 3766 3767 // CopyIn implements marshal.Marshallable.CopyIn. 3768 func (f *FUSEFsyncIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3769 // Construct a slice backed by dst's underlying memory. 3770 var buf []byte 3771 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3772 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3773 hdr.Len = f.SizeBytes() 3774 hdr.Cap = f.SizeBytes() 3775 3776 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3777 // Since we bypassed the compiler's escape analysis, indicate that f 3778 // must live until the use above. 3779 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3780 return length, err 3781 } 3782 3783 // WriteTo implements io.WriterTo.WriteTo. 3784 func (f *FUSEFsyncIn) WriteTo(writer io.Writer) (int64, error) { 3785 // Construct a slice backed by dst's underlying memory. 3786 var buf []byte 3787 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3788 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3789 hdr.Len = f.SizeBytes() 3790 hdr.Cap = f.SizeBytes() 3791 3792 length, err := writer.Write(buf) 3793 // Since we bypassed the compiler's escape analysis, indicate that f 3794 // must live until the use above. 3795 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3796 return int64(length), err 3797 } 3798 3799 // SizeBytes implements marshal.Marshallable.SizeBytes. 3800 func (f *FUSEGetAttrIn) SizeBytes() int { 3801 return 16 3802 } 3803 3804 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3805 func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) []byte { 3806 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GetAttrFlags)) 3807 dst = dst[4:] 3808 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3809 dst = dst[4:] 3810 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3811 dst = dst[8:] 3812 return dst 3813 } 3814 3815 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3816 func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) []byte { 3817 f.GetAttrFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3818 src = src[4:] 3819 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3820 src = src[4:] 3821 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3822 src = src[8:] 3823 return src 3824 } 3825 3826 // Packed implements marshal.Marshallable.Packed. 3827 // 3828 //go:nosplit 3829 func (f *FUSEGetAttrIn) Packed() bool { 3830 return true 3831 } 3832 3833 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3834 func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) []byte { 3835 size := f.SizeBytes() 3836 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3837 return dst[size:] 3838 } 3839 3840 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3841 func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) []byte { 3842 size := f.SizeBytes() 3843 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3844 return src[size:] 3845 } 3846 3847 // CopyOutN implements marshal.Marshallable.CopyOutN. 3848 func (f *FUSEGetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3849 // Construct a slice backed by dst's underlying memory. 3850 var buf []byte 3851 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3852 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3853 hdr.Len = f.SizeBytes() 3854 hdr.Cap = f.SizeBytes() 3855 3856 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3857 // Since we bypassed the compiler's escape analysis, indicate that f 3858 // must live until the use above. 3859 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3860 return length, err 3861 } 3862 3863 // CopyOut implements marshal.Marshallable.CopyOut. 3864 func (f *FUSEGetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3865 return f.CopyOutN(cc, addr, f.SizeBytes()) 3866 } 3867 3868 // CopyIn implements marshal.Marshallable.CopyIn. 3869 func (f *FUSEGetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, 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 := cc.CopyInBytes(addr, buf) // escapes: okay. 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 length, err 3882 } 3883 3884 // WriteTo implements io.WriterTo.WriteTo. 3885 func (f *FUSEGetAttrIn) WriteTo(writer io.Writer) (int64, error) { 3886 // Construct a slice backed by dst's underlying memory. 3887 var buf []byte 3888 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3889 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3890 hdr.Len = f.SizeBytes() 3891 hdr.Cap = f.SizeBytes() 3892 3893 length, err := writer.Write(buf) 3894 // Since we bypassed the compiler's escape analysis, indicate that f 3895 // must live until the use above. 3896 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3897 return int64(length), err 3898 } 3899 3900 // SizeBytes implements marshal.Marshallable.SizeBytes. 3901 func (f *FUSEHeaderIn) SizeBytes() int { 3902 return 28 + 3903 (*FUSEOpcode)(nil).SizeBytes() + 3904 (*FUSEOpID)(nil).SizeBytes() 3905 } 3906 3907 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3908 func (f *FUSEHeaderIn) MarshalBytes(dst []byte) []byte { 3909 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 3910 dst = dst[4:] 3911 dst = f.Opcode.MarshalUnsafe(dst) 3912 dst = f.Unique.MarshalUnsafe(dst) 3913 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3914 dst = dst[8:] 3915 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 3916 dst = dst[4:] 3917 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 3918 dst = dst[4:] 3919 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 3920 dst = dst[4:] 3921 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3922 dst = dst[4:] 3923 return dst 3924 } 3925 3926 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3927 func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) []byte { 3928 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3929 src = src[4:] 3930 src = f.Opcode.UnmarshalUnsafe(src) 3931 src = f.Unique.UnmarshalUnsafe(src) 3932 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3933 src = src[8:] 3934 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3935 src = src[4:] 3936 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3937 src = src[4:] 3938 f.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3939 src = src[4:] 3940 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3941 src = src[4:] 3942 return src 3943 } 3944 3945 // Packed implements marshal.Marshallable.Packed. 3946 // 3947 //go:nosplit 3948 func (f *FUSEHeaderIn) Packed() bool { 3949 return f.Opcode.Packed() && f.Unique.Packed() 3950 } 3951 3952 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3953 func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) []byte { 3954 if f.Opcode.Packed() && f.Unique.Packed() { 3955 size := f.SizeBytes() 3956 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3957 return dst[size:] 3958 } 3959 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3960 return f.MarshalBytes(dst) 3961 } 3962 3963 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3964 func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) []byte { 3965 if f.Opcode.Packed() && f.Unique.Packed() { 3966 size := f.SizeBytes() 3967 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3968 return src[size:] 3969 } 3970 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3971 return f.UnmarshalBytes(src) 3972 } 3973 3974 // CopyOutN implements marshal.Marshallable.CopyOutN. 3975 func (f *FUSEHeaderIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3976 if !f.Opcode.Packed() && f.Unique.Packed() { 3977 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3978 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3979 f.MarshalBytes(buf) // escapes: fallback. 3980 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3981 } 3982 3983 // Construct a slice backed by dst's underlying memory. 3984 var buf []byte 3985 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3986 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3987 hdr.Len = f.SizeBytes() 3988 hdr.Cap = f.SizeBytes() 3989 3990 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3991 // Since we bypassed the compiler's escape analysis, indicate that f 3992 // must live until the use above. 3993 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3994 return length, err 3995 } 3996 3997 // CopyOut implements marshal.Marshallable.CopyOut. 3998 func (f *FUSEHeaderIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3999 return f.CopyOutN(cc, addr, f.SizeBytes()) 4000 } 4001 4002 // CopyIn implements marshal.Marshallable.CopyIn. 4003 func (f *FUSEHeaderIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4004 if !f.Opcode.Packed() && f.Unique.Packed() { 4005 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4006 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4007 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4008 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4009 // partially unmarshalled struct. 4010 f.UnmarshalBytes(buf) // escapes: fallback. 4011 return length, err 4012 } 4013 4014 // Construct a slice backed by dst's underlying memory. 4015 var buf []byte 4016 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4017 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4018 hdr.Len = f.SizeBytes() 4019 hdr.Cap = f.SizeBytes() 4020 4021 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4022 // Since we bypassed the compiler's escape analysis, indicate that f 4023 // must live until the use above. 4024 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4025 return length, err 4026 } 4027 4028 // WriteTo implements io.WriterTo.WriteTo. 4029 func (f *FUSEHeaderIn) WriteTo(writer io.Writer) (int64, error) { 4030 if !f.Opcode.Packed() && f.Unique.Packed() { 4031 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4032 buf := make([]byte, f.SizeBytes()) 4033 f.MarshalBytes(buf) 4034 length, err := writer.Write(buf) 4035 return int64(length), err 4036 } 4037 4038 // Construct a slice backed by dst's underlying memory. 4039 var buf []byte 4040 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4041 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4042 hdr.Len = f.SizeBytes() 4043 hdr.Cap = f.SizeBytes() 4044 4045 length, err := writer.Write(buf) 4046 // Since we bypassed the compiler's escape analysis, indicate that f 4047 // must live until the use above. 4048 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4049 return int64(length), err 4050 } 4051 4052 // SizeBytes implements marshal.Marshallable.SizeBytes. 4053 func (f *FUSEHeaderOut) SizeBytes() int { 4054 return 8 + 4055 (*FUSEOpID)(nil).SizeBytes() 4056 } 4057 4058 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4059 func (f *FUSEHeaderOut) MarshalBytes(dst []byte) []byte { 4060 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 4061 dst = dst[4:] 4062 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Error)) 4063 dst = dst[4:] 4064 dst = f.Unique.MarshalUnsafe(dst) 4065 return dst 4066 } 4067 4068 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4069 func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) []byte { 4070 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4071 src = src[4:] 4072 f.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 4073 src = src[4:] 4074 src = f.Unique.UnmarshalUnsafe(src) 4075 return src 4076 } 4077 4078 // Packed implements marshal.Marshallable.Packed. 4079 // 4080 //go:nosplit 4081 func (f *FUSEHeaderOut) Packed() bool { 4082 return f.Unique.Packed() 4083 } 4084 4085 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4086 func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) []byte { 4087 if f.Unique.Packed() { 4088 size := f.SizeBytes() 4089 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4090 return dst[size:] 4091 } 4092 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes. 4093 return f.MarshalBytes(dst) 4094 } 4095 4096 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4097 func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) []byte { 4098 if f.Unique.Packed() { 4099 size := f.SizeBytes() 4100 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4101 return src[size:] 4102 } 4103 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4104 return f.UnmarshalBytes(src) 4105 } 4106 4107 // CopyOutN implements marshal.Marshallable.CopyOutN. 4108 func (f *FUSEHeaderOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4109 if !f.Unique.Packed() { 4110 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4111 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4112 f.MarshalBytes(buf) // escapes: fallback. 4113 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4114 } 4115 4116 // Construct a slice backed by dst's underlying memory. 4117 var buf []byte 4118 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4119 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4120 hdr.Len = f.SizeBytes() 4121 hdr.Cap = f.SizeBytes() 4122 4123 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4124 // Since we bypassed the compiler's escape analysis, indicate that f 4125 // must live until the use above. 4126 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4127 return length, err 4128 } 4129 4130 // CopyOut implements marshal.Marshallable.CopyOut. 4131 func (f *FUSEHeaderOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4132 return f.CopyOutN(cc, addr, f.SizeBytes()) 4133 } 4134 4135 // CopyIn implements marshal.Marshallable.CopyIn. 4136 func (f *FUSEHeaderOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4137 if !f.Unique.Packed() { 4138 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4139 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4140 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4141 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4142 // partially unmarshalled struct. 4143 f.UnmarshalBytes(buf) // escapes: fallback. 4144 return length, err 4145 } 4146 4147 // Construct a slice backed by dst's underlying memory. 4148 var buf []byte 4149 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4150 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4151 hdr.Len = f.SizeBytes() 4152 hdr.Cap = f.SizeBytes() 4153 4154 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4155 // Since we bypassed the compiler's escape analysis, indicate that f 4156 // must live until the use above. 4157 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4158 return length, err 4159 } 4160 4161 // WriteTo implements io.WriterTo.WriteTo. 4162 func (f *FUSEHeaderOut) WriteTo(writer io.Writer) (int64, error) { 4163 if !f.Unique.Packed() { 4164 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4165 buf := make([]byte, f.SizeBytes()) 4166 f.MarshalBytes(buf) 4167 length, err := writer.Write(buf) 4168 return int64(length), err 4169 } 4170 4171 // Construct a slice backed by dst's underlying memory. 4172 var buf []byte 4173 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4174 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4175 hdr.Len = f.SizeBytes() 4176 hdr.Cap = f.SizeBytes() 4177 4178 length, err := writer.Write(buf) 4179 // Since we bypassed the compiler's escape analysis, indicate that f 4180 // must live until the use above. 4181 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4182 return int64(length), err 4183 } 4184 4185 // SizeBytes implements marshal.Marshallable.SizeBytes. 4186 func (f *FUSEInitIn) SizeBytes() int { 4187 return 16 4188 } 4189 4190 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4191 func (f *FUSEInitIn) MarshalBytes(dst []byte) []byte { 4192 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4193 dst = dst[4:] 4194 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4195 dst = dst[4:] 4196 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4197 dst = dst[4:] 4198 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4199 dst = dst[4:] 4200 return dst 4201 } 4202 4203 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4204 func (f *FUSEInitIn) UnmarshalBytes(src []byte) []byte { 4205 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4206 src = src[4:] 4207 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4208 src = src[4:] 4209 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4210 src = src[4:] 4211 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4212 src = src[4:] 4213 return src 4214 } 4215 4216 // Packed implements marshal.Marshallable.Packed. 4217 // 4218 //go:nosplit 4219 func (f *FUSEInitIn) Packed() bool { 4220 return true 4221 } 4222 4223 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4224 func (f *FUSEInitIn) MarshalUnsafe(dst []byte) []byte { 4225 size := f.SizeBytes() 4226 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4227 return dst[size:] 4228 } 4229 4230 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4231 func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) []byte { 4232 size := f.SizeBytes() 4233 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4234 return src[size:] 4235 } 4236 4237 // CopyOutN implements marshal.Marshallable.CopyOutN. 4238 func (f *FUSEInitIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4239 // Construct a slice backed by dst's underlying memory. 4240 var buf []byte 4241 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4242 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4243 hdr.Len = f.SizeBytes() 4244 hdr.Cap = f.SizeBytes() 4245 4246 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4247 // Since we bypassed the compiler's escape analysis, indicate that f 4248 // must live until the use above. 4249 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4250 return length, err 4251 } 4252 4253 // CopyOut implements marshal.Marshallable.CopyOut. 4254 func (f *FUSEInitIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4255 return f.CopyOutN(cc, addr, f.SizeBytes()) 4256 } 4257 4258 // CopyIn implements marshal.Marshallable.CopyIn. 4259 func (f *FUSEInitIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4260 // Construct a slice backed by dst's underlying memory. 4261 var buf []byte 4262 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4263 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4264 hdr.Len = f.SizeBytes() 4265 hdr.Cap = f.SizeBytes() 4266 4267 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4268 // Since we bypassed the compiler's escape analysis, indicate that f 4269 // must live until the use above. 4270 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4271 return length, err 4272 } 4273 4274 // WriteTo implements io.WriterTo.WriteTo. 4275 func (f *FUSEInitIn) WriteTo(writer io.Writer) (int64, error) { 4276 // Construct a slice backed by dst's underlying memory. 4277 var buf []byte 4278 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4279 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4280 hdr.Len = f.SizeBytes() 4281 hdr.Cap = f.SizeBytes() 4282 4283 length, err := writer.Write(buf) 4284 // Since we bypassed the compiler's escape analysis, indicate that f 4285 // must live until the use above. 4286 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4287 return int64(length), err 4288 } 4289 4290 // SizeBytes implements marshal.Marshallable.SizeBytes. 4291 func (f *FUSEInitOut) SizeBytes() int { 4292 return 32 + 4293 4*8 4294 } 4295 4296 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4297 func (f *FUSEInitOut) MarshalBytes(dst []byte) []byte { 4298 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4299 dst = dst[4:] 4300 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4301 dst = dst[4:] 4302 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4303 dst = dst[4:] 4304 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4305 dst = dst[4:] 4306 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxBackground)) 4307 dst = dst[2:] 4308 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.CongestionThreshold)) 4309 dst = dst[2:] 4310 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxWrite)) 4311 dst = dst[4:] 4312 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.TimeGran)) 4313 dst = dst[4:] 4314 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxPages)) 4315 dst = dst[2:] 4316 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 4317 dst = dst[2:] 4318 // Padding: dst[:sizeof(uint32)*8] ~= [8]uint32{0} 4319 dst = dst[4*(8):] 4320 return dst 4321 } 4322 4323 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4324 func (f *FUSEInitOut) UnmarshalBytes(src []byte) []byte { 4325 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4326 src = src[4:] 4327 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4328 src = src[4:] 4329 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4330 src = src[4:] 4331 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4332 src = src[4:] 4333 f.MaxBackground = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4334 src = src[2:] 4335 f.CongestionThreshold = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4336 src = src[2:] 4337 f.MaxWrite = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4338 src = src[4:] 4339 f.TimeGran = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4340 src = src[4:] 4341 f.MaxPages = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4342 src = src[2:] 4343 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 4344 src = src[2:] 4345 // Padding: ~ copy([8]uint32(f._), src[:sizeof(uint32)*8]) 4346 src = src[4*(8):] 4347 return src 4348 } 4349 4350 // Packed implements marshal.Marshallable.Packed. 4351 // 4352 //go:nosplit 4353 func (f *FUSEInitOut) Packed() bool { 4354 return true 4355 } 4356 4357 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4358 func (f *FUSEInitOut) MarshalUnsafe(dst []byte) []byte { 4359 size := f.SizeBytes() 4360 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4361 return dst[size:] 4362 } 4363 4364 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4365 func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) []byte { 4366 size := f.SizeBytes() 4367 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4368 return src[size:] 4369 } 4370 4371 // CopyOutN implements marshal.Marshallable.CopyOutN. 4372 func (f *FUSEInitOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4373 // Construct a slice backed by dst's underlying memory. 4374 var buf []byte 4375 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4376 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4377 hdr.Len = f.SizeBytes() 4378 hdr.Cap = f.SizeBytes() 4379 4380 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4381 // Since we bypassed the compiler's escape analysis, indicate that f 4382 // must live until the use above. 4383 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4384 return length, err 4385 } 4386 4387 // CopyOut implements marshal.Marshallable.CopyOut. 4388 func (f *FUSEInitOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4389 return f.CopyOutN(cc, addr, f.SizeBytes()) 4390 } 4391 4392 // CopyIn implements marshal.Marshallable.CopyIn. 4393 func (f *FUSEInitOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4394 // Construct a slice backed by dst's underlying memory. 4395 var buf []byte 4396 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4397 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4398 hdr.Len = f.SizeBytes() 4399 hdr.Cap = f.SizeBytes() 4400 4401 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4402 // Since we bypassed the compiler's escape analysis, indicate that f 4403 // must live until the use above. 4404 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4405 return length, err 4406 } 4407 4408 // WriteTo implements io.WriterTo.WriteTo. 4409 func (f *FUSEInitOut) WriteTo(writer io.Writer) (int64, error) { 4410 // Construct a slice backed by dst's underlying memory. 4411 var buf []byte 4412 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4413 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4414 hdr.Len = f.SizeBytes() 4415 hdr.Cap = f.SizeBytes() 4416 4417 length, err := writer.Write(buf) 4418 // Since we bypassed the compiler's escape analysis, indicate that f 4419 // must live until the use above. 4420 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4421 return int64(length), err 4422 } 4423 4424 // Packed implements marshal.Marshallable.Packed. 4425 // 4426 //go:nosplit 4427 func (r *FUSELinkIn) Packed() bool { 4428 // Type FUSELinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4429 return false 4430 } 4431 4432 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4433 func (r *FUSELinkIn) MarshalUnsafe(dst []byte) []byte { 4434 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4435 return r.MarshalBytes(dst) 4436 } 4437 4438 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4439 func (r *FUSELinkIn) UnmarshalUnsafe(src []byte) []byte { 4440 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4441 return r.UnmarshalBytes(src) 4442 } 4443 4444 // CopyOutN implements marshal.Marshallable.CopyOutN. 4445 // 4446 //go:nosplit 4447 func (r *FUSELinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4448 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4449 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4450 r.MarshalBytes(buf) // escapes: fallback. 4451 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4452 } 4453 4454 // CopyOut implements marshal.Marshallable.CopyOut. 4455 func (r *FUSELinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4456 return r.CopyOutN(cc, addr, r.SizeBytes()) 4457 } 4458 4459 // CopyIn implements marshal.Marshallable.CopyIn. 4460 func (r *FUSELinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4461 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4462 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4463 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4464 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4465 // partially unmarshalled struct. 4466 r.UnmarshalBytes(buf) // escapes: fallback. 4467 return length, err 4468 } 4469 4470 // WriteTo implements io.WriterTo.WriteTo. 4471 func (r *FUSELinkIn) WriteTo(writer io.Writer) (int64, error) { 4472 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4473 buf := make([]byte, r.SizeBytes()) 4474 r.MarshalBytes(buf) 4475 length, err := writer.Write(buf) 4476 return int64(length), err 4477 } 4478 4479 // Packed implements marshal.Marshallable.Packed. 4480 // 4481 //go:nosplit 4482 func (r *FUSELookupIn) Packed() bool { 4483 // Type FUSELookupIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4484 return false 4485 } 4486 4487 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4488 func (r *FUSELookupIn) MarshalUnsafe(dst []byte) []byte { 4489 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4490 return r.MarshalBytes(dst) 4491 } 4492 4493 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4494 func (r *FUSELookupIn) UnmarshalUnsafe(src []byte) []byte { 4495 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4496 return r.UnmarshalBytes(src) 4497 } 4498 4499 // CopyOutN implements marshal.Marshallable.CopyOutN. 4500 // 4501 //go:nosplit 4502 func (r *FUSELookupIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4503 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4504 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4505 r.MarshalBytes(buf) // escapes: fallback. 4506 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4507 } 4508 4509 // CopyOut implements marshal.Marshallable.CopyOut. 4510 func (r *FUSELookupIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4511 return r.CopyOutN(cc, addr, r.SizeBytes()) 4512 } 4513 4514 // CopyIn implements marshal.Marshallable.CopyIn. 4515 func (r *FUSELookupIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4516 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4517 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4518 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4519 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4520 // partially unmarshalled struct. 4521 r.UnmarshalBytes(buf) // escapes: fallback. 4522 return length, err 4523 } 4524 4525 // WriteTo implements io.WriterTo.WriteTo. 4526 func (r *FUSELookupIn) WriteTo(writer io.Writer) (int64, error) { 4527 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4528 buf := make([]byte, r.SizeBytes()) 4529 r.MarshalBytes(buf) 4530 length, err := writer.Write(buf) 4531 return int64(length), err 4532 } 4533 4534 // Packed implements marshal.Marshallable.Packed. 4535 // 4536 //go:nosplit 4537 func (r *FUSEMkdirIn) Packed() bool { 4538 // Type FUSEMkdirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4539 return false 4540 } 4541 4542 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4543 func (r *FUSEMkdirIn) MarshalUnsafe(dst []byte) []byte { 4544 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4545 return r.MarshalBytes(dst) 4546 } 4547 4548 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4549 func (r *FUSEMkdirIn) UnmarshalUnsafe(src []byte) []byte { 4550 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4551 return r.UnmarshalBytes(src) 4552 } 4553 4554 // CopyOutN implements marshal.Marshallable.CopyOutN. 4555 // 4556 //go:nosplit 4557 func (r *FUSEMkdirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4558 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4559 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4560 r.MarshalBytes(buf) // escapes: fallback. 4561 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4562 } 4563 4564 // CopyOut implements marshal.Marshallable.CopyOut. 4565 func (r *FUSEMkdirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4566 return r.CopyOutN(cc, addr, r.SizeBytes()) 4567 } 4568 4569 // CopyIn implements marshal.Marshallable.CopyIn. 4570 func (r *FUSEMkdirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4571 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4572 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4573 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4574 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4575 // partially unmarshalled struct. 4576 r.UnmarshalBytes(buf) // escapes: fallback. 4577 return length, err 4578 } 4579 4580 // WriteTo implements io.WriterTo.WriteTo. 4581 func (r *FUSEMkdirIn) WriteTo(writer io.Writer) (int64, error) { 4582 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4583 buf := make([]byte, r.SizeBytes()) 4584 r.MarshalBytes(buf) 4585 length, err := writer.Write(buf) 4586 return int64(length), err 4587 } 4588 4589 // SizeBytes implements marshal.Marshallable.SizeBytes. 4590 func (f *FUSEMkdirMeta) SizeBytes() int { 4591 return 8 4592 } 4593 4594 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4595 func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) []byte { 4596 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4597 dst = dst[4:] 4598 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4599 dst = dst[4:] 4600 return dst 4601 } 4602 4603 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4604 func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) []byte { 4605 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4606 src = src[4:] 4607 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4608 src = src[4:] 4609 return src 4610 } 4611 4612 // Packed implements marshal.Marshallable.Packed. 4613 // 4614 //go:nosplit 4615 func (f *FUSEMkdirMeta) Packed() bool { 4616 return true 4617 } 4618 4619 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4620 func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) []byte { 4621 size := f.SizeBytes() 4622 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4623 return dst[size:] 4624 } 4625 4626 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4627 func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) []byte { 4628 size := f.SizeBytes() 4629 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4630 return src[size:] 4631 } 4632 4633 // CopyOutN implements marshal.Marshallable.CopyOutN. 4634 func (f *FUSEMkdirMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4635 // Construct a slice backed by dst's underlying memory. 4636 var buf []byte 4637 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4638 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4639 hdr.Len = f.SizeBytes() 4640 hdr.Cap = f.SizeBytes() 4641 4642 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4643 // Since we bypassed the compiler's escape analysis, indicate that f 4644 // must live until the use above. 4645 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4646 return length, err 4647 } 4648 4649 // CopyOut implements marshal.Marshallable.CopyOut. 4650 func (f *FUSEMkdirMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4651 return f.CopyOutN(cc, addr, f.SizeBytes()) 4652 } 4653 4654 // CopyIn implements marshal.Marshallable.CopyIn. 4655 func (f *FUSEMkdirMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4656 // Construct a slice backed by dst's underlying memory. 4657 var buf []byte 4658 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4659 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4660 hdr.Len = f.SizeBytes() 4661 hdr.Cap = f.SizeBytes() 4662 4663 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4664 // Since we bypassed the compiler's escape analysis, indicate that f 4665 // must live until the use above. 4666 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4667 return length, err 4668 } 4669 4670 // WriteTo implements io.WriterTo.WriteTo. 4671 func (f *FUSEMkdirMeta) WriteTo(writer io.Writer) (int64, error) { 4672 // Construct a slice backed by dst's underlying memory. 4673 var buf []byte 4674 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4675 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4676 hdr.Len = f.SizeBytes() 4677 hdr.Cap = f.SizeBytes() 4678 4679 length, err := writer.Write(buf) 4680 // Since we bypassed the compiler's escape analysis, indicate that f 4681 // must live until the use above. 4682 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4683 return int64(length), err 4684 } 4685 4686 // Packed implements marshal.Marshallable.Packed. 4687 // 4688 //go:nosplit 4689 func (r *FUSEMknodIn) Packed() bool { 4690 // Type FUSEMknodIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4691 return false 4692 } 4693 4694 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4695 func (r *FUSEMknodIn) MarshalUnsafe(dst []byte) []byte { 4696 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4697 return r.MarshalBytes(dst) 4698 } 4699 4700 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4701 func (r *FUSEMknodIn) UnmarshalUnsafe(src []byte) []byte { 4702 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4703 return r.UnmarshalBytes(src) 4704 } 4705 4706 // CopyOutN implements marshal.Marshallable.CopyOutN. 4707 // 4708 //go:nosplit 4709 func (r *FUSEMknodIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4710 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4711 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4712 r.MarshalBytes(buf) // escapes: fallback. 4713 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4714 } 4715 4716 // CopyOut implements marshal.Marshallable.CopyOut. 4717 func (r *FUSEMknodIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4718 return r.CopyOutN(cc, addr, r.SizeBytes()) 4719 } 4720 4721 // CopyIn implements marshal.Marshallable.CopyIn. 4722 func (r *FUSEMknodIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4723 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4724 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4725 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4726 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4727 // partially unmarshalled struct. 4728 r.UnmarshalBytes(buf) // escapes: fallback. 4729 return length, err 4730 } 4731 4732 // WriteTo implements io.WriterTo.WriteTo. 4733 func (r *FUSEMknodIn) WriteTo(writer io.Writer) (int64, error) { 4734 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4735 buf := make([]byte, r.SizeBytes()) 4736 r.MarshalBytes(buf) 4737 length, err := writer.Write(buf) 4738 return int64(length), err 4739 } 4740 4741 // SizeBytes implements marshal.Marshallable.SizeBytes. 4742 func (f *FUSEMknodMeta) SizeBytes() int { 4743 return 16 4744 } 4745 4746 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4747 func (f *FUSEMknodMeta) MarshalBytes(dst []byte) []byte { 4748 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 4749 dst = dst[4:] 4750 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev)) 4751 dst = dst[4:] 4752 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 4753 dst = dst[4:] 4754 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4755 dst = dst[4:] 4756 return dst 4757 } 4758 4759 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4760 func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) []byte { 4761 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4762 src = src[4:] 4763 f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4764 src = src[4:] 4765 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4766 src = src[4:] 4767 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4768 src = src[4:] 4769 return src 4770 } 4771 4772 // Packed implements marshal.Marshallable.Packed. 4773 // 4774 //go:nosplit 4775 func (f *FUSEMknodMeta) Packed() bool { 4776 return true 4777 } 4778 4779 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4780 func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) []byte { 4781 size := f.SizeBytes() 4782 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4783 return dst[size:] 4784 } 4785 4786 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4787 func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) []byte { 4788 size := f.SizeBytes() 4789 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4790 return src[size:] 4791 } 4792 4793 // CopyOutN implements marshal.Marshallable.CopyOutN. 4794 func (f *FUSEMknodMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4795 // Construct a slice backed by dst's underlying memory. 4796 var buf []byte 4797 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4798 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4799 hdr.Len = f.SizeBytes() 4800 hdr.Cap = f.SizeBytes() 4801 4802 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4803 // Since we bypassed the compiler's escape analysis, indicate that f 4804 // must live until the use above. 4805 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4806 return length, err 4807 } 4808 4809 // CopyOut implements marshal.Marshallable.CopyOut. 4810 func (f *FUSEMknodMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4811 return f.CopyOutN(cc, addr, f.SizeBytes()) 4812 } 4813 4814 // CopyIn implements marshal.Marshallable.CopyIn. 4815 func (f *FUSEMknodMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4816 // Construct a slice backed by dst's underlying memory. 4817 var buf []byte 4818 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4819 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4820 hdr.Len = f.SizeBytes() 4821 hdr.Cap = f.SizeBytes() 4822 4823 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4824 // Since we bypassed the compiler's escape analysis, indicate that f 4825 // must live until the use above. 4826 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4827 return length, err 4828 } 4829 4830 // WriteTo implements io.WriterTo.WriteTo. 4831 func (f *FUSEMknodMeta) WriteTo(writer io.Writer) (int64, error) { 4832 // Construct a slice backed by dst's underlying memory. 4833 var buf []byte 4834 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4835 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4836 hdr.Len = f.SizeBytes() 4837 hdr.Cap = f.SizeBytes() 4838 4839 length, err := writer.Write(buf) 4840 // Since we bypassed the compiler's escape analysis, indicate that f 4841 // must live until the use above. 4842 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4843 return int64(length), err 4844 } 4845 4846 // SizeBytes implements marshal.Marshallable.SizeBytes. 4847 // 4848 //go:nosplit 4849 func (f *FUSEOpID) SizeBytes() int { 4850 return 8 4851 } 4852 4853 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4854 func (f *FUSEOpID) MarshalBytes(dst []byte) []byte { 4855 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f)) 4856 return dst[8:] 4857 } 4858 4859 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4860 func (f *FUSEOpID) UnmarshalBytes(src []byte) []byte { 4861 *f = FUSEOpID(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 4862 return src[8:] 4863 } 4864 4865 // Packed implements marshal.Marshallable.Packed. 4866 // 4867 //go:nosplit 4868 func (f *FUSEOpID) Packed() bool { 4869 // Scalar newtypes are always packed. 4870 return true 4871 } 4872 4873 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4874 func (f *FUSEOpID) MarshalUnsafe(dst []byte) []byte { 4875 size := f.SizeBytes() 4876 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4877 return dst[size:] 4878 } 4879 4880 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4881 func (f *FUSEOpID) UnmarshalUnsafe(src []byte) []byte { 4882 size := f.SizeBytes() 4883 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4884 return src[size:] 4885 } 4886 4887 // CopyOutN implements marshal.Marshallable.CopyOutN. 4888 func (f *FUSEOpID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4889 // Construct a slice backed by dst's underlying memory. 4890 var buf []byte 4891 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4892 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4893 hdr.Len = f.SizeBytes() 4894 hdr.Cap = f.SizeBytes() 4895 4896 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4897 // Since we bypassed the compiler's escape analysis, indicate that f 4898 // must live until the use above. 4899 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4900 return length, err 4901 } 4902 4903 // CopyOut implements marshal.Marshallable.CopyOut. 4904 func (f *FUSEOpID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4905 return f.CopyOutN(cc, addr, f.SizeBytes()) 4906 } 4907 4908 // CopyIn implements marshal.Marshallable.CopyIn. 4909 func (f *FUSEOpID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4910 // Construct a slice backed by dst's underlying memory. 4911 var buf []byte 4912 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4913 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4914 hdr.Len = f.SizeBytes() 4915 hdr.Cap = f.SizeBytes() 4916 4917 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4918 // Since we bypassed the compiler's escape analysis, indicate that f 4919 // must live until the use above. 4920 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4921 return length, err 4922 } 4923 4924 // WriteTo implements io.WriterTo.WriteTo. 4925 func (f *FUSEOpID) WriteTo(writer io.Writer) (int64, error) { 4926 // Construct a slice backed by dst's underlying memory. 4927 var buf []byte 4928 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4929 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4930 hdr.Len = f.SizeBytes() 4931 hdr.Cap = f.SizeBytes() 4932 4933 length, err := writer.Write(buf) 4934 // Since we bypassed the compiler's escape analysis, indicate that f 4935 // must live until the use above. 4936 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4937 return int64(length), err 4938 } 4939 4940 // SizeBytes implements marshal.Marshallable.SizeBytes. 4941 // 4942 //go:nosplit 4943 func (f *FUSEOpcode) SizeBytes() int { 4944 return 4 4945 } 4946 4947 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4948 func (f *FUSEOpcode) MarshalBytes(dst []byte) []byte { 4949 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f)) 4950 return dst[4:] 4951 } 4952 4953 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4954 func (f *FUSEOpcode) UnmarshalBytes(src []byte) []byte { 4955 *f = FUSEOpcode(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 4956 return src[4:] 4957 } 4958 4959 // Packed implements marshal.Marshallable.Packed. 4960 // 4961 //go:nosplit 4962 func (f *FUSEOpcode) Packed() bool { 4963 // Scalar newtypes are always packed. 4964 return true 4965 } 4966 4967 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4968 func (f *FUSEOpcode) MarshalUnsafe(dst []byte) []byte { 4969 size := f.SizeBytes() 4970 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4971 return dst[size:] 4972 } 4973 4974 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4975 func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) []byte { 4976 size := f.SizeBytes() 4977 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4978 return src[size:] 4979 } 4980 4981 // CopyOutN implements marshal.Marshallable.CopyOutN. 4982 func (f *FUSEOpcode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4983 // Construct a slice backed by dst's underlying memory. 4984 var buf []byte 4985 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4986 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4987 hdr.Len = f.SizeBytes() 4988 hdr.Cap = f.SizeBytes() 4989 4990 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4991 // Since we bypassed the compiler's escape analysis, indicate that f 4992 // must live until the use above. 4993 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4994 return length, err 4995 } 4996 4997 // CopyOut implements marshal.Marshallable.CopyOut. 4998 func (f *FUSEOpcode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4999 return f.CopyOutN(cc, addr, f.SizeBytes()) 5000 } 5001 5002 // CopyIn implements marshal.Marshallable.CopyIn. 5003 func (f *FUSEOpcode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5004 // Construct a slice backed by dst's underlying memory. 5005 var buf []byte 5006 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5007 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5008 hdr.Len = f.SizeBytes() 5009 hdr.Cap = f.SizeBytes() 5010 5011 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5012 // Since we bypassed the compiler's escape analysis, indicate that f 5013 // must live until the use above. 5014 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5015 return length, err 5016 } 5017 5018 // WriteTo implements io.WriterTo.WriteTo. 5019 func (f *FUSEOpcode) WriteTo(writer io.Writer) (int64, error) { 5020 // Construct a slice backed by dst's underlying memory. 5021 var buf []byte 5022 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5023 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5024 hdr.Len = f.SizeBytes() 5025 hdr.Cap = f.SizeBytes() 5026 5027 length, err := writer.Write(buf) 5028 // Since we bypassed the compiler's escape analysis, indicate that f 5029 // must live until the use above. 5030 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5031 return int64(length), err 5032 } 5033 5034 // SizeBytes implements marshal.Marshallable.SizeBytes. 5035 func (f *FUSEOpenIn) SizeBytes() int { 5036 return 8 5037 } 5038 5039 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5040 func (f *FUSEOpenIn) MarshalBytes(dst []byte) []byte { 5041 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5042 dst = dst[4:] 5043 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5044 dst = dst[4:] 5045 return dst 5046 } 5047 5048 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5049 func (f *FUSEOpenIn) UnmarshalBytes(src []byte) []byte { 5050 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5051 src = src[4:] 5052 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5053 src = src[4:] 5054 return src 5055 } 5056 5057 // Packed implements marshal.Marshallable.Packed. 5058 // 5059 //go:nosplit 5060 func (f *FUSEOpenIn) Packed() bool { 5061 return true 5062 } 5063 5064 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5065 func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) []byte { 5066 size := f.SizeBytes() 5067 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5068 return dst[size:] 5069 } 5070 5071 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5072 func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) []byte { 5073 size := f.SizeBytes() 5074 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5075 return src[size:] 5076 } 5077 5078 // CopyOutN implements marshal.Marshallable.CopyOutN. 5079 func (f *FUSEOpenIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5080 // Construct a slice backed by dst's underlying memory. 5081 var buf []byte 5082 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5083 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5084 hdr.Len = f.SizeBytes() 5085 hdr.Cap = f.SizeBytes() 5086 5087 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5088 // Since we bypassed the compiler's escape analysis, indicate that f 5089 // must live until the use above. 5090 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5091 return length, err 5092 } 5093 5094 // CopyOut implements marshal.Marshallable.CopyOut. 5095 func (f *FUSEOpenIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5096 return f.CopyOutN(cc, addr, f.SizeBytes()) 5097 } 5098 5099 // CopyIn implements marshal.Marshallable.CopyIn. 5100 func (f *FUSEOpenIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5101 // Construct a slice backed by dst's underlying memory. 5102 var buf []byte 5103 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5104 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5105 hdr.Len = f.SizeBytes() 5106 hdr.Cap = f.SizeBytes() 5107 5108 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5109 // Since we bypassed the compiler's escape analysis, indicate that f 5110 // must live until the use above. 5111 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5112 return length, err 5113 } 5114 5115 // WriteTo implements io.WriterTo.WriteTo. 5116 func (f *FUSEOpenIn) WriteTo(writer io.Writer) (int64, error) { 5117 // Construct a slice backed by dst's underlying memory. 5118 var buf []byte 5119 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5120 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5121 hdr.Len = f.SizeBytes() 5122 hdr.Cap = f.SizeBytes() 5123 5124 length, err := writer.Write(buf) 5125 // Since we bypassed the compiler's escape analysis, indicate that f 5126 // must live until the use above. 5127 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5128 return int64(length), err 5129 } 5130 5131 // SizeBytes implements marshal.Marshallable.SizeBytes. 5132 func (f *FUSEOpenOut) SizeBytes() int { 5133 return 16 5134 } 5135 5136 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5137 func (f *FUSEOpenOut) MarshalBytes(dst []byte) []byte { 5138 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5139 dst = dst[8:] 5140 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.OpenFlag)) 5141 dst = dst[4:] 5142 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5143 dst = dst[4:] 5144 return dst 5145 } 5146 5147 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5148 func (f *FUSEOpenOut) UnmarshalBytes(src []byte) []byte { 5149 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5150 src = src[8:] 5151 f.OpenFlag = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5152 src = src[4:] 5153 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5154 src = src[4:] 5155 return src 5156 } 5157 5158 // Packed implements marshal.Marshallable.Packed. 5159 // 5160 //go:nosplit 5161 func (f *FUSEOpenOut) Packed() bool { 5162 return true 5163 } 5164 5165 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5166 func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) []byte { 5167 size := f.SizeBytes() 5168 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5169 return dst[size:] 5170 } 5171 5172 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5173 func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) []byte { 5174 size := f.SizeBytes() 5175 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5176 return src[size:] 5177 } 5178 5179 // CopyOutN implements marshal.Marshallable.CopyOutN. 5180 func (f *FUSEOpenOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5181 // Construct a slice backed by dst's underlying memory. 5182 var buf []byte 5183 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5184 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5185 hdr.Len = f.SizeBytes() 5186 hdr.Cap = f.SizeBytes() 5187 5188 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5189 // Since we bypassed the compiler's escape analysis, indicate that f 5190 // must live until the use above. 5191 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5192 return length, err 5193 } 5194 5195 // CopyOut implements marshal.Marshallable.CopyOut. 5196 func (f *FUSEOpenOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5197 return f.CopyOutN(cc, addr, f.SizeBytes()) 5198 } 5199 5200 // CopyIn implements marshal.Marshallable.CopyIn. 5201 func (f *FUSEOpenOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5202 // Construct a slice backed by dst's underlying memory. 5203 var buf []byte 5204 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5205 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5206 hdr.Len = f.SizeBytes() 5207 hdr.Cap = f.SizeBytes() 5208 5209 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5210 // Since we bypassed the compiler's escape analysis, indicate that f 5211 // must live until the use above. 5212 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5213 return length, err 5214 } 5215 5216 // WriteTo implements io.WriterTo.WriteTo. 5217 func (f *FUSEOpenOut) WriteTo(writer io.Writer) (int64, error) { 5218 // Construct a slice backed by dst's underlying memory. 5219 var buf []byte 5220 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5221 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5222 hdr.Len = f.SizeBytes() 5223 hdr.Cap = f.SizeBytes() 5224 5225 length, err := writer.Write(buf) 5226 // Since we bypassed the compiler's escape analysis, indicate that f 5227 // must live until the use above. 5228 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5229 return int64(length), err 5230 } 5231 5232 // SizeBytes implements marshal.Marshallable.SizeBytes. 5233 func (f *FUSEReadIn) SizeBytes() int { 5234 return 40 5235 } 5236 5237 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5238 func (f *FUSEReadIn) MarshalBytes(dst []byte) []byte { 5239 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5240 dst = dst[8:] 5241 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5242 dst = dst[8:] 5243 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5244 dst = dst[4:] 5245 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReadFlags)) 5246 dst = dst[4:] 5247 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5248 dst = dst[8:] 5249 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5250 dst = dst[4:] 5251 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5252 dst = dst[4:] 5253 return dst 5254 } 5255 5256 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5257 func (f *FUSEReadIn) UnmarshalBytes(src []byte) []byte { 5258 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5259 src = src[8:] 5260 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5261 src = src[8:] 5262 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5263 src = src[4:] 5264 f.ReadFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5265 src = src[4:] 5266 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5267 src = src[8:] 5268 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5269 src = src[4:] 5270 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5271 src = src[4:] 5272 return src 5273 } 5274 5275 // Packed implements marshal.Marshallable.Packed. 5276 // 5277 //go:nosplit 5278 func (f *FUSEReadIn) Packed() bool { 5279 return true 5280 } 5281 5282 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5283 func (f *FUSEReadIn) MarshalUnsafe(dst []byte) []byte { 5284 size := f.SizeBytes() 5285 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5286 return dst[size:] 5287 } 5288 5289 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5290 func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) []byte { 5291 size := f.SizeBytes() 5292 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5293 return src[size:] 5294 } 5295 5296 // CopyOutN implements marshal.Marshallable.CopyOutN. 5297 func (f *FUSEReadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5298 // Construct a slice backed by dst's underlying memory. 5299 var buf []byte 5300 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5301 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5302 hdr.Len = f.SizeBytes() 5303 hdr.Cap = f.SizeBytes() 5304 5305 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5306 // Since we bypassed the compiler's escape analysis, indicate that f 5307 // must live until the use above. 5308 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5309 return length, err 5310 } 5311 5312 // CopyOut implements marshal.Marshallable.CopyOut. 5313 func (f *FUSEReadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5314 return f.CopyOutN(cc, addr, f.SizeBytes()) 5315 } 5316 5317 // CopyIn implements marshal.Marshallable.CopyIn. 5318 func (f *FUSEReadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5319 // Construct a slice backed by dst's underlying memory. 5320 var buf []byte 5321 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5322 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5323 hdr.Len = f.SizeBytes() 5324 hdr.Cap = f.SizeBytes() 5325 5326 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5327 // Since we bypassed the compiler's escape analysis, indicate that f 5328 // must live until the use above. 5329 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5330 return length, err 5331 } 5332 5333 // WriteTo implements io.WriterTo.WriteTo. 5334 func (f *FUSEReadIn) WriteTo(writer io.Writer) (int64, error) { 5335 // Construct a slice backed by dst's underlying memory. 5336 var buf []byte 5337 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5338 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5339 hdr.Len = f.SizeBytes() 5340 hdr.Cap = f.SizeBytes() 5341 5342 length, err := writer.Write(buf) 5343 // Since we bypassed the compiler's escape analysis, indicate that f 5344 // must live until the use above. 5345 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5346 return int64(length), err 5347 } 5348 5349 // SizeBytes implements marshal.Marshallable.SizeBytes. 5350 func (f *FUSEReleaseIn) SizeBytes() int { 5351 return 24 5352 } 5353 5354 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5355 func (f *FUSEReleaseIn) MarshalBytes(dst []byte) []byte { 5356 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5357 dst = dst[8:] 5358 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5359 dst = dst[4:] 5360 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReleaseFlags)) 5361 dst = dst[4:] 5362 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5363 dst = dst[8:] 5364 return dst 5365 } 5366 5367 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5368 func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) []byte { 5369 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5370 src = src[8:] 5371 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5372 src = src[4:] 5373 f.ReleaseFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5374 src = src[4:] 5375 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5376 src = src[8:] 5377 return src 5378 } 5379 5380 // Packed implements marshal.Marshallable.Packed. 5381 // 5382 //go:nosplit 5383 func (f *FUSEReleaseIn) Packed() bool { 5384 return true 5385 } 5386 5387 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5388 func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) []byte { 5389 size := f.SizeBytes() 5390 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5391 return dst[size:] 5392 } 5393 5394 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5395 func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) []byte { 5396 size := f.SizeBytes() 5397 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5398 return src[size:] 5399 } 5400 5401 // CopyOutN implements marshal.Marshallable.CopyOutN. 5402 func (f *FUSEReleaseIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5403 // Construct a slice backed by dst's underlying memory. 5404 var buf []byte 5405 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5406 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5407 hdr.Len = f.SizeBytes() 5408 hdr.Cap = f.SizeBytes() 5409 5410 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5411 // Since we bypassed the compiler's escape analysis, indicate that f 5412 // must live until the use above. 5413 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5414 return length, err 5415 } 5416 5417 // CopyOut implements marshal.Marshallable.CopyOut. 5418 func (f *FUSEReleaseIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5419 return f.CopyOutN(cc, addr, f.SizeBytes()) 5420 } 5421 5422 // CopyIn implements marshal.Marshallable.CopyIn. 5423 func (f *FUSEReleaseIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5424 // Construct a slice backed by dst's underlying memory. 5425 var buf []byte 5426 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5427 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5428 hdr.Len = f.SizeBytes() 5429 hdr.Cap = f.SizeBytes() 5430 5431 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5432 // Since we bypassed the compiler's escape analysis, indicate that f 5433 // must live until the use above. 5434 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5435 return length, err 5436 } 5437 5438 // WriteTo implements io.WriterTo.WriteTo. 5439 func (f *FUSEReleaseIn) WriteTo(writer io.Writer) (int64, error) { 5440 // Construct a slice backed by dst's underlying memory. 5441 var buf []byte 5442 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5443 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5444 hdr.Len = f.SizeBytes() 5445 hdr.Cap = f.SizeBytes() 5446 5447 length, err := writer.Write(buf) 5448 // Since we bypassed the compiler's escape analysis, indicate that f 5449 // must live until the use above. 5450 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5451 return int64(length), err 5452 } 5453 5454 // Packed implements marshal.Marshallable.Packed. 5455 // 5456 //go:nosplit 5457 func (r *FUSERenameIn) Packed() bool { 5458 // Type FUSERenameIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5459 return false 5460 } 5461 5462 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5463 func (r *FUSERenameIn) MarshalUnsafe(dst []byte) []byte { 5464 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5465 return r.MarshalBytes(dst) 5466 } 5467 5468 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5469 func (r *FUSERenameIn) UnmarshalUnsafe(src []byte) []byte { 5470 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5471 return r.UnmarshalBytes(src) 5472 } 5473 5474 // CopyOutN implements marshal.Marshallable.CopyOutN. 5475 // 5476 //go:nosplit 5477 func (r *FUSERenameIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5478 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5479 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5480 r.MarshalBytes(buf) // escapes: fallback. 5481 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5482 } 5483 5484 // CopyOut implements marshal.Marshallable.CopyOut. 5485 func (r *FUSERenameIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5486 return r.CopyOutN(cc, addr, r.SizeBytes()) 5487 } 5488 5489 // CopyIn implements marshal.Marshallable.CopyIn. 5490 func (r *FUSERenameIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5491 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5492 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5493 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5494 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5495 // partially unmarshalled struct. 5496 r.UnmarshalBytes(buf) // escapes: fallback. 5497 return length, err 5498 } 5499 5500 // WriteTo implements io.WriterTo.WriteTo. 5501 func (r *FUSERenameIn) WriteTo(writer io.Writer) (int64, error) { 5502 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5503 buf := make([]byte, r.SizeBytes()) 5504 r.MarshalBytes(buf) 5505 length, err := writer.Write(buf) 5506 return int64(length), err 5507 } 5508 5509 // Packed implements marshal.Marshallable.Packed. 5510 // 5511 //go:nosplit 5512 func (r *FUSERmDirIn) Packed() bool { 5513 // Type FUSERmDirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5514 return false 5515 } 5516 5517 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5518 func (r *FUSERmDirIn) MarshalUnsafe(dst []byte) []byte { 5519 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5520 return r.MarshalBytes(dst) 5521 } 5522 5523 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5524 func (r *FUSERmDirIn) UnmarshalUnsafe(src []byte) []byte { 5525 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5526 return r.UnmarshalBytes(src) 5527 } 5528 5529 // CopyOutN implements marshal.Marshallable.CopyOutN. 5530 // 5531 //go:nosplit 5532 func (r *FUSERmDirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5533 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5534 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5535 r.MarshalBytes(buf) // escapes: fallback. 5536 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5537 } 5538 5539 // CopyOut implements marshal.Marshallable.CopyOut. 5540 func (r *FUSERmDirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5541 return r.CopyOutN(cc, addr, r.SizeBytes()) 5542 } 5543 5544 // CopyIn implements marshal.Marshallable.CopyIn. 5545 func (r *FUSERmDirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5546 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5547 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5548 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5549 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5550 // partially unmarshalled struct. 5551 r.UnmarshalBytes(buf) // escapes: fallback. 5552 return length, err 5553 } 5554 5555 // WriteTo implements io.WriterTo.WriteTo. 5556 func (r *FUSERmDirIn) WriteTo(writer io.Writer) (int64, error) { 5557 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5558 buf := make([]byte, r.SizeBytes()) 5559 r.MarshalBytes(buf) 5560 length, err := writer.Write(buf) 5561 return int64(length), err 5562 } 5563 5564 // SizeBytes implements marshal.Marshallable.SizeBytes. 5565 func (f *FUSESetAttrIn) SizeBytes() int { 5566 return 88 5567 } 5568 5569 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5570 func (f *FUSESetAttrIn) MarshalBytes(dst []byte) []byte { 5571 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Valid)) 5572 dst = dst[4:] 5573 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5574 dst = dst[4:] 5575 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5576 dst = dst[8:] 5577 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size)) 5578 dst = dst[8:] 5579 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5580 dst = dst[8:] 5581 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Atime)) 5582 dst = dst[8:] 5583 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mtime)) 5584 dst = dst[8:] 5585 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ctime)) 5586 dst = dst[8:] 5587 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AtimeNsec)) 5588 dst = dst[4:] 5589 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MtimeNsec)) 5590 dst = dst[4:] 5591 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.CtimeNsec)) 5592 dst = dst[4:] 5593 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5594 dst = dst[4:] 5595 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5596 dst = dst[4:] 5597 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 5598 dst = dst[4:] 5599 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 5600 dst = dst[4:] 5601 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5602 dst = dst[4:] 5603 return dst 5604 } 5605 5606 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5607 func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) []byte { 5608 f.Valid = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5609 src = src[4:] 5610 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5611 src = src[4:] 5612 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5613 src = src[8:] 5614 f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5615 src = src[8:] 5616 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5617 src = src[8:] 5618 f.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5619 src = src[8:] 5620 f.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5621 src = src[8:] 5622 f.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5623 src = src[8:] 5624 f.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5625 src = src[4:] 5626 f.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5627 src = src[4:] 5628 f.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5629 src = src[4:] 5630 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5631 src = src[4:] 5632 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5633 src = src[4:] 5634 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5635 src = src[4:] 5636 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5637 src = src[4:] 5638 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5639 src = src[4:] 5640 return src 5641 } 5642 5643 // Packed implements marshal.Marshallable.Packed. 5644 // 5645 //go:nosplit 5646 func (f *FUSESetAttrIn) Packed() bool { 5647 return true 5648 } 5649 5650 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5651 func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) []byte { 5652 size := f.SizeBytes() 5653 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5654 return dst[size:] 5655 } 5656 5657 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5658 func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) []byte { 5659 size := f.SizeBytes() 5660 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5661 return src[size:] 5662 } 5663 5664 // CopyOutN implements marshal.Marshallable.CopyOutN. 5665 func (f *FUSESetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5666 // Construct a slice backed by dst's underlying memory. 5667 var buf []byte 5668 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5669 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5670 hdr.Len = f.SizeBytes() 5671 hdr.Cap = f.SizeBytes() 5672 5673 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5674 // Since we bypassed the compiler's escape analysis, indicate that f 5675 // must live until the use above. 5676 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5677 return length, err 5678 } 5679 5680 // CopyOut implements marshal.Marshallable.CopyOut. 5681 func (f *FUSESetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5682 return f.CopyOutN(cc, addr, f.SizeBytes()) 5683 } 5684 5685 // CopyIn implements marshal.Marshallable.CopyIn. 5686 func (f *FUSESetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5687 // Construct a slice backed by dst's underlying memory. 5688 var buf []byte 5689 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5690 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5691 hdr.Len = f.SizeBytes() 5692 hdr.Cap = f.SizeBytes() 5693 5694 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5695 // Since we bypassed the compiler's escape analysis, indicate that f 5696 // must live until the use above. 5697 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5698 return length, err 5699 } 5700 5701 // WriteTo implements io.WriterTo.WriteTo. 5702 func (f *FUSESetAttrIn) WriteTo(writer io.Writer) (int64, error) { 5703 // Construct a slice backed by dst's underlying memory. 5704 var buf []byte 5705 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5706 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5707 hdr.Len = f.SizeBytes() 5708 hdr.Cap = f.SizeBytes() 5709 5710 length, err := writer.Write(buf) 5711 // Since we bypassed the compiler's escape analysis, indicate that f 5712 // must live until the use above. 5713 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5714 return int64(length), err 5715 } 5716 5717 // SizeBytes implements marshal.Marshallable.SizeBytes. 5718 func (f *FUSEStatfsOut) SizeBytes() int { 5719 return 56 + 5720 4*6 5721 } 5722 5723 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5724 func (f *FUSEStatfsOut) MarshalBytes(dst []byte) []byte { 5725 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Blocks)) 5726 dst = dst[8:] 5727 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksFree)) 5728 dst = dst[8:] 5729 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksAvailable)) 5730 dst = dst[8:] 5731 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Files)) 5732 dst = dst[8:] 5733 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.FilesFree)) 5734 dst = dst[8:] 5735 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.BlockSize)) 5736 dst = dst[4:] 5737 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLength)) 5738 dst = dst[4:] 5739 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FragmentSize)) 5740 dst = dst[4:] 5741 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5742 dst = dst[4:] 5743 for idx := 0; idx < 6; idx++ { 5744 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Spare[idx])) 5745 dst = dst[4:] 5746 } 5747 return dst 5748 } 5749 5750 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5751 func (f *FUSEStatfsOut) UnmarshalBytes(src []byte) []byte { 5752 f.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5753 src = src[8:] 5754 f.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5755 src = src[8:] 5756 f.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5757 src = src[8:] 5758 f.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5759 src = src[8:] 5760 f.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5761 src = src[8:] 5762 f.BlockSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5763 src = src[4:] 5764 f.NameLength = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5765 src = src[4:] 5766 f.FragmentSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5767 src = src[4:] 5768 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5769 src = src[4:] 5770 for idx := 0; idx < 6; idx++ { 5771 f.Spare[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5772 src = src[4:] 5773 } 5774 return src 5775 } 5776 5777 // Packed implements marshal.Marshallable.Packed. 5778 // 5779 //go:nosplit 5780 func (f *FUSEStatfsOut) Packed() bool { 5781 return true 5782 } 5783 5784 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5785 func (f *FUSEStatfsOut) MarshalUnsafe(dst []byte) []byte { 5786 size := f.SizeBytes() 5787 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5788 return dst[size:] 5789 } 5790 5791 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5792 func (f *FUSEStatfsOut) UnmarshalUnsafe(src []byte) []byte { 5793 size := f.SizeBytes() 5794 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5795 return src[size:] 5796 } 5797 5798 // CopyOutN implements marshal.Marshallable.CopyOutN. 5799 func (f *FUSEStatfsOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5800 // Construct a slice backed by dst's underlying memory. 5801 var buf []byte 5802 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5803 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5804 hdr.Len = f.SizeBytes() 5805 hdr.Cap = f.SizeBytes() 5806 5807 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5808 // Since we bypassed the compiler's escape analysis, indicate that f 5809 // must live until the use above. 5810 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5811 return length, err 5812 } 5813 5814 // CopyOut implements marshal.Marshallable.CopyOut. 5815 func (f *FUSEStatfsOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5816 return f.CopyOutN(cc, addr, f.SizeBytes()) 5817 } 5818 5819 // CopyIn implements marshal.Marshallable.CopyIn. 5820 func (f *FUSEStatfsOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5821 // Construct a slice backed by dst's underlying memory. 5822 var buf []byte 5823 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5824 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5825 hdr.Len = f.SizeBytes() 5826 hdr.Cap = f.SizeBytes() 5827 5828 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5829 // Since we bypassed the compiler's escape analysis, indicate that f 5830 // must live until the use above. 5831 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5832 return length, err 5833 } 5834 5835 // WriteTo implements io.WriterTo.WriteTo. 5836 func (f *FUSEStatfsOut) WriteTo(writer io.Writer) (int64, error) { 5837 // Construct a slice backed by dst's underlying memory. 5838 var buf []byte 5839 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5840 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5841 hdr.Len = f.SizeBytes() 5842 hdr.Cap = f.SizeBytes() 5843 5844 length, err := writer.Write(buf) 5845 // Since we bypassed the compiler's escape analysis, indicate that f 5846 // must live until the use above. 5847 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5848 return int64(length), err 5849 } 5850 5851 // Packed implements marshal.Marshallable.Packed. 5852 // 5853 //go:nosplit 5854 func (r *FUSESymlinkIn) Packed() bool { 5855 // Type FUSESymlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5856 return false 5857 } 5858 5859 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5860 func (r *FUSESymlinkIn) MarshalUnsafe(dst []byte) []byte { 5861 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5862 return r.MarshalBytes(dst) 5863 } 5864 5865 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5866 func (r *FUSESymlinkIn) UnmarshalUnsafe(src []byte) []byte { 5867 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5868 return r.UnmarshalBytes(src) 5869 } 5870 5871 // CopyOutN implements marshal.Marshallable.CopyOutN. 5872 // 5873 //go:nosplit 5874 func (r *FUSESymlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5875 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5876 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5877 r.MarshalBytes(buf) // escapes: fallback. 5878 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5879 } 5880 5881 // CopyOut implements marshal.Marshallable.CopyOut. 5882 func (r *FUSESymlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5883 return r.CopyOutN(cc, addr, r.SizeBytes()) 5884 } 5885 5886 // CopyIn implements marshal.Marshallable.CopyIn. 5887 func (r *FUSESymlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5888 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5889 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5890 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5891 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5892 // partially unmarshalled struct. 5893 r.UnmarshalBytes(buf) // escapes: fallback. 5894 return length, err 5895 } 5896 5897 // WriteTo implements io.WriterTo.WriteTo. 5898 func (r *FUSESymlinkIn) WriteTo(writer io.Writer) (int64, error) { 5899 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5900 buf := make([]byte, r.SizeBytes()) 5901 r.MarshalBytes(buf) 5902 length, err := writer.Write(buf) 5903 return int64(length), err 5904 } 5905 5906 // Packed implements marshal.Marshallable.Packed. 5907 // 5908 //go:nosplit 5909 func (r *FUSEUnlinkIn) Packed() bool { 5910 // Type FUSEUnlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5911 return false 5912 } 5913 5914 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5915 func (r *FUSEUnlinkIn) MarshalUnsafe(dst []byte) []byte { 5916 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5917 return r.MarshalBytes(dst) 5918 } 5919 5920 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5921 func (r *FUSEUnlinkIn) UnmarshalUnsafe(src []byte) []byte { 5922 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5923 return r.UnmarshalBytes(src) 5924 } 5925 5926 // CopyOutN implements marshal.Marshallable.CopyOutN. 5927 // 5928 //go:nosplit 5929 func (r *FUSEUnlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5930 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5931 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5932 r.MarshalBytes(buf) // escapes: fallback. 5933 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5934 } 5935 5936 // CopyOut implements marshal.Marshallable.CopyOut. 5937 func (r *FUSEUnlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5938 return r.CopyOutN(cc, addr, r.SizeBytes()) 5939 } 5940 5941 // CopyIn implements marshal.Marshallable.CopyIn. 5942 func (r *FUSEUnlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5943 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5944 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5945 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5946 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5947 // partially unmarshalled struct. 5948 r.UnmarshalBytes(buf) // escapes: fallback. 5949 return length, err 5950 } 5951 5952 // WriteTo implements io.WriterTo.WriteTo. 5953 func (r *FUSEUnlinkIn) WriteTo(writer io.Writer) (int64, error) { 5954 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5955 buf := make([]byte, r.SizeBytes()) 5956 r.MarshalBytes(buf) 5957 length, err := writer.Write(buf) 5958 return int64(length), err 5959 } 5960 5961 // SizeBytes implements marshal.Marshallable.SizeBytes. 5962 func (f *FUSEWriteIn) SizeBytes() int { 5963 return 40 5964 } 5965 5966 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5967 func (f *FUSEWriteIn) MarshalBytes(dst []byte) []byte { 5968 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5969 dst = dst[8:] 5970 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5971 dst = dst[8:] 5972 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5973 dst = dst[4:] 5974 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.WriteFlags)) 5975 dst = dst[4:] 5976 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5977 dst = dst[8:] 5978 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5979 dst = dst[4:] 5980 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5981 dst = dst[4:] 5982 return dst 5983 } 5984 5985 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5986 func (f *FUSEWriteIn) UnmarshalBytes(src []byte) []byte { 5987 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5988 src = src[8:] 5989 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5990 src = src[8:] 5991 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5992 src = src[4:] 5993 f.WriteFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5994 src = src[4:] 5995 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5996 src = src[8:] 5997 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5998 src = src[4:] 5999 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6000 src = src[4:] 6001 return src 6002 } 6003 6004 // Packed implements marshal.Marshallable.Packed. 6005 // 6006 //go:nosplit 6007 func (f *FUSEWriteIn) Packed() bool { 6008 return true 6009 } 6010 6011 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6012 func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) []byte { 6013 size := f.SizeBytes() 6014 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6015 return dst[size:] 6016 } 6017 6018 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6019 func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) []byte { 6020 size := f.SizeBytes() 6021 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6022 return src[size:] 6023 } 6024 6025 // CopyOutN implements marshal.Marshallable.CopyOutN. 6026 func (f *FUSEWriteIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6027 // Construct a slice backed by dst's underlying memory. 6028 var buf []byte 6029 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6030 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6031 hdr.Len = f.SizeBytes() 6032 hdr.Cap = f.SizeBytes() 6033 6034 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6035 // Since we bypassed the compiler's escape analysis, indicate that f 6036 // must live until the use above. 6037 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6038 return length, err 6039 } 6040 6041 // CopyOut implements marshal.Marshallable.CopyOut. 6042 func (f *FUSEWriteIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6043 return f.CopyOutN(cc, addr, f.SizeBytes()) 6044 } 6045 6046 // CopyIn implements marshal.Marshallable.CopyIn. 6047 func (f *FUSEWriteIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6048 // Construct a slice backed by dst's underlying memory. 6049 var buf []byte 6050 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6051 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6052 hdr.Len = f.SizeBytes() 6053 hdr.Cap = f.SizeBytes() 6054 6055 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6056 // Since we bypassed the compiler's escape analysis, indicate that f 6057 // must live until the use above. 6058 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6059 return length, err 6060 } 6061 6062 // WriteTo implements io.WriterTo.WriteTo. 6063 func (f *FUSEWriteIn) WriteTo(writer io.Writer) (int64, error) { 6064 // Construct a slice backed by dst's underlying memory. 6065 var buf []byte 6066 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6067 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6068 hdr.Len = f.SizeBytes() 6069 hdr.Cap = f.SizeBytes() 6070 6071 length, err := writer.Write(buf) 6072 // Since we bypassed the compiler's escape analysis, indicate that f 6073 // must live until the use above. 6074 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6075 return int64(length), err 6076 } 6077 6078 // SizeBytes implements marshal.Marshallable.SizeBytes. 6079 func (f *FUSEWriteOut) SizeBytes() int { 6080 return 8 6081 } 6082 6083 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6084 func (f *FUSEWriteOut) MarshalBytes(dst []byte) []byte { 6085 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 6086 dst = dst[4:] 6087 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6088 dst = dst[4:] 6089 return dst 6090 } 6091 6092 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6093 func (f *FUSEWriteOut) UnmarshalBytes(src []byte) []byte { 6094 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6095 src = src[4:] 6096 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6097 src = src[4:] 6098 return src 6099 } 6100 6101 // Packed implements marshal.Marshallable.Packed. 6102 // 6103 //go:nosplit 6104 func (f *FUSEWriteOut) Packed() bool { 6105 return true 6106 } 6107 6108 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6109 func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) []byte { 6110 size := f.SizeBytes() 6111 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6112 return dst[size:] 6113 } 6114 6115 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6116 func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) []byte { 6117 size := f.SizeBytes() 6118 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6119 return src[size:] 6120 } 6121 6122 // CopyOutN implements marshal.Marshallable.CopyOutN. 6123 func (f *FUSEWriteOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6124 // Construct a slice backed by dst's underlying memory. 6125 var buf []byte 6126 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6127 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6128 hdr.Len = f.SizeBytes() 6129 hdr.Cap = f.SizeBytes() 6130 6131 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6132 // Since we bypassed the compiler's escape analysis, indicate that f 6133 // must live until the use above. 6134 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6135 return length, err 6136 } 6137 6138 // CopyOut implements marshal.Marshallable.CopyOut. 6139 func (f *FUSEWriteOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6140 return f.CopyOutN(cc, addr, f.SizeBytes()) 6141 } 6142 6143 // CopyIn implements marshal.Marshallable.CopyIn. 6144 func (f *FUSEWriteOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6145 // Construct a slice backed by dst's underlying memory. 6146 var buf []byte 6147 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6148 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6149 hdr.Len = f.SizeBytes() 6150 hdr.Cap = f.SizeBytes() 6151 6152 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6153 // Since we bypassed the compiler's escape analysis, indicate that f 6154 // must live until the use above. 6155 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6156 return length, err 6157 } 6158 6159 // WriteTo implements io.WriterTo.WriteTo. 6160 func (f *FUSEWriteOut) WriteTo(writer io.Writer) (int64, error) { 6161 // Construct a slice backed by dst's underlying memory. 6162 var buf []byte 6163 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6164 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6165 hdr.Len = f.SizeBytes() 6166 hdr.Cap = f.SizeBytes() 6167 6168 length, err := writer.Write(buf) 6169 // Since we bypassed the compiler's escape analysis, indicate that f 6170 // must live until the use above. 6171 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6172 return int64(length), err 6173 } 6174 6175 // Packed implements marshal.Marshallable.Packed. 6176 // 6177 //go:nosplit 6178 func (r *FUSEWritePayloadIn) Packed() bool { 6179 // Type FUSEWritePayloadIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6180 return false 6181 } 6182 6183 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6184 func (r *FUSEWritePayloadIn) MarshalUnsafe(dst []byte) []byte { 6185 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6186 return r.MarshalBytes(dst) 6187 } 6188 6189 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6190 func (r *FUSEWritePayloadIn) UnmarshalUnsafe(src []byte) []byte { 6191 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6192 return r.UnmarshalBytes(src) 6193 } 6194 6195 // CopyOutN implements marshal.Marshallable.CopyOutN. 6196 // 6197 //go:nosplit 6198 func (r *FUSEWritePayloadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6199 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6200 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6201 r.MarshalBytes(buf) // escapes: fallback. 6202 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6203 } 6204 6205 // CopyOut implements marshal.Marshallable.CopyOut. 6206 func (r *FUSEWritePayloadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6207 return r.CopyOutN(cc, addr, r.SizeBytes()) 6208 } 6209 6210 // CopyIn implements marshal.Marshallable.CopyIn. 6211 func (r *FUSEWritePayloadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6212 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6213 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6214 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6215 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6216 // partially unmarshalled struct. 6217 r.UnmarshalBytes(buf) // escapes: fallback. 6218 return length, err 6219 } 6220 6221 // WriteTo implements io.WriterTo.WriteTo. 6222 func (r *FUSEWritePayloadIn) WriteTo(writer io.Writer) (int64, error) { 6223 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6224 buf := make([]byte, r.SizeBytes()) 6225 r.MarshalBytes(buf) 6226 length, err := writer.Write(buf) 6227 return int64(length), err 6228 } 6229 6230 // SizeBytes implements marshal.Marshallable.SizeBytes. 6231 func (r *RobustListHead) SizeBytes() int { 6232 return 24 6233 } 6234 6235 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6236 func (r *RobustListHead) MarshalBytes(dst []byte) []byte { 6237 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.List)) 6238 dst = dst[8:] 6239 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.FutexOffset)) 6240 dst = dst[8:] 6241 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ListOpPending)) 6242 dst = dst[8:] 6243 return dst 6244 } 6245 6246 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6247 func (r *RobustListHead) UnmarshalBytes(src []byte) []byte { 6248 r.List = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6249 src = src[8:] 6250 r.FutexOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6251 src = src[8:] 6252 r.ListOpPending = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6253 src = src[8:] 6254 return src 6255 } 6256 6257 // Packed implements marshal.Marshallable.Packed. 6258 // 6259 //go:nosplit 6260 func (r *RobustListHead) Packed() bool { 6261 return true 6262 } 6263 6264 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6265 func (r *RobustListHead) MarshalUnsafe(dst []byte) []byte { 6266 size := r.SizeBytes() 6267 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 6268 return dst[size:] 6269 } 6270 6271 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6272 func (r *RobustListHead) UnmarshalUnsafe(src []byte) []byte { 6273 size := r.SizeBytes() 6274 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 6275 return src[size:] 6276 } 6277 6278 // CopyOutN implements marshal.Marshallable.CopyOutN. 6279 func (r *RobustListHead) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6280 // Construct a slice backed by dst's underlying memory. 6281 var buf []byte 6282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6284 hdr.Len = r.SizeBytes() 6285 hdr.Cap = r.SizeBytes() 6286 6287 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6288 // Since we bypassed the compiler's escape analysis, indicate that r 6289 // must live until the use above. 6290 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6291 return length, err 6292 } 6293 6294 // CopyOut implements marshal.Marshallable.CopyOut. 6295 func (r *RobustListHead) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6296 return r.CopyOutN(cc, addr, r.SizeBytes()) 6297 } 6298 6299 // CopyIn implements marshal.Marshallable.CopyIn. 6300 func (r *RobustListHead) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6301 // Construct a slice backed by dst's underlying memory. 6302 var buf []byte 6303 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6304 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6305 hdr.Len = r.SizeBytes() 6306 hdr.Cap = r.SizeBytes() 6307 6308 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6309 // Since we bypassed the compiler's escape analysis, indicate that r 6310 // must live until the use above. 6311 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6312 return length, err 6313 } 6314 6315 // WriteTo implements io.WriterTo.WriteTo. 6316 func (r *RobustListHead) WriteTo(writer io.Writer) (int64, error) { 6317 // Construct a slice backed by dst's underlying memory. 6318 var buf []byte 6319 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6320 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6321 hdr.Len = r.SizeBytes() 6322 hdr.Cap = r.SizeBytes() 6323 6324 length, err := writer.Write(buf) 6325 // Since we bypassed the compiler's escape analysis, indicate that r 6326 // must live until the use above. 6327 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6328 return int64(length), err 6329 } 6330 6331 // SizeBytes implements marshal.Marshallable.SizeBytes. 6332 func (i *IOCqRingOffsets) SizeBytes() int { 6333 return 40 6334 } 6335 6336 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6337 func (i *IOCqRingOffsets) MarshalBytes(dst []byte) []byte { 6338 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6339 dst = dst[4:] 6340 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6341 dst = dst[4:] 6342 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 6343 dst = dst[4:] 6344 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 6345 dst = dst[4:] 6346 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Overflow)) 6347 dst = dst[4:] 6348 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Cqes)) 6349 dst = dst[4:] 6350 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6351 dst = dst[4:] 6352 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 6353 dst = dst[4:] 6354 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 6355 dst = dst[8:] 6356 return dst 6357 } 6358 6359 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6360 func (i *IOCqRingOffsets) UnmarshalBytes(src []byte) []byte { 6361 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6362 src = src[4:] 6363 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6364 src = src[4:] 6365 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6366 src = src[4:] 6367 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6368 src = src[4:] 6369 i.Overflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6370 src = src[4:] 6371 i.Cqes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6372 src = src[4:] 6373 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6374 src = src[4:] 6375 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6376 src = src[4:] 6377 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6378 src = src[8:] 6379 return src 6380 } 6381 6382 // Packed implements marshal.Marshallable.Packed. 6383 // 6384 //go:nosplit 6385 func (i *IOCqRingOffsets) Packed() bool { 6386 return true 6387 } 6388 6389 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6390 func (i *IOCqRingOffsets) MarshalUnsafe(dst []byte) []byte { 6391 size := i.SizeBytes() 6392 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6393 return dst[size:] 6394 } 6395 6396 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6397 func (i *IOCqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 6398 size := i.SizeBytes() 6399 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6400 return src[size:] 6401 } 6402 6403 // CopyOutN implements marshal.Marshallable.CopyOutN. 6404 func (i *IOCqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6405 // Construct a slice backed by dst's underlying memory. 6406 var buf []byte 6407 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6408 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6409 hdr.Len = i.SizeBytes() 6410 hdr.Cap = i.SizeBytes() 6411 6412 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6413 // Since we bypassed the compiler's escape analysis, indicate that i 6414 // must live until the use above. 6415 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6416 return length, err 6417 } 6418 6419 // CopyOut implements marshal.Marshallable.CopyOut. 6420 func (i *IOCqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6421 return i.CopyOutN(cc, addr, i.SizeBytes()) 6422 } 6423 6424 // CopyIn implements marshal.Marshallable.CopyIn. 6425 func (i *IOCqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6426 // Construct a slice backed by dst's underlying memory. 6427 var buf []byte 6428 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6429 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6430 hdr.Len = i.SizeBytes() 6431 hdr.Cap = i.SizeBytes() 6432 6433 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6434 // Since we bypassed the compiler's escape analysis, indicate that i 6435 // must live until the use above. 6436 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6437 return length, err 6438 } 6439 6440 // WriteTo implements io.WriterTo.WriteTo. 6441 func (i *IOCqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 6442 // Construct a slice backed by dst's underlying memory. 6443 var buf []byte 6444 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6445 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6446 hdr.Len = i.SizeBytes() 6447 hdr.Cap = i.SizeBytes() 6448 6449 length, err := writer.Write(buf) 6450 // Since we bypassed the compiler's escape analysis, indicate that i 6451 // must live until the use above. 6452 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6453 return int64(length), err 6454 } 6455 6456 // SizeBytes implements marshal.Marshallable.SizeBytes. 6457 // 6458 //go:nosplit 6459 func (i *IORingIndex) SizeBytes() int { 6460 return 4 6461 } 6462 6463 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6464 func (i *IORingIndex) MarshalBytes(dst []byte) []byte { 6465 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i)) 6466 return dst[4:] 6467 } 6468 6469 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6470 func (i *IORingIndex) UnmarshalBytes(src []byte) []byte { 6471 *i = IORingIndex(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 6472 return src[4:] 6473 } 6474 6475 // Packed implements marshal.Marshallable.Packed. 6476 // 6477 //go:nosplit 6478 func (i *IORingIndex) Packed() bool { 6479 // Scalar newtypes are always packed. 6480 return true 6481 } 6482 6483 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6484 func (i *IORingIndex) MarshalUnsafe(dst []byte) []byte { 6485 size := i.SizeBytes() 6486 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6487 return dst[size:] 6488 } 6489 6490 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6491 func (i *IORingIndex) UnmarshalUnsafe(src []byte) []byte { 6492 size := i.SizeBytes() 6493 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6494 return src[size:] 6495 } 6496 6497 // CopyOutN implements marshal.Marshallable.CopyOutN. 6498 func (i *IORingIndex) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6499 // Construct a slice backed by dst's underlying memory. 6500 var buf []byte 6501 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6502 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6503 hdr.Len = i.SizeBytes() 6504 hdr.Cap = i.SizeBytes() 6505 6506 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6507 // Since we bypassed the compiler's escape analysis, indicate that i 6508 // must live until the use above. 6509 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6510 return length, err 6511 } 6512 6513 // CopyOut implements marshal.Marshallable.CopyOut. 6514 func (i *IORingIndex) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6515 return i.CopyOutN(cc, addr, i.SizeBytes()) 6516 } 6517 6518 // CopyIn implements marshal.Marshallable.CopyIn. 6519 func (i *IORingIndex) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6520 // Construct a slice backed by dst's underlying memory. 6521 var buf []byte 6522 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6523 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6524 hdr.Len = i.SizeBytes() 6525 hdr.Cap = i.SizeBytes() 6526 6527 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6528 // Since we bypassed the compiler's escape analysis, indicate that i 6529 // must live until the use above. 6530 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6531 return length, err 6532 } 6533 6534 // WriteTo implements io.WriterTo.WriteTo. 6535 func (i *IORingIndex) WriteTo(writer io.Writer) (int64, error) { 6536 // Construct a slice backed by dst's underlying memory. 6537 var buf []byte 6538 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6539 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6540 hdr.Len = i.SizeBytes() 6541 hdr.Cap = i.SizeBytes() 6542 6543 length, err := writer.Write(buf) 6544 // Since we bypassed the compiler's escape analysis, indicate that i 6545 // must live until the use above. 6546 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6547 return int64(length), err 6548 } 6549 6550 // SizeBytes implements marshal.Marshallable.SizeBytes. 6551 func (i *IORings) SizeBytes() int { 6552 return 32 + 6553 (*IOUring)(nil).SizeBytes() + 6554 (*IOUring)(nil).SizeBytes() + 6555 1*32 6556 } 6557 6558 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6559 func (i *IORings) MarshalBytes(dst []byte) []byte { 6560 dst = i.Sq.MarshalUnsafe(dst) 6561 dst = i.Cq.MarshalUnsafe(dst) 6562 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingMask)) 6563 dst = dst[4:] 6564 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingMask)) 6565 dst = dst[4:] 6566 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingEntries)) 6567 dst = dst[4:] 6568 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingEntries)) 6569 dst = dst[4:] 6570 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqDropped)) 6571 dst = dst[4:] 6572 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqFlags)) 6573 dst = dst[4:] 6574 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.cqFlags)) 6575 dst = dst[4:] 6576 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqOverflow)) 6577 dst = dst[4:] 6578 // Padding: dst[:sizeof(byte)*32] ~= [32]byte{0} 6579 dst = dst[1*(32):] 6580 return dst 6581 } 6582 6583 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6584 func (i *IORings) UnmarshalBytes(src []byte) []byte { 6585 src = i.Sq.UnmarshalUnsafe(src) 6586 src = i.Cq.UnmarshalUnsafe(src) 6587 i.SqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6588 src = src[4:] 6589 i.CqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6590 src = src[4:] 6591 i.SqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6592 src = src[4:] 6593 i.CqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6594 src = src[4:] 6595 i.sqDropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6596 src = src[4:] 6597 i.sqFlags = int32(hostarch.ByteOrder.Uint32(src[:4])) 6598 src = src[4:] 6599 i.cqFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6600 src = src[4:] 6601 i.CqOverflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6602 src = src[4:] 6603 // Padding: ~ copy([32]byte(i._), src[:sizeof(byte)*32]) 6604 src = src[1*(32):] 6605 return src 6606 } 6607 6608 // Packed implements marshal.Marshallable.Packed. 6609 // 6610 //go:nosplit 6611 func (i *IORings) Packed() bool { 6612 return i.Cq.Packed() && i.Sq.Packed() 6613 } 6614 6615 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6616 func (i *IORings) MarshalUnsafe(dst []byte) []byte { 6617 if i.Cq.Packed() && i.Sq.Packed() { 6618 size := i.SizeBytes() 6619 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6620 return dst[size:] 6621 } 6622 // Type IORings doesn't have a packed layout in memory, fallback to MarshalBytes. 6623 return i.MarshalBytes(dst) 6624 } 6625 6626 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6627 func (i *IORings) UnmarshalUnsafe(src []byte) []byte { 6628 if i.Cq.Packed() && i.Sq.Packed() { 6629 size := i.SizeBytes() 6630 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6631 return src[size:] 6632 } 6633 // Type IORings doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6634 return i.UnmarshalBytes(src) 6635 } 6636 6637 // CopyOutN implements marshal.Marshallable.CopyOutN. 6638 func (i *IORings) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6639 if !i.Cq.Packed() && i.Sq.Packed() { 6640 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 6641 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 6642 i.MarshalBytes(buf) // escapes: fallback. 6643 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6644 } 6645 6646 // Construct a slice backed by dst's underlying memory. 6647 var buf []byte 6648 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6649 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6650 hdr.Len = i.SizeBytes() 6651 hdr.Cap = i.SizeBytes() 6652 6653 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6654 // Since we bypassed the compiler's escape analysis, indicate that i 6655 // must live until the use above. 6656 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6657 return length, err 6658 } 6659 6660 // CopyOut implements marshal.Marshallable.CopyOut. 6661 func (i *IORings) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6662 return i.CopyOutN(cc, addr, i.SizeBytes()) 6663 } 6664 6665 // CopyIn implements marshal.Marshallable.CopyIn. 6666 func (i *IORings) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6667 if !i.Cq.Packed() && i.Sq.Packed() { 6668 // Type IORings doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6669 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 6670 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6671 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6672 // partially unmarshalled struct. 6673 i.UnmarshalBytes(buf) // escapes: fallback. 6674 return length, err 6675 } 6676 6677 // Construct a slice backed by dst's underlying memory. 6678 var buf []byte 6679 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6680 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6681 hdr.Len = i.SizeBytes() 6682 hdr.Cap = i.SizeBytes() 6683 6684 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6685 // Since we bypassed the compiler's escape analysis, indicate that i 6686 // must live until the use above. 6687 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6688 return length, err 6689 } 6690 6691 // WriteTo implements io.WriterTo.WriteTo. 6692 func (i *IORings) WriteTo(writer io.Writer) (int64, error) { 6693 if !i.Cq.Packed() && i.Sq.Packed() { 6694 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 6695 buf := make([]byte, i.SizeBytes()) 6696 i.MarshalBytes(buf) 6697 length, err := writer.Write(buf) 6698 return int64(length), err 6699 } 6700 6701 // Construct a slice backed by dst's underlying memory. 6702 var buf []byte 6703 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6704 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6705 hdr.Len = i.SizeBytes() 6706 hdr.Cap = i.SizeBytes() 6707 6708 length, err := writer.Write(buf) 6709 // Since we bypassed the compiler's escape analysis, indicate that i 6710 // must live until the use above. 6711 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6712 return int64(length), err 6713 } 6714 6715 // SizeBytes implements marshal.Marshallable.SizeBytes. 6716 func (i *IOSqRingOffsets) SizeBytes() int { 6717 return 40 6718 } 6719 6720 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6721 func (i *IOSqRingOffsets) MarshalBytes(dst []byte) []byte { 6722 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6723 dst = dst[4:] 6724 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6725 dst = dst[4:] 6726 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 6727 dst = dst[4:] 6728 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 6729 dst = dst[4:] 6730 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6731 dst = dst[4:] 6732 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Dropped)) 6733 dst = dst[4:] 6734 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Array)) 6735 dst = dst[4:] 6736 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 6737 dst = dst[4:] 6738 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 6739 dst = dst[8:] 6740 return dst 6741 } 6742 6743 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6744 func (i *IOSqRingOffsets) UnmarshalBytes(src []byte) []byte { 6745 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6746 src = src[4:] 6747 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6748 src = src[4:] 6749 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6750 src = src[4:] 6751 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6752 src = src[4:] 6753 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6754 src = src[4:] 6755 i.Dropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6756 src = src[4:] 6757 i.Array = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6758 src = src[4:] 6759 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6760 src = src[4:] 6761 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6762 src = src[8:] 6763 return src 6764 } 6765 6766 // Packed implements marshal.Marshallable.Packed. 6767 // 6768 //go:nosplit 6769 func (i *IOSqRingOffsets) Packed() bool { 6770 return true 6771 } 6772 6773 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6774 func (i *IOSqRingOffsets) MarshalUnsafe(dst []byte) []byte { 6775 size := i.SizeBytes() 6776 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6777 return dst[size:] 6778 } 6779 6780 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6781 func (i *IOSqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 6782 size := i.SizeBytes() 6783 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6784 return src[size:] 6785 } 6786 6787 // CopyOutN implements marshal.Marshallable.CopyOutN. 6788 func (i *IOSqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6789 // Construct a slice backed by dst's underlying memory. 6790 var buf []byte 6791 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6792 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6793 hdr.Len = i.SizeBytes() 6794 hdr.Cap = i.SizeBytes() 6795 6796 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6797 // Since we bypassed the compiler's escape analysis, indicate that i 6798 // must live until the use above. 6799 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6800 return length, err 6801 } 6802 6803 // CopyOut implements marshal.Marshallable.CopyOut. 6804 func (i *IOSqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6805 return i.CopyOutN(cc, addr, i.SizeBytes()) 6806 } 6807 6808 // CopyIn implements marshal.Marshallable.CopyIn. 6809 func (i *IOSqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6810 // Construct a slice backed by dst's underlying memory. 6811 var buf []byte 6812 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6813 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6814 hdr.Len = i.SizeBytes() 6815 hdr.Cap = i.SizeBytes() 6816 6817 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6818 // Since we bypassed the compiler's escape analysis, indicate that i 6819 // must live until the use above. 6820 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6821 return length, err 6822 } 6823 6824 // WriteTo implements io.WriterTo.WriteTo. 6825 func (i *IOSqRingOffsets) WriteTo(writer io.Writer) (int64, 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(i))) 6830 hdr.Len = i.SizeBytes() 6831 hdr.Cap = i.SizeBytes() 6832 6833 length, err := writer.Write(buf) 6834 // Since we bypassed the compiler's escape analysis, indicate that i 6835 // must live until the use above. 6836 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6837 return int64(length), err 6838 } 6839 6840 // SizeBytes implements marshal.Marshallable.SizeBytes. 6841 func (i *IOUring) SizeBytes() int { 6842 return 8 + 6843 1*60 + 6844 1*60 6845 } 6846 6847 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6848 func (i *IOUring) MarshalBytes(dst []byte) []byte { 6849 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6850 dst = dst[4:] 6851 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 6852 dst = dst[1*(60):] 6853 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6854 dst = dst[4:] 6855 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 6856 dst = dst[1*(60):] 6857 return dst 6858 } 6859 6860 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6861 func (i *IOUring) UnmarshalBytes(src []byte) []byte { 6862 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6863 src = src[4:] 6864 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 6865 src = src[1*(60):] 6866 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6867 src = src[4:] 6868 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 6869 src = src[1*(60):] 6870 return src 6871 } 6872 6873 // Packed implements marshal.Marshallable.Packed. 6874 // 6875 //go:nosplit 6876 func (i *IOUring) Packed() bool { 6877 return true 6878 } 6879 6880 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6881 func (i *IOUring) MarshalUnsafe(dst []byte) []byte { 6882 size := i.SizeBytes() 6883 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6884 return dst[size:] 6885 } 6886 6887 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6888 func (i *IOUring) UnmarshalUnsafe(src []byte) []byte { 6889 size := i.SizeBytes() 6890 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6891 return src[size:] 6892 } 6893 6894 // CopyOutN implements marshal.Marshallable.CopyOutN. 6895 func (i *IOUring) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6896 // Construct a slice backed by dst's underlying memory. 6897 var buf []byte 6898 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6899 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6900 hdr.Len = i.SizeBytes() 6901 hdr.Cap = i.SizeBytes() 6902 6903 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6904 // Since we bypassed the compiler's escape analysis, indicate that i 6905 // must live until the use above. 6906 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6907 return length, err 6908 } 6909 6910 // CopyOut implements marshal.Marshallable.CopyOut. 6911 func (i *IOUring) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6912 return i.CopyOutN(cc, addr, i.SizeBytes()) 6913 } 6914 6915 // CopyIn implements marshal.Marshallable.CopyIn. 6916 func (i *IOUring) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6917 // Construct a slice backed by dst's underlying memory. 6918 var buf []byte 6919 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6920 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6921 hdr.Len = i.SizeBytes() 6922 hdr.Cap = i.SizeBytes() 6923 6924 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6925 // Since we bypassed the compiler's escape analysis, indicate that i 6926 // must live until the use above. 6927 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6928 return length, err 6929 } 6930 6931 // WriteTo implements io.WriterTo.WriteTo. 6932 func (i *IOUring) WriteTo(writer io.Writer) (int64, error) { 6933 // Construct a slice backed by dst's underlying memory. 6934 var buf []byte 6935 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6936 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6937 hdr.Len = i.SizeBytes() 6938 hdr.Cap = i.SizeBytes() 6939 6940 length, err := writer.Write(buf) 6941 // Since we bypassed the compiler's escape analysis, indicate that i 6942 // must live until the use above. 6943 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6944 return int64(length), err 6945 } 6946 6947 // SizeBytes implements marshal.Marshallable.SizeBytes. 6948 func (i *IOUringCqe) SizeBytes() int { 6949 return 16 6950 } 6951 6952 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6953 func (i *IOUringCqe) MarshalBytes(dst []byte) []byte { 6954 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 6955 dst = dst[8:] 6956 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Res)) 6957 dst = dst[4:] 6958 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6959 dst = dst[4:] 6960 return dst 6961 } 6962 6963 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6964 func (i *IOUringCqe) UnmarshalBytes(src []byte) []byte { 6965 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6966 src = src[8:] 6967 i.Res = int32(hostarch.ByteOrder.Uint32(src[:4])) 6968 src = src[4:] 6969 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6970 src = src[4:] 6971 return src 6972 } 6973 6974 // Packed implements marshal.Marshallable.Packed. 6975 // 6976 //go:nosplit 6977 func (i *IOUringCqe) Packed() bool { 6978 return true 6979 } 6980 6981 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6982 func (i *IOUringCqe) MarshalUnsafe(dst []byte) []byte { 6983 size := i.SizeBytes() 6984 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6985 return dst[size:] 6986 } 6987 6988 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6989 func (i *IOUringCqe) UnmarshalUnsafe(src []byte) []byte { 6990 size := i.SizeBytes() 6991 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6992 return src[size:] 6993 } 6994 6995 // CopyOutN implements marshal.Marshallable.CopyOutN. 6996 func (i *IOUringCqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6997 // Construct a slice backed by dst's underlying memory. 6998 var buf []byte 6999 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7000 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7001 hdr.Len = i.SizeBytes() 7002 hdr.Cap = i.SizeBytes() 7003 7004 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7005 // Since we bypassed the compiler's escape analysis, indicate that i 7006 // must live until the use above. 7007 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7008 return length, err 7009 } 7010 7011 // CopyOut implements marshal.Marshallable.CopyOut. 7012 func (i *IOUringCqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7013 return i.CopyOutN(cc, addr, i.SizeBytes()) 7014 } 7015 7016 // CopyIn implements marshal.Marshallable.CopyIn. 7017 func (i *IOUringCqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7018 // Construct a slice backed by dst's underlying memory. 7019 var buf []byte 7020 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7021 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7022 hdr.Len = i.SizeBytes() 7023 hdr.Cap = i.SizeBytes() 7024 7025 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7026 // Since we bypassed the compiler's escape analysis, indicate that i 7027 // must live until the use above. 7028 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7029 return length, err 7030 } 7031 7032 // WriteTo implements io.WriterTo.WriteTo. 7033 func (i *IOUringCqe) WriteTo(writer io.Writer) (int64, error) { 7034 // Construct a slice backed by dst's underlying memory. 7035 var buf []byte 7036 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7037 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7038 hdr.Len = i.SizeBytes() 7039 hdr.Cap = i.SizeBytes() 7040 7041 length, err := writer.Write(buf) 7042 // Since we bypassed the compiler's escape analysis, indicate that i 7043 // must live until the use above. 7044 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7045 return int64(length), err 7046 } 7047 7048 // SizeBytes implements marshal.Marshallable.SizeBytes. 7049 func (i *IOUringParams) SizeBytes() int { 7050 return 28 + 7051 4*3 + 7052 (*IOSqRingOffsets)(nil).SizeBytes() + 7053 (*IOCqRingOffsets)(nil).SizeBytes() 7054 } 7055 7056 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7057 func (i *IOUringParams) MarshalBytes(dst []byte) []byte { 7058 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqEntries)) 7059 dst = dst[4:] 7060 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqEntries)) 7061 dst = dst[4:] 7062 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7063 dst = dst[4:] 7064 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadCPU)) 7065 dst = dst[4:] 7066 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadIdle)) 7067 dst = dst[4:] 7068 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Features)) 7069 dst = dst[4:] 7070 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.WqFd)) 7071 dst = dst[4:] 7072 for idx := 0; idx < 3; idx++ { 7073 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv[idx])) 7074 dst = dst[4:] 7075 } 7076 dst = i.SqOff.MarshalUnsafe(dst) 7077 dst = i.CqOff.MarshalUnsafe(dst) 7078 return dst 7079 } 7080 7081 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7082 func (i *IOUringParams) UnmarshalBytes(src []byte) []byte { 7083 i.SqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7084 src = src[4:] 7085 i.CqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7086 src = src[4:] 7087 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7088 src = src[4:] 7089 i.SqThreadCPU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7090 src = src[4:] 7091 i.SqThreadIdle = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7092 src = src[4:] 7093 i.Features = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7094 src = src[4:] 7095 i.WqFd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7096 src = src[4:] 7097 for idx := 0; idx < 3; idx++ { 7098 i.Resv[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7099 src = src[4:] 7100 } 7101 src = i.SqOff.UnmarshalUnsafe(src) 7102 src = i.CqOff.UnmarshalUnsafe(src) 7103 return src 7104 } 7105 7106 // Packed implements marshal.Marshallable.Packed. 7107 // 7108 //go:nosplit 7109 func (i *IOUringParams) Packed() bool { 7110 return i.CqOff.Packed() && i.SqOff.Packed() 7111 } 7112 7113 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7114 func (i *IOUringParams) MarshalUnsafe(dst []byte) []byte { 7115 if i.CqOff.Packed() && i.SqOff.Packed() { 7116 size := i.SizeBytes() 7117 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7118 return dst[size:] 7119 } 7120 // Type IOUringParams doesn't have a packed layout in memory, fallback to MarshalBytes. 7121 return i.MarshalBytes(dst) 7122 } 7123 7124 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7125 func (i *IOUringParams) UnmarshalUnsafe(src []byte) []byte { 7126 if i.CqOff.Packed() && i.SqOff.Packed() { 7127 size := i.SizeBytes() 7128 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7129 return src[size:] 7130 } 7131 // Type IOUringParams doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7132 return i.UnmarshalBytes(src) 7133 } 7134 7135 // CopyOutN implements marshal.Marshallable.CopyOutN. 7136 func (i *IOUringParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7137 if !i.CqOff.Packed() && i.SqOff.Packed() { 7138 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7139 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7140 i.MarshalBytes(buf) // escapes: fallback. 7141 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7142 } 7143 7144 // Construct a slice backed by dst's underlying memory. 7145 var buf []byte 7146 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7147 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7148 hdr.Len = i.SizeBytes() 7149 hdr.Cap = i.SizeBytes() 7150 7151 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7152 // Since we bypassed the compiler's escape analysis, indicate that i 7153 // must live until the use above. 7154 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7155 return length, err 7156 } 7157 7158 // CopyOut implements marshal.Marshallable.CopyOut. 7159 func (i *IOUringParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7160 return i.CopyOutN(cc, addr, i.SizeBytes()) 7161 } 7162 7163 // CopyIn implements marshal.Marshallable.CopyIn. 7164 func (i *IOUringParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7165 if !i.CqOff.Packed() && i.SqOff.Packed() { 7166 // Type IOUringParams doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7167 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7168 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7169 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7170 // partially unmarshalled struct. 7171 i.UnmarshalBytes(buf) // escapes: fallback. 7172 return length, err 7173 } 7174 7175 // Construct a slice backed by dst's underlying memory. 7176 var buf []byte 7177 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7178 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7179 hdr.Len = i.SizeBytes() 7180 hdr.Cap = i.SizeBytes() 7181 7182 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7183 // Since we bypassed the compiler's escape analysis, indicate that i 7184 // must live until the use above. 7185 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7186 return length, err 7187 } 7188 7189 // WriteTo implements io.WriterTo.WriteTo. 7190 func (i *IOUringParams) WriteTo(writer io.Writer) (int64, error) { 7191 if !i.CqOff.Packed() && i.SqOff.Packed() { 7192 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7193 buf := make([]byte, i.SizeBytes()) 7194 i.MarshalBytes(buf) 7195 length, err := writer.Write(buf) 7196 return int64(length), err 7197 } 7198 7199 // Construct a slice backed by dst's underlying memory. 7200 var buf []byte 7201 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7202 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7203 hdr.Len = i.SizeBytes() 7204 hdr.Cap = i.SizeBytes() 7205 7206 length, err := writer.Write(buf) 7207 // Since we bypassed the compiler's escape analysis, indicate that i 7208 // must live until the use above. 7209 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7210 return int64(length), err 7211 } 7212 7213 // SizeBytes implements marshal.Marshallable.SizeBytes. 7214 func (i *IOUringSqe) SizeBytes() int { 7215 return 64 7216 } 7217 7218 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7219 func (i *IOUringSqe) MarshalBytes(dst []byte) []byte { 7220 dst[0] = byte(i.Opcode) 7221 dst = dst[1:] 7222 dst[0] = byte(i.Flags) 7223 dst = dst[1:] 7224 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.IoPrio)) 7225 dst = dst[2:] 7226 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Fd)) 7227 dst = dst[4:] 7228 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.OffOrAddrOrCmdOp)) 7229 dst = dst[8:] 7230 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.AddrOrSpliceOff)) 7231 dst = dst[8:] 7232 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 7233 dst = dst[4:] 7234 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.specialFlags)) 7235 dst = dst[4:] 7236 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 7237 dst = dst[8:] 7238 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.BufIndexOrGroup)) 7239 dst = dst[2:] 7240 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.personality)) 7241 dst = dst[2:] 7242 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.spliceFDOrFileIndex)) 7243 dst = dst[4:] 7244 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.addr3)) 7245 dst = dst[8:] 7246 // Padding: dst[:sizeof(uint64)] ~= uint64(0) 7247 dst = dst[8:] 7248 return dst 7249 } 7250 7251 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7252 func (i *IOUringSqe) UnmarshalBytes(src []byte) []byte { 7253 i.Opcode = uint8(src[0]) 7254 src = src[1:] 7255 i.Flags = uint8(src[0]) 7256 src = src[1:] 7257 i.IoPrio = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7258 src = src[2:] 7259 i.Fd = int32(hostarch.ByteOrder.Uint32(src[:4])) 7260 src = src[4:] 7261 i.OffOrAddrOrCmdOp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7262 src = src[8:] 7263 i.AddrOrSpliceOff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7264 src = src[8:] 7265 i.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7266 src = src[4:] 7267 i.specialFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7268 src = src[4:] 7269 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7270 src = src[8:] 7271 i.BufIndexOrGroup = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7272 src = src[2:] 7273 i.personality = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7274 src = src[2:] 7275 i.spliceFDOrFileIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 7276 src = src[4:] 7277 i.addr3 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7278 src = src[8:] 7279 // Padding: var _ uint64 ~= src[:sizeof(uint64)] 7280 src = src[8:] 7281 return src 7282 } 7283 7284 // Packed implements marshal.Marshallable.Packed. 7285 // 7286 //go:nosplit 7287 func (i *IOUringSqe) Packed() bool { 7288 return true 7289 } 7290 7291 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7292 func (i *IOUringSqe) MarshalUnsafe(dst []byte) []byte { 7293 size := i.SizeBytes() 7294 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7295 return dst[size:] 7296 } 7297 7298 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7299 func (i *IOUringSqe) UnmarshalUnsafe(src []byte) []byte { 7300 size := i.SizeBytes() 7301 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7302 return src[size:] 7303 } 7304 7305 // CopyOutN implements marshal.Marshallable.CopyOutN. 7306 func (i *IOUringSqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7307 // Construct a slice backed by dst's underlying memory. 7308 var buf []byte 7309 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7310 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7311 hdr.Len = i.SizeBytes() 7312 hdr.Cap = i.SizeBytes() 7313 7314 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7315 // Since we bypassed the compiler's escape analysis, indicate that i 7316 // must live until the use above. 7317 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7318 return length, err 7319 } 7320 7321 // CopyOut implements marshal.Marshallable.CopyOut. 7322 func (i *IOUringSqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7323 return i.CopyOutN(cc, addr, i.SizeBytes()) 7324 } 7325 7326 // CopyIn implements marshal.Marshallable.CopyIn. 7327 func (i *IOUringSqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7328 // Construct a slice backed by dst's underlying memory. 7329 var buf []byte 7330 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7331 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7332 hdr.Len = i.SizeBytes() 7333 hdr.Cap = i.SizeBytes() 7334 7335 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7336 // Since we bypassed the compiler's escape analysis, indicate that i 7337 // must live until the use above. 7338 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7339 return length, err 7340 } 7341 7342 // WriteTo implements io.WriterTo.WriteTo. 7343 func (i *IOUringSqe) WriteTo(writer io.Writer) (int64, error) { 7344 // Construct a slice backed by dst's underlying memory. 7345 var buf []byte 7346 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7347 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7348 hdr.Len = i.SizeBytes() 7349 hdr.Cap = i.SizeBytes() 7350 7351 length, err := writer.Write(buf) 7352 // Since we bypassed the compiler's escape analysis, indicate that i 7353 // must live until the use above. 7354 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7355 return int64(length), err 7356 } 7357 7358 // SizeBytes implements marshal.Marshallable.SizeBytes. 7359 func (i *IPCPerm) SizeBytes() int { 7360 return 48 7361 } 7362 7363 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7364 func (i *IPCPerm) MarshalBytes(dst []byte) []byte { 7365 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 7366 dst = dst[4:] 7367 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 7368 dst = dst[4:] 7369 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 7370 dst = dst[4:] 7371 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CUID)) 7372 dst = dst[4:] 7373 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CGID)) 7374 dst = dst[4:] 7375 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Mode)) 7376 dst = dst[2:] 7377 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7378 dst = dst[2:] 7379 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Seq)) 7380 dst = dst[2:] 7381 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7382 dst = dst[2:] 7383 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 7384 dst = dst[4:] 7385 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused1)) 7386 dst = dst[8:] 7387 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused2)) 7388 dst = dst[8:] 7389 return dst 7390 } 7391 7392 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7393 func (i *IPCPerm) UnmarshalBytes(src []byte) []byte { 7394 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7395 src = src[4:] 7396 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7397 src = src[4:] 7398 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7399 src = src[4:] 7400 i.CUID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7401 src = src[4:] 7402 i.CGID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7403 src = src[4:] 7404 i.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7405 src = src[2:] 7406 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7407 src = src[2:] 7408 i.Seq = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7409 src = src[2:] 7410 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7411 src = src[2:] 7412 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 7413 src = src[4:] 7414 i.unused1 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7415 src = src[8:] 7416 i.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7417 src = src[8:] 7418 return src 7419 } 7420 7421 // Packed implements marshal.Marshallable.Packed. 7422 // 7423 //go:nosplit 7424 func (i *IPCPerm) Packed() bool { 7425 return true 7426 } 7427 7428 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7429 func (i *IPCPerm) MarshalUnsafe(dst []byte) []byte { 7430 size := i.SizeBytes() 7431 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7432 return dst[size:] 7433 } 7434 7435 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7436 func (i *IPCPerm) UnmarshalUnsafe(src []byte) []byte { 7437 size := i.SizeBytes() 7438 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7439 return src[size:] 7440 } 7441 7442 // CopyOutN implements marshal.Marshallable.CopyOutN. 7443 func (i *IPCPerm) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7444 // Construct a slice backed by dst's underlying memory. 7445 var buf []byte 7446 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7447 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7448 hdr.Len = i.SizeBytes() 7449 hdr.Cap = i.SizeBytes() 7450 7451 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7452 // Since we bypassed the compiler's escape analysis, indicate that i 7453 // must live until the use above. 7454 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7455 return length, err 7456 } 7457 7458 // CopyOut implements marshal.Marshallable.CopyOut. 7459 func (i *IPCPerm) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7460 return i.CopyOutN(cc, addr, i.SizeBytes()) 7461 } 7462 7463 // CopyIn implements marshal.Marshallable.CopyIn. 7464 func (i *IPCPerm) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7465 // Construct a slice backed by dst's underlying memory. 7466 var buf []byte 7467 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7468 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7469 hdr.Len = i.SizeBytes() 7470 hdr.Cap = i.SizeBytes() 7471 7472 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7473 // Since we bypassed the compiler's escape analysis, indicate that i 7474 // must live until the use above. 7475 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7476 return length, err 7477 } 7478 7479 // WriteTo implements io.WriterTo.WriteTo. 7480 func (i *IPCPerm) WriteTo(writer io.Writer) (int64, error) { 7481 // Construct a slice backed by dst's underlying memory. 7482 var buf []byte 7483 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7484 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7485 hdr.Len = i.SizeBytes() 7486 hdr.Cap = i.SizeBytes() 7487 7488 length, err := writer.Write(buf) 7489 // Since we bypassed the compiler's escape analysis, indicate that i 7490 // must live until the use above. 7491 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7492 return int64(length), err 7493 } 7494 7495 // SizeBytes implements marshal.Marshallable.SizeBytes. 7496 func (s *Sysinfo) SizeBytes() int { 7497 return 78 + 7498 8*3 + 7499 1*6 7500 } 7501 7502 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7503 func (s *Sysinfo) MarshalBytes(dst []byte) []byte { 7504 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Uptime)) 7505 dst = dst[8:] 7506 for idx := 0; idx < 3; idx++ { 7507 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Loads[idx])) 7508 dst = dst[8:] 7509 } 7510 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalRAM)) 7511 dst = dst[8:] 7512 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeRAM)) 7513 dst = dst[8:] 7514 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SharedRAM)) 7515 dst = dst[8:] 7516 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BufferRAM)) 7517 dst = dst[8:] 7518 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalSwap)) 7519 dst = dst[8:] 7520 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeSwap)) 7521 dst = dst[8:] 7522 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Procs)) 7523 dst = dst[2:] 7524 // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0} 7525 dst = dst[1*(6):] 7526 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalHigh)) 7527 dst = dst[8:] 7528 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeHigh)) 7529 dst = dst[8:] 7530 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Unit)) 7531 dst = dst[4:] 7532 return dst 7533 } 7534 7535 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7536 func (s *Sysinfo) UnmarshalBytes(src []byte) []byte { 7537 s.Uptime = int64(hostarch.ByteOrder.Uint64(src[:8])) 7538 src = src[8:] 7539 for idx := 0; idx < 3; idx++ { 7540 s.Loads[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7541 src = src[8:] 7542 } 7543 s.TotalRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7544 src = src[8:] 7545 s.FreeRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7546 src = src[8:] 7547 s.SharedRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7548 src = src[8:] 7549 s.BufferRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7550 src = src[8:] 7551 s.TotalSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7552 src = src[8:] 7553 s.FreeSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7554 src = src[8:] 7555 s.Procs = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7556 src = src[2:] 7557 // Padding: ~ copy([6]byte(s._), src[:sizeof(byte)*6]) 7558 src = src[1*(6):] 7559 s.TotalHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7560 src = src[8:] 7561 s.FreeHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7562 src = src[8:] 7563 s.Unit = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7564 src = src[4:] 7565 return src 7566 } 7567 7568 // Packed implements marshal.Marshallable.Packed. 7569 // 7570 //go:nosplit 7571 func (s *Sysinfo) Packed() bool { 7572 return false 7573 } 7574 7575 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7576 func (s *Sysinfo) MarshalUnsafe(dst []byte) []byte { 7577 // Type Sysinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7578 return s.MarshalBytes(dst) 7579 } 7580 7581 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7582 func (s *Sysinfo) UnmarshalUnsafe(src []byte) []byte { 7583 // Type Sysinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7584 return s.UnmarshalBytes(src) 7585 } 7586 7587 // CopyOutN implements marshal.Marshallable.CopyOutN. 7588 func (s *Sysinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7589 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7590 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 7591 s.MarshalBytes(buf) // escapes: fallback. 7592 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7593 } 7594 7595 // CopyOut implements marshal.Marshallable.CopyOut. 7596 func (s *Sysinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7597 return s.CopyOutN(cc, addr, s.SizeBytes()) 7598 } 7599 7600 // CopyIn implements marshal.Marshallable.CopyIn. 7601 func (s *Sysinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7602 // Type Sysinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7603 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 7604 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7605 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7606 // partially unmarshalled struct. 7607 s.UnmarshalBytes(buf) // escapes: fallback. 7608 return length, err 7609 } 7610 7611 // WriteTo implements io.WriterTo.WriteTo. 7612 func (s *Sysinfo) WriteTo(writer io.Writer) (int64, error) { 7613 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7614 buf := make([]byte, s.SizeBytes()) 7615 s.MarshalBytes(buf) 7616 length, err := writer.Write(buf) 7617 return int64(length), err 7618 } 7619 7620 // SizeBytes implements marshal.Marshallable.SizeBytes. 7621 // 7622 //go:nosplit 7623 func (n *NumaPolicy) SizeBytes() int { 7624 return 4 7625 } 7626 7627 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7628 func (n *NumaPolicy) MarshalBytes(dst []byte) []byte { 7629 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*n)) 7630 return dst[4:] 7631 } 7632 7633 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7634 func (n *NumaPolicy) UnmarshalBytes(src []byte) []byte { 7635 *n = NumaPolicy(int32(hostarch.ByteOrder.Uint32(src[:4]))) 7636 return src[4:] 7637 } 7638 7639 // Packed implements marshal.Marshallable.Packed. 7640 // 7641 //go:nosplit 7642 func (n *NumaPolicy) Packed() bool { 7643 // Scalar newtypes are always packed. 7644 return true 7645 } 7646 7647 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7648 func (n *NumaPolicy) MarshalUnsafe(dst []byte) []byte { 7649 size := n.SizeBytes() 7650 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 7651 return dst[size:] 7652 } 7653 7654 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7655 func (n *NumaPolicy) UnmarshalUnsafe(src []byte) []byte { 7656 size := n.SizeBytes() 7657 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 7658 return src[size:] 7659 } 7660 7661 // CopyOutN implements marshal.Marshallable.CopyOutN. 7662 func (n *NumaPolicy) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7663 // Construct a slice backed by dst's underlying memory. 7664 var buf []byte 7665 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7666 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 7667 hdr.Len = n.SizeBytes() 7668 hdr.Cap = n.SizeBytes() 7669 7670 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7671 // Since we bypassed the compiler's escape analysis, indicate that n 7672 // must live until the use above. 7673 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 7674 return length, err 7675 } 7676 7677 // CopyOut implements marshal.Marshallable.CopyOut. 7678 func (n *NumaPolicy) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7679 return n.CopyOutN(cc, addr, n.SizeBytes()) 7680 } 7681 7682 // CopyIn implements marshal.Marshallable.CopyIn. 7683 func (n *NumaPolicy) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7684 // Construct a slice backed by dst's underlying memory. 7685 var buf []byte 7686 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7687 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 7688 hdr.Len = n.SizeBytes() 7689 hdr.Cap = n.SizeBytes() 7690 7691 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7692 // Since we bypassed the compiler's escape analysis, indicate that n 7693 // must live until the use above. 7694 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 7695 return length, err 7696 } 7697 7698 // WriteTo implements io.WriterTo.WriteTo. 7699 func (n *NumaPolicy) WriteTo(writer io.Writer) (int64, error) { 7700 // Construct a slice backed by dst's underlying memory. 7701 var buf []byte 7702 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7703 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 7704 hdr.Len = n.SizeBytes() 7705 hdr.Cap = n.SizeBytes() 7706 7707 length, err := writer.Write(buf) 7708 // Since we bypassed the compiler's escape analysis, indicate that n 7709 // must live until the use above. 7710 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 7711 return int64(length), err 7712 } 7713 7714 // SizeBytes implements marshal.Marshallable.SizeBytes. 7715 func (m *MqAttr) SizeBytes() int { 7716 return 32 + 7717 8*4 7718 } 7719 7720 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7721 func (m *MqAttr) MarshalBytes(dst []byte) []byte { 7722 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqFlags)) 7723 dst = dst[8:] 7724 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMaxmsg)) 7725 dst = dst[8:] 7726 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMsgsize)) 7727 dst = dst[8:] 7728 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqCurmsgs)) 7729 dst = dst[8:] 7730 // Padding: dst[:sizeof(int64)*4] ~= [4]int64{0} 7731 dst = dst[8*(4):] 7732 return dst 7733 } 7734 7735 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7736 func (m *MqAttr) UnmarshalBytes(src []byte) []byte { 7737 m.MqFlags = int64(hostarch.ByteOrder.Uint64(src[:8])) 7738 src = src[8:] 7739 m.MqMaxmsg = int64(hostarch.ByteOrder.Uint64(src[:8])) 7740 src = src[8:] 7741 m.MqMsgsize = int64(hostarch.ByteOrder.Uint64(src[:8])) 7742 src = src[8:] 7743 m.MqCurmsgs = int64(hostarch.ByteOrder.Uint64(src[:8])) 7744 src = src[8:] 7745 // Padding: ~ copy([4]int64(m._), src[:sizeof(int64)*4]) 7746 src = src[8*(4):] 7747 return src 7748 } 7749 7750 // Packed implements marshal.Marshallable.Packed. 7751 // 7752 //go:nosplit 7753 func (m *MqAttr) Packed() bool { 7754 return true 7755 } 7756 7757 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7758 func (m *MqAttr) MarshalUnsafe(dst []byte) []byte { 7759 size := m.SizeBytes() 7760 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 7761 return dst[size:] 7762 } 7763 7764 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7765 func (m *MqAttr) UnmarshalUnsafe(src []byte) []byte { 7766 size := m.SizeBytes() 7767 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 7768 return src[size:] 7769 } 7770 7771 // CopyOutN implements marshal.Marshallable.CopyOutN. 7772 func (m *MqAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7773 // Construct a slice backed by dst's underlying memory. 7774 var buf []byte 7775 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7776 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7777 hdr.Len = m.SizeBytes() 7778 hdr.Cap = m.SizeBytes() 7779 7780 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7781 // Since we bypassed the compiler's escape analysis, indicate that m 7782 // must live until the use above. 7783 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7784 return length, err 7785 } 7786 7787 // CopyOut implements marshal.Marshallable.CopyOut. 7788 func (m *MqAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7789 return m.CopyOutN(cc, addr, m.SizeBytes()) 7790 } 7791 7792 // CopyIn implements marshal.Marshallable.CopyIn. 7793 func (m *MqAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7794 // Construct a slice backed by dst's underlying memory. 7795 var buf []byte 7796 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7797 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7798 hdr.Len = m.SizeBytes() 7799 hdr.Cap = m.SizeBytes() 7800 7801 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7802 // Since we bypassed the compiler's escape analysis, indicate that m 7803 // must live until the use above. 7804 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7805 return length, err 7806 } 7807 7808 // WriteTo implements io.WriterTo.WriteTo. 7809 func (m *MqAttr) WriteTo(writer io.Writer) (int64, error) { 7810 // Construct a slice backed by dst's underlying memory. 7811 var buf []byte 7812 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7813 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 7814 hdr.Len = m.SizeBytes() 7815 hdr.Cap = m.SizeBytes() 7816 7817 length, err := writer.Write(buf) 7818 // Since we bypassed the compiler's escape analysis, indicate that m 7819 // must live until the use above. 7820 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 7821 return int64(length), err 7822 } 7823 7824 // Packed implements marshal.Marshallable.Packed. 7825 // 7826 //go:nosplit 7827 func (b *MsgBuf) Packed() bool { 7828 // Type MsgBuf is dynamic so it might have slice/string headers. Hence, it is not packed. 7829 return false 7830 } 7831 7832 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7833 func (b *MsgBuf) MarshalUnsafe(dst []byte) []byte { 7834 // Type MsgBuf doesn't have a packed layout in memory, fallback to MarshalBytes. 7835 return b.MarshalBytes(dst) 7836 } 7837 7838 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7839 func (b *MsgBuf) UnmarshalUnsafe(src []byte) []byte { 7840 // Type MsgBuf doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7841 return b.UnmarshalBytes(src) 7842 } 7843 7844 // CopyOutN implements marshal.Marshallable.CopyOutN. 7845 // 7846 //go:nosplit 7847 func (b *MsgBuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7848 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 7849 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 7850 b.MarshalBytes(buf) // escapes: fallback. 7851 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7852 } 7853 7854 // CopyOut implements marshal.Marshallable.CopyOut. 7855 func (b *MsgBuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7856 return b.CopyOutN(cc, addr, b.SizeBytes()) 7857 } 7858 7859 // CopyIn implements marshal.Marshallable.CopyIn. 7860 func (b *MsgBuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7861 // Type MsgBuf doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7862 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 7863 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7864 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7865 // partially unmarshalled struct. 7866 b.UnmarshalBytes(buf) // escapes: fallback. 7867 return length, err 7868 } 7869 7870 // WriteTo implements io.WriterTo.WriteTo. 7871 func (b *MsgBuf) WriteTo(writer io.Writer) (int64, error) { 7872 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 7873 buf := make([]byte, b.SizeBytes()) 7874 b.MarshalBytes(buf) 7875 length, err := writer.Write(buf) 7876 return int64(length), err 7877 } 7878 7879 // SizeBytes implements marshal.Marshallable.SizeBytes. 7880 func (m *MsgInfo) SizeBytes() int { 7881 return 30 7882 } 7883 7884 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7885 func (m *MsgInfo) MarshalBytes(dst []byte) []byte { 7886 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgPool)) 7887 dst = dst[4:] 7888 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMap)) 7889 dst = dst[4:] 7890 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMax)) 7891 dst = dst[4:] 7892 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMnb)) 7893 dst = dst[4:] 7894 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMni)) 7895 dst = dst[4:] 7896 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgSsz)) 7897 dst = dst[4:] 7898 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgTql)) 7899 dst = dst[4:] 7900 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.MsgSeg)) 7901 dst = dst[2:] 7902 return dst 7903 } 7904 7905 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7906 func (m *MsgInfo) UnmarshalBytes(src []byte) []byte { 7907 m.MsgPool = int32(hostarch.ByteOrder.Uint32(src[:4])) 7908 src = src[4:] 7909 m.MsgMap = int32(hostarch.ByteOrder.Uint32(src[:4])) 7910 src = src[4:] 7911 m.MsgMax = int32(hostarch.ByteOrder.Uint32(src[:4])) 7912 src = src[4:] 7913 m.MsgMnb = int32(hostarch.ByteOrder.Uint32(src[:4])) 7914 src = src[4:] 7915 m.MsgMni = int32(hostarch.ByteOrder.Uint32(src[:4])) 7916 src = src[4:] 7917 m.MsgSsz = int32(hostarch.ByteOrder.Uint32(src[:4])) 7918 src = src[4:] 7919 m.MsgTql = int32(hostarch.ByteOrder.Uint32(src[:4])) 7920 src = src[4:] 7921 m.MsgSeg = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7922 src = src[2:] 7923 return src 7924 } 7925 7926 // Packed implements marshal.Marshallable.Packed. 7927 // 7928 //go:nosplit 7929 func (m *MsgInfo) Packed() bool { 7930 return false 7931 } 7932 7933 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7934 func (m *MsgInfo) MarshalUnsafe(dst []byte) []byte { 7935 // Type MsgInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 7936 return m.MarshalBytes(dst) 7937 } 7938 7939 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7940 func (m *MsgInfo) UnmarshalUnsafe(src []byte) []byte { 7941 // Type MsgInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7942 return m.UnmarshalBytes(src) 7943 } 7944 7945 // CopyOutN implements marshal.Marshallable.CopyOutN. 7946 func (m *MsgInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7947 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7948 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 7949 m.MarshalBytes(buf) // escapes: fallback. 7950 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7951 } 7952 7953 // CopyOut implements marshal.Marshallable.CopyOut. 7954 func (m *MsgInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7955 return m.CopyOutN(cc, addr, m.SizeBytes()) 7956 } 7957 7958 // CopyIn implements marshal.Marshallable.CopyIn. 7959 func (m *MsgInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7960 // Type MsgInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7961 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 7962 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 7963 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7964 // partially unmarshalled struct. 7965 m.UnmarshalBytes(buf) // escapes: fallback. 7966 return length, err 7967 } 7968 7969 // WriteTo implements io.WriterTo.WriteTo. 7970 func (m *MsgInfo) WriteTo(writer io.Writer) (int64, error) { 7971 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 7972 buf := make([]byte, m.SizeBytes()) 7973 m.MarshalBytes(buf) 7974 length, err := writer.Write(buf) 7975 return int64(length), err 7976 } 7977 7978 // SizeBytes implements marshal.Marshallable.SizeBytes. 7979 func (m *MsqidDS) SizeBytes() int { 7980 return 48 + 7981 (*IPCPerm)(nil).SizeBytes() + 7982 (*TimeT)(nil).SizeBytes() + 7983 (*TimeT)(nil).SizeBytes() + 7984 (*TimeT)(nil).SizeBytes() 7985 } 7986 7987 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7988 func (m *MsqidDS) MarshalBytes(dst []byte) []byte { 7989 dst = m.MsgPerm.MarshalUnsafe(dst) 7990 dst = m.MsgStime.MarshalUnsafe(dst) 7991 dst = m.MsgRtime.MarshalUnsafe(dst) 7992 dst = m.MsgCtime.MarshalUnsafe(dst) 7993 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgCbytes)) 7994 dst = dst[8:] 7995 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQnum)) 7996 dst = dst[8:] 7997 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQbytes)) 7998 dst = dst[8:] 7999 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLspid)) 8000 dst = dst[4:] 8001 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLrpid)) 8002 dst = dst[4:] 8003 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused4)) 8004 dst = dst[8:] 8005 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused5)) 8006 dst = dst[8:] 8007 return dst 8008 } 8009 8010 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8011 func (m *MsqidDS) UnmarshalBytes(src []byte) []byte { 8012 src = m.MsgPerm.UnmarshalUnsafe(src) 8013 src = m.MsgStime.UnmarshalUnsafe(src) 8014 src = m.MsgRtime.UnmarshalUnsafe(src) 8015 src = m.MsgCtime.UnmarshalUnsafe(src) 8016 m.MsgCbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8017 src = src[8:] 8018 m.MsgQnum = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8019 src = src[8:] 8020 m.MsgQbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8021 src = src[8:] 8022 m.MsgLspid = int32(hostarch.ByteOrder.Uint32(src[:4])) 8023 src = src[4:] 8024 m.MsgLrpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 8025 src = src[4:] 8026 m.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8027 src = src[8:] 8028 m.unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8029 src = src[8:] 8030 return src 8031 } 8032 8033 // Packed implements marshal.Marshallable.Packed. 8034 // 8035 //go:nosplit 8036 func (m *MsqidDS) Packed() bool { 8037 return m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() 8038 } 8039 8040 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8041 func (m *MsqidDS) MarshalUnsafe(dst []byte) []byte { 8042 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8043 size := m.SizeBytes() 8044 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 8045 return dst[size:] 8046 } 8047 // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 8048 return m.MarshalBytes(dst) 8049 } 8050 8051 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8052 func (m *MsqidDS) UnmarshalUnsafe(src []byte) []byte { 8053 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8054 size := m.SizeBytes() 8055 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 8056 return src[size:] 8057 } 8058 // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8059 return m.UnmarshalBytes(src) 8060 } 8061 8062 // CopyOutN implements marshal.Marshallable.CopyOutN. 8063 func (m *MsqidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8064 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8065 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8066 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8067 m.MarshalBytes(buf) // escapes: fallback. 8068 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8069 } 8070 8071 // Construct a slice backed by dst's underlying memory. 8072 var buf []byte 8073 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8074 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8075 hdr.Len = m.SizeBytes() 8076 hdr.Cap = m.SizeBytes() 8077 8078 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8079 // Since we bypassed the compiler's escape analysis, indicate that m 8080 // must live until the use above. 8081 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8082 return length, err 8083 } 8084 8085 // CopyOut implements marshal.Marshallable.CopyOut. 8086 func (m *MsqidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8087 return m.CopyOutN(cc, addr, m.SizeBytes()) 8088 } 8089 8090 // CopyIn implements marshal.Marshallable.CopyIn. 8091 func (m *MsqidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8092 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8093 // Type MsqidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8094 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8095 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8096 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8097 // partially unmarshalled struct. 8098 m.UnmarshalBytes(buf) // escapes: fallback. 8099 return length, err 8100 } 8101 8102 // Construct a slice backed by dst's underlying memory. 8103 var buf []byte 8104 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8105 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8106 hdr.Len = m.SizeBytes() 8107 hdr.Cap = m.SizeBytes() 8108 8109 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8110 // Since we bypassed the compiler's escape analysis, indicate that m 8111 // must live until the use above. 8112 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8113 return length, err 8114 } 8115 8116 // WriteTo implements io.WriterTo.WriteTo. 8117 func (m *MsqidDS) WriteTo(writer io.Writer) (int64, error) { 8118 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8119 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8120 buf := make([]byte, m.SizeBytes()) 8121 m.MarshalBytes(buf) 8122 length, err := writer.Write(buf) 8123 return int64(length), err 8124 } 8125 8126 // Construct a slice backed by dst's underlying memory. 8127 var buf []byte 8128 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8129 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8130 hdr.Len = m.SizeBytes() 8131 hdr.Cap = m.SizeBytes() 8132 8133 length, err := writer.Write(buf) 8134 // Since we bypassed the compiler's escape analysis, indicate that m 8135 // must live until the use above. 8136 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8137 return int64(length), err 8138 } 8139 8140 // SizeBytes implements marshal.Marshallable.SizeBytes. 8141 // 8142 //go:nosplit 8143 func (e *EthtoolCmd) SizeBytes() int { 8144 return 4 8145 } 8146 8147 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8148 func (e *EthtoolCmd) MarshalBytes(dst []byte) []byte { 8149 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*e)) 8150 return dst[4:] 8151 } 8152 8153 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8154 func (e *EthtoolCmd) UnmarshalBytes(src []byte) []byte { 8155 *e = EthtoolCmd(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 8156 return src[4:] 8157 } 8158 8159 // Packed implements marshal.Marshallable.Packed. 8160 // 8161 //go:nosplit 8162 func (e *EthtoolCmd) Packed() bool { 8163 // Scalar newtypes are always packed. 8164 return true 8165 } 8166 8167 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8168 func (e *EthtoolCmd) MarshalUnsafe(dst []byte) []byte { 8169 size := e.SizeBytes() 8170 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8171 return dst[size:] 8172 } 8173 8174 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8175 func (e *EthtoolCmd) UnmarshalUnsafe(src []byte) []byte { 8176 size := e.SizeBytes() 8177 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8178 return src[size:] 8179 } 8180 8181 // CopyOutN implements marshal.Marshallable.CopyOutN. 8182 func (e *EthtoolCmd) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8183 // Construct a slice backed by dst's underlying memory. 8184 var buf []byte 8185 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8186 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8187 hdr.Len = e.SizeBytes() 8188 hdr.Cap = e.SizeBytes() 8189 8190 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8191 // Since we bypassed the compiler's escape analysis, indicate that e 8192 // must live until the use above. 8193 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8194 return length, err 8195 } 8196 8197 // CopyOut implements marshal.Marshallable.CopyOut. 8198 func (e *EthtoolCmd) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8199 return e.CopyOutN(cc, addr, e.SizeBytes()) 8200 } 8201 8202 // CopyIn implements marshal.Marshallable.CopyIn. 8203 func (e *EthtoolCmd) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8204 // Construct a slice backed by dst's underlying memory. 8205 var buf []byte 8206 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8207 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8208 hdr.Len = e.SizeBytes() 8209 hdr.Cap = e.SizeBytes() 8210 8211 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8212 // Since we bypassed the compiler's escape analysis, indicate that e 8213 // must live until the use above. 8214 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8215 return length, err 8216 } 8217 8218 // WriteTo implements io.WriterTo.WriteTo. 8219 func (e *EthtoolCmd) WriteTo(writer io.Writer) (int64, error) { 8220 // Construct a slice backed by dst's underlying memory. 8221 var buf []byte 8222 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8223 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8224 hdr.Len = e.SizeBytes() 8225 hdr.Cap = e.SizeBytes() 8226 8227 length, err := writer.Write(buf) 8228 // Since we bypassed the compiler's escape analysis, indicate that e 8229 // must live until the use above. 8230 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8231 return int64(length), err 8232 } 8233 8234 // SizeBytes implements marshal.Marshallable.SizeBytes. 8235 func (e *EthtoolGFeatures) SizeBytes() int { 8236 return 8 8237 } 8238 8239 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8240 func (e *EthtoolGFeatures) MarshalBytes(dst []byte) []byte { 8241 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Cmd)) 8242 dst = dst[4:] 8243 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Size)) 8244 dst = dst[4:] 8245 return dst 8246 } 8247 8248 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8249 func (e *EthtoolGFeatures) UnmarshalBytes(src []byte) []byte { 8250 e.Cmd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8251 src = src[4:] 8252 e.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8253 src = src[4:] 8254 return src 8255 } 8256 8257 // Packed implements marshal.Marshallable.Packed. 8258 // 8259 //go:nosplit 8260 func (e *EthtoolGFeatures) Packed() bool { 8261 return true 8262 } 8263 8264 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8265 func (e *EthtoolGFeatures) MarshalUnsafe(dst []byte) []byte { 8266 size := e.SizeBytes() 8267 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8268 return dst[size:] 8269 } 8270 8271 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8272 func (e *EthtoolGFeatures) UnmarshalUnsafe(src []byte) []byte { 8273 size := e.SizeBytes() 8274 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8275 return src[size:] 8276 } 8277 8278 // CopyOutN implements marshal.Marshallable.CopyOutN. 8279 func (e *EthtoolGFeatures) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (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(e))) 8284 hdr.Len = e.SizeBytes() 8285 hdr.Cap = e.SizeBytes() 8286 8287 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8288 // Since we bypassed the compiler's escape analysis, indicate that e 8289 // must live until the use above. 8290 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8291 return length, err 8292 } 8293 8294 // CopyOut implements marshal.Marshallable.CopyOut. 8295 func (e *EthtoolGFeatures) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8296 return e.CopyOutN(cc, addr, e.SizeBytes()) 8297 } 8298 8299 // CopyIn implements marshal.Marshallable.CopyIn. 8300 func (e *EthtoolGFeatures) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8301 // Construct a slice backed by dst's underlying memory. 8302 var buf []byte 8303 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8304 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8305 hdr.Len = e.SizeBytes() 8306 hdr.Cap = e.SizeBytes() 8307 8308 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8309 // Since we bypassed the compiler's escape analysis, indicate that e 8310 // must live until the use above. 8311 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8312 return length, err 8313 } 8314 8315 // WriteTo implements io.WriterTo.WriteTo. 8316 func (e *EthtoolGFeatures) WriteTo(writer io.Writer) (int64, error) { 8317 // Construct a slice backed by dst's underlying memory. 8318 var buf []byte 8319 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8320 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8321 hdr.Len = e.SizeBytes() 8322 hdr.Cap = e.SizeBytes() 8323 8324 length, err := writer.Write(buf) 8325 // Since we bypassed the compiler's escape analysis, indicate that e 8326 // must live until the use above. 8327 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8328 return int64(length), err 8329 } 8330 8331 // SizeBytes implements marshal.Marshallable.SizeBytes. 8332 func (e *EthtoolGetFeaturesBlock) SizeBytes() int { 8333 return 16 8334 } 8335 8336 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8337 func (e *EthtoolGetFeaturesBlock) MarshalBytes(dst []byte) []byte { 8338 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Available)) 8339 dst = dst[4:] 8340 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Requested)) 8341 dst = dst[4:] 8342 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Active)) 8343 dst = dst[4:] 8344 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.NeverChanged)) 8345 dst = dst[4:] 8346 return dst 8347 } 8348 8349 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8350 func (e *EthtoolGetFeaturesBlock) UnmarshalBytes(src []byte) []byte { 8351 e.Available = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8352 src = src[4:] 8353 e.Requested = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8354 src = src[4:] 8355 e.Active = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8356 src = src[4:] 8357 e.NeverChanged = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8358 src = src[4:] 8359 return src 8360 } 8361 8362 // Packed implements marshal.Marshallable.Packed. 8363 // 8364 //go:nosplit 8365 func (e *EthtoolGetFeaturesBlock) Packed() bool { 8366 return true 8367 } 8368 8369 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8370 func (e *EthtoolGetFeaturesBlock) MarshalUnsafe(dst []byte) []byte { 8371 size := e.SizeBytes() 8372 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8373 return dst[size:] 8374 } 8375 8376 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8377 func (e *EthtoolGetFeaturesBlock) UnmarshalUnsafe(src []byte) []byte { 8378 size := e.SizeBytes() 8379 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8380 return src[size:] 8381 } 8382 8383 // CopyOutN implements marshal.Marshallable.CopyOutN. 8384 func (e *EthtoolGetFeaturesBlock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8385 // Construct a slice backed by dst's underlying memory. 8386 var buf []byte 8387 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8388 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8389 hdr.Len = e.SizeBytes() 8390 hdr.Cap = e.SizeBytes() 8391 8392 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8393 // Since we bypassed the compiler's escape analysis, indicate that e 8394 // must live until the use above. 8395 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8396 return length, err 8397 } 8398 8399 // CopyOut implements marshal.Marshallable.CopyOut. 8400 func (e *EthtoolGetFeaturesBlock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8401 return e.CopyOutN(cc, addr, e.SizeBytes()) 8402 } 8403 8404 // CopyIn implements marshal.Marshallable.CopyIn. 8405 func (e *EthtoolGetFeaturesBlock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8406 // Construct a slice backed by dst's underlying memory. 8407 var buf []byte 8408 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8409 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8410 hdr.Len = e.SizeBytes() 8411 hdr.Cap = e.SizeBytes() 8412 8413 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8414 // Since we bypassed the compiler's escape analysis, indicate that e 8415 // must live until the use above. 8416 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8417 return length, err 8418 } 8419 8420 // WriteTo implements io.WriterTo.WriteTo. 8421 func (e *EthtoolGetFeaturesBlock) WriteTo(writer io.Writer) (int64, error) { 8422 // Construct a slice backed by dst's underlying memory. 8423 var buf []byte 8424 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8425 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8426 hdr.Len = e.SizeBytes() 8427 hdr.Cap = e.SizeBytes() 8428 8429 length, err := writer.Write(buf) 8430 // Since we bypassed the compiler's escape analysis, indicate that e 8431 // must live until the use above. 8432 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8433 return int64(length), err 8434 } 8435 8436 // SizeBytes implements marshal.Marshallable.SizeBytes. 8437 func (i *IFConf) SizeBytes() int { 8438 return 12 + 8439 1*4 8440 } 8441 8442 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8443 func (i *IFConf) MarshalBytes(dst []byte) []byte { 8444 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 8445 dst = dst[4:] 8446 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 8447 dst = dst[1*(4):] 8448 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Ptr)) 8449 dst = dst[8:] 8450 return dst 8451 } 8452 8453 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8454 func (i *IFConf) UnmarshalBytes(src []byte) []byte { 8455 i.Len = int32(hostarch.ByteOrder.Uint32(src[:4])) 8456 src = src[4:] 8457 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 8458 src = src[1*(4):] 8459 i.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8460 src = src[8:] 8461 return src 8462 } 8463 8464 // Packed implements marshal.Marshallable.Packed. 8465 // 8466 //go:nosplit 8467 func (i *IFConf) Packed() bool { 8468 return true 8469 } 8470 8471 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8472 func (i *IFConf) MarshalUnsafe(dst []byte) []byte { 8473 size := i.SizeBytes() 8474 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 8475 return dst[size:] 8476 } 8477 8478 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8479 func (i *IFConf) UnmarshalUnsafe(src []byte) []byte { 8480 size := i.SizeBytes() 8481 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 8482 return src[size:] 8483 } 8484 8485 // CopyOutN implements marshal.Marshallable.CopyOutN. 8486 func (i *IFConf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8487 // Construct a slice backed by dst's underlying memory. 8488 var buf []byte 8489 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8490 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8491 hdr.Len = i.SizeBytes() 8492 hdr.Cap = i.SizeBytes() 8493 8494 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8495 // Since we bypassed the compiler's escape analysis, indicate that i 8496 // must live until the use above. 8497 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8498 return length, err 8499 } 8500 8501 // CopyOut implements marshal.Marshallable.CopyOut. 8502 func (i *IFConf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8503 return i.CopyOutN(cc, addr, i.SizeBytes()) 8504 } 8505 8506 // CopyIn implements marshal.Marshallable.CopyIn. 8507 func (i *IFConf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8508 // Construct a slice backed by dst's underlying memory. 8509 var buf []byte 8510 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8511 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8512 hdr.Len = i.SizeBytes() 8513 hdr.Cap = i.SizeBytes() 8514 8515 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8516 // Since we bypassed the compiler's escape analysis, indicate that i 8517 // must live until the use above. 8518 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8519 return length, err 8520 } 8521 8522 // WriteTo implements io.WriterTo.WriteTo. 8523 func (i *IFConf) WriteTo(writer io.Writer) (int64, error) { 8524 // Construct a slice backed by dst's underlying memory. 8525 var buf []byte 8526 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8527 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8528 hdr.Len = i.SizeBytes() 8529 hdr.Cap = i.SizeBytes() 8530 8531 length, err := writer.Write(buf) 8532 // Since we bypassed the compiler's escape analysis, indicate that i 8533 // must live until the use above. 8534 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8535 return int64(length), err 8536 } 8537 8538 // SizeBytes implements marshal.Marshallable.SizeBytes. 8539 func (ifr *IFReq) SizeBytes() int { 8540 return 0 + 8541 1*IFNAMSIZ + 8542 1*24 8543 } 8544 8545 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8546 func (ifr *IFReq) MarshalBytes(dst []byte) []byte { 8547 for idx := 0; idx < IFNAMSIZ; idx++ { 8548 dst[0] = byte(ifr.IFName[idx]) 8549 dst = dst[1:] 8550 } 8551 for idx := 0; idx < 24; idx++ { 8552 dst[0] = byte(ifr.Data[idx]) 8553 dst = dst[1:] 8554 } 8555 return dst 8556 } 8557 8558 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8559 func (ifr *IFReq) UnmarshalBytes(src []byte) []byte { 8560 for idx := 0; idx < IFNAMSIZ; idx++ { 8561 ifr.IFName[idx] = src[0] 8562 src = src[1:] 8563 } 8564 for idx := 0; idx < 24; idx++ { 8565 ifr.Data[idx] = src[0] 8566 src = src[1:] 8567 } 8568 return src 8569 } 8570 8571 // Packed implements marshal.Marshallable.Packed. 8572 // 8573 //go:nosplit 8574 func (ifr *IFReq) Packed() bool { 8575 return true 8576 } 8577 8578 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8579 func (ifr *IFReq) MarshalUnsafe(dst []byte) []byte { 8580 size := ifr.SizeBytes() 8581 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(size)) 8582 return dst[size:] 8583 } 8584 8585 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8586 func (ifr *IFReq) UnmarshalUnsafe(src []byte) []byte { 8587 size := ifr.SizeBytes() 8588 gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(size)) 8589 return src[size:] 8590 } 8591 8592 // CopyOutN implements marshal.Marshallable.CopyOutN. 8593 func (ifr *IFReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8594 // Construct a slice backed by dst's underlying memory. 8595 var buf []byte 8596 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8597 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 8598 hdr.Len = ifr.SizeBytes() 8599 hdr.Cap = ifr.SizeBytes() 8600 8601 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8602 // Since we bypassed the compiler's escape analysis, indicate that ifr 8603 // must live until the use above. 8604 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 8605 return length, err 8606 } 8607 8608 // CopyOut implements marshal.Marshallable.CopyOut. 8609 func (ifr *IFReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8610 return ifr.CopyOutN(cc, addr, ifr.SizeBytes()) 8611 } 8612 8613 // CopyIn implements marshal.Marshallable.CopyIn. 8614 func (ifr *IFReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8615 // Construct a slice backed by dst's underlying memory. 8616 var buf []byte 8617 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8618 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 8619 hdr.Len = ifr.SizeBytes() 8620 hdr.Cap = ifr.SizeBytes() 8621 8622 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8623 // Since we bypassed the compiler's escape analysis, indicate that ifr 8624 // must live until the use above. 8625 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 8626 return length, err 8627 } 8628 8629 // WriteTo implements io.WriterTo.WriteTo. 8630 func (ifr *IFReq) WriteTo(writer io.Writer) (int64, error) { 8631 // Construct a slice backed by dst's underlying memory. 8632 var buf []byte 8633 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8634 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 8635 hdr.Len = ifr.SizeBytes() 8636 hdr.Cap = ifr.SizeBytes() 8637 8638 length, err := writer.Write(buf) 8639 // Since we bypassed the compiler's escape analysis, indicate that ifr 8640 // must live until the use above. 8641 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 8642 return int64(length), err 8643 } 8644 8645 // SizeBytes implements marshal.Marshallable.SizeBytes. 8646 // 8647 //go:nosplit 8648 func (en *ErrorName) SizeBytes() int { 8649 return 1 * XT_FUNCTION_MAXNAMELEN 8650 } 8651 8652 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8653 func (en *ErrorName) MarshalBytes(dst []byte) []byte { 8654 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 8655 dst[0] = byte(en[idx]) 8656 dst = dst[1:] 8657 } 8658 return dst 8659 } 8660 8661 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8662 func (en *ErrorName) UnmarshalBytes(src []byte) []byte { 8663 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 8664 en[idx] = src[0] 8665 src = src[1:] 8666 } 8667 return src 8668 } 8669 8670 // Packed implements marshal.Marshallable.Packed. 8671 // 8672 //go:nosplit 8673 func (en *ErrorName) Packed() bool { 8674 // Array newtypes are always packed. 8675 return true 8676 } 8677 8678 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8679 func (en *ErrorName) MarshalUnsafe(dst []byte) []byte { 8680 size := en.SizeBytes() 8681 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 8682 return dst[size:] 8683 } 8684 8685 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8686 func (en *ErrorName) UnmarshalUnsafe(src []byte) []byte { 8687 size := en.SizeBytes() 8688 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 8689 return src[size:] 8690 } 8691 8692 // CopyOutN implements marshal.Marshallable.CopyOutN. 8693 func (en *ErrorName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8694 // Construct a slice backed by dst's underlying memory. 8695 var buf []byte 8696 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8697 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8698 hdr.Len = en.SizeBytes() 8699 hdr.Cap = en.SizeBytes() 8700 8701 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8702 // Since we bypassed the compiler's escape analysis, indicate that en 8703 // must live until the use above. 8704 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8705 return length, err 8706 } 8707 8708 // CopyOut implements marshal.Marshallable.CopyOut. 8709 func (en *ErrorName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8710 return en.CopyOutN(cc, addr, en.SizeBytes()) 8711 } 8712 8713 // CopyIn implements marshal.Marshallable.CopyIn. 8714 func (en *ErrorName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8715 // Construct a slice backed by dst's underlying memory. 8716 var buf []byte 8717 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8718 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8719 hdr.Len = en.SizeBytes() 8720 hdr.Cap = en.SizeBytes() 8721 8722 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8723 // Since we bypassed the compiler's escape analysis, indicate that en 8724 // must live until the use above. 8725 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8726 return length, err 8727 } 8728 8729 // WriteTo implements io.WriterTo.WriteTo. 8730 func (en *ErrorName) WriteTo(writer io.Writer) (int64, error) { 8731 // Construct a slice backed by dst's underlying memory. 8732 var buf []byte 8733 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8734 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8735 hdr.Len = en.SizeBytes() 8736 hdr.Cap = en.SizeBytes() 8737 8738 length, err := writer.Write(buf) 8739 // Since we bypassed the compiler's escape analysis, indicate that en 8740 // must live until the use above. 8741 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8742 return int64(length), err 8743 } 8744 8745 // SizeBytes implements marshal.Marshallable.SizeBytes. 8746 // 8747 //go:nosplit 8748 func (en *ExtensionName) SizeBytes() int { 8749 return 1 * XT_EXTENSION_MAXNAMELEN 8750 } 8751 8752 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8753 func (en *ExtensionName) MarshalBytes(dst []byte) []byte { 8754 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 8755 dst[0] = byte(en[idx]) 8756 dst = dst[1:] 8757 } 8758 return dst 8759 } 8760 8761 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8762 func (en *ExtensionName) UnmarshalBytes(src []byte) []byte { 8763 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 8764 en[idx] = src[0] 8765 src = src[1:] 8766 } 8767 return src 8768 } 8769 8770 // Packed implements marshal.Marshallable.Packed. 8771 // 8772 //go:nosplit 8773 func (en *ExtensionName) Packed() bool { 8774 // Array newtypes are always packed. 8775 return true 8776 } 8777 8778 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8779 func (en *ExtensionName) MarshalUnsafe(dst []byte) []byte { 8780 size := en.SizeBytes() 8781 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 8782 return dst[size:] 8783 } 8784 8785 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8786 func (en *ExtensionName) UnmarshalUnsafe(src []byte) []byte { 8787 size := en.SizeBytes() 8788 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 8789 return src[size:] 8790 } 8791 8792 // CopyOutN implements marshal.Marshallable.CopyOutN. 8793 func (en *ExtensionName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8794 // Construct a slice backed by dst's underlying memory. 8795 var buf []byte 8796 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8797 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8798 hdr.Len = en.SizeBytes() 8799 hdr.Cap = en.SizeBytes() 8800 8801 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8802 // Since we bypassed the compiler's escape analysis, indicate that en 8803 // must live until the use above. 8804 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8805 return length, err 8806 } 8807 8808 // CopyOut implements marshal.Marshallable.CopyOut. 8809 func (en *ExtensionName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8810 return en.CopyOutN(cc, addr, en.SizeBytes()) 8811 } 8812 8813 // CopyIn implements marshal.Marshallable.CopyIn. 8814 func (en *ExtensionName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8815 // Construct a slice backed by dst's underlying memory. 8816 var buf []byte 8817 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8818 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8819 hdr.Len = en.SizeBytes() 8820 hdr.Cap = en.SizeBytes() 8821 8822 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8823 // Since we bypassed the compiler's escape analysis, indicate that en 8824 // must live until the use above. 8825 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8826 return length, err 8827 } 8828 8829 // WriteTo implements io.WriterTo.WriteTo. 8830 func (en *ExtensionName) WriteTo(writer io.Writer) (int64, error) { 8831 // Construct a slice backed by dst's underlying memory. 8832 var buf []byte 8833 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8834 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 8835 hdr.Len = en.SizeBytes() 8836 hdr.Cap = en.SizeBytes() 8837 8838 length, err := writer.Write(buf) 8839 // Since we bypassed the compiler's escape analysis, indicate that en 8840 // must live until the use above. 8841 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 8842 return int64(length), err 8843 } 8844 8845 // SizeBytes implements marshal.Marshallable.SizeBytes. 8846 func (i *IPTEntry) SizeBytes() int { 8847 return 12 + 8848 (*IPTIP)(nil).SizeBytes() + 8849 (*XTCounters)(nil).SizeBytes() 8850 } 8851 8852 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8853 func (i *IPTEntry) MarshalBytes(dst []byte) []byte { 8854 dst = i.IP.MarshalUnsafe(dst) 8855 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 8856 dst = dst[4:] 8857 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 8858 dst = dst[2:] 8859 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 8860 dst = dst[2:] 8861 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 8862 dst = dst[4:] 8863 dst = i.Counters.MarshalUnsafe(dst) 8864 return dst 8865 } 8866 8867 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8868 func (i *IPTEntry) UnmarshalBytes(src []byte) []byte { 8869 src = i.IP.UnmarshalUnsafe(src) 8870 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8871 src = src[4:] 8872 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8873 src = src[2:] 8874 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8875 src = src[2:] 8876 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8877 src = src[4:] 8878 src = i.Counters.UnmarshalUnsafe(src) 8879 return src 8880 } 8881 8882 // Packed implements marshal.Marshallable.Packed. 8883 // 8884 //go:nosplit 8885 func (i *IPTEntry) Packed() bool { 8886 return i.Counters.Packed() && i.IP.Packed() 8887 } 8888 8889 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8890 func (i *IPTEntry) MarshalUnsafe(dst []byte) []byte { 8891 if i.Counters.Packed() && i.IP.Packed() { 8892 size := i.SizeBytes() 8893 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 8894 return dst[size:] 8895 } 8896 // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 8897 return i.MarshalBytes(dst) 8898 } 8899 8900 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8901 func (i *IPTEntry) UnmarshalUnsafe(src []byte) []byte { 8902 if i.Counters.Packed() && i.IP.Packed() { 8903 size := i.SizeBytes() 8904 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 8905 return src[size:] 8906 } 8907 // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8908 return i.UnmarshalBytes(src) 8909 } 8910 8911 // CopyOutN implements marshal.Marshallable.CopyOutN. 8912 func (i *IPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8913 if !i.Counters.Packed() && i.IP.Packed() { 8914 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 8915 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 8916 i.MarshalBytes(buf) // escapes: fallback. 8917 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8918 } 8919 8920 // Construct a slice backed by dst's underlying memory. 8921 var buf []byte 8922 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8923 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8924 hdr.Len = i.SizeBytes() 8925 hdr.Cap = i.SizeBytes() 8926 8927 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8928 // Since we bypassed the compiler's escape analysis, indicate that i 8929 // must live until the use above. 8930 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8931 return length, err 8932 } 8933 8934 // CopyOut implements marshal.Marshallable.CopyOut. 8935 func (i *IPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8936 return i.CopyOutN(cc, addr, i.SizeBytes()) 8937 } 8938 8939 // CopyIn implements marshal.Marshallable.CopyIn. 8940 func (i *IPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8941 if !i.Counters.Packed() && i.IP.Packed() { 8942 // Type IPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8943 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 8944 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8945 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8946 // partially unmarshalled struct. 8947 i.UnmarshalBytes(buf) // escapes: fallback. 8948 return length, err 8949 } 8950 8951 // Construct a slice backed by dst's underlying memory. 8952 var buf []byte 8953 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8954 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8955 hdr.Len = i.SizeBytes() 8956 hdr.Cap = i.SizeBytes() 8957 8958 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8959 // Since we bypassed the compiler's escape analysis, indicate that i 8960 // must live until the use above. 8961 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8962 return length, err 8963 } 8964 8965 // WriteTo implements io.WriterTo.WriteTo. 8966 func (i *IPTEntry) WriteTo(writer io.Writer) (int64, error) { 8967 if !i.Counters.Packed() && i.IP.Packed() { 8968 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 8969 buf := make([]byte, i.SizeBytes()) 8970 i.MarshalBytes(buf) 8971 length, err := writer.Write(buf) 8972 return int64(length), err 8973 } 8974 8975 // Construct a slice backed by dst's underlying memory. 8976 var buf []byte 8977 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8978 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 8979 hdr.Len = i.SizeBytes() 8980 hdr.Cap = i.SizeBytes() 8981 8982 length, err := writer.Write(buf) 8983 // Since we bypassed the compiler's escape analysis, indicate that i 8984 // must live until the use above. 8985 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8986 return int64(length), err 8987 } 8988 8989 // SizeBytes implements marshal.Marshallable.SizeBytes. 8990 func (i *IPTGetEntries) SizeBytes() int { 8991 return 4 + 8992 (*TableName)(nil).SizeBytes() + 8993 1*4 8994 } 8995 8996 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8997 func (i *IPTGetEntries) MarshalBytes(dst []byte) []byte { 8998 dst = i.Name.MarshalUnsafe(dst) 8999 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9000 dst = dst[4:] 9001 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 9002 dst = dst[1*(4):] 9003 return dst 9004 } 9005 9006 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9007 func (i *IPTGetEntries) UnmarshalBytes(src []byte) []byte { 9008 src = i.Name.UnmarshalUnsafe(src) 9009 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9010 src = src[4:] 9011 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 9012 src = src[1*(4):] 9013 return src 9014 } 9015 9016 // Packed implements marshal.Marshallable.Packed. 9017 // 9018 //go:nosplit 9019 func (i *IPTGetEntries) Packed() bool { 9020 return i.Name.Packed() 9021 } 9022 9023 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9024 func (i *IPTGetEntries) MarshalUnsafe(dst []byte) []byte { 9025 if i.Name.Packed() { 9026 size := i.SizeBytes() 9027 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9028 return dst[size:] 9029 } 9030 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 9031 return i.MarshalBytes(dst) 9032 } 9033 9034 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9035 func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 9036 if i.Name.Packed() { 9037 size := i.SizeBytes() 9038 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9039 return src[size:] 9040 } 9041 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9042 return i.UnmarshalBytes(src) 9043 } 9044 9045 // CopyOutN implements marshal.Marshallable.CopyOutN. 9046 func (i *IPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9047 if !i.Name.Packed() { 9048 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9049 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9050 i.MarshalBytes(buf) // escapes: fallback. 9051 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9052 } 9053 9054 // Construct a slice backed by dst's underlying memory. 9055 var buf []byte 9056 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9057 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9058 hdr.Len = i.SizeBytes() 9059 hdr.Cap = i.SizeBytes() 9060 9061 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9062 // Since we bypassed the compiler's escape analysis, indicate that i 9063 // must live until the use above. 9064 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9065 return length, err 9066 } 9067 9068 // CopyOut implements marshal.Marshallable.CopyOut. 9069 func (i *IPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9070 return i.CopyOutN(cc, addr, i.SizeBytes()) 9071 } 9072 9073 // CopyIn implements marshal.Marshallable.CopyIn. 9074 func (i *IPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9075 if !i.Name.Packed() { 9076 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9077 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9078 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9079 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9080 // partially unmarshalled struct. 9081 i.UnmarshalBytes(buf) // escapes: fallback. 9082 return length, err 9083 } 9084 9085 // Construct a slice backed by dst's underlying memory. 9086 var buf []byte 9087 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9088 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9089 hdr.Len = i.SizeBytes() 9090 hdr.Cap = i.SizeBytes() 9091 9092 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9093 // Since we bypassed the compiler's escape analysis, indicate that i 9094 // must live until the use above. 9095 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9096 return length, err 9097 } 9098 9099 // WriteTo implements io.WriterTo.WriteTo. 9100 func (i *IPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 9101 if !i.Name.Packed() { 9102 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9103 buf := make([]byte, i.SizeBytes()) 9104 i.MarshalBytes(buf) 9105 length, err := writer.Write(buf) 9106 return int64(length), err 9107 } 9108 9109 // Construct a slice backed by dst's underlying memory. 9110 var buf []byte 9111 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9112 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9113 hdr.Len = i.SizeBytes() 9114 hdr.Cap = i.SizeBytes() 9115 9116 length, err := writer.Write(buf) 9117 // Since we bypassed the compiler's escape analysis, indicate that i 9118 // must live until the use above. 9119 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9120 return int64(length), err 9121 } 9122 9123 // SizeBytes implements marshal.Marshallable.SizeBytes. 9124 func (i *IPTGetinfo) SizeBytes() int { 9125 return 12 + 9126 (*TableName)(nil).SizeBytes() + 9127 4*NF_INET_NUMHOOKS + 9128 4*NF_INET_NUMHOOKS 9129 } 9130 9131 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9132 func (i *IPTGetinfo) MarshalBytes(dst []byte) []byte { 9133 dst = i.Name.MarshalUnsafe(dst) 9134 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9135 dst = dst[4:] 9136 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9137 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9138 dst = dst[4:] 9139 } 9140 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9141 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9142 dst = dst[4:] 9143 } 9144 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9145 dst = dst[4:] 9146 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9147 dst = dst[4:] 9148 return dst 9149 } 9150 9151 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9152 func (i *IPTGetinfo) UnmarshalBytes(src []byte) []byte { 9153 src = i.Name.UnmarshalUnsafe(src) 9154 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9155 src = src[4:] 9156 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9157 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9158 src = src[4:] 9159 } 9160 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9161 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9162 src = src[4:] 9163 } 9164 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9165 src = src[4:] 9166 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9167 src = src[4:] 9168 return src 9169 } 9170 9171 // Packed implements marshal.Marshallable.Packed. 9172 // 9173 //go:nosplit 9174 func (i *IPTGetinfo) Packed() bool { 9175 return i.Name.Packed() 9176 } 9177 9178 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9179 func (i *IPTGetinfo) MarshalUnsafe(dst []byte) []byte { 9180 if i.Name.Packed() { 9181 size := i.SizeBytes() 9182 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9183 return dst[size:] 9184 } 9185 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9186 return i.MarshalBytes(dst) 9187 } 9188 9189 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9190 func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) []byte { 9191 if i.Name.Packed() { 9192 size := i.SizeBytes() 9193 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9194 return src[size:] 9195 } 9196 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9197 return i.UnmarshalBytes(src) 9198 } 9199 9200 // CopyOutN implements marshal.Marshallable.CopyOutN. 9201 func (i *IPTGetinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9202 if !i.Name.Packed() { 9203 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9204 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9205 i.MarshalBytes(buf) // escapes: fallback. 9206 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9207 } 9208 9209 // Construct a slice backed by dst's underlying memory. 9210 var buf []byte 9211 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9212 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9213 hdr.Len = i.SizeBytes() 9214 hdr.Cap = i.SizeBytes() 9215 9216 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9217 // Since we bypassed the compiler's escape analysis, indicate that i 9218 // must live until the use above. 9219 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9220 return length, err 9221 } 9222 9223 // CopyOut implements marshal.Marshallable.CopyOut. 9224 func (i *IPTGetinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9225 return i.CopyOutN(cc, addr, i.SizeBytes()) 9226 } 9227 9228 // CopyIn implements marshal.Marshallable.CopyIn. 9229 func (i *IPTGetinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9230 if !i.Name.Packed() { 9231 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9232 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9233 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9234 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9235 // partially unmarshalled struct. 9236 i.UnmarshalBytes(buf) // escapes: fallback. 9237 return length, err 9238 } 9239 9240 // Construct a slice backed by dst's underlying memory. 9241 var buf []byte 9242 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9243 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9244 hdr.Len = i.SizeBytes() 9245 hdr.Cap = i.SizeBytes() 9246 9247 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9248 // Since we bypassed the compiler's escape analysis, indicate that i 9249 // must live until the use above. 9250 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9251 return length, err 9252 } 9253 9254 // WriteTo implements io.WriterTo.WriteTo. 9255 func (i *IPTGetinfo) WriteTo(writer io.Writer) (int64, error) { 9256 if !i.Name.Packed() { 9257 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9258 buf := make([]byte, i.SizeBytes()) 9259 i.MarshalBytes(buf) 9260 length, err := writer.Write(buf) 9261 return int64(length), err 9262 } 9263 9264 // Construct a slice backed by dst's underlying memory. 9265 var buf []byte 9266 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9267 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9268 hdr.Len = i.SizeBytes() 9269 hdr.Cap = i.SizeBytes() 9270 9271 length, err := writer.Write(buf) 9272 // Since we bypassed the compiler's escape analysis, indicate that i 9273 // must live until the use above. 9274 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9275 return int64(length), err 9276 } 9277 9278 // SizeBytes implements marshal.Marshallable.SizeBytes. 9279 func (i *IPTIP) SizeBytes() int { 9280 return 4 + 9281 (*InetAddr)(nil).SizeBytes() + 9282 (*InetAddr)(nil).SizeBytes() + 9283 (*InetAddr)(nil).SizeBytes() + 9284 (*InetAddr)(nil).SizeBytes() + 9285 1*IFNAMSIZ + 9286 1*IFNAMSIZ + 9287 1*IFNAMSIZ + 9288 1*IFNAMSIZ 9289 } 9290 9291 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9292 func (i *IPTIP) MarshalBytes(dst []byte) []byte { 9293 dst = i.Src.MarshalUnsafe(dst) 9294 dst = i.Dst.MarshalUnsafe(dst) 9295 dst = i.SrcMask.MarshalUnsafe(dst) 9296 dst = i.DstMask.MarshalUnsafe(dst) 9297 for idx := 0; idx < IFNAMSIZ; idx++ { 9298 dst[0] = byte(i.InputInterface[idx]) 9299 dst = dst[1:] 9300 } 9301 for idx := 0; idx < IFNAMSIZ; idx++ { 9302 dst[0] = byte(i.OutputInterface[idx]) 9303 dst = dst[1:] 9304 } 9305 for idx := 0; idx < IFNAMSIZ; idx++ { 9306 dst[0] = byte(i.InputInterfaceMask[idx]) 9307 dst = dst[1:] 9308 } 9309 for idx := 0; idx < IFNAMSIZ; idx++ { 9310 dst[0] = byte(i.OutputInterfaceMask[idx]) 9311 dst = dst[1:] 9312 } 9313 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 9314 dst = dst[2:] 9315 dst[0] = byte(i.Flags) 9316 dst = dst[1:] 9317 dst[0] = byte(i.InverseFlags) 9318 dst = dst[1:] 9319 return dst 9320 } 9321 9322 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9323 func (i *IPTIP) UnmarshalBytes(src []byte) []byte { 9324 src = i.Src.UnmarshalUnsafe(src) 9325 src = i.Dst.UnmarshalUnsafe(src) 9326 src = i.SrcMask.UnmarshalUnsafe(src) 9327 src = i.DstMask.UnmarshalUnsafe(src) 9328 for idx := 0; idx < IFNAMSIZ; idx++ { 9329 i.InputInterface[idx] = src[0] 9330 src = src[1:] 9331 } 9332 for idx := 0; idx < IFNAMSIZ; idx++ { 9333 i.OutputInterface[idx] = src[0] 9334 src = src[1:] 9335 } 9336 for idx := 0; idx < IFNAMSIZ; idx++ { 9337 i.InputInterfaceMask[idx] = src[0] 9338 src = src[1:] 9339 } 9340 for idx := 0; idx < IFNAMSIZ; idx++ { 9341 i.OutputInterfaceMask[idx] = src[0] 9342 src = src[1:] 9343 } 9344 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9345 src = src[2:] 9346 i.Flags = uint8(src[0]) 9347 src = src[1:] 9348 i.InverseFlags = uint8(src[0]) 9349 src = src[1:] 9350 return src 9351 } 9352 9353 // Packed implements marshal.Marshallable.Packed. 9354 // 9355 //go:nosplit 9356 func (i *IPTIP) Packed() bool { 9357 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 9358 } 9359 9360 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9361 func (i *IPTIP) MarshalUnsafe(dst []byte) []byte { 9362 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9363 size := i.SizeBytes() 9364 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9365 return dst[size:] 9366 } 9367 // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes. 9368 return i.MarshalBytes(dst) 9369 } 9370 9371 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9372 func (i *IPTIP) UnmarshalUnsafe(src []byte) []byte { 9373 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9374 size := i.SizeBytes() 9375 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9376 return src[size:] 9377 } 9378 // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9379 return i.UnmarshalBytes(src) 9380 } 9381 9382 // CopyOutN implements marshal.Marshallable.CopyOutN. 9383 func (i *IPTIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9384 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9385 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9386 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9387 i.MarshalBytes(buf) // escapes: fallback. 9388 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9389 } 9390 9391 // Construct a slice backed by dst's underlying memory. 9392 var buf []byte 9393 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9394 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9395 hdr.Len = i.SizeBytes() 9396 hdr.Cap = i.SizeBytes() 9397 9398 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9399 // Since we bypassed the compiler's escape analysis, indicate that i 9400 // must live until the use above. 9401 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9402 return length, err 9403 } 9404 9405 // CopyOut implements marshal.Marshallable.CopyOut. 9406 func (i *IPTIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9407 return i.CopyOutN(cc, addr, i.SizeBytes()) 9408 } 9409 9410 // CopyIn implements marshal.Marshallable.CopyIn. 9411 func (i *IPTIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9412 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9413 // Type IPTIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9414 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9415 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9416 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9417 // partially unmarshalled struct. 9418 i.UnmarshalBytes(buf) // escapes: fallback. 9419 return length, err 9420 } 9421 9422 // Construct a slice backed by dst's underlying memory. 9423 var buf []byte 9424 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9425 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9426 hdr.Len = i.SizeBytes() 9427 hdr.Cap = i.SizeBytes() 9428 9429 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9430 // Since we bypassed the compiler's escape analysis, indicate that i 9431 // must live until the use above. 9432 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9433 return length, err 9434 } 9435 9436 // WriteTo implements io.WriterTo.WriteTo. 9437 func (i *IPTIP) WriteTo(writer io.Writer) (int64, error) { 9438 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9439 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9440 buf := make([]byte, i.SizeBytes()) 9441 i.MarshalBytes(buf) 9442 length, err := writer.Write(buf) 9443 return int64(length), err 9444 } 9445 9446 // Construct a slice backed by dst's underlying memory. 9447 var buf []byte 9448 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9449 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9450 hdr.Len = i.SizeBytes() 9451 hdr.Cap = i.SizeBytes() 9452 9453 length, err := writer.Write(buf) 9454 // Since we bypassed the compiler's escape analysis, indicate that i 9455 // must live until the use above. 9456 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9457 return int64(length), err 9458 } 9459 9460 // SizeBytes implements marshal.Marshallable.SizeBytes. 9461 func (i *IPTOwnerInfo) SizeBytes() int { 9462 return 18 + 9463 1*16 9464 } 9465 9466 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9467 func (i *IPTOwnerInfo) MarshalBytes(dst []byte) []byte { 9468 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 9469 dst = dst[4:] 9470 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 9471 dst = dst[4:] 9472 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.PID)) 9473 dst = dst[4:] 9474 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SID)) 9475 dst = dst[4:] 9476 for idx := 0; idx < 16; idx++ { 9477 dst[0] = byte(i.Comm[idx]) 9478 dst = dst[1:] 9479 } 9480 dst[0] = byte(i.Match) 9481 dst = dst[1:] 9482 dst[0] = byte(i.Invert) 9483 dst = dst[1:] 9484 return dst 9485 } 9486 9487 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9488 func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) []byte { 9489 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9490 src = src[4:] 9491 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9492 src = src[4:] 9493 i.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9494 src = src[4:] 9495 i.SID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9496 src = src[4:] 9497 for idx := 0; idx < 16; idx++ { 9498 i.Comm[idx] = src[0] 9499 src = src[1:] 9500 } 9501 i.Match = uint8(src[0]) 9502 src = src[1:] 9503 i.Invert = uint8(src[0]) 9504 src = src[1:] 9505 return src 9506 } 9507 9508 // Packed implements marshal.Marshallable.Packed. 9509 // 9510 //go:nosplit 9511 func (i *IPTOwnerInfo) Packed() bool { 9512 return false 9513 } 9514 9515 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9516 func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) []byte { 9517 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9518 return i.MarshalBytes(dst) 9519 } 9520 9521 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9522 func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) []byte { 9523 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9524 return i.UnmarshalBytes(src) 9525 } 9526 9527 // CopyOutN implements marshal.Marshallable.CopyOutN. 9528 func (i *IPTOwnerInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9529 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9530 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9531 i.MarshalBytes(buf) // escapes: fallback. 9532 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9533 } 9534 9535 // CopyOut implements marshal.Marshallable.CopyOut. 9536 func (i *IPTOwnerInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9537 return i.CopyOutN(cc, addr, i.SizeBytes()) 9538 } 9539 9540 // CopyIn implements marshal.Marshallable.CopyIn. 9541 func (i *IPTOwnerInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9542 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9543 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9544 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9545 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9546 // partially unmarshalled struct. 9547 i.UnmarshalBytes(buf) // escapes: fallback. 9548 return length, err 9549 } 9550 9551 // WriteTo implements io.WriterTo.WriteTo. 9552 func (i *IPTOwnerInfo) WriteTo(writer io.Writer) (int64, error) { 9553 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9554 buf := make([]byte, i.SizeBytes()) 9555 i.MarshalBytes(buf) 9556 length, err := writer.Write(buf) 9557 return int64(length), err 9558 } 9559 9560 // SizeBytes implements marshal.Marshallable.SizeBytes. 9561 func (i *IPTReplace) SizeBytes() int { 9562 return 24 + 9563 (*TableName)(nil).SizeBytes() + 9564 4*NF_INET_NUMHOOKS + 9565 4*NF_INET_NUMHOOKS 9566 } 9567 9568 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9569 func (i *IPTReplace) MarshalBytes(dst []byte) []byte { 9570 dst = i.Name.MarshalUnsafe(dst) 9571 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9572 dst = dst[4:] 9573 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9574 dst = dst[4:] 9575 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9576 dst = dst[4:] 9577 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9578 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9579 dst = dst[4:] 9580 } 9581 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9582 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9583 dst = dst[4:] 9584 } 9585 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 9586 dst = dst[4:] 9587 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 9588 dst = dst[8:] 9589 return dst 9590 } 9591 9592 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9593 func (i *IPTReplace) UnmarshalBytes(src []byte) []byte { 9594 src = i.Name.UnmarshalUnsafe(src) 9595 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9596 src = src[4:] 9597 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9598 src = src[4:] 9599 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9600 src = src[4:] 9601 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9602 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9603 src = src[4:] 9604 } 9605 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9606 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9607 src = src[4:] 9608 } 9609 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9610 src = src[4:] 9611 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 9612 src = src[8:] 9613 return src 9614 } 9615 9616 // Packed implements marshal.Marshallable.Packed. 9617 // 9618 //go:nosplit 9619 func (i *IPTReplace) Packed() bool { 9620 return i.Name.Packed() 9621 } 9622 9623 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9624 func (i *IPTReplace) MarshalUnsafe(dst []byte) []byte { 9625 if i.Name.Packed() { 9626 size := i.SizeBytes() 9627 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9628 return dst[size:] 9629 } 9630 // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 9631 return i.MarshalBytes(dst) 9632 } 9633 9634 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9635 func (i *IPTReplace) UnmarshalUnsafe(src []byte) []byte { 9636 if i.Name.Packed() { 9637 size := i.SizeBytes() 9638 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9639 return src[size:] 9640 } 9641 // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9642 return i.UnmarshalBytes(src) 9643 } 9644 9645 // CopyOutN implements marshal.Marshallable.CopyOutN. 9646 func (i *IPTReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9647 if !i.Name.Packed() { 9648 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 9649 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9650 i.MarshalBytes(buf) // escapes: fallback. 9651 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9652 } 9653 9654 // Construct a slice backed by dst's underlying memory. 9655 var buf []byte 9656 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9657 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9658 hdr.Len = i.SizeBytes() 9659 hdr.Cap = i.SizeBytes() 9660 9661 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9662 // Since we bypassed the compiler's escape analysis, indicate that i 9663 // must live until the use above. 9664 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9665 return length, err 9666 } 9667 9668 // CopyOut implements marshal.Marshallable.CopyOut. 9669 func (i *IPTReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9670 return i.CopyOutN(cc, addr, i.SizeBytes()) 9671 } 9672 9673 // CopyIn implements marshal.Marshallable.CopyIn. 9674 func (i *IPTReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9675 if !i.Name.Packed() { 9676 // Type IPTReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9677 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9678 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9679 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9680 // partially unmarshalled struct. 9681 i.UnmarshalBytes(buf) // escapes: fallback. 9682 return length, err 9683 } 9684 9685 // Construct a slice backed by dst's underlying memory. 9686 var buf []byte 9687 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9688 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9689 hdr.Len = i.SizeBytes() 9690 hdr.Cap = i.SizeBytes() 9691 9692 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9693 // Since we bypassed the compiler's escape analysis, indicate that i 9694 // must live until the use above. 9695 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9696 return length, err 9697 } 9698 9699 // WriteTo implements io.WriterTo.WriteTo. 9700 func (i *IPTReplace) WriteTo(writer io.Writer) (int64, error) { 9701 if !i.Name.Packed() { 9702 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 9703 buf := make([]byte, i.SizeBytes()) 9704 i.MarshalBytes(buf) 9705 length, err := writer.Write(buf) 9706 return int64(length), err 9707 } 9708 9709 // Construct a slice backed by dst's underlying memory. 9710 var buf []byte 9711 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9712 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9713 hdr.Len = i.SizeBytes() 9714 hdr.Cap = i.SizeBytes() 9715 9716 length, err := writer.Write(buf) 9717 // Since we bypassed the compiler's escape analysis, indicate that i 9718 // must live until the use above. 9719 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9720 return int64(length), err 9721 } 9722 9723 // Packed implements marshal.Marshallable.Packed. 9724 // 9725 //go:nosplit 9726 func (ke *KernelIPTEntry) Packed() bool { 9727 // Type KernelIPTEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 9728 return false 9729 } 9730 9731 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9732 func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) []byte { 9733 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 9734 return ke.MarshalBytes(dst) 9735 } 9736 9737 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9738 func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) []byte { 9739 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9740 return ke.UnmarshalBytes(src) 9741 } 9742 9743 // CopyOutN implements marshal.Marshallable.CopyOutN. 9744 // 9745 //go:nosplit 9746 func (ke *KernelIPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9747 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9748 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9749 ke.MarshalBytes(buf) // escapes: fallback. 9750 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9751 } 9752 9753 // CopyOut implements marshal.Marshallable.CopyOut. 9754 func (ke *KernelIPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9755 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 9756 } 9757 9758 // CopyIn implements marshal.Marshallable.CopyIn. 9759 func (ke *KernelIPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9760 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9761 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9762 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9763 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9764 // partially unmarshalled struct. 9765 ke.UnmarshalBytes(buf) // escapes: fallback. 9766 return length, err 9767 } 9768 9769 // WriteTo implements io.WriterTo.WriteTo. 9770 func (ke *KernelIPTEntry) WriteTo(writer io.Writer) (int64, error) { 9771 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9772 buf := make([]byte, ke.SizeBytes()) 9773 ke.MarshalBytes(buf) 9774 length, err := writer.Write(buf) 9775 return int64(length), err 9776 } 9777 9778 // Packed implements marshal.Marshallable.Packed. 9779 // 9780 //go:nosplit 9781 func (ke *KernelIPTGetEntries) Packed() bool { 9782 // Type KernelIPTGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 9783 return false 9784 } 9785 9786 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9787 func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) []byte { 9788 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 9789 return ke.MarshalBytes(dst) 9790 } 9791 9792 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9793 func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 9794 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9795 return ke.UnmarshalBytes(src) 9796 } 9797 9798 // CopyOutN implements marshal.Marshallable.CopyOutN. 9799 // 9800 //go:nosplit 9801 func (ke *KernelIPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9802 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9803 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9804 ke.MarshalBytes(buf) // escapes: fallback. 9805 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9806 } 9807 9808 // CopyOut implements marshal.Marshallable.CopyOut. 9809 func (ke *KernelIPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9810 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 9811 } 9812 9813 // CopyIn implements marshal.Marshallable.CopyIn. 9814 func (ke *KernelIPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9815 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9816 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 9817 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9818 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9819 // partially unmarshalled struct. 9820 ke.UnmarshalBytes(buf) // escapes: fallback. 9821 return length, err 9822 } 9823 9824 // WriteTo implements io.WriterTo.WriteTo. 9825 func (ke *KernelIPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 9826 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9827 buf := make([]byte, ke.SizeBytes()) 9828 ke.MarshalBytes(buf) 9829 length, err := writer.Write(buf) 9830 return int64(length), err 9831 } 9832 9833 // SizeBytes implements marshal.Marshallable.SizeBytes. 9834 func (n *NfNATIPV4MultiRangeCompat) SizeBytes() int { 9835 return 4 + 9836 (*NfNATIPV4Range)(nil).SizeBytes() 9837 } 9838 9839 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9840 func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) []byte { 9841 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.RangeSize)) 9842 dst = dst[4:] 9843 dst = n.RangeIPV4.MarshalUnsafe(dst) 9844 return dst 9845 } 9846 9847 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9848 func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) []byte { 9849 n.RangeSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9850 src = src[4:] 9851 src = n.RangeIPV4.UnmarshalUnsafe(src) 9852 return src 9853 } 9854 9855 // Packed implements marshal.Marshallable.Packed. 9856 // 9857 //go:nosplit 9858 func (n *NfNATIPV4MultiRangeCompat) Packed() bool { 9859 return n.RangeIPV4.Packed() 9860 } 9861 9862 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9863 func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) []byte { 9864 if n.RangeIPV4.Packed() { 9865 size := n.SizeBytes() 9866 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 9867 return dst[size:] 9868 } 9869 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes. 9870 return n.MarshalBytes(dst) 9871 } 9872 9873 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9874 func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) []byte { 9875 if n.RangeIPV4.Packed() { 9876 size := n.SizeBytes() 9877 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 9878 return src[size:] 9879 } 9880 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9881 return n.UnmarshalBytes(src) 9882 } 9883 9884 // CopyOutN implements marshal.Marshallable.CopyOutN. 9885 func (n *NfNATIPV4MultiRangeCompat) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9886 if !n.RangeIPV4.Packed() { 9887 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 9888 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 9889 n.MarshalBytes(buf) // escapes: fallback. 9890 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9891 } 9892 9893 // Construct a slice backed by dst's underlying memory. 9894 var buf []byte 9895 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9896 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9897 hdr.Len = n.SizeBytes() 9898 hdr.Cap = n.SizeBytes() 9899 9900 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9901 // Since we bypassed the compiler's escape analysis, indicate that n 9902 // must live until the use above. 9903 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9904 return length, err 9905 } 9906 9907 // CopyOut implements marshal.Marshallable.CopyOut. 9908 func (n *NfNATIPV4MultiRangeCompat) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9909 return n.CopyOutN(cc, addr, n.SizeBytes()) 9910 } 9911 9912 // CopyIn implements marshal.Marshallable.CopyIn. 9913 func (n *NfNATIPV4MultiRangeCompat) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9914 if !n.RangeIPV4.Packed() { 9915 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9916 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 9917 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9918 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9919 // partially unmarshalled struct. 9920 n.UnmarshalBytes(buf) // escapes: fallback. 9921 return length, err 9922 } 9923 9924 // Construct a slice backed by dst's underlying memory. 9925 var buf []byte 9926 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9927 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9928 hdr.Len = n.SizeBytes() 9929 hdr.Cap = n.SizeBytes() 9930 9931 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 9932 // Since we bypassed the compiler's escape analysis, indicate that n 9933 // must live until the use above. 9934 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9935 return length, err 9936 } 9937 9938 // WriteTo implements io.WriterTo.WriteTo. 9939 func (n *NfNATIPV4MultiRangeCompat) WriteTo(writer io.Writer) (int64, error) { 9940 if !n.RangeIPV4.Packed() { 9941 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 9942 buf := make([]byte, n.SizeBytes()) 9943 n.MarshalBytes(buf) 9944 length, err := writer.Write(buf) 9945 return int64(length), err 9946 } 9947 9948 // Construct a slice backed by dst's underlying memory. 9949 var buf []byte 9950 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9951 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 9952 hdr.Len = n.SizeBytes() 9953 hdr.Cap = n.SizeBytes() 9954 9955 length, err := writer.Write(buf) 9956 // Since we bypassed the compiler's escape analysis, indicate that n 9957 // must live until the use above. 9958 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 9959 return int64(length), err 9960 } 9961 9962 // SizeBytes implements marshal.Marshallable.SizeBytes. 9963 func (n *NfNATIPV4Range) SizeBytes() int { 9964 return 8 + 9965 1*4 + 9966 1*4 9967 } 9968 9969 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9970 func (n *NfNATIPV4Range) MarshalBytes(dst []byte) []byte { 9971 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 9972 dst = dst[4:] 9973 for idx := 0; idx < 4; idx++ { 9974 dst[0] = byte(n.MinIP[idx]) 9975 dst = dst[1:] 9976 } 9977 for idx := 0; idx < 4; idx++ { 9978 dst[0] = byte(n.MaxIP[idx]) 9979 dst = dst[1:] 9980 } 9981 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinPort)) 9982 dst = dst[2:] 9983 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxPort)) 9984 dst = dst[2:] 9985 return dst 9986 } 9987 9988 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9989 func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) []byte { 9990 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9991 src = src[4:] 9992 for idx := 0; idx < 4; idx++ { 9993 n.MinIP[idx] = src[0] 9994 src = src[1:] 9995 } 9996 for idx := 0; idx < 4; idx++ { 9997 n.MaxIP[idx] = src[0] 9998 src = src[1:] 9999 } 10000 n.MinPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10001 src = src[2:] 10002 n.MaxPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10003 src = src[2:] 10004 return src 10005 } 10006 10007 // Packed implements marshal.Marshallable.Packed. 10008 // 10009 //go:nosplit 10010 func (n *NfNATIPV4Range) Packed() bool { 10011 return true 10012 } 10013 10014 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10015 func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) []byte { 10016 size := n.SizeBytes() 10017 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10018 return dst[size:] 10019 } 10020 10021 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10022 func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) []byte { 10023 size := n.SizeBytes() 10024 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10025 return src[size:] 10026 } 10027 10028 // CopyOutN implements marshal.Marshallable.CopyOutN. 10029 func (n *NfNATIPV4Range) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10030 // Construct a slice backed by dst's underlying memory. 10031 var buf []byte 10032 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10033 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10034 hdr.Len = n.SizeBytes() 10035 hdr.Cap = n.SizeBytes() 10036 10037 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10038 // Since we bypassed the compiler's escape analysis, indicate that n 10039 // must live until the use above. 10040 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10041 return length, err 10042 } 10043 10044 // CopyOut implements marshal.Marshallable.CopyOut. 10045 func (n *NfNATIPV4Range) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10046 return n.CopyOutN(cc, addr, n.SizeBytes()) 10047 } 10048 10049 // CopyIn implements marshal.Marshallable.CopyIn. 10050 func (n *NfNATIPV4Range) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10051 // Construct a slice backed by dst's underlying memory. 10052 var buf []byte 10053 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10054 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10055 hdr.Len = n.SizeBytes() 10056 hdr.Cap = n.SizeBytes() 10057 10058 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10059 // Since we bypassed the compiler's escape analysis, indicate that n 10060 // must live until the use above. 10061 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10062 return length, err 10063 } 10064 10065 // WriteTo implements io.WriterTo.WriteTo. 10066 func (n *NfNATIPV4Range) WriteTo(writer io.Writer) (int64, error) { 10067 // Construct a slice backed by dst's underlying memory. 10068 var buf []byte 10069 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10070 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10071 hdr.Len = n.SizeBytes() 10072 hdr.Cap = n.SizeBytes() 10073 10074 length, err := writer.Write(buf) 10075 // Since we bypassed the compiler's escape analysis, indicate that n 10076 // must live until the use above. 10077 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10078 return int64(length), err 10079 } 10080 10081 // SizeBytes implements marshal.Marshallable.SizeBytes. 10082 // 10083 //go:nosplit 10084 func (tn *TableName) SizeBytes() int { 10085 return 1 * XT_TABLE_MAXNAMELEN 10086 } 10087 10088 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10089 func (tn *TableName) MarshalBytes(dst []byte) []byte { 10090 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 10091 dst[0] = byte(tn[idx]) 10092 dst = dst[1:] 10093 } 10094 return dst 10095 } 10096 10097 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10098 func (tn *TableName) UnmarshalBytes(src []byte) []byte { 10099 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 10100 tn[idx] = src[0] 10101 src = src[1:] 10102 } 10103 return src 10104 } 10105 10106 // Packed implements marshal.Marshallable.Packed. 10107 // 10108 //go:nosplit 10109 func (tn *TableName) Packed() bool { 10110 // Array newtypes are always packed. 10111 return true 10112 } 10113 10114 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10115 func (tn *TableName) MarshalUnsafe(dst []byte) []byte { 10116 size := tn.SizeBytes() 10117 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(size)) 10118 return dst[size:] 10119 } 10120 10121 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10122 func (tn *TableName) UnmarshalUnsafe(src []byte) []byte { 10123 size := tn.SizeBytes() 10124 gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(size)) 10125 return src[size:] 10126 } 10127 10128 // CopyOutN implements marshal.Marshallable.CopyOutN. 10129 func (tn *TableName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10130 // Construct a slice backed by dst's underlying memory. 10131 var buf []byte 10132 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10133 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10134 hdr.Len = tn.SizeBytes() 10135 hdr.Cap = tn.SizeBytes() 10136 10137 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10138 // Since we bypassed the compiler's escape analysis, indicate that tn 10139 // must live until the use above. 10140 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10141 return length, err 10142 } 10143 10144 // CopyOut implements marshal.Marshallable.CopyOut. 10145 func (tn *TableName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10146 return tn.CopyOutN(cc, addr, tn.SizeBytes()) 10147 } 10148 10149 // CopyIn implements marshal.Marshallable.CopyIn. 10150 func (tn *TableName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10151 // Construct a slice backed by dst's underlying memory. 10152 var buf []byte 10153 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10154 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10155 hdr.Len = tn.SizeBytes() 10156 hdr.Cap = tn.SizeBytes() 10157 10158 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10159 // Since we bypassed the compiler's escape analysis, indicate that tn 10160 // must live until the use above. 10161 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10162 return length, err 10163 } 10164 10165 // WriteTo implements io.WriterTo.WriteTo. 10166 func (tn *TableName) WriteTo(writer io.Writer) (int64, error) { 10167 // Construct a slice backed by dst's underlying memory. 10168 var buf []byte 10169 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10170 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10171 hdr.Len = tn.SizeBytes() 10172 hdr.Cap = tn.SizeBytes() 10173 10174 length, err := writer.Write(buf) 10175 // Since we bypassed the compiler's escape analysis, indicate that tn 10176 // must live until the use above. 10177 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10178 return int64(length), err 10179 } 10180 10181 // SizeBytes implements marshal.Marshallable.SizeBytes. 10182 func (x *XTCounters) SizeBytes() int { 10183 return 16 10184 } 10185 10186 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10187 func (x *XTCounters) MarshalBytes(dst []byte) []byte { 10188 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Pcnt)) 10189 dst = dst[8:] 10190 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Bcnt)) 10191 dst = dst[8:] 10192 return dst 10193 } 10194 10195 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10196 func (x *XTCounters) UnmarshalBytes(src []byte) []byte { 10197 x.Pcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10198 src = src[8:] 10199 x.Bcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10200 src = src[8:] 10201 return src 10202 } 10203 10204 // Packed implements marshal.Marshallable.Packed. 10205 // 10206 //go:nosplit 10207 func (x *XTCounters) Packed() bool { 10208 return true 10209 } 10210 10211 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10212 func (x *XTCounters) MarshalUnsafe(dst []byte) []byte { 10213 size := x.SizeBytes() 10214 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10215 return dst[size:] 10216 } 10217 10218 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10219 func (x *XTCounters) UnmarshalUnsafe(src []byte) []byte { 10220 size := x.SizeBytes() 10221 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10222 return src[size:] 10223 } 10224 10225 // CopyOutN implements marshal.Marshallable.CopyOutN. 10226 func (x *XTCounters) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10227 // Construct a slice backed by dst's underlying memory. 10228 var buf []byte 10229 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10230 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10231 hdr.Len = x.SizeBytes() 10232 hdr.Cap = x.SizeBytes() 10233 10234 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10235 // Since we bypassed the compiler's escape analysis, indicate that x 10236 // must live until the use above. 10237 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10238 return length, err 10239 } 10240 10241 // CopyOut implements marshal.Marshallable.CopyOut. 10242 func (x *XTCounters) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10243 return x.CopyOutN(cc, addr, x.SizeBytes()) 10244 } 10245 10246 // CopyIn implements marshal.Marshallable.CopyIn. 10247 func (x *XTCounters) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10248 // Construct a slice backed by dst's underlying memory. 10249 var buf []byte 10250 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10251 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10252 hdr.Len = x.SizeBytes() 10253 hdr.Cap = x.SizeBytes() 10254 10255 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10256 // Since we bypassed the compiler's escape analysis, indicate that x 10257 // must live until the use above. 10258 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10259 return length, err 10260 } 10261 10262 // WriteTo implements io.WriterTo.WriteTo. 10263 func (x *XTCounters) WriteTo(writer io.Writer) (int64, error) { 10264 // Construct a slice backed by dst's underlying memory. 10265 var buf []byte 10266 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10267 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10268 hdr.Len = x.SizeBytes() 10269 hdr.Cap = x.SizeBytes() 10270 10271 length, err := writer.Write(buf) 10272 // Since we bypassed the compiler's escape analysis, indicate that x 10273 // must live until the use above. 10274 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10275 return int64(length), err 10276 } 10277 10278 // SizeBytes implements marshal.Marshallable.SizeBytes. 10279 func (x *XTEntryMatch) SizeBytes() int { 10280 return 3 + 10281 (*ExtensionName)(nil).SizeBytes() 10282 } 10283 10284 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10285 func (x *XTEntryMatch) MarshalBytes(dst []byte) []byte { 10286 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.MatchSize)) 10287 dst = dst[2:] 10288 dst = x.Name.MarshalUnsafe(dst) 10289 dst[0] = byte(x.Revision) 10290 dst = dst[1:] 10291 return dst 10292 } 10293 10294 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10295 func (x *XTEntryMatch) UnmarshalBytes(src []byte) []byte { 10296 x.MatchSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10297 src = src[2:] 10298 src = x.Name.UnmarshalUnsafe(src) 10299 x.Revision = uint8(src[0]) 10300 src = src[1:] 10301 return src 10302 } 10303 10304 // Packed implements marshal.Marshallable.Packed. 10305 // 10306 //go:nosplit 10307 func (x *XTEntryMatch) Packed() bool { 10308 return x.Name.Packed() 10309 } 10310 10311 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10312 func (x *XTEntryMatch) MarshalUnsafe(dst []byte) []byte { 10313 if x.Name.Packed() { 10314 size := x.SizeBytes() 10315 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10316 return dst[size:] 10317 } 10318 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes. 10319 return x.MarshalBytes(dst) 10320 } 10321 10322 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10323 func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) []byte { 10324 if x.Name.Packed() { 10325 size := x.SizeBytes() 10326 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10327 return src[size:] 10328 } 10329 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10330 return x.UnmarshalBytes(src) 10331 } 10332 10333 // CopyOutN implements marshal.Marshallable.CopyOutN. 10334 func (x *XTEntryMatch) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10335 if !x.Name.Packed() { 10336 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10337 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10338 x.MarshalBytes(buf) // escapes: fallback. 10339 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10340 } 10341 10342 // Construct a slice backed by dst's underlying memory. 10343 var buf []byte 10344 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10345 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10346 hdr.Len = x.SizeBytes() 10347 hdr.Cap = x.SizeBytes() 10348 10349 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10350 // Since we bypassed the compiler's escape analysis, indicate that x 10351 // must live until the use above. 10352 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10353 return length, err 10354 } 10355 10356 // CopyOut implements marshal.Marshallable.CopyOut. 10357 func (x *XTEntryMatch) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10358 return x.CopyOutN(cc, addr, x.SizeBytes()) 10359 } 10360 10361 // CopyIn implements marshal.Marshallable.CopyIn. 10362 func (x *XTEntryMatch) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10363 if !x.Name.Packed() { 10364 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10365 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10366 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10367 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10368 // partially unmarshalled struct. 10369 x.UnmarshalBytes(buf) // escapes: fallback. 10370 return length, err 10371 } 10372 10373 // Construct a slice backed by dst's underlying memory. 10374 var buf []byte 10375 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10376 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10377 hdr.Len = x.SizeBytes() 10378 hdr.Cap = x.SizeBytes() 10379 10380 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10381 // Since we bypassed the compiler's escape analysis, indicate that x 10382 // must live until the use above. 10383 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10384 return length, err 10385 } 10386 10387 // WriteTo implements io.WriterTo.WriteTo. 10388 func (x *XTEntryMatch) WriteTo(writer io.Writer) (int64, error) { 10389 if !x.Name.Packed() { 10390 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10391 buf := make([]byte, x.SizeBytes()) 10392 x.MarshalBytes(buf) 10393 length, err := writer.Write(buf) 10394 return int64(length), err 10395 } 10396 10397 // Construct a slice backed by dst's underlying memory. 10398 var buf []byte 10399 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10400 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10401 hdr.Len = x.SizeBytes() 10402 hdr.Cap = x.SizeBytes() 10403 10404 length, err := writer.Write(buf) 10405 // Since we bypassed the compiler's escape analysis, indicate that x 10406 // must live until the use above. 10407 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10408 return int64(length), err 10409 } 10410 10411 // SizeBytes implements marshal.Marshallable.SizeBytes. 10412 func (x *XTEntryTarget) SizeBytes() int { 10413 return 3 + 10414 (*ExtensionName)(nil).SizeBytes() 10415 } 10416 10417 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10418 func (x *XTEntryTarget) MarshalBytes(dst []byte) []byte { 10419 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.TargetSize)) 10420 dst = dst[2:] 10421 dst = x.Name.MarshalUnsafe(dst) 10422 dst[0] = byte(x.Revision) 10423 dst = dst[1:] 10424 return dst 10425 } 10426 10427 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10428 func (x *XTEntryTarget) UnmarshalBytes(src []byte) []byte { 10429 x.TargetSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10430 src = src[2:] 10431 src = x.Name.UnmarshalUnsafe(src) 10432 x.Revision = uint8(src[0]) 10433 src = src[1:] 10434 return src 10435 } 10436 10437 // Packed implements marshal.Marshallable.Packed. 10438 // 10439 //go:nosplit 10440 func (x *XTEntryTarget) Packed() bool { 10441 return x.Name.Packed() 10442 } 10443 10444 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10445 func (x *XTEntryTarget) MarshalUnsafe(dst []byte) []byte { 10446 if x.Name.Packed() { 10447 size := x.SizeBytes() 10448 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10449 return dst[size:] 10450 } 10451 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10452 return x.MarshalBytes(dst) 10453 } 10454 10455 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10456 func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) []byte { 10457 if x.Name.Packed() { 10458 size := x.SizeBytes() 10459 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10460 return src[size:] 10461 } 10462 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10463 return x.UnmarshalBytes(src) 10464 } 10465 10466 // CopyOutN implements marshal.Marshallable.CopyOutN. 10467 func (x *XTEntryTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10468 if !x.Name.Packed() { 10469 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10470 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10471 x.MarshalBytes(buf) // escapes: fallback. 10472 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10473 } 10474 10475 // Construct a slice backed by dst's underlying memory. 10476 var buf []byte 10477 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10478 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10479 hdr.Len = x.SizeBytes() 10480 hdr.Cap = x.SizeBytes() 10481 10482 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10483 // Since we bypassed the compiler's escape analysis, indicate that x 10484 // must live until the use above. 10485 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10486 return length, err 10487 } 10488 10489 // CopyOut implements marshal.Marshallable.CopyOut. 10490 func (x *XTEntryTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10491 return x.CopyOutN(cc, addr, x.SizeBytes()) 10492 } 10493 10494 // CopyIn implements marshal.Marshallable.CopyIn. 10495 func (x *XTEntryTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10496 if !x.Name.Packed() { 10497 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10498 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10499 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10500 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10501 // partially unmarshalled struct. 10502 x.UnmarshalBytes(buf) // escapes: fallback. 10503 return length, err 10504 } 10505 10506 // Construct a slice backed by dst's underlying memory. 10507 var buf []byte 10508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10510 hdr.Len = x.SizeBytes() 10511 hdr.Cap = x.SizeBytes() 10512 10513 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10514 // Since we bypassed the compiler's escape analysis, indicate that x 10515 // must live until the use above. 10516 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10517 return length, err 10518 } 10519 10520 // WriteTo implements io.WriterTo.WriteTo. 10521 func (x *XTEntryTarget) WriteTo(writer io.Writer) (int64, error) { 10522 if !x.Name.Packed() { 10523 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10524 buf := make([]byte, x.SizeBytes()) 10525 x.MarshalBytes(buf) 10526 length, err := writer.Write(buf) 10527 return int64(length), err 10528 } 10529 10530 // Construct a slice backed by dst's underlying memory. 10531 var buf []byte 10532 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10533 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10534 hdr.Len = x.SizeBytes() 10535 hdr.Cap = x.SizeBytes() 10536 10537 length, err := writer.Write(buf) 10538 // Since we bypassed the compiler's escape analysis, indicate that x 10539 // must live until the use above. 10540 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10541 return int64(length), err 10542 } 10543 10544 // SizeBytes implements marshal.Marshallable.SizeBytes. 10545 func (x *XTErrorTarget) SizeBytes() int { 10546 return 0 + 10547 (*XTEntryTarget)(nil).SizeBytes() + 10548 (*ErrorName)(nil).SizeBytes() + 10549 1*2 10550 } 10551 10552 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10553 func (x *XTErrorTarget) MarshalBytes(dst []byte) []byte { 10554 dst = x.Target.MarshalUnsafe(dst) 10555 dst = x.Name.MarshalUnsafe(dst) 10556 // Padding: dst[:sizeof(byte)*2] ~= [2]byte{0} 10557 dst = dst[1*(2):] 10558 return dst 10559 } 10560 10561 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10562 func (x *XTErrorTarget) UnmarshalBytes(src []byte) []byte { 10563 src = x.Target.UnmarshalUnsafe(src) 10564 src = x.Name.UnmarshalUnsafe(src) 10565 // Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2]) 10566 src = src[1*(2):] 10567 return src 10568 } 10569 10570 // Packed implements marshal.Marshallable.Packed. 10571 // 10572 //go:nosplit 10573 func (x *XTErrorTarget) Packed() bool { 10574 return x.Name.Packed() && x.Target.Packed() 10575 } 10576 10577 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10578 func (x *XTErrorTarget) MarshalUnsafe(dst []byte) []byte { 10579 if x.Name.Packed() && x.Target.Packed() { 10580 size := x.SizeBytes() 10581 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10582 return dst[size:] 10583 } 10584 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10585 return x.MarshalBytes(dst) 10586 } 10587 10588 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10589 func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) []byte { 10590 if x.Name.Packed() && x.Target.Packed() { 10591 size := x.SizeBytes() 10592 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10593 return src[size:] 10594 } 10595 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10596 return x.UnmarshalBytes(src) 10597 } 10598 10599 // CopyOutN implements marshal.Marshallable.CopyOutN. 10600 func (x *XTErrorTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10601 if !x.Name.Packed() && x.Target.Packed() { 10602 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10603 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10604 x.MarshalBytes(buf) // escapes: fallback. 10605 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10606 } 10607 10608 // Construct a slice backed by dst's underlying memory. 10609 var buf []byte 10610 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10611 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10612 hdr.Len = x.SizeBytes() 10613 hdr.Cap = x.SizeBytes() 10614 10615 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10616 // Since we bypassed the compiler's escape analysis, indicate that x 10617 // must live until the use above. 10618 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10619 return length, err 10620 } 10621 10622 // CopyOut implements marshal.Marshallable.CopyOut. 10623 func (x *XTErrorTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10624 return x.CopyOutN(cc, addr, x.SizeBytes()) 10625 } 10626 10627 // CopyIn implements marshal.Marshallable.CopyIn. 10628 func (x *XTErrorTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10629 if !x.Name.Packed() && x.Target.Packed() { 10630 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10631 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10632 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10633 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10634 // partially unmarshalled struct. 10635 x.UnmarshalBytes(buf) // escapes: fallback. 10636 return length, err 10637 } 10638 10639 // Construct a slice backed by dst's underlying memory. 10640 var buf []byte 10641 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10642 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10643 hdr.Len = x.SizeBytes() 10644 hdr.Cap = x.SizeBytes() 10645 10646 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10647 // Since we bypassed the compiler's escape analysis, indicate that x 10648 // must live until the use above. 10649 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10650 return length, err 10651 } 10652 10653 // WriteTo implements io.WriterTo.WriteTo. 10654 func (x *XTErrorTarget) WriteTo(writer io.Writer) (int64, error) { 10655 if !x.Name.Packed() && x.Target.Packed() { 10656 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10657 buf := make([]byte, x.SizeBytes()) 10658 x.MarshalBytes(buf) 10659 length, err := writer.Write(buf) 10660 return int64(length), err 10661 } 10662 10663 // Construct a slice backed by dst's underlying memory. 10664 var buf []byte 10665 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10666 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10667 hdr.Len = x.SizeBytes() 10668 hdr.Cap = x.SizeBytes() 10669 10670 length, err := writer.Write(buf) 10671 // Since we bypassed the compiler's escape analysis, indicate that x 10672 // must live until the use above. 10673 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10674 return int64(length), err 10675 } 10676 10677 // SizeBytes implements marshal.Marshallable.SizeBytes. 10678 func (x *XTGetRevision) SizeBytes() int { 10679 return 1 + 10680 (*ExtensionName)(nil).SizeBytes() 10681 } 10682 10683 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10684 func (x *XTGetRevision) MarshalBytes(dst []byte) []byte { 10685 dst = x.Name.MarshalUnsafe(dst) 10686 dst[0] = byte(x.Revision) 10687 dst = dst[1:] 10688 return dst 10689 } 10690 10691 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10692 func (x *XTGetRevision) UnmarshalBytes(src []byte) []byte { 10693 src = x.Name.UnmarshalUnsafe(src) 10694 x.Revision = uint8(src[0]) 10695 src = src[1:] 10696 return src 10697 } 10698 10699 // Packed implements marshal.Marshallable.Packed. 10700 // 10701 //go:nosplit 10702 func (x *XTGetRevision) Packed() bool { 10703 return x.Name.Packed() 10704 } 10705 10706 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10707 func (x *XTGetRevision) MarshalUnsafe(dst []byte) []byte { 10708 if x.Name.Packed() { 10709 size := x.SizeBytes() 10710 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10711 return dst[size:] 10712 } 10713 // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes. 10714 return x.MarshalBytes(dst) 10715 } 10716 10717 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10718 func (x *XTGetRevision) UnmarshalUnsafe(src []byte) []byte { 10719 if x.Name.Packed() { 10720 size := x.SizeBytes() 10721 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10722 return src[size:] 10723 } 10724 // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10725 return x.UnmarshalBytes(src) 10726 } 10727 10728 // CopyOutN implements marshal.Marshallable.CopyOutN. 10729 func (x *XTGetRevision) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10730 if !x.Name.Packed() { 10731 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 10732 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10733 x.MarshalBytes(buf) // escapes: fallback. 10734 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10735 } 10736 10737 // Construct a slice backed by dst's underlying memory. 10738 var buf []byte 10739 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10740 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10741 hdr.Len = x.SizeBytes() 10742 hdr.Cap = x.SizeBytes() 10743 10744 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10745 // Since we bypassed the compiler's escape analysis, indicate that x 10746 // must live until the use above. 10747 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10748 return length, err 10749 } 10750 10751 // CopyOut implements marshal.Marshallable.CopyOut. 10752 func (x *XTGetRevision) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10753 return x.CopyOutN(cc, addr, x.SizeBytes()) 10754 } 10755 10756 // CopyIn implements marshal.Marshallable.CopyIn. 10757 func (x *XTGetRevision) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10758 if !x.Name.Packed() { 10759 // Type XTGetRevision doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10760 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10761 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10762 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10763 // partially unmarshalled struct. 10764 x.UnmarshalBytes(buf) // escapes: fallback. 10765 return length, err 10766 } 10767 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(x))) 10772 hdr.Len = x.SizeBytes() 10773 hdr.Cap = x.SizeBytes() 10774 10775 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10776 // Since we bypassed the compiler's escape analysis, indicate that x 10777 // must live until the use above. 10778 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10779 return length, err 10780 } 10781 10782 // WriteTo implements io.WriterTo.WriteTo. 10783 func (x *XTGetRevision) WriteTo(writer io.Writer) (int64, error) { 10784 if !x.Name.Packed() { 10785 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 10786 buf := make([]byte, x.SizeBytes()) 10787 x.MarshalBytes(buf) 10788 length, err := writer.Write(buf) 10789 return int64(length), err 10790 } 10791 10792 // Construct a slice backed by dst's underlying memory. 10793 var buf []byte 10794 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10795 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10796 hdr.Len = x.SizeBytes() 10797 hdr.Cap = x.SizeBytes() 10798 10799 length, err := writer.Write(buf) 10800 // Since we bypassed the compiler's escape analysis, indicate that x 10801 // must live until the use above. 10802 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10803 return int64(length), err 10804 } 10805 10806 // SizeBytes implements marshal.Marshallable.SizeBytes. 10807 func (x *XTRedirectTarget) SizeBytes() int { 10808 return 0 + 10809 (*XTEntryTarget)(nil).SizeBytes() + 10810 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 10811 1*4 10812 } 10813 10814 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10815 func (x *XTRedirectTarget) MarshalBytes(dst []byte) []byte { 10816 dst = x.Target.MarshalUnsafe(dst) 10817 dst = x.NfRange.MarshalUnsafe(dst) 10818 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 10819 dst = dst[1*(4):] 10820 return dst 10821 } 10822 10823 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10824 func (x *XTRedirectTarget) UnmarshalBytes(src []byte) []byte { 10825 src = x.Target.UnmarshalUnsafe(src) 10826 src = x.NfRange.UnmarshalUnsafe(src) 10827 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 10828 src = src[1*(4):] 10829 return src 10830 } 10831 10832 // Packed implements marshal.Marshallable.Packed. 10833 // 10834 //go:nosplit 10835 func (x *XTRedirectTarget) Packed() bool { 10836 return x.NfRange.Packed() && x.Target.Packed() 10837 } 10838 10839 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10840 func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) []byte { 10841 if x.NfRange.Packed() && x.Target.Packed() { 10842 size := x.SizeBytes() 10843 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10844 return dst[size:] 10845 } 10846 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10847 return x.MarshalBytes(dst) 10848 } 10849 10850 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10851 func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) []byte { 10852 if x.NfRange.Packed() && x.Target.Packed() { 10853 size := x.SizeBytes() 10854 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10855 return src[size:] 10856 } 10857 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10858 return x.UnmarshalBytes(src) 10859 } 10860 10861 // CopyOutN implements marshal.Marshallable.CopyOutN. 10862 func (x *XTRedirectTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10863 if !x.NfRange.Packed() && x.Target.Packed() { 10864 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10865 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10866 x.MarshalBytes(buf) // escapes: fallback. 10867 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10868 } 10869 10870 // Construct a slice backed by dst's underlying memory. 10871 var buf []byte 10872 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10873 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10874 hdr.Len = x.SizeBytes() 10875 hdr.Cap = x.SizeBytes() 10876 10877 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10878 // Since we bypassed the compiler's escape analysis, indicate that x 10879 // must live until the use above. 10880 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10881 return length, err 10882 } 10883 10884 // CopyOut implements marshal.Marshallable.CopyOut. 10885 func (x *XTRedirectTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10886 return x.CopyOutN(cc, addr, x.SizeBytes()) 10887 } 10888 10889 // CopyIn implements marshal.Marshallable.CopyIn. 10890 func (x *XTRedirectTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10891 if !x.NfRange.Packed() && x.Target.Packed() { 10892 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10893 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10894 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10895 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10896 // partially unmarshalled struct. 10897 x.UnmarshalBytes(buf) // escapes: fallback. 10898 return length, err 10899 } 10900 10901 // Construct a slice backed by dst's underlying memory. 10902 var buf []byte 10903 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10904 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10905 hdr.Len = x.SizeBytes() 10906 hdr.Cap = x.SizeBytes() 10907 10908 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10909 // Since we bypassed the compiler's escape analysis, indicate that x 10910 // must live until the use above. 10911 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10912 return length, err 10913 } 10914 10915 // WriteTo implements io.WriterTo.WriteTo. 10916 func (x *XTRedirectTarget) WriteTo(writer io.Writer) (int64, error) { 10917 if !x.NfRange.Packed() && x.Target.Packed() { 10918 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10919 buf := make([]byte, x.SizeBytes()) 10920 x.MarshalBytes(buf) 10921 length, err := writer.Write(buf) 10922 return int64(length), err 10923 } 10924 10925 // Construct a slice backed by dst's underlying memory. 10926 var buf []byte 10927 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10928 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10929 hdr.Len = x.SizeBytes() 10930 hdr.Cap = x.SizeBytes() 10931 10932 length, err := writer.Write(buf) 10933 // Since we bypassed the compiler's escape analysis, indicate that x 10934 // must live until the use above. 10935 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10936 return int64(length), err 10937 } 10938 10939 // SizeBytes implements marshal.Marshallable.SizeBytes. 10940 func (x *XTSNATTarget) SizeBytes() int { 10941 return 0 + 10942 (*XTEntryTarget)(nil).SizeBytes() + 10943 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 10944 1*4 10945 } 10946 10947 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10948 func (x *XTSNATTarget) MarshalBytes(dst []byte) []byte { 10949 dst = x.Target.MarshalUnsafe(dst) 10950 dst = x.NfRange.MarshalUnsafe(dst) 10951 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 10952 dst = dst[1*(4):] 10953 return dst 10954 } 10955 10956 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10957 func (x *XTSNATTarget) UnmarshalBytes(src []byte) []byte { 10958 src = x.Target.UnmarshalUnsafe(src) 10959 src = x.NfRange.UnmarshalUnsafe(src) 10960 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 10961 src = src[1*(4):] 10962 return src 10963 } 10964 10965 // Packed implements marshal.Marshallable.Packed. 10966 // 10967 //go:nosplit 10968 func (x *XTSNATTarget) Packed() bool { 10969 return x.NfRange.Packed() && x.Target.Packed() 10970 } 10971 10972 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10973 func (x *XTSNATTarget) MarshalUnsafe(dst []byte) []byte { 10974 if x.NfRange.Packed() && x.Target.Packed() { 10975 size := x.SizeBytes() 10976 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10977 return dst[size:] 10978 } 10979 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 10980 return x.MarshalBytes(dst) 10981 } 10982 10983 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10984 func (x *XTSNATTarget) UnmarshalUnsafe(src []byte) []byte { 10985 if x.NfRange.Packed() && x.Target.Packed() { 10986 size := x.SizeBytes() 10987 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10988 return src[size:] 10989 } 10990 // Type XTSNATTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10991 return x.UnmarshalBytes(src) 10992 } 10993 10994 // CopyOutN implements marshal.Marshallable.CopyOutN. 10995 func (x *XTSNATTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10996 if !x.NfRange.Packed() && x.Target.Packed() { 10997 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 10998 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10999 x.MarshalBytes(buf) // escapes: fallback. 11000 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11001 } 11002 11003 // Construct a slice backed by dst's underlying memory. 11004 var buf []byte 11005 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11006 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11007 hdr.Len = x.SizeBytes() 11008 hdr.Cap = x.SizeBytes() 11009 11010 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11011 // Since we bypassed the compiler's escape analysis, indicate that x 11012 // must live until the use above. 11013 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11014 return length, err 11015 } 11016 11017 // CopyOut implements marshal.Marshallable.CopyOut. 11018 func (x *XTSNATTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11019 return x.CopyOutN(cc, addr, x.SizeBytes()) 11020 } 11021 11022 // CopyIn implements marshal.Marshallable.CopyIn. 11023 func (x *XTSNATTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11024 if !x.NfRange.Packed() && x.Target.Packed() { 11025 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11026 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11027 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11028 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11029 // partially unmarshalled struct. 11030 x.UnmarshalBytes(buf) // escapes: fallback. 11031 return length, err 11032 } 11033 11034 // Construct a slice backed by dst's underlying memory. 11035 var buf []byte 11036 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11037 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11038 hdr.Len = x.SizeBytes() 11039 hdr.Cap = x.SizeBytes() 11040 11041 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11042 // Since we bypassed the compiler's escape analysis, indicate that x 11043 // must live until the use above. 11044 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11045 return length, err 11046 } 11047 11048 // WriteTo implements io.WriterTo.WriteTo. 11049 func (x *XTSNATTarget) WriteTo(writer io.Writer) (int64, error) { 11050 if !x.NfRange.Packed() && x.Target.Packed() { 11051 // Type XTSNATTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11052 buf := make([]byte, x.SizeBytes()) 11053 x.MarshalBytes(buf) 11054 length, err := writer.Write(buf) 11055 return int64(length), err 11056 } 11057 11058 // Construct a slice backed by dst's underlying memory. 11059 var buf []byte 11060 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11061 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11062 hdr.Len = x.SizeBytes() 11063 hdr.Cap = x.SizeBytes() 11064 11065 length, err := writer.Write(buf) 11066 // Since we bypassed the compiler's escape analysis, indicate that x 11067 // must live until the use above. 11068 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11069 return int64(length), err 11070 } 11071 11072 // SizeBytes implements marshal.Marshallable.SizeBytes. 11073 func (x *XTStandardTarget) SizeBytes() int { 11074 return 4 + 11075 (*XTEntryTarget)(nil).SizeBytes() + 11076 1*4 11077 } 11078 11079 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11080 func (x *XTStandardTarget) MarshalBytes(dst []byte) []byte { 11081 dst = x.Target.MarshalUnsafe(dst) 11082 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.Verdict)) 11083 dst = dst[4:] 11084 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11085 dst = dst[1*(4):] 11086 return dst 11087 } 11088 11089 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11090 func (x *XTStandardTarget) UnmarshalBytes(src []byte) []byte { 11091 src = x.Target.UnmarshalUnsafe(src) 11092 x.Verdict = int32(hostarch.ByteOrder.Uint32(src[:4])) 11093 src = src[4:] 11094 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 11095 src = src[1*(4):] 11096 return src 11097 } 11098 11099 // Packed implements marshal.Marshallable.Packed. 11100 // 11101 //go:nosplit 11102 func (x *XTStandardTarget) Packed() bool { 11103 return x.Target.Packed() 11104 } 11105 11106 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11107 func (x *XTStandardTarget) MarshalUnsafe(dst []byte) []byte { 11108 if x.Target.Packed() { 11109 size := x.SizeBytes() 11110 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11111 return dst[size:] 11112 } 11113 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11114 return x.MarshalBytes(dst) 11115 } 11116 11117 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11118 func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) []byte { 11119 if x.Target.Packed() { 11120 size := x.SizeBytes() 11121 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11122 return src[size:] 11123 } 11124 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11125 return x.UnmarshalBytes(src) 11126 } 11127 11128 // CopyOutN implements marshal.Marshallable.CopyOutN. 11129 func (x *XTStandardTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11130 if !x.Target.Packed() { 11131 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11132 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11133 x.MarshalBytes(buf) // escapes: fallback. 11134 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11135 } 11136 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(x))) 11141 hdr.Len = x.SizeBytes() 11142 hdr.Cap = x.SizeBytes() 11143 11144 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11145 // Since we bypassed the compiler's escape analysis, indicate that x 11146 // must live until the use above. 11147 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11148 return length, err 11149 } 11150 11151 // CopyOut implements marshal.Marshallable.CopyOut. 11152 func (x *XTStandardTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11153 return x.CopyOutN(cc, addr, x.SizeBytes()) 11154 } 11155 11156 // CopyIn implements marshal.Marshallable.CopyIn. 11157 func (x *XTStandardTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11158 if !x.Target.Packed() { 11159 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11160 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11161 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11162 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11163 // partially unmarshalled struct. 11164 x.UnmarshalBytes(buf) // escapes: fallback. 11165 return length, err 11166 } 11167 11168 // Construct a slice backed by dst's underlying memory. 11169 var buf []byte 11170 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11171 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11172 hdr.Len = x.SizeBytes() 11173 hdr.Cap = x.SizeBytes() 11174 11175 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11176 // Since we bypassed the compiler's escape analysis, indicate that x 11177 // must live until the use above. 11178 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11179 return length, err 11180 } 11181 11182 // WriteTo implements io.WriterTo.WriteTo. 11183 func (x *XTStandardTarget) WriteTo(writer io.Writer) (int64, error) { 11184 if !x.Target.Packed() { 11185 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11186 buf := make([]byte, x.SizeBytes()) 11187 x.MarshalBytes(buf) 11188 length, err := writer.Write(buf) 11189 return int64(length), err 11190 } 11191 11192 // Construct a slice backed by dst's underlying memory. 11193 var buf []byte 11194 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11195 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11196 hdr.Len = x.SizeBytes() 11197 hdr.Cap = x.SizeBytes() 11198 11199 length, err := writer.Write(buf) 11200 // Since we bypassed the compiler's escape analysis, indicate that x 11201 // must live until the use above. 11202 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11203 return int64(length), err 11204 } 11205 11206 // SizeBytes implements marshal.Marshallable.SizeBytes. 11207 func (x *XTTCP) SizeBytes() int { 11208 return 12 11209 } 11210 11211 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11212 func (x *XTTCP) MarshalBytes(dst []byte) []byte { 11213 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 11214 dst = dst[2:] 11215 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 11216 dst = dst[2:] 11217 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 11218 dst = dst[2:] 11219 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 11220 dst = dst[2:] 11221 dst[0] = byte(x.Option) 11222 dst = dst[1:] 11223 dst[0] = byte(x.FlagMask) 11224 dst = dst[1:] 11225 dst[0] = byte(x.FlagCompare) 11226 dst = dst[1:] 11227 dst[0] = byte(x.InverseFlags) 11228 dst = dst[1:] 11229 return dst 11230 } 11231 11232 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11233 func (x *XTTCP) UnmarshalBytes(src []byte) []byte { 11234 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11235 src = src[2:] 11236 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11237 src = src[2:] 11238 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11239 src = src[2:] 11240 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11241 src = src[2:] 11242 x.Option = uint8(src[0]) 11243 src = src[1:] 11244 x.FlagMask = uint8(src[0]) 11245 src = src[1:] 11246 x.FlagCompare = uint8(src[0]) 11247 src = src[1:] 11248 x.InverseFlags = uint8(src[0]) 11249 src = src[1:] 11250 return src 11251 } 11252 11253 // Packed implements marshal.Marshallable.Packed. 11254 // 11255 //go:nosplit 11256 func (x *XTTCP) Packed() bool { 11257 return true 11258 } 11259 11260 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11261 func (x *XTTCP) MarshalUnsafe(dst []byte) []byte { 11262 size := x.SizeBytes() 11263 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11264 return dst[size:] 11265 } 11266 11267 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11268 func (x *XTTCP) UnmarshalUnsafe(src []byte) []byte { 11269 size := x.SizeBytes() 11270 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11271 return src[size:] 11272 } 11273 11274 // CopyOutN implements marshal.Marshallable.CopyOutN. 11275 func (x *XTTCP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11276 // Construct a slice backed by dst's underlying memory. 11277 var buf []byte 11278 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11279 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11280 hdr.Len = x.SizeBytes() 11281 hdr.Cap = x.SizeBytes() 11282 11283 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11284 // Since we bypassed the compiler's escape analysis, indicate that x 11285 // must live until the use above. 11286 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11287 return length, err 11288 } 11289 11290 // CopyOut implements marshal.Marshallable.CopyOut. 11291 func (x *XTTCP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11292 return x.CopyOutN(cc, addr, x.SizeBytes()) 11293 } 11294 11295 // CopyIn implements marshal.Marshallable.CopyIn. 11296 func (x *XTTCP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11297 // Construct a slice backed by dst's underlying memory. 11298 var buf []byte 11299 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11300 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11301 hdr.Len = x.SizeBytes() 11302 hdr.Cap = x.SizeBytes() 11303 11304 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11305 // Since we bypassed the compiler's escape analysis, indicate that x 11306 // must live until the use above. 11307 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11308 return length, err 11309 } 11310 11311 // WriteTo implements io.WriterTo.WriteTo. 11312 func (x *XTTCP) WriteTo(writer io.Writer) (int64, error) { 11313 // Construct a slice backed by dst's underlying memory. 11314 var buf []byte 11315 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11316 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11317 hdr.Len = x.SizeBytes() 11318 hdr.Cap = x.SizeBytes() 11319 11320 length, err := writer.Write(buf) 11321 // Since we bypassed the compiler's escape analysis, indicate that x 11322 // must live until the use above. 11323 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11324 return int64(length), err 11325 } 11326 11327 // SizeBytes implements marshal.Marshallable.SizeBytes. 11328 func (x *XTUDP) SizeBytes() int { 11329 return 10 11330 } 11331 11332 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11333 func (x *XTUDP) MarshalBytes(dst []byte) []byte { 11334 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 11335 dst = dst[2:] 11336 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 11337 dst = dst[2:] 11338 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 11339 dst = dst[2:] 11340 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 11341 dst = dst[2:] 11342 dst[0] = byte(x.InverseFlags) 11343 dst = dst[1:] 11344 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 11345 dst = dst[1:] 11346 return dst 11347 } 11348 11349 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11350 func (x *XTUDP) UnmarshalBytes(src []byte) []byte { 11351 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11352 src = src[2:] 11353 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11354 src = src[2:] 11355 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11356 src = src[2:] 11357 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11358 src = src[2:] 11359 x.InverseFlags = uint8(src[0]) 11360 src = src[1:] 11361 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 11362 src = src[1:] 11363 return src 11364 } 11365 11366 // Packed implements marshal.Marshallable.Packed. 11367 // 11368 //go:nosplit 11369 func (x *XTUDP) Packed() bool { 11370 return true 11371 } 11372 11373 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11374 func (x *XTUDP) MarshalUnsafe(dst []byte) []byte { 11375 size := x.SizeBytes() 11376 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11377 return dst[size:] 11378 } 11379 11380 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11381 func (x *XTUDP) UnmarshalUnsafe(src []byte) []byte { 11382 size := x.SizeBytes() 11383 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11384 return src[size:] 11385 } 11386 11387 // CopyOutN implements marshal.Marshallable.CopyOutN. 11388 func (x *XTUDP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11389 // Construct a slice backed by dst's underlying memory. 11390 var buf []byte 11391 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11392 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11393 hdr.Len = x.SizeBytes() 11394 hdr.Cap = x.SizeBytes() 11395 11396 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11397 // Since we bypassed the compiler's escape analysis, indicate that x 11398 // must live until the use above. 11399 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11400 return length, err 11401 } 11402 11403 // CopyOut implements marshal.Marshallable.CopyOut. 11404 func (x *XTUDP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11405 return x.CopyOutN(cc, addr, x.SizeBytes()) 11406 } 11407 11408 // CopyIn implements marshal.Marshallable.CopyIn. 11409 func (x *XTUDP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11410 // Construct a slice backed by dst's underlying memory. 11411 var buf []byte 11412 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11413 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11414 hdr.Len = x.SizeBytes() 11415 hdr.Cap = x.SizeBytes() 11416 11417 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11418 // Since we bypassed the compiler's escape analysis, indicate that x 11419 // must live until the use above. 11420 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11421 return length, err 11422 } 11423 11424 // WriteTo implements io.WriterTo.WriteTo. 11425 func (x *XTUDP) WriteTo(writer io.Writer) (int64, error) { 11426 // Construct a slice backed by dst's underlying memory. 11427 var buf []byte 11428 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11429 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11430 hdr.Len = x.SizeBytes() 11431 hdr.Cap = x.SizeBytes() 11432 11433 length, err := writer.Write(buf) 11434 // Since we bypassed the compiler's escape analysis, indicate that x 11435 // must live until the use above. 11436 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11437 return int64(length), err 11438 } 11439 11440 // SizeBytes implements marshal.Marshallable.SizeBytes. 11441 func (i *IP6TEntry) SizeBytes() int { 11442 return 12 + 11443 (*IP6TIP)(nil).SizeBytes() + 11444 1*4 + 11445 (*XTCounters)(nil).SizeBytes() 11446 } 11447 11448 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11449 func (i *IP6TEntry) MarshalBytes(dst []byte) []byte { 11450 dst = i.IPv6.MarshalUnsafe(dst) 11451 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 11452 dst = dst[4:] 11453 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 11454 dst = dst[2:] 11455 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 11456 dst = dst[2:] 11457 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 11458 dst = dst[4:] 11459 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11460 dst = dst[1*(4):] 11461 dst = i.Counters.MarshalUnsafe(dst) 11462 return dst 11463 } 11464 11465 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11466 func (i *IP6TEntry) UnmarshalBytes(src []byte) []byte { 11467 src = i.IPv6.UnmarshalUnsafe(src) 11468 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11469 src = src[4:] 11470 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11471 src = src[2:] 11472 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11473 src = src[2:] 11474 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11475 src = src[4:] 11476 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 11477 src = src[1*(4):] 11478 src = i.Counters.UnmarshalUnsafe(src) 11479 return src 11480 } 11481 11482 // Packed implements marshal.Marshallable.Packed. 11483 // 11484 //go:nosplit 11485 func (i *IP6TEntry) Packed() bool { 11486 return i.Counters.Packed() && i.IPv6.Packed() 11487 } 11488 11489 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11490 func (i *IP6TEntry) MarshalUnsafe(dst []byte) []byte { 11491 if i.Counters.Packed() && i.IPv6.Packed() { 11492 size := i.SizeBytes() 11493 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 11494 return dst[size:] 11495 } 11496 // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 11497 return i.MarshalBytes(dst) 11498 } 11499 11500 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11501 func (i *IP6TEntry) UnmarshalUnsafe(src []byte) []byte { 11502 if i.Counters.Packed() && i.IPv6.Packed() { 11503 size := i.SizeBytes() 11504 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 11505 return src[size:] 11506 } 11507 // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11508 return i.UnmarshalBytes(src) 11509 } 11510 11511 // CopyOutN implements marshal.Marshallable.CopyOutN. 11512 func (i *IP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11513 if !i.Counters.Packed() && i.IPv6.Packed() { 11514 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11515 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11516 i.MarshalBytes(buf) // escapes: fallback. 11517 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11518 } 11519 11520 // Construct a slice backed by dst's underlying memory. 11521 var buf []byte 11522 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11523 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11524 hdr.Len = i.SizeBytes() 11525 hdr.Cap = i.SizeBytes() 11526 11527 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11528 // Since we bypassed the compiler's escape analysis, indicate that i 11529 // must live until the use above. 11530 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11531 return length, err 11532 } 11533 11534 // CopyOut implements marshal.Marshallable.CopyOut. 11535 func (i *IP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11536 return i.CopyOutN(cc, addr, i.SizeBytes()) 11537 } 11538 11539 // CopyIn implements marshal.Marshallable.CopyIn. 11540 func (i *IP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11541 if !i.Counters.Packed() && i.IPv6.Packed() { 11542 // Type IP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11543 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11544 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11545 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11546 // partially unmarshalled struct. 11547 i.UnmarshalBytes(buf) // escapes: fallback. 11548 return length, err 11549 } 11550 11551 // Construct a slice backed by dst's underlying memory. 11552 var buf []byte 11553 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11554 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11555 hdr.Len = i.SizeBytes() 11556 hdr.Cap = i.SizeBytes() 11557 11558 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11559 // Since we bypassed the compiler's escape analysis, indicate that i 11560 // must live until the use above. 11561 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11562 return length, err 11563 } 11564 11565 // WriteTo implements io.WriterTo.WriteTo. 11566 func (i *IP6TEntry) WriteTo(writer io.Writer) (int64, error) { 11567 if !i.Counters.Packed() && i.IPv6.Packed() { 11568 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11569 buf := make([]byte, i.SizeBytes()) 11570 i.MarshalBytes(buf) 11571 length, err := writer.Write(buf) 11572 return int64(length), err 11573 } 11574 11575 // Construct a slice backed by dst's underlying memory. 11576 var buf []byte 11577 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11578 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11579 hdr.Len = i.SizeBytes() 11580 hdr.Cap = i.SizeBytes() 11581 11582 length, err := writer.Write(buf) 11583 // Since we bypassed the compiler's escape analysis, indicate that i 11584 // must live until the use above. 11585 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11586 return int64(length), err 11587 } 11588 11589 // SizeBytes implements marshal.Marshallable.SizeBytes. 11590 func (i *IP6TIP) SizeBytes() int { 11591 return 5 + 11592 (*Inet6Addr)(nil).SizeBytes() + 11593 (*Inet6Addr)(nil).SizeBytes() + 11594 (*Inet6Addr)(nil).SizeBytes() + 11595 (*Inet6Addr)(nil).SizeBytes() + 11596 1*IFNAMSIZ + 11597 1*IFNAMSIZ + 11598 1*IFNAMSIZ + 11599 1*IFNAMSIZ + 11600 1*3 11601 } 11602 11603 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11604 func (i *IP6TIP) MarshalBytes(dst []byte) []byte { 11605 dst = i.Src.MarshalUnsafe(dst) 11606 dst = i.Dst.MarshalUnsafe(dst) 11607 dst = i.SrcMask.MarshalUnsafe(dst) 11608 dst = i.DstMask.MarshalUnsafe(dst) 11609 for idx := 0; idx < IFNAMSIZ; idx++ { 11610 dst[0] = byte(i.InputInterface[idx]) 11611 dst = dst[1:] 11612 } 11613 for idx := 0; idx < IFNAMSIZ; idx++ { 11614 dst[0] = byte(i.OutputInterface[idx]) 11615 dst = dst[1:] 11616 } 11617 for idx := 0; idx < IFNAMSIZ; idx++ { 11618 dst[0] = byte(i.InputInterfaceMask[idx]) 11619 dst = dst[1:] 11620 } 11621 for idx := 0; idx < IFNAMSIZ; idx++ { 11622 dst[0] = byte(i.OutputInterfaceMask[idx]) 11623 dst = dst[1:] 11624 } 11625 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 11626 dst = dst[2:] 11627 dst[0] = byte(i.TOS) 11628 dst = dst[1:] 11629 dst[0] = byte(i.Flags) 11630 dst = dst[1:] 11631 dst[0] = byte(i.InverseFlags) 11632 dst = dst[1:] 11633 // Padding: dst[:sizeof(byte)*3] ~= [3]byte{0} 11634 dst = dst[1*(3):] 11635 return dst 11636 } 11637 11638 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11639 func (i *IP6TIP) UnmarshalBytes(src []byte) []byte { 11640 src = i.Src.UnmarshalUnsafe(src) 11641 src = i.Dst.UnmarshalUnsafe(src) 11642 src = i.SrcMask.UnmarshalUnsafe(src) 11643 src = i.DstMask.UnmarshalUnsafe(src) 11644 for idx := 0; idx < IFNAMSIZ; idx++ { 11645 i.InputInterface[idx] = src[0] 11646 src = src[1:] 11647 } 11648 for idx := 0; idx < IFNAMSIZ; idx++ { 11649 i.OutputInterface[idx] = src[0] 11650 src = src[1:] 11651 } 11652 for idx := 0; idx < IFNAMSIZ; idx++ { 11653 i.InputInterfaceMask[idx] = src[0] 11654 src = src[1:] 11655 } 11656 for idx := 0; idx < IFNAMSIZ; idx++ { 11657 i.OutputInterfaceMask[idx] = src[0] 11658 src = src[1:] 11659 } 11660 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11661 src = src[2:] 11662 i.TOS = uint8(src[0]) 11663 src = src[1:] 11664 i.Flags = uint8(src[0]) 11665 src = src[1:] 11666 i.InverseFlags = uint8(src[0]) 11667 src = src[1:] 11668 // Padding: ~ copy([3]byte(i._), src[:sizeof(byte)*3]) 11669 src = src[1*(3):] 11670 return src 11671 } 11672 11673 // Packed implements marshal.Marshallable.Packed. 11674 // 11675 //go:nosplit 11676 func (i *IP6TIP) Packed() bool { 11677 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 11678 } 11679 11680 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11681 func (i *IP6TIP) MarshalUnsafe(dst []byte) []byte { 11682 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11683 size := i.SizeBytes() 11684 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 11685 return dst[size:] 11686 } 11687 // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes. 11688 return i.MarshalBytes(dst) 11689 } 11690 11691 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11692 func (i *IP6TIP) UnmarshalUnsafe(src []byte) []byte { 11693 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11694 size := i.SizeBytes() 11695 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 11696 return src[size:] 11697 } 11698 // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11699 return i.UnmarshalBytes(src) 11700 } 11701 11702 // CopyOutN implements marshal.Marshallable.CopyOutN. 11703 func (i *IP6TIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11704 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11705 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 11706 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11707 i.MarshalBytes(buf) // escapes: fallback. 11708 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11709 } 11710 11711 // Construct a slice backed by dst's underlying memory. 11712 var buf []byte 11713 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11714 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11715 hdr.Len = i.SizeBytes() 11716 hdr.Cap = i.SizeBytes() 11717 11718 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11719 // Since we bypassed the compiler's escape analysis, indicate that i 11720 // must live until the use above. 11721 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11722 return length, err 11723 } 11724 11725 // CopyOut implements marshal.Marshallable.CopyOut. 11726 func (i *IP6TIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11727 return i.CopyOutN(cc, addr, i.SizeBytes()) 11728 } 11729 11730 // CopyIn implements marshal.Marshallable.CopyIn. 11731 func (i *IP6TIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11732 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11733 // Type IP6TIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11734 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11735 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11736 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11737 // partially unmarshalled struct. 11738 i.UnmarshalBytes(buf) // escapes: fallback. 11739 return length, err 11740 } 11741 11742 // Construct a slice backed by dst's underlying memory. 11743 var buf []byte 11744 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11745 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11746 hdr.Len = i.SizeBytes() 11747 hdr.Cap = i.SizeBytes() 11748 11749 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11750 // Since we bypassed the compiler's escape analysis, indicate that i 11751 // must live until the use above. 11752 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11753 return length, err 11754 } 11755 11756 // WriteTo implements io.WriterTo.WriteTo. 11757 func (i *IP6TIP) WriteTo(writer io.Writer) (int64, error) { 11758 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 11759 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 11760 buf := make([]byte, i.SizeBytes()) 11761 i.MarshalBytes(buf) 11762 length, err := writer.Write(buf) 11763 return int64(length), err 11764 } 11765 11766 // Construct a slice backed by dst's underlying memory. 11767 var buf []byte 11768 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11769 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11770 hdr.Len = i.SizeBytes() 11771 hdr.Cap = i.SizeBytes() 11772 11773 length, err := writer.Write(buf) 11774 // Since we bypassed the compiler's escape analysis, indicate that i 11775 // must live until the use above. 11776 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11777 return int64(length), err 11778 } 11779 11780 // SizeBytes implements marshal.Marshallable.SizeBytes. 11781 func (i *IP6TReplace) SizeBytes() int { 11782 return 24 + 11783 (*TableName)(nil).SizeBytes() + 11784 4*NF_INET_NUMHOOKS + 11785 4*NF_INET_NUMHOOKS 11786 } 11787 11788 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11789 func (i *IP6TReplace) MarshalBytes(dst []byte) []byte { 11790 dst = i.Name.MarshalUnsafe(dst) 11791 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 11792 dst = dst[4:] 11793 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 11794 dst = dst[4:] 11795 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 11796 dst = dst[4:] 11797 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11798 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 11799 dst = dst[4:] 11800 } 11801 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11802 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 11803 dst = dst[4:] 11804 } 11805 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 11806 dst = dst[4:] 11807 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 11808 dst = dst[8:] 11809 return dst 11810 } 11811 11812 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11813 func (i *IP6TReplace) UnmarshalBytes(src []byte) []byte { 11814 src = i.Name.UnmarshalUnsafe(src) 11815 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11816 src = src[4:] 11817 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11818 src = src[4:] 11819 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11820 src = src[4:] 11821 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11822 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11823 src = src[4:] 11824 } 11825 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 11826 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11827 src = src[4:] 11828 } 11829 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11830 src = src[4:] 11831 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 11832 src = src[8:] 11833 return src 11834 } 11835 11836 // Packed implements marshal.Marshallable.Packed. 11837 // 11838 //go:nosplit 11839 func (i *IP6TReplace) Packed() bool { 11840 return i.Name.Packed() 11841 } 11842 11843 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11844 func (i *IP6TReplace) MarshalUnsafe(dst []byte) []byte { 11845 if i.Name.Packed() { 11846 size := i.SizeBytes() 11847 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 11848 return dst[size:] 11849 } 11850 // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 11851 return i.MarshalBytes(dst) 11852 } 11853 11854 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11855 func (i *IP6TReplace) UnmarshalUnsafe(src []byte) []byte { 11856 if i.Name.Packed() { 11857 size := i.SizeBytes() 11858 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 11859 return src[size:] 11860 } 11861 // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11862 return i.UnmarshalBytes(src) 11863 } 11864 11865 // CopyOutN implements marshal.Marshallable.CopyOutN. 11866 func (i *IP6TReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11867 if !i.Name.Packed() { 11868 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 11869 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11870 i.MarshalBytes(buf) // escapes: fallback. 11871 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11872 } 11873 11874 // Construct a slice backed by dst's underlying memory. 11875 var buf []byte 11876 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11877 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11878 hdr.Len = i.SizeBytes() 11879 hdr.Cap = i.SizeBytes() 11880 11881 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11882 // Since we bypassed the compiler's escape analysis, indicate that i 11883 // must live until the use above. 11884 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11885 return length, err 11886 } 11887 11888 // CopyOut implements marshal.Marshallable.CopyOut. 11889 func (i *IP6TReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11890 return i.CopyOutN(cc, addr, i.SizeBytes()) 11891 } 11892 11893 // CopyIn implements marshal.Marshallable.CopyIn. 11894 func (i *IP6TReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11895 if !i.Name.Packed() { 11896 // Type IP6TReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11897 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 11898 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11899 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11900 // partially unmarshalled struct. 11901 i.UnmarshalBytes(buf) // escapes: fallback. 11902 return length, err 11903 } 11904 11905 // Construct a slice backed by dst's underlying memory. 11906 var buf []byte 11907 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11908 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11909 hdr.Len = i.SizeBytes() 11910 hdr.Cap = i.SizeBytes() 11911 11912 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11913 // Since we bypassed the compiler's escape analysis, indicate that i 11914 // must live until the use above. 11915 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11916 return length, err 11917 } 11918 11919 // WriteTo implements io.WriterTo.WriteTo. 11920 func (i *IP6TReplace) WriteTo(writer io.Writer) (int64, error) { 11921 if !i.Name.Packed() { 11922 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 11923 buf := make([]byte, i.SizeBytes()) 11924 i.MarshalBytes(buf) 11925 length, err := writer.Write(buf) 11926 return int64(length), err 11927 } 11928 11929 // Construct a slice backed by dst's underlying memory. 11930 var buf []byte 11931 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11932 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 11933 hdr.Len = i.SizeBytes() 11934 hdr.Cap = i.SizeBytes() 11935 11936 length, err := writer.Write(buf) 11937 // Since we bypassed the compiler's escape analysis, indicate that i 11938 // must live until the use above. 11939 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 11940 return int64(length), err 11941 } 11942 11943 // Packed implements marshal.Marshallable.Packed. 11944 // 11945 //go:nosplit 11946 func (ke *KernelIP6TEntry) Packed() bool { 11947 // Type KernelIP6TEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 11948 return false 11949 } 11950 11951 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11952 func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) []byte { 11953 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 11954 return ke.MarshalBytes(dst) 11955 } 11956 11957 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11958 func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) []byte { 11959 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11960 return ke.UnmarshalBytes(src) 11961 } 11962 11963 // CopyOutN implements marshal.Marshallable.CopyOutN. 11964 // 11965 //go:nosplit 11966 func (ke *KernelIP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11967 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11968 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 11969 ke.MarshalBytes(buf) // escapes: fallback. 11970 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11971 } 11972 11973 // CopyOut implements marshal.Marshallable.CopyOut. 11974 func (ke *KernelIP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11975 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 11976 } 11977 11978 // CopyIn implements marshal.Marshallable.CopyIn. 11979 func (ke *KernelIP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11980 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11981 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 11982 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 11983 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11984 // partially unmarshalled struct. 11985 ke.UnmarshalBytes(buf) // escapes: fallback. 11986 return length, err 11987 } 11988 11989 // WriteTo implements io.WriterTo.WriteTo. 11990 func (ke *KernelIP6TEntry) WriteTo(writer io.Writer) (int64, error) { 11991 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 11992 buf := make([]byte, ke.SizeBytes()) 11993 ke.MarshalBytes(buf) 11994 length, err := writer.Write(buf) 11995 return int64(length), err 11996 } 11997 11998 // Packed implements marshal.Marshallable.Packed. 11999 // 12000 //go:nosplit 12001 func (ke *KernelIP6TGetEntries) Packed() bool { 12002 // Type KernelIP6TGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 12003 return false 12004 } 12005 12006 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12007 func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) []byte { 12008 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 12009 return ke.MarshalBytes(dst) 12010 } 12011 12012 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12013 func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) []byte { 12014 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12015 return ke.UnmarshalBytes(src) 12016 } 12017 12018 // CopyOutN implements marshal.Marshallable.CopyOutN. 12019 // 12020 //go:nosplit 12021 func (ke *KernelIP6TGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12022 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 12023 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 12024 ke.MarshalBytes(buf) // escapes: fallback. 12025 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12026 } 12027 12028 // CopyOut implements marshal.Marshallable.CopyOut. 12029 func (ke *KernelIP6TGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12030 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 12031 } 12032 12033 // CopyIn implements marshal.Marshallable.CopyIn. 12034 func (ke *KernelIP6TGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12035 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12036 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 12037 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12038 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12039 // partially unmarshalled struct. 12040 ke.UnmarshalBytes(buf) // escapes: fallback. 12041 return length, err 12042 } 12043 12044 // WriteTo implements io.WriterTo.WriteTo. 12045 func (ke *KernelIP6TGetEntries) WriteTo(writer io.Writer) (int64, error) { 12046 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 12047 buf := make([]byte, ke.SizeBytes()) 12048 ke.MarshalBytes(buf) 12049 length, err := writer.Write(buf) 12050 return int64(length), err 12051 } 12052 12053 // SizeBytes implements marshal.Marshallable.SizeBytes. 12054 func (n *NFNATRange) SizeBytes() int { 12055 return 8 + 12056 (*Inet6Addr)(nil).SizeBytes() + 12057 (*Inet6Addr)(nil).SizeBytes() 12058 } 12059 12060 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12061 func (n *NFNATRange) MarshalBytes(dst []byte) []byte { 12062 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 12063 dst = dst[4:] 12064 dst = n.MinAddr.MarshalUnsafe(dst) 12065 dst = n.MaxAddr.MarshalUnsafe(dst) 12066 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto)) 12067 dst = dst[2:] 12068 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto)) 12069 dst = dst[2:] 12070 return dst 12071 } 12072 12073 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12074 func (n *NFNATRange) UnmarshalBytes(src []byte) []byte { 12075 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12076 src = src[4:] 12077 src = n.MinAddr.UnmarshalUnsafe(src) 12078 src = n.MaxAddr.UnmarshalUnsafe(src) 12079 n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12080 src = src[2:] 12081 n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12082 src = src[2:] 12083 return src 12084 } 12085 12086 // Packed implements marshal.Marshallable.Packed. 12087 // 12088 //go:nosplit 12089 func (n *NFNATRange) Packed() bool { 12090 return n.MaxAddr.Packed() && n.MinAddr.Packed() 12091 } 12092 12093 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12094 func (n *NFNATRange) MarshalUnsafe(dst []byte) []byte { 12095 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 12096 size := n.SizeBytes() 12097 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12098 return dst[size:] 12099 } 12100 // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes. 12101 return n.MarshalBytes(dst) 12102 } 12103 12104 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12105 func (n *NFNATRange) UnmarshalUnsafe(src []byte) []byte { 12106 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 12107 size := n.SizeBytes() 12108 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12109 return src[size:] 12110 } 12111 // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12112 return n.UnmarshalBytes(src) 12113 } 12114 12115 // CopyOutN implements marshal.Marshallable.CopyOutN. 12116 func (n *NFNATRange) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12117 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12118 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 12119 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12120 n.MarshalBytes(buf) // escapes: fallback. 12121 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12122 } 12123 12124 // Construct a slice backed by dst's underlying memory. 12125 var buf []byte 12126 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12127 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12128 hdr.Len = n.SizeBytes() 12129 hdr.Cap = n.SizeBytes() 12130 12131 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12132 // Since we bypassed the compiler's escape analysis, indicate that n 12133 // must live until the use above. 12134 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12135 return length, err 12136 } 12137 12138 // CopyOut implements marshal.Marshallable.CopyOut. 12139 func (n *NFNATRange) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12140 return n.CopyOutN(cc, addr, n.SizeBytes()) 12141 } 12142 12143 // CopyIn implements marshal.Marshallable.CopyIn. 12144 func (n *NFNATRange) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12145 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12146 // Type NFNATRange doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12147 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12148 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12149 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12150 // partially unmarshalled struct. 12151 n.UnmarshalBytes(buf) // escapes: fallback. 12152 return length, err 12153 } 12154 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(n))) 12159 hdr.Len = n.SizeBytes() 12160 hdr.Cap = n.SizeBytes() 12161 12162 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12163 // Since we bypassed the compiler's escape analysis, indicate that n 12164 // must live until the use above. 12165 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12166 return length, err 12167 } 12168 12169 // WriteTo implements io.WriterTo.WriteTo. 12170 func (n *NFNATRange) WriteTo(writer io.Writer) (int64, error) { 12171 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 12172 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 12173 buf := make([]byte, n.SizeBytes()) 12174 n.MarshalBytes(buf) 12175 length, err := writer.Write(buf) 12176 return int64(length), err 12177 } 12178 12179 // Construct a slice backed by dst's underlying memory. 12180 var buf []byte 12181 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12182 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12183 hdr.Len = n.SizeBytes() 12184 hdr.Cap = n.SizeBytes() 12185 12186 length, err := writer.Write(buf) 12187 // Since we bypassed the compiler's escape analysis, indicate that n 12188 // must live until the use above. 12189 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12190 return int64(length), err 12191 } 12192 12193 // SizeBytes implements marshal.Marshallable.SizeBytes. 12194 func (n *NetlinkAttrHeader) SizeBytes() int { 12195 return 4 12196 } 12197 12198 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12199 func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) []byte { 12200 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Length)) 12201 dst = dst[2:] 12202 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 12203 dst = dst[2:] 12204 return dst 12205 } 12206 12207 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12208 func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) []byte { 12209 n.Length = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12210 src = src[2:] 12211 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12212 src = src[2:] 12213 return src 12214 } 12215 12216 // Packed implements marshal.Marshallable.Packed. 12217 // 12218 //go:nosplit 12219 func (n *NetlinkAttrHeader) Packed() bool { 12220 return true 12221 } 12222 12223 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12224 func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) []byte { 12225 size := n.SizeBytes() 12226 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12227 return dst[size:] 12228 } 12229 12230 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12231 func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) []byte { 12232 size := n.SizeBytes() 12233 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12234 return src[size:] 12235 } 12236 12237 // CopyOutN implements marshal.Marshallable.CopyOutN. 12238 func (n *NetlinkAttrHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12239 // Construct a slice backed by dst's underlying memory. 12240 var buf []byte 12241 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12242 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12243 hdr.Len = n.SizeBytes() 12244 hdr.Cap = n.SizeBytes() 12245 12246 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12247 // Since we bypassed the compiler's escape analysis, indicate that n 12248 // must live until the use above. 12249 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12250 return length, err 12251 } 12252 12253 // CopyOut implements marshal.Marshallable.CopyOut. 12254 func (n *NetlinkAttrHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12255 return n.CopyOutN(cc, addr, n.SizeBytes()) 12256 } 12257 12258 // CopyIn implements marshal.Marshallable.CopyIn. 12259 func (n *NetlinkAttrHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12260 // Construct a slice backed by dst's underlying memory. 12261 var buf []byte 12262 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12263 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12264 hdr.Len = n.SizeBytes() 12265 hdr.Cap = n.SizeBytes() 12266 12267 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12268 // Since we bypassed the compiler's escape analysis, indicate that n 12269 // must live until the use above. 12270 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12271 return length, err 12272 } 12273 12274 // WriteTo implements io.WriterTo.WriteTo. 12275 func (n *NetlinkAttrHeader) WriteTo(writer io.Writer) (int64, error) { 12276 // Construct a slice backed by dst's underlying memory. 12277 var buf []byte 12278 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12279 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12280 hdr.Len = n.SizeBytes() 12281 hdr.Cap = n.SizeBytes() 12282 12283 length, err := writer.Write(buf) 12284 // Since we bypassed the compiler's escape analysis, indicate that n 12285 // must live until the use above. 12286 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12287 return int64(length), err 12288 } 12289 12290 // SizeBytes implements marshal.Marshallable.SizeBytes. 12291 func (n *NetlinkErrorMessage) SizeBytes() int { 12292 return 4 + 12293 (*NetlinkMessageHeader)(nil).SizeBytes() 12294 } 12295 12296 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12297 func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) []byte { 12298 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Error)) 12299 dst = dst[4:] 12300 dst = n.Header.MarshalUnsafe(dst) 12301 return dst 12302 } 12303 12304 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12305 func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) []byte { 12306 n.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 12307 src = src[4:] 12308 src = n.Header.UnmarshalUnsafe(src) 12309 return src 12310 } 12311 12312 // Packed implements marshal.Marshallable.Packed. 12313 // 12314 //go:nosplit 12315 func (n *NetlinkErrorMessage) Packed() bool { 12316 return n.Header.Packed() 12317 } 12318 12319 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12320 func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) []byte { 12321 if n.Header.Packed() { 12322 size := n.SizeBytes() 12323 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12324 return dst[size:] 12325 } 12326 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes. 12327 return n.MarshalBytes(dst) 12328 } 12329 12330 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12331 func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) []byte { 12332 if n.Header.Packed() { 12333 size := n.SizeBytes() 12334 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12335 return src[size:] 12336 } 12337 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12338 return n.UnmarshalBytes(src) 12339 } 12340 12341 // CopyOutN implements marshal.Marshallable.CopyOutN. 12342 func (n *NetlinkErrorMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12343 if !n.Header.Packed() { 12344 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 12345 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12346 n.MarshalBytes(buf) // escapes: fallback. 12347 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12348 } 12349 12350 // Construct a slice backed by dst's underlying memory. 12351 var buf []byte 12352 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12353 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12354 hdr.Len = n.SizeBytes() 12355 hdr.Cap = n.SizeBytes() 12356 12357 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12358 // Since we bypassed the compiler's escape analysis, indicate that n 12359 // must live until the use above. 12360 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12361 return length, err 12362 } 12363 12364 // CopyOut implements marshal.Marshallable.CopyOut. 12365 func (n *NetlinkErrorMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12366 return n.CopyOutN(cc, addr, n.SizeBytes()) 12367 } 12368 12369 // CopyIn implements marshal.Marshallable.CopyIn. 12370 func (n *NetlinkErrorMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12371 if !n.Header.Packed() { 12372 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12373 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 12374 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12375 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12376 // partially unmarshalled struct. 12377 n.UnmarshalBytes(buf) // escapes: fallback. 12378 return length, err 12379 } 12380 12381 // Construct a slice backed by dst's underlying memory. 12382 var buf []byte 12383 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12384 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12385 hdr.Len = n.SizeBytes() 12386 hdr.Cap = n.SizeBytes() 12387 12388 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12389 // Since we bypassed the compiler's escape analysis, indicate that n 12390 // must live until the use above. 12391 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12392 return length, err 12393 } 12394 12395 // WriteTo implements io.WriterTo.WriteTo. 12396 func (n *NetlinkErrorMessage) WriteTo(writer io.Writer) (int64, error) { 12397 if !n.Header.Packed() { 12398 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 12399 buf := make([]byte, n.SizeBytes()) 12400 n.MarshalBytes(buf) 12401 length, err := writer.Write(buf) 12402 return int64(length), err 12403 } 12404 12405 // Construct a slice backed by dst's underlying memory. 12406 var buf []byte 12407 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12408 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12409 hdr.Len = n.SizeBytes() 12410 hdr.Cap = n.SizeBytes() 12411 12412 length, err := writer.Write(buf) 12413 // Since we bypassed the compiler's escape analysis, indicate that n 12414 // must live until the use above. 12415 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12416 return int64(length), err 12417 } 12418 12419 // SizeBytes implements marshal.Marshallable.SizeBytes. 12420 func (n *NetlinkMessageHeader) SizeBytes() int { 12421 return 16 12422 } 12423 12424 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12425 func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) []byte { 12426 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Length)) 12427 dst = dst[4:] 12428 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 12429 dst = dst[2:] 12430 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Flags)) 12431 dst = dst[2:] 12432 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Seq)) 12433 dst = dst[4:] 12434 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.PortID)) 12435 dst = dst[4:] 12436 return dst 12437 } 12438 12439 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12440 func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) []byte { 12441 n.Length = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12442 src = src[4:] 12443 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12444 src = src[2:] 12445 n.Flags = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12446 src = src[2:] 12447 n.Seq = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12448 src = src[4:] 12449 n.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12450 src = src[4:] 12451 return src 12452 } 12453 12454 // Packed implements marshal.Marshallable.Packed. 12455 // 12456 //go:nosplit 12457 func (n *NetlinkMessageHeader) Packed() bool { 12458 return true 12459 } 12460 12461 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12462 func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) []byte { 12463 size := n.SizeBytes() 12464 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 12465 return dst[size:] 12466 } 12467 12468 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12469 func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) []byte { 12470 size := n.SizeBytes() 12471 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 12472 return src[size:] 12473 } 12474 12475 // CopyOutN implements marshal.Marshallable.CopyOutN. 12476 func (n *NetlinkMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12477 // Construct a slice backed by dst's underlying memory. 12478 var buf []byte 12479 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12480 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12481 hdr.Len = n.SizeBytes() 12482 hdr.Cap = n.SizeBytes() 12483 12484 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12485 // Since we bypassed the compiler's escape analysis, indicate that n 12486 // must live until the use above. 12487 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12488 return length, err 12489 } 12490 12491 // CopyOut implements marshal.Marshallable.CopyOut. 12492 func (n *NetlinkMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12493 return n.CopyOutN(cc, addr, n.SizeBytes()) 12494 } 12495 12496 // CopyIn implements marshal.Marshallable.CopyIn. 12497 func (n *NetlinkMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12498 // Construct a slice backed by dst's underlying memory. 12499 var buf []byte 12500 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12501 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12502 hdr.Len = n.SizeBytes() 12503 hdr.Cap = n.SizeBytes() 12504 12505 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12506 // Since we bypassed the compiler's escape analysis, indicate that n 12507 // must live until the use above. 12508 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12509 return length, err 12510 } 12511 12512 // WriteTo implements io.WriterTo.WriteTo. 12513 func (n *NetlinkMessageHeader) WriteTo(writer io.Writer) (int64, error) { 12514 // Construct a slice backed by dst's underlying memory. 12515 var buf []byte 12516 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12517 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 12518 hdr.Len = n.SizeBytes() 12519 hdr.Cap = n.SizeBytes() 12520 12521 length, err := writer.Write(buf) 12522 // Since we bypassed the compiler's escape analysis, indicate that n 12523 // must live until the use above. 12524 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 12525 return int64(length), err 12526 } 12527 12528 // SizeBytes implements marshal.Marshallable.SizeBytes. 12529 func (s *SockAddrNetlink) SizeBytes() int { 12530 return 12 12531 } 12532 12533 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12534 func (s *SockAddrNetlink) MarshalBytes(dst []byte) []byte { 12535 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 12536 dst = dst[2:] 12537 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 12538 dst = dst[2:] 12539 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PortID)) 12540 dst = dst[4:] 12541 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Groups)) 12542 dst = dst[4:] 12543 return dst 12544 } 12545 12546 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12547 func (s *SockAddrNetlink) UnmarshalBytes(src []byte) []byte { 12548 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12549 src = src[2:] 12550 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 12551 src = src[2:] 12552 s.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12553 src = src[4:] 12554 s.Groups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12555 src = src[4:] 12556 return src 12557 } 12558 12559 // Packed implements marshal.Marshallable.Packed. 12560 // 12561 //go:nosplit 12562 func (s *SockAddrNetlink) Packed() bool { 12563 return true 12564 } 12565 12566 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12567 func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) []byte { 12568 size := s.SizeBytes() 12569 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 12570 return dst[size:] 12571 } 12572 12573 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12574 func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) []byte { 12575 size := s.SizeBytes() 12576 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 12577 return src[size:] 12578 } 12579 12580 // CopyOutN implements marshal.Marshallable.CopyOutN. 12581 func (s *SockAddrNetlink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12582 // Construct a slice backed by dst's underlying memory. 12583 var buf []byte 12584 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12585 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12586 hdr.Len = s.SizeBytes() 12587 hdr.Cap = s.SizeBytes() 12588 12589 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12590 // Since we bypassed the compiler's escape analysis, indicate that s 12591 // must live until the use above. 12592 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12593 return length, err 12594 } 12595 12596 // CopyOut implements marshal.Marshallable.CopyOut. 12597 func (s *SockAddrNetlink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12598 return s.CopyOutN(cc, addr, s.SizeBytes()) 12599 } 12600 12601 // CopyIn implements marshal.Marshallable.CopyIn. 12602 func (s *SockAddrNetlink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12603 // Construct a slice backed by dst's underlying memory. 12604 var buf []byte 12605 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12606 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12607 hdr.Len = s.SizeBytes() 12608 hdr.Cap = s.SizeBytes() 12609 12610 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12611 // Since we bypassed the compiler's escape analysis, indicate that s 12612 // must live until the use above. 12613 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12614 return length, err 12615 } 12616 12617 // WriteTo implements io.WriterTo.WriteTo. 12618 func (s *SockAddrNetlink) WriteTo(writer io.Writer) (int64, error) { 12619 // Construct a slice backed by dst's underlying memory. 12620 var buf []byte 12621 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12622 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 12623 hdr.Len = s.SizeBytes() 12624 hdr.Cap = s.SizeBytes() 12625 12626 length, err := writer.Write(buf) 12627 // Since we bypassed the compiler's escape analysis, indicate that s 12628 // must live until the use above. 12629 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 12630 return int64(length), err 12631 } 12632 12633 // SizeBytes implements marshal.Marshallable.SizeBytes. 12634 func (i *InterfaceAddrMessage) SizeBytes() int { 12635 return 8 12636 } 12637 12638 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12639 func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) []byte { 12640 dst[0] = byte(i.Family) 12641 dst = dst[1:] 12642 dst[0] = byte(i.PrefixLen) 12643 dst = dst[1:] 12644 dst[0] = byte(i.Flags) 12645 dst = dst[1:] 12646 dst[0] = byte(i.Scope) 12647 dst = dst[1:] 12648 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 12649 dst = dst[4:] 12650 return dst 12651 } 12652 12653 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12654 func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) []byte { 12655 i.Family = uint8(src[0]) 12656 src = src[1:] 12657 i.PrefixLen = uint8(src[0]) 12658 src = src[1:] 12659 i.Flags = uint8(src[0]) 12660 src = src[1:] 12661 i.Scope = uint8(src[0]) 12662 src = src[1:] 12663 i.Index = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12664 src = src[4:] 12665 return src 12666 } 12667 12668 // Packed implements marshal.Marshallable.Packed. 12669 // 12670 //go:nosplit 12671 func (i *InterfaceAddrMessage) Packed() bool { 12672 return true 12673 } 12674 12675 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12676 func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) []byte { 12677 size := i.SizeBytes() 12678 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12679 return dst[size:] 12680 } 12681 12682 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12683 func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) []byte { 12684 size := i.SizeBytes() 12685 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12686 return src[size:] 12687 } 12688 12689 // CopyOutN implements marshal.Marshallable.CopyOutN. 12690 func (i *InterfaceAddrMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12691 // Construct a slice backed by dst's underlying memory. 12692 var buf []byte 12693 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12694 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12695 hdr.Len = i.SizeBytes() 12696 hdr.Cap = i.SizeBytes() 12697 12698 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12699 // Since we bypassed the compiler's escape analysis, indicate that i 12700 // must live until the use above. 12701 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12702 return length, err 12703 } 12704 12705 // CopyOut implements marshal.Marshallable.CopyOut. 12706 func (i *InterfaceAddrMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12707 return i.CopyOutN(cc, addr, i.SizeBytes()) 12708 } 12709 12710 // CopyIn implements marshal.Marshallable.CopyIn. 12711 func (i *InterfaceAddrMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12712 // Construct a slice backed by dst's underlying memory. 12713 var buf []byte 12714 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12715 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12716 hdr.Len = i.SizeBytes() 12717 hdr.Cap = i.SizeBytes() 12718 12719 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12720 // Since we bypassed the compiler's escape analysis, indicate that i 12721 // must live until the use above. 12722 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12723 return length, err 12724 } 12725 12726 // WriteTo implements io.WriterTo.WriteTo. 12727 func (i *InterfaceAddrMessage) WriteTo(writer io.Writer) (int64, error) { 12728 // Construct a slice backed by dst's underlying memory. 12729 var buf []byte 12730 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12731 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12732 hdr.Len = i.SizeBytes() 12733 hdr.Cap = i.SizeBytes() 12734 12735 length, err := writer.Write(buf) 12736 // Since we bypassed the compiler's escape analysis, indicate that i 12737 // must live until the use above. 12738 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12739 return int64(length), err 12740 } 12741 12742 // SizeBytes implements marshal.Marshallable.SizeBytes. 12743 func (i *InterfaceInfoMessage) SizeBytes() int { 12744 return 16 12745 } 12746 12747 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12748 func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) []byte { 12749 dst[0] = byte(i.Family) 12750 dst = dst[1:] 12751 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 12752 dst = dst[1:] 12753 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Type)) 12754 dst = dst[2:] 12755 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 12756 dst = dst[4:] 12757 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 12758 dst = dst[4:] 12759 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Change)) 12760 dst = dst[4:] 12761 return dst 12762 } 12763 12764 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12765 func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) []byte { 12766 i.Family = uint8(src[0]) 12767 src = src[1:] 12768 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 12769 src = src[1:] 12770 i.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12771 src = src[2:] 12772 i.Index = int32(hostarch.ByteOrder.Uint32(src[:4])) 12773 src = src[4:] 12774 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12775 src = src[4:] 12776 i.Change = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12777 src = src[4:] 12778 return src 12779 } 12780 12781 // Packed implements marshal.Marshallable.Packed. 12782 // 12783 //go:nosplit 12784 func (i *InterfaceInfoMessage) Packed() bool { 12785 return true 12786 } 12787 12788 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12789 func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) []byte { 12790 size := i.SizeBytes() 12791 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12792 return dst[size:] 12793 } 12794 12795 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12796 func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) []byte { 12797 size := i.SizeBytes() 12798 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12799 return src[size:] 12800 } 12801 12802 // CopyOutN implements marshal.Marshallable.CopyOutN. 12803 func (i *InterfaceInfoMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12804 // Construct a slice backed by dst's underlying memory. 12805 var buf []byte 12806 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12807 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12808 hdr.Len = i.SizeBytes() 12809 hdr.Cap = i.SizeBytes() 12810 12811 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12812 // Since we bypassed the compiler's escape analysis, indicate that i 12813 // must live until the use above. 12814 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12815 return length, err 12816 } 12817 12818 // CopyOut implements marshal.Marshallable.CopyOut. 12819 func (i *InterfaceInfoMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12820 return i.CopyOutN(cc, addr, i.SizeBytes()) 12821 } 12822 12823 // CopyIn implements marshal.Marshallable.CopyIn. 12824 func (i *InterfaceInfoMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12825 // Construct a slice backed by dst's underlying memory. 12826 var buf []byte 12827 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12828 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12829 hdr.Len = i.SizeBytes() 12830 hdr.Cap = i.SizeBytes() 12831 12832 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12833 // Since we bypassed the compiler's escape analysis, indicate that i 12834 // must live until the use above. 12835 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12836 return length, err 12837 } 12838 12839 // WriteTo implements io.WriterTo.WriteTo. 12840 func (i *InterfaceInfoMessage) WriteTo(writer io.Writer) (int64, error) { 12841 // Construct a slice backed by dst's underlying memory. 12842 var buf []byte 12843 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12844 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12845 hdr.Len = i.SizeBytes() 12846 hdr.Cap = i.SizeBytes() 12847 12848 length, err := writer.Write(buf) 12849 // Since we bypassed the compiler's escape analysis, indicate that i 12850 // must live until the use above. 12851 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12852 return int64(length), err 12853 } 12854 12855 // SizeBytes implements marshal.Marshallable.SizeBytes. 12856 func (r *RouteMessage) SizeBytes() int { 12857 return 12 12858 } 12859 12860 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12861 func (r *RouteMessage) MarshalBytes(dst []byte) []byte { 12862 dst[0] = byte(r.Family) 12863 dst = dst[1:] 12864 dst[0] = byte(r.DstLen) 12865 dst = dst[1:] 12866 dst[0] = byte(r.SrcLen) 12867 dst = dst[1:] 12868 dst[0] = byte(r.TOS) 12869 dst = dst[1:] 12870 dst[0] = byte(r.Table) 12871 dst = dst[1:] 12872 dst[0] = byte(r.Protocol) 12873 dst = dst[1:] 12874 dst[0] = byte(r.Scope) 12875 dst = dst[1:] 12876 dst[0] = byte(r.Type) 12877 dst = dst[1:] 12878 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 12879 dst = dst[4:] 12880 return dst 12881 } 12882 12883 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12884 func (r *RouteMessage) UnmarshalBytes(src []byte) []byte { 12885 r.Family = uint8(src[0]) 12886 src = src[1:] 12887 r.DstLen = uint8(src[0]) 12888 src = src[1:] 12889 r.SrcLen = uint8(src[0]) 12890 src = src[1:] 12891 r.TOS = uint8(src[0]) 12892 src = src[1:] 12893 r.Table = uint8(src[0]) 12894 src = src[1:] 12895 r.Protocol = uint8(src[0]) 12896 src = src[1:] 12897 r.Scope = uint8(src[0]) 12898 src = src[1:] 12899 r.Type = uint8(src[0]) 12900 src = src[1:] 12901 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12902 src = src[4:] 12903 return src 12904 } 12905 12906 // Packed implements marshal.Marshallable.Packed. 12907 // 12908 //go:nosplit 12909 func (r *RouteMessage) Packed() bool { 12910 return true 12911 } 12912 12913 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12914 func (r *RouteMessage) MarshalUnsafe(dst []byte) []byte { 12915 size := r.SizeBytes() 12916 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 12917 return dst[size:] 12918 } 12919 12920 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12921 func (r *RouteMessage) UnmarshalUnsafe(src []byte) []byte { 12922 size := r.SizeBytes() 12923 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 12924 return src[size:] 12925 } 12926 12927 // CopyOutN implements marshal.Marshallable.CopyOutN. 12928 func (r *RouteMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12929 // Construct a slice backed by dst's underlying memory. 12930 var buf []byte 12931 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12932 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12933 hdr.Len = r.SizeBytes() 12934 hdr.Cap = r.SizeBytes() 12935 12936 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12937 // Since we bypassed the compiler's escape analysis, indicate that r 12938 // must live until the use above. 12939 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12940 return length, err 12941 } 12942 12943 // CopyOut implements marshal.Marshallable.CopyOut. 12944 func (r *RouteMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12945 return r.CopyOutN(cc, addr, r.SizeBytes()) 12946 } 12947 12948 // CopyIn implements marshal.Marshallable.CopyIn. 12949 func (r *RouteMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12950 // Construct a slice backed by dst's underlying memory. 12951 var buf []byte 12952 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12953 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12954 hdr.Len = r.SizeBytes() 12955 hdr.Cap = r.SizeBytes() 12956 12957 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 12958 // Since we bypassed the compiler's escape analysis, indicate that r 12959 // must live until the use above. 12960 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12961 return length, err 12962 } 12963 12964 // WriteTo implements io.WriterTo.WriteTo. 12965 func (r *RouteMessage) WriteTo(writer io.Writer) (int64, error) { 12966 // Construct a slice backed by dst's underlying memory. 12967 var buf []byte 12968 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12969 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 12970 hdr.Len = r.SizeBytes() 12971 hdr.Cap = r.SizeBytes() 12972 12973 length, err := writer.Write(buf) 12974 // Since we bypassed the compiler's escape analysis, indicate that r 12975 // must live until the use above. 12976 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 12977 return int64(length), err 12978 } 12979 12980 // SizeBytes implements marshal.Marshallable.SizeBytes. 12981 func (r *RtAttr) SizeBytes() int { 12982 return 4 12983 } 12984 12985 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12986 func (r *RtAttr) MarshalBytes(dst []byte) []byte { 12987 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Len)) 12988 dst = dst[2:] 12989 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Type)) 12990 dst = dst[2:] 12991 return dst 12992 } 12993 12994 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12995 func (r *RtAttr) UnmarshalBytes(src []byte) []byte { 12996 r.Len = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12997 src = src[2:] 12998 r.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12999 src = src[2:] 13000 return src 13001 } 13002 13003 // Packed implements marshal.Marshallable.Packed. 13004 // 13005 //go:nosplit 13006 func (r *RtAttr) Packed() bool { 13007 return true 13008 } 13009 13010 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13011 func (r *RtAttr) MarshalUnsafe(dst []byte) []byte { 13012 size := r.SizeBytes() 13013 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13014 return dst[size:] 13015 } 13016 13017 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13018 func (r *RtAttr) UnmarshalUnsafe(src []byte) []byte { 13019 size := r.SizeBytes() 13020 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13021 return src[size:] 13022 } 13023 13024 // CopyOutN implements marshal.Marshallable.CopyOutN. 13025 func (r *RtAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13026 // Construct a slice backed by dst's underlying memory. 13027 var buf []byte 13028 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13029 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13030 hdr.Len = r.SizeBytes() 13031 hdr.Cap = r.SizeBytes() 13032 13033 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13034 // Since we bypassed the compiler's escape analysis, indicate that r 13035 // must live until the use above. 13036 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13037 return length, err 13038 } 13039 13040 // CopyOut implements marshal.Marshallable.CopyOut. 13041 func (r *RtAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13042 return r.CopyOutN(cc, addr, r.SizeBytes()) 13043 } 13044 13045 // CopyIn implements marshal.Marshallable.CopyIn. 13046 func (r *RtAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13047 // Construct a slice backed by dst's underlying memory. 13048 var buf []byte 13049 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13050 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13051 hdr.Len = r.SizeBytes() 13052 hdr.Cap = r.SizeBytes() 13053 13054 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13055 // Since we bypassed the compiler's escape analysis, indicate that r 13056 // must live until the use above. 13057 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13058 return length, err 13059 } 13060 13061 // WriteTo implements io.WriterTo.WriteTo. 13062 func (r *RtAttr) WriteTo(writer io.Writer) (int64, error) { 13063 // Construct a slice backed by dst's underlying memory. 13064 var buf []byte 13065 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13066 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13067 hdr.Len = r.SizeBytes() 13068 hdr.Cap = r.SizeBytes() 13069 13070 length, err := writer.Write(buf) 13071 // Since we bypassed the compiler's escape analysis, indicate that r 13072 // must live until the use above. 13073 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13074 return int64(length), err 13075 } 13076 13077 // SizeBytes implements marshal.Marshallable.SizeBytes. 13078 func (p *PollFD) SizeBytes() int { 13079 return 8 13080 } 13081 13082 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13083 func (p *PollFD) MarshalBytes(dst []byte) []byte { 13084 hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.FD)) 13085 dst = dst[4:] 13086 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.Events)) 13087 dst = dst[2:] 13088 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.REvents)) 13089 dst = dst[2:] 13090 return dst 13091 } 13092 13093 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13094 func (p *PollFD) UnmarshalBytes(src []byte) []byte { 13095 p.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 13096 src = src[4:] 13097 p.Events = int16(hostarch.ByteOrder.Uint16(src[:2])) 13098 src = src[2:] 13099 p.REvents = int16(hostarch.ByteOrder.Uint16(src[:2])) 13100 src = src[2:] 13101 return src 13102 } 13103 13104 // Packed implements marshal.Marshallable.Packed. 13105 // 13106 //go:nosplit 13107 func (p *PollFD) Packed() bool { 13108 return true 13109 } 13110 13111 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13112 func (p *PollFD) MarshalUnsafe(dst []byte) []byte { 13113 size := p.SizeBytes() 13114 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size)) 13115 return dst[size:] 13116 } 13117 13118 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13119 func (p *PollFD) UnmarshalUnsafe(src []byte) []byte { 13120 size := p.SizeBytes() 13121 gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size)) 13122 return src[size:] 13123 } 13124 13125 // CopyOutN implements marshal.Marshallable.CopyOutN. 13126 func (p *PollFD) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13127 // Construct a slice backed by dst's underlying memory. 13128 var buf []byte 13129 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13130 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13131 hdr.Len = p.SizeBytes() 13132 hdr.Cap = p.SizeBytes() 13133 13134 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13135 // Since we bypassed the compiler's escape analysis, indicate that p 13136 // must live until the use above. 13137 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13138 return length, err 13139 } 13140 13141 // CopyOut implements marshal.Marshallable.CopyOut. 13142 func (p *PollFD) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13143 return p.CopyOutN(cc, addr, p.SizeBytes()) 13144 } 13145 13146 // CopyIn implements marshal.Marshallable.CopyIn. 13147 func (p *PollFD) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13148 // Construct a slice backed by dst's underlying memory. 13149 var buf []byte 13150 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13151 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13152 hdr.Len = p.SizeBytes() 13153 hdr.Cap = p.SizeBytes() 13154 13155 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13156 // Since we bypassed the compiler's escape analysis, indicate that p 13157 // must live until the use above. 13158 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13159 return length, err 13160 } 13161 13162 // WriteTo implements io.WriterTo.WriteTo. 13163 func (p *PollFD) WriteTo(writer io.Writer) (int64, error) { 13164 // Construct a slice backed by dst's underlying memory. 13165 var buf []byte 13166 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13167 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 13168 hdr.Len = p.SizeBytes() 13169 hdr.Cap = p.SizeBytes() 13170 13171 length, err := writer.Write(buf) 13172 // Since we bypassed the compiler's escape analysis, indicate that p 13173 // must live until the use above. 13174 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 13175 return int64(length), err 13176 } 13177 13178 // CopyPollFDSliceIn copies in a slice of PollFD objects from the task's memory. 13179 func CopyPollFDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []PollFD) (int, error) { 13180 count := len(dst) 13181 if count == 0 { 13182 return 0, nil 13183 } 13184 size := (*PollFD)(nil).SizeBytes() 13185 13186 ptr := unsafe.Pointer(&dst) 13187 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13188 13189 // Construct a slice backed by dst's underlying memory. 13190 var buf []byte 13191 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13192 hdr.Data = uintptr(val) 13193 hdr.Len = size * count 13194 hdr.Cap = size * count 13195 13196 length, err := cc.CopyInBytes(addr, buf) 13197 // Since we bypassed the compiler's escape analysis, indicate that dst 13198 // must live until the use above. 13199 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 13200 return length, err 13201 } 13202 13203 // CopyPollFDSliceOut copies a slice of PollFD objects to the task's memory. 13204 func CopyPollFDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []PollFD) (int, error) { 13205 count := len(src) 13206 if count == 0 { 13207 return 0, nil 13208 } 13209 size := (*PollFD)(nil).SizeBytes() 13210 13211 ptr := unsafe.Pointer(&src) 13212 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13213 13214 // Construct a slice backed by dst's underlying memory. 13215 var buf []byte 13216 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13217 hdr.Data = uintptr(val) 13218 hdr.Len = size * count 13219 hdr.Cap = size * count 13220 13221 length, err := cc.CopyOutBytes(addr, buf) 13222 // Since we bypassed the compiler's escape analysis, indicate that src 13223 // must live until the use above. 13224 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 13225 return length, err 13226 } 13227 13228 // MarshalUnsafePollFDSlice is like PollFD.MarshalUnsafe, but for a []PollFD. 13229 func MarshalUnsafePollFDSlice(src []PollFD, dst []byte) []byte { 13230 count := len(src) 13231 if count == 0 { 13232 return dst 13233 } 13234 13235 size := (*PollFD)(nil).SizeBytes() 13236 buf := dst[:size*count] 13237 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 13238 return dst[size*count:] 13239 } 13240 13241 // UnmarshalUnsafePollFDSlice is like PollFD.UnmarshalUnsafe, but for a []PollFD. 13242 func UnmarshalUnsafePollFDSlice(dst []PollFD, src []byte) []byte { 13243 count := len(dst) 13244 if count == 0 { 13245 return src 13246 } 13247 13248 size := (*PollFD)(nil).SizeBytes() 13249 buf := src[:size*count] 13250 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 13251 return src[size*count:] 13252 } 13253 13254 // SizeBytes implements marshal.Marshallable.SizeBytes. 13255 func (r *RSeqCriticalSection) SizeBytes() int { 13256 return 32 13257 } 13258 13259 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13260 func (r *RSeqCriticalSection) MarshalBytes(dst []byte) []byte { 13261 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Version)) 13262 dst = dst[4:] 13263 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 13264 dst = dst[4:] 13265 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Start)) 13266 dst = dst[8:] 13267 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.PostCommitOffset)) 13268 dst = dst[8:] 13269 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Abort)) 13270 dst = dst[8:] 13271 return dst 13272 } 13273 13274 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13275 func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) []byte { 13276 r.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13277 src = src[4:] 13278 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13279 src = src[4:] 13280 r.Start = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13281 src = src[8:] 13282 r.PostCommitOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13283 src = src[8:] 13284 r.Abort = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13285 src = src[8:] 13286 return src 13287 } 13288 13289 // Packed implements marshal.Marshallable.Packed. 13290 // 13291 //go:nosplit 13292 func (r *RSeqCriticalSection) Packed() bool { 13293 return true 13294 } 13295 13296 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13297 func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) []byte { 13298 size := r.SizeBytes() 13299 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13300 return dst[size:] 13301 } 13302 13303 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13304 func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) []byte { 13305 size := r.SizeBytes() 13306 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13307 return src[size:] 13308 } 13309 13310 // CopyOutN implements marshal.Marshallable.CopyOutN. 13311 func (r *RSeqCriticalSection) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13312 // Construct a slice backed by dst's underlying memory. 13313 var buf []byte 13314 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13315 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13316 hdr.Len = r.SizeBytes() 13317 hdr.Cap = r.SizeBytes() 13318 13319 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13320 // Since we bypassed the compiler's escape analysis, indicate that r 13321 // must live until the use above. 13322 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13323 return length, err 13324 } 13325 13326 // CopyOut implements marshal.Marshallable.CopyOut. 13327 func (r *RSeqCriticalSection) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13328 return r.CopyOutN(cc, addr, r.SizeBytes()) 13329 } 13330 13331 // CopyIn implements marshal.Marshallable.CopyIn. 13332 func (r *RSeqCriticalSection) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13333 // Construct a slice backed by dst's underlying memory. 13334 var buf []byte 13335 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13336 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13337 hdr.Len = r.SizeBytes() 13338 hdr.Cap = r.SizeBytes() 13339 13340 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13341 // Since we bypassed the compiler's escape analysis, indicate that r 13342 // must live until the use above. 13343 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13344 return length, err 13345 } 13346 13347 // WriteTo implements io.WriterTo.WriteTo. 13348 func (r *RSeqCriticalSection) WriteTo(writer io.Writer) (int64, error) { 13349 // Construct a slice backed by dst's underlying memory. 13350 var buf []byte 13351 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13352 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13353 hdr.Len = r.SizeBytes() 13354 hdr.Cap = r.SizeBytes() 13355 13356 length, err := writer.Write(buf) 13357 // Since we bypassed the compiler's escape analysis, indicate that r 13358 // must live until the use above. 13359 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13360 return int64(length), err 13361 } 13362 13363 // SizeBytes implements marshal.Marshallable.SizeBytes. 13364 func (r *Rusage) SizeBytes() int { 13365 return 112 + 13366 (*Timeval)(nil).SizeBytes() + 13367 (*Timeval)(nil).SizeBytes() 13368 } 13369 13370 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13371 func (r *Rusage) MarshalBytes(dst []byte) []byte { 13372 dst = r.UTime.MarshalUnsafe(dst) 13373 dst = r.STime.MarshalUnsafe(dst) 13374 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MaxRSS)) 13375 dst = dst[8:] 13376 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IXRSS)) 13377 dst = dst[8:] 13378 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IDRSS)) 13379 dst = dst[8:] 13380 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ISRSS)) 13381 dst = dst[8:] 13382 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MinFlt)) 13383 dst = dst[8:] 13384 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MajFlt)) 13385 dst = dst[8:] 13386 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSwap)) 13387 dst = dst[8:] 13388 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.InBlock)) 13389 dst = dst[8:] 13390 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.OuBlock)) 13391 dst = dst[8:] 13392 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgSnd)) 13393 dst = dst[8:] 13394 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgRcv)) 13395 dst = dst[8:] 13396 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSignals)) 13397 dst = dst[8:] 13398 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NVCSw)) 13399 dst = dst[8:] 13400 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NIvCSw)) 13401 dst = dst[8:] 13402 return dst 13403 } 13404 13405 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13406 func (r *Rusage) UnmarshalBytes(src []byte) []byte { 13407 src = r.UTime.UnmarshalUnsafe(src) 13408 src = r.STime.UnmarshalUnsafe(src) 13409 r.MaxRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13410 src = src[8:] 13411 r.IXRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13412 src = src[8:] 13413 r.IDRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13414 src = src[8:] 13415 r.ISRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 13416 src = src[8:] 13417 r.MinFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 13418 src = src[8:] 13419 r.MajFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 13420 src = src[8:] 13421 r.NSwap = int64(hostarch.ByteOrder.Uint64(src[:8])) 13422 src = src[8:] 13423 r.InBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 13424 src = src[8:] 13425 r.OuBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 13426 src = src[8:] 13427 r.MsgSnd = int64(hostarch.ByteOrder.Uint64(src[:8])) 13428 src = src[8:] 13429 r.MsgRcv = int64(hostarch.ByteOrder.Uint64(src[:8])) 13430 src = src[8:] 13431 r.NSignals = int64(hostarch.ByteOrder.Uint64(src[:8])) 13432 src = src[8:] 13433 r.NVCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 13434 src = src[8:] 13435 r.NIvCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 13436 src = src[8:] 13437 return src 13438 } 13439 13440 // Packed implements marshal.Marshallable.Packed. 13441 // 13442 //go:nosplit 13443 func (r *Rusage) Packed() bool { 13444 return r.STime.Packed() && r.UTime.Packed() 13445 } 13446 13447 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13448 func (r *Rusage) MarshalUnsafe(dst []byte) []byte { 13449 if r.STime.Packed() && r.UTime.Packed() { 13450 size := r.SizeBytes() 13451 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 13452 return dst[size:] 13453 } 13454 // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes. 13455 return r.MarshalBytes(dst) 13456 } 13457 13458 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13459 func (r *Rusage) UnmarshalUnsafe(src []byte) []byte { 13460 if r.STime.Packed() && r.UTime.Packed() { 13461 size := r.SizeBytes() 13462 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 13463 return src[size:] 13464 } 13465 // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13466 return r.UnmarshalBytes(src) 13467 } 13468 13469 // CopyOutN implements marshal.Marshallable.CopyOutN. 13470 func (r *Rusage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13471 if !r.STime.Packed() && r.UTime.Packed() { 13472 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 13473 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 13474 r.MarshalBytes(buf) // escapes: fallback. 13475 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13476 } 13477 13478 // Construct a slice backed by dst's underlying memory. 13479 var buf []byte 13480 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13481 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13482 hdr.Len = r.SizeBytes() 13483 hdr.Cap = r.SizeBytes() 13484 13485 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13486 // Since we bypassed the compiler's escape analysis, indicate that r 13487 // must live until the use above. 13488 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13489 return length, err 13490 } 13491 13492 // CopyOut implements marshal.Marshallable.CopyOut. 13493 func (r *Rusage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13494 return r.CopyOutN(cc, addr, r.SizeBytes()) 13495 } 13496 13497 // CopyIn implements marshal.Marshallable.CopyIn. 13498 func (r *Rusage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13499 if !r.STime.Packed() && r.UTime.Packed() { 13500 // Type Rusage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13501 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 13502 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13503 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13504 // partially unmarshalled struct. 13505 r.UnmarshalBytes(buf) // escapes: fallback. 13506 return length, err 13507 } 13508 13509 // Construct a slice backed by dst's underlying memory. 13510 var buf []byte 13511 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13512 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13513 hdr.Len = r.SizeBytes() 13514 hdr.Cap = r.SizeBytes() 13515 13516 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13517 // Since we bypassed the compiler's escape analysis, indicate that r 13518 // must live until the use above. 13519 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13520 return length, err 13521 } 13522 13523 // WriteTo implements io.WriterTo.WriteTo. 13524 func (r *Rusage) WriteTo(writer io.Writer) (int64, error) { 13525 if !r.STime.Packed() && r.UTime.Packed() { 13526 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 13527 buf := make([]byte, r.SizeBytes()) 13528 r.MarshalBytes(buf) 13529 length, err := writer.Write(buf) 13530 return int64(length), err 13531 } 13532 13533 // Construct a slice backed by dst's underlying memory. 13534 var buf []byte 13535 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13536 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 13537 hdr.Len = r.SizeBytes() 13538 hdr.Cap = r.SizeBytes() 13539 13540 length, err := writer.Write(buf) 13541 // Since we bypassed the compiler's escape analysis, indicate that r 13542 // must live until the use above. 13543 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 13544 return int64(length), err 13545 } 13546 13547 // SizeBytes implements marshal.Marshallable.SizeBytes. 13548 func (s *SeccompData) SizeBytes() int { 13549 return 16 + 13550 8*6 13551 } 13552 13553 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13554 func (s *SeccompData) MarshalBytes(dst []byte) []byte { 13555 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nr)) 13556 dst = dst[4:] 13557 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Arch)) 13558 dst = dst[4:] 13559 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.InstructionPointer)) 13560 dst = dst[8:] 13561 for idx := 0; idx < 6; idx++ { 13562 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Args[idx])) 13563 dst = dst[8:] 13564 } 13565 return dst 13566 } 13567 13568 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13569 func (s *SeccompData) UnmarshalBytes(src []byte) []byte { 13570 s.Nr = int32(hostarch.ByteOrder.Uint32(src[:4])) 13571 src = src[4:] 13572 s.Arch = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13573 src = src[4:] 13574 s.InstructionPointer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13575 src = src[8:] 13576 for idx := 0; idx < 6; idx++ { 13577 s.Args[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13578 src = src[8:] 13579 } 13580 return src 13581 } 13582 13583 // Packed implements marshal.Marshallable.Packed. 13584 // 13585 //go:nosplit 13586 func (s *SeccompData) Packed() bool { 13587 return true 13588 } 13589 13590 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13591 func (s *SeccompData) MarshalUnsafe(dst []byte) []byte { 13592 size := s.SizeBytes() 13593 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13594 return dst[size:] 13595 } 13596 13597 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13598 func (s *SeccompData) UnmarshalUnsafe(src []byte) []byte { 13599 size := s.SizeBytes() 13600 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13601 return src[size:] 13602 } 13603 13604 // CopyOutN implements marshal.Marshallable.CopyOutN. 13605 func (s *SeccompData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13606 // Construct a slice backed by dst's underlying memory. 13607 var buf []byte 13608 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13609 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13610 hdr.Len = s.SizeBytes() 13611 hdr.Cap = s.SizeBytes() 13612 13613 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13614 // Since we bypassed the compiler's escape analysis, indicate that s 13615 // must live until the use above. 13616 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13617 return length, err 13618 } 13619 13620 // CopyOut implements marshal.Marshallable.CopyOut. 13621 func (s *SeccompData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13622 return s.CopyOutN(cc, addr, s.SizeBytes()) 13623 } 13624 13625 // CopyIn implements marshal.Marshallable.CopyIn. 13626 func (s *SeccompData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13627 // Construct a slice backed by dst's underlying memory. 13628 var buf []byte 13629 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13630 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13631 hdr.Len = s.SizeBytes() 13632 hdr.Cap = s.SizeBytes() 13633 13634 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13635 // Since we bypassed the compiler's escape analysis, indicate that s 13636 // must live until the use above. 13637 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13638 return length, err 13639 } 13640 13641 // WriteTo implements io.WriterTo.WriteTo. 13642 func (s *SeccompData) WriteTo(writer io.Writer) (int64, error) { 13643 // Construct a slice backed by dst's underlying memory. 13644 var buf []byte 13645 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13646 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13647 hdr.Len = s.SizeBytes() 13648 hdr.Cap = s.SizeBytes() 13649 13650 length, err := writer.Write(buf) 13651 // Since we bypassed the compiler's escape analysis, indicate that s 13652 // must live until the use above. 13653 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13654 return int64(length), err 13655 } 13656 13657 // SizeBytes implements marshal.Marshallable.SizeBytes. 13658 func (s *SemInfo) SizeBytes() int { 13659 return 40 13660 } 13661 13662 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13663 func (s *SemInfo) MarshalBytes(dst []byte) []byte { 13664 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMap)) 13665 dst = dst[4:] 13666 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMni)) 13667 dst = dst[4:] 13668 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMns)) 13669 dst = dst[4:] 13670 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMnu)) 13671 dst = dst[4:] 13672 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMsl)) 13673 dst = dst[4:] 13674 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemOpm)) 13675 dst = dst[4:] 13676 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUme)) 13677 dst = dst[4:] 13678 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUsz)) 13679 dst = dst[4:] 13680 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemVmx)) 13681 dst = dst[4:] 13682 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemAem)) 13683 dst = dst[4:] 13684 return dst 13685 } 13686 13687 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13688 func (s *SemInfo) UnmarshalBytes(src []byte) []byte { 13689 s.SemMap = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13690 src = src[4:] 13691 s.SemMni = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13692 src = src[4:] 13693 s.SemMns = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13694 src = src[4:] 13695 s.SemMnu = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13696 src = src[4:] 13697 s.SemMsl = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13698 src = src[4:] 13699 s.SemOpm = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13700 src = src[4:] 13701 s.SemUme = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13702 src = src[4:] 13703 s.SemUsz = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13704 src = src[4:] 13705 s.SemVmx = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13706 src = src[4:] 13707 s.SemAem = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13708 src = src[4:] 13709 return src 13710 } 13711 13712 // Packed implements marshal.Marshallable.Packed. 13713 // 13714 //go:nosplit 13715 func (s *SemInfo) Packed() bool { 13716 return true 13717 } 13718 13719 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13720 func (s *SemInfo) MarshalUnsafe(dst []byte) []byte { 13721 size := s.SizeBytes() 13722 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13723 return dst[size:] 13724 } 13725 13726 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13727 func (s *SemInfo) UnmarshalUnsafe(src []byte) []byte { 13728 size := s.SizeBytes() 13729 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13730 return src[size:] 13731 } 13732 13733 // CopyOutN implements marshal.Marshallable.CopyOutN. 13734 func (s *SemInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13735 // Construct a slice backed by dst's underlying memory. 13736 var buf []byte 13737 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13738 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13739 hdr.Len = s.SizeBytes() 13740 hdr.Cap = s.SizeBytes() 13741 13742 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13743 // Since we bypassed the compiler's escape analysis, indicate that s 13744 // must live until the use above. 13745 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13746 return length, err 13747 } 13748 13749 // CopyOut implements marshal.Marshallable.CopyOut. 13750 func (s *SemInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13751 return s.CopyOutN(cc, addr, s.SizeBytes()) 13752 } 13753 13754 // CopyIn implements marshal.Marshallable.CopyIn. 13755 func (s *SemInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13756 // Construct a slice backed by dst's underlying memory. 13757 var buf []byte 13758 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13759 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13760 hdr.Len = s.SizeBytes() 13761 hdr.Cap = s.SizeBytes() 13762 13763 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13764 // Since we bypassed the compiler's escape analysis, indicate that s 13765 // must live until the use above. 13766 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13767 return length, err 13768 } 13769 13770 // WriteTo implements io.WriterTo.WriteTo. 13771 func (s *SemInfo) WriteTo(writer io.Writer) (int64, error) { 13772 // Construct a slice backed by dst's underlying memory. 13773 var buf []byte 13774 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13775 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13776 hdr.Len = s.SizeBytes() 13777 hdr.Cap = s.SizeBytes() 13778 13779 length, err := writer.Write(buf) 13780 // Since we bypassed the compiler's escape analysis, indicate that s 13781 // must live until the use above. 13782 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13783 return int64(length), err 13784 } 13785 13786 // SizeBytes implements marshal.Marshallable.SizeBytes. 13787 func (s *Sembuf) SizeBytes() int { 13788 return 6 13789 } 13790 13791 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13792 func (s *Sembuf) MarshalBytes(dst []byte) []byte { 13793 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemNum)) 13794 dst = dst[2:] 13795 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemOp)) 13796 dst = dst[2:] 13797 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemFlg)) 13798 dst = dst[2:] 13799 return dst 13800 } 13801 13802 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13803 func (s *Sembuf) UnmarshalBytes(src []byte) []byte { 13804 s.SemNum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13805 src = src[2:] 13806 s.SemOp = int16(hostarch.ByteOrder.Uint16(src[:2])) 13807 src = src[2:] 13808 s.SemFlg = int16(hostarch.ByteOrder.Uint16(src[:2])) 13809 src = src[2:] 13810 return src 13811 } 13812 13813 // Packed implements marshal.Marshallable.Packed. 13814 // 13815 //go:nosplit 13816 func (s *Sembuf) Packed() bool { 13817 return true 13818 } 13819 13820 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13821 func (s *Sembuf) MarshalUnsafe(dst []byte) []byte { 13822 size := s.SizeBytes() 13823 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13824 return dst[size:] 13825 } 13826 13827 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13828 func (s *Sembuf) UnmarshalUnsafe(src []byte) []byte { 13829 size := s.SizeBytes() 13830 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13831 return src[size:] 13832 } 13833 13834 // CopyOutN implements marshal.Marshallable.CopyOutN. 13835 func (s *Sembuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13836 // Construct a slice backed by dst's underlying memory. 13837 var buf []byte 13838 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13839 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13840 hdr.Len = s.SizeBytes() 13841 hdr.Cap = s.SizeBytes() 13842 13843 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13844 // Since we bypassed the compiler's escape analysis, indicate that s 13845 // must live until the use above. 13846 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13847 return length, err 13848 } 13849 13850 // CopyOut implements marshal.Marshallable.CopyOut. 13851 func (s *Sembuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13852 return s.CopyOutN(cc, addr, s.SizeBytes()) 13853 } 13854 13855 // CopyIn implements marshal.Marshallable.CopyIn. 13856 func (s *Sembuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13857 // Construct a slice backed by dst's underlying memory. 13858 var buf []byte 13859 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13860 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13861 hdr.Len = s.SizeBytes() 13862 hdr.Cap = s.SizeBytes() 13863 13864 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13865 // Since we bypassed the compiler's escape analysis, indicate that s 13866 // must live until the use above. 13867 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13868 return length, err 13869 } 13870 13871 // WriteTo implements io.WriterTo.WriteTo. 13872 func (s *Sembuf) WriteTo(writer io.Writer) (int64, error) { 13873 // Construct a slice backed by dst's underlying memory. 13874 var buf []byte 13875 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13876 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13877 hdr.Len = s.SizeBytes() 13878 hdr.Cap = s.SizeBytes() 13879 13880 length, err := writer.Write(buf) 13881 // Since we bypassed the compiler's escape analysis, indicate that s 13882 // must live until the use above. 13883 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13884 return int64(length), err 13885 } 13886 13887 // CopySembufSliceIn copies in a slice of Sembuf objects from the task's memory. 13888 func CopySembufSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Sembuf) (int, error) { 13889 count := len(dst) 13890 if count == 0 { 13891 return 0, nil 13892 } 13893 size := (*Sembuf)(nil).SizeBytes() 13894 13895 ptr := unsafe.Pointer(&dst) 13896 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13897 13898 // Construct a slice backed by dst's underlying memory. 13899 var buf []byte 13900 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13901 hdr.Data = uintptr(val) 13902 hdr.Len = size * count 13903 hdr.Cap = size * count 13904 13905 length, err := cc.CopyInBytes(addr, buf) 13906 // Since we bypassed the compiler's escape analysis, indicate that dst 13907 // must live until the use above. 13908 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 13909 return length, err 13910 } 13911 13912 // CopySembufSliceOut copies a slice of Sembuf objects to the task's memory. 13913 func CopySembufSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Sembuf) (int, error) { 13914 count := len(src) 13915 if count == 0 { 13916 return 0, nil 13917 } 13918 size := (*Sembuf)(nil).SizeBytes() 13919 13920 ptr := unsafe.Pointer(&src) 13921 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 13922 13923 // Construct a slice backed by dst's underlying memory. 13924 var buf []byte 13925 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13926 hdr.Data = uintptr(val) 13927 hdr.Len = size * count 13928 hdr.Cap = size * count 13929 13930 length, err := cc.CopyOutBytes(addr, buf) 13931 // Since we bypassed the compiler's escape analysis, indicate that src 13932 // must live until the use above. 13933 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 13934 return length, err 13935 } 13936 13937 // MarshalUnsafeSembufSlice is like Sembuf.MarshalUnsafe, but for a []Sembuf. 13938 func MarshalUnsafeSembufSlice(src []Sembuf, dst []byte) []byte { 13939 count := len(src) 13940 if count == 0 { 13941 return dst 13942 } 13943 13944 size := (*Sembuf)(nil).SizeBytes() 13945 buf := dst[:size*count] 13946 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 13947 return dst[size*count:] 13948 } 13949 13950 // UnmarshalUnsafeSembufSlice is like Sembuf.UnmarshalUnsafe, but for a []Sembuf. 13951 func UnmarshalUnsafeSembufSlice(dst []Sembuf, src []byte) []byte { 13952 count := len(dst) 13953 if count == 0 { 13954 return src 13955 } 13956 13957 size := (*Sembuf)(nil).SizeBytes() 13958 buf := src[:size*count] 13959 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 13960 return src[size*count:] 13961 } 13962 13963 // SizeBytes implements marshal.Marshallable.SizeBytes. 13964 func (s *ShmInfo) SizeBytes() int { 13965 return 44 + 13966 1*4 13967 } 13968 13969 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13970 func (s *ShmInfo) MarshalBytes(dst []byte) []byte { 13971 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UsedIDs)) 13972 dst = dst[4:] 13973 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 13974 dst = dst[1*(4):] 13975 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmTot)) 13976 dst = dst[8:] 13977 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmRss)) 13978 dst = dst[8:] 13979 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSwp)) 13980 dst = dst[8:] 13981 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapAttempts)) 13982 dst = dst[8:] 13983 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapSuccesses)) 13984 dst = dst[8:] 13985 return dst 13986 } 13987 13988 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13989 func (s *ShmInfo) UnmarshalBytes(src []byte) []byte { 13990 s.UsedIDs = int32(hostarch.ByteOrder.Uint32(src[:4])) 13991 src = src[4:] 13992 // Padding: ~ copy([4]byte(s._), src[:sizeof(byte)*4]) 13993 src = src[1*(4):] 13994 s.ShmTot = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13995 src = src[8:] 13996 s.ShmRss = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13997 src = src[8:] 13998 s.ShmSwp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 13999 src = src[8:] 14000 s.SwapAttempts = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14001 src = src[8:] 14002 s.SwapSuccesses = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14003 src = src[8:] 14004 return src 14005 } 14006 14007 // Packed implements marshal.Marshallable.Packed. 14008 // 14009 //go:nosplit 14010 func (s *ShmInfo) Packed() bool { 14011 return true 14012 } 14013 14014 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14015 func (s *ShmInfo) MarshalUnsafe(dst []byte) []byte { 14016 size := s.SizeBytes() 14017 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14018 return dst[size:] 14019 } 14020 14021 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14022 func (s *ShmInfo) UnmarshalUnsafe(src []byte) []byte { 14023 size := s.SizeBytes() 14024 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14025 return src[size:] 14026 } 14027 14028 // CopyOutN implements marshal.Marshallable.CopyOutN. 14029 func (s *ShmInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14030 // Construct a slice backed by dst's underlying memory. 14031 var buf []byte 14032 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14033 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14034 hdr.Len = s.SizeBytes() 14035 hdr.Cap = s.SizeBytes() 14036 14037 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14038 // Since we bypassed the compiler's escape analysis, indicate that s 14039 // must live until the use above. 14040 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14041 return length, err 14042 } 14043 14044 // CopyOut implements marshal.Marshallable.CopyOut. 14045 func (s *ShmInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14046 return s.CopyOutN(cc, addr, s.SizeBytes()) 14047 } 14048 14049 // CopyIn implements marshal.Marshallable.CopyIn. 14050 func (s *ShmInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 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(s))) 14055 hdr.Len = s.SizeBytes() 14056 hdr.Cap = s.SizeBytes() 14057 14058 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14059 // Since we bypassed the compiler's escape analysis, indicate that s 14060 // must live until the use above. 14061 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14062 return length, err 14063 } 14064 14065 // WriteTo implements io.WriterTo.WriteTo. 14066 func (s *ShmInfo) WriteTo(writer io.Writer) (int64, error) { 14067 // Construct a slice backed by dst's underlying memory. 14068 var buf []byte 14069 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14070 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14071 hdr.Len = s.SizeBytes() 14072 hdr.Cap = s.SizeBytes() 14073 14074 length, err := writer.Write(buf) 14075 // Since we bypassed the compiler's escape analysis, indicate that s 14076 // must live until the use above. 14077 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14078 return int64(length), err 14079 } 14080 14081 // SizeBytes implements marshal.Marshallable.SizeBytes. 14082 func (s *ShmParams) SizeBytes() int { 14083 return 40 14084 } 14085 14086 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14087 func (s *ShmParams) MarshalBytes(dst []byte) []byte { 14088 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMax)) 14089 dst = dst[8:] 14090 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMin)) 14091 dst = dst[8:] 14092 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMni)) 14093 dst = dst[8:] 14094 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSeg)) 14095 dst = dst[8:] 14096 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmAll)) 14097 dst = dst[8:] 14098 return dst 14099 } 14100 14101 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14102 func (s *ShmParams) UnmarshalBytes(src []byte) []byte { 14103 s.ShmMax = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14104 src = src[8:] 14105 s.ShmMin = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14106 src = src[8:] 14107 s.ShmMni = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14108 src = src[8:] 14109 s.ShmSeg = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14110 src = src[8:] 14111 s.ShmAll = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14112 src = src[8:] 14113 return src 14114 } 14115 14116 // Packed implements marshal.Marshallable.Packed. 14117 // 14118 //go:nosplit 14119 func (s *ShmParams) Packed() bool { 14120 return true 14121 } 14122 14123 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14124 func (s *ShmParams) MarshalUnsafe(dst []byte) []byte { 14125 size := s.SizeBytes() 14126 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14127 return dst[size:] 14128 } 14129 14130 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14131 func (s *ShmParams) UnmarshalUnsafe(src []byte) []byte { 14132 size := s.SizeBytes() 14133 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14134 return src[size:] 14135 } 14136 14137 // CopyOutN implements marshal.Marshallable.CopyOutN. 14138 func (s *ShmParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14139 // Construct a slice backed by dst's underlying memory. 14140 var buf []byte 14141 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14142 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14143 hdr.Len = s.SizeBytes() 14144 hdr.Cap = s.SizeBytes() 14145 14146 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14147 // Since we bypassed the compiler's escape analysis, indicate that s 14148 // must live until the use above. 14149 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14150 return length, err 14151 } 14152 14153 // CopyOut implements marshal.Marshallable.CopyOut. 14154 func (s *ShmParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14155 return s.CopyOutN(cc, addr, s.SizeBytes()) 14156 } 14157 14158 // CopyIn implements marshal.Marshallable.CopyIn. 14159 func (s *ShmParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14160 // Construct a slice backed by dst's underlying memory. 14161 var buf []byte 14162 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14163 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14164 hdr.Len = s.SizeBytes() 14165 hdr.Cap = s.SizeBytes() 14166 14167 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14168 // Since we bypassed the compiler's escape analysis, indicate that s 14169 // must live until the use above. 14170 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14171 return length, err 14172 } 14173 14174 // WriteTo implements io.WriterTo.WriteTo. 14175 func (s *ShmParams) WriteTo(writer io.Writer) (int64, error) { 14176 // Construct a slice backed by dst's underlying memory. 14177 var buf []byte 14178 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14179 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14180 hdr.Len = s.SizeBytes() 14181 hdr.Cap = s.SizeBytes() 14182 14183 length, err := writer.Write(buf) 14184 // Since we bypassed the compiler's escape analysis, indicate that s 14185 // must live until the use above. 14186 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14187 return int64(length), err 14188 } 14189 14190 // SizeBytes implements marshal.Marshallable.SizeBytes. 14191 func (s *ShmidDS) SizeBytes() int { 14192 return 40 + 14193 (*IPCPerm)(nil).SizeBytes() + 14194 (*TimeT)(nil).SizeBytes() + 14195 (*TimeT)(nil).SizeBytes() + 14196 (*TimeT)(nil).SizeBytes() 14197 } 14198 14199 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14200 func (s *ShmidDS) MarshalBytes(dst []byte) []byte { 14201 dst = s.ShmPerm.MarshalUnsafe(dst) 14202 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSegsz)) 14203 dst = dst[8:] 14204 dst = s.ShmAtime.MarshalUnsafe(dst) 14205 dst = s.ShmDtime.MarshalUnsafe(dst) 14206 dst = s.ShmCtime.MarshalUnsafe(dst) 14207 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmCpid)) 14208 dst = dst[4:] 14209 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmLpid)) 14210 dst = dst[4:] 14211 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmNattach)) 14212 dst = dst[8:] 14213 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused4)) 14214 dst = dst[8:] 14215 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused5)) 14216 dst = dst[8:] 14217 return dst 14218 } 14219 14220 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14221 func (s *ShmidDS) UnmarshalBytes(src []byte) []byte { 14222 src = s.ShmPerm.UnmarshalUnsafe(src) 14223 s.ShmSegsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14224 src = src[8:] 14225 src = s.ShmAtime.UnmarshalUnsafe(src) 14226 src = s.ShmDtime.UnmarshalUnsafe(src) 14227 src = s.ShmCtime.UnmarshalUnsafe(src) 14228 s.ShmCpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14229 src = src[4:] 14230 s.ShmLpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14231 src = src[4:] 14232 s.ShmNattach = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14233 src = src[8:] 14234 s.Unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14235 src = src[8:] 14236 s.Unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14237 src = src[8:] 14238 return src 14239 } 14240 14241 // Packed implements marshal.Marshallable.Packed. 14242 // 14243 //go:nosplit 14244 func (s *ShmidDS) Packed() bool { 14245 return s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() 14246 } 14247 14248 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14249 func (s *ShmidDS) MarshalUnsafe(dst []byte) []byte { 14250 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14251 size := s.SizeBytes() 14252 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14253 return dst[size:] 14254 } 14255 // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 14256 return s.MarshalBytes(dst) 14257 } 14258 14259 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14260 func (s *ShmidDS) UnmarshalUnsafe(src []byte) []byte { 14261 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14262 size := s.SizeBytes() 14263 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14264 return src[size:] 14265 } 14266 // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14267 return s.UnmarshalBytes(src) 14268 } 14269 14270 // CopyOutN implements marshal.Marshallable.CopyOutN. 14271 func (s *ShmidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14272 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14273 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 14274 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14275 s.MarshalBytes(buf) // escapes: fallback. 14276 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14277 } 14278 14279 // Construct a slice backed by dst's underlying memory. 14280 var buf []byte 14281 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14282 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14283 hdr.Len = s.SizeBytes() 14284 hdr.Cap = s.SizeBytes() 14285 14286 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14287 // Since we bypassed the compiler's escape analysis, indicate that s 14288 // must live until the use above. 14289 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14290 return length, err 14291 } 14292 14293 // CopyOut implements marshal.Marshallable.CopyOut. 14294 func (s *ShmidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14295 return s.CopyOutN(cc, addr, s.SizeBytes()) 14296 } 14297 14298 // CopyIn implements marshal.Marshallable.CopyIn. 14299 func (s *ShmidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14300 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14301 // Type ShmidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14302 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14303 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14304 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14305 // partially unmarshalled struct. 14306 s.UnmarshalBytes(buf) // escapes: fallback. 14307 return length, err 14308 } 14309 14310 // Construct a slice backed by dst's underlying memory. 14311 var buf []byte 14312 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14313 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14314 hdr.Len = s.SizeBytes() 14315 hdr.Cap = s.SizeBytes() 14316 14317 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14318 // Since we bypassed the compiler's escape analysis, indicate that s 14319 // must live until the use above. 14320 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14321 return length, err 14322 } 14323 14324 // WriteTo implements io.WriterTo.WriteTo. 14325 func (s *ShmidDS) WriteTo(writer io.Writer) (int64, error) { 14326 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 14327 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 14328 buf := make([]byte, s.SizeBytes()) 14329 s.MarshalBytes(buf) 14330 length, err := writer.Write(buf) 14331 return int64(length), err 14332 } 14333 14334 // Construct a slice backed by dst's underlying memory. 14335 var buf []byte 14336 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14337 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14338 hdr.Len = s.SizeBytes() 14339 hdr.Cap = s.SizeBytes() 14340 14341 length, err := writer.Write(buf) 14342 // Since we bypassed the compiler's escape analysis, indicate that s 14343 // must live until the use above. 14344 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14345 return int64(length), err 14346 } 14347 14348 // SizeBytes implements marshal.Marshallable.SizeBytes. 14349 func (s *SigAction) SizeBytes() int { 14350 return 24 + 14351 (*SignalSet)(nil).SizeBytes() 14352 } 14353 14354 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14355 func (s *SigAction) MarshalBytes(dst []byte) []byte { 14356 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Handler)) 14357 dst = dst[8:] 14358 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 14359 dst = dst[8:] 14360 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Restorer)) 14361 dst = dst[8:] 14362 dst = s.Mask.MarshalUnsafe(dst) 14363 return dst 14364 } 14365 14366 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14367 func (s *SigAction) UnmarshalBytes(src []byte) []byte { 14368 s.Handler = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14369 src = src[8:] 14370 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14371 src = src[8:] 14372 s.Restorer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14373 src = src[8:] 14374 src = s.Mask.UnmarshalUnsafe(src) 14375 return src 14376 } 14377 14378 // Packed implements marshal.Marshallable.Packed. 14379 // 14380 //go:nosplit 14381 func (s *SigAction) Packed() bool { 14382 return s.Mask.Packed() 14383 } 14384 14385 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14386 func (s *SigAction) MarshalUnsafe(dst []byte) []byte { 14387 if s.Mask.Packed() { 14388 size := s.SizeBytes() 14389 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14390 return dst[size:] 14391 } 14392 // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes. 14393 return s.MarshalBytes(dst) 14394 } 14395 14396 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14397 func (s *SigAction) UnmarshalUnsafe(src []byte) []byte { 14398 if s.Mask.Packed() { 14399 size := s.SizeBytes() 14400 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14401 return src[size:] 14402 } 14403 // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14404 return s.UnmarshalBytes(src) 14405 } 14406 14407 // CopyOutN implements marshal.Marshallable.CopyOutN. 14408 func (s *SigAction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14409 if !s.Mask.Packed() { 14410 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 14411 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14412 s.MarshalBytes(buf) // escapes: fallback. 14413 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14414 } 14415 14416 // Construct a slice backed by dst's underlying memory. 14417 var buf []byte 14418 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14419 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14420 hdr.Len = s.SizeBytes() 14421 hdr.Cap = s.SizeBytes() 14422 14423 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14424 // Since we bypassed the compiler's escape analysis, indicate that s 14425 // must live until the use above. 14426 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14427 return length, err 14428 } 14429 14430 // CopyOut implements marshal.Marshallable.CopyOut. 14431 func (s *SigAction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14432 return s.CopyOutN(cc, addr, s.SizeBytes()) 14433 } 14434 14435 // CopyIn implements marshal.Marshallable.CopyIn. 14436 func (s *SigAction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14437 if !s.Mask.Packed() { 14438 // Type SigAction doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14439 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 14440 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14441 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14442 // partially unmarshalled struct. 14443 s.UnmarshalBytes(buf) // escapes: fallback. 14444 return length, err 14445 } 14446 14447 // Construct a slice backed by dst's underlying memory. 14448 var buf []byte 14449 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14450 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14451 hdr.Len = s.SizeBytes() 14452 hdr.Cap = s.SizeBytes() 14453 14454 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14455 // Since we bypassed the compiler's escape analysis, indicate that s 14456 // must live until the use above. 14457 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14458 return length, err 14459 } 14460 14461 // WriteTo implements io.WriterTo.WriteTo. 14462 func (s *SigAction) WriteTo(writer io.Writer) (int64, error) { 14463 if !s.Mask.Packed() { 14464 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 14465 buf := make([]byte, s.SizeBytes()) 14466 s.MarshalBytes(buf) 14467 length, err := writer.Write(buf) 14468 return int64(length), err 14469 } 14470 14471 // Construct a slice backed by dst's underlying memory. 14472 var buf []byte 14473 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14474 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14475 hdr.Len = s.SizeBytes() 14476 hdr.Cap = s.SizeBytes() 14477 14478 length, err := writer.Write(buf) 14479 // Since we bypassed the compiler's escape analysis, indicate that s 14480 // must live until the use above. 14481 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14482 return int64(length), err 14483 } 14484 14485 // SizeBytes implements marshal.Marshallable.SizeBytes. 14486 func (s *Sigevent) SizeBytes() int { 14487 return 20 + 14488 1*44 14489 } 14490 14491 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14492 func (s *Sigevent) MarshalBytes(dst []byte) []byte { 14493 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Value)) 14494 dst = dst[8:] 14495 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 14496 dst = dst[4:] 14497 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Notify)) 14498 dst = dst[4:] 14499 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Tid)) 14500 dst = dst[4:] 14501 for idx := 0; idx < 44; idx++ { 14502 dst[0] = byte(s.UnRemainder[idx]) 14503 dst = dst[1:] 14504 } 14505 return dst 14506 } 14507 14508 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14509 func (s *Sigevent) UnmarshalBytes(src []byte) []byte { 14510 s.Value = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14511 src = src[8:] 14512 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 14513 src = src[4:] 14514 s.Notify = int32(hostarch.ByteOrder.Uint32(src[:4])) 14515 src = src[4:] 14516 s.Tid = int32(hostarch.ByteOrder.Uint32(src[:4])) 14517 src = src[4:] 14518 for idx := 0; idx < 44; idx++ { 14519 s.UnRemainder[idx] = src[0] 14520 src = src[1:] 14521 } 14522 return src 14523 } 14524 14525 // Packed implements marshal.Marshallable.Packed. 14526 // 14527 //go:nosplit 14528 func (s *Sigevent) Packed() bool { 14529 return true 14530 } 14531 14532 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14533 func (s *Sigevent) MarshalUnsafe(dst []byte) []byte { 14534 size := s.SizeBytes() 14535 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14536 return dst[size:] 14537 } 14538 14539 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14540 func (s *Sigevent) UnmarshalUnsafe(src []byte) []byte { 14541 size := s.SizeBytes() 14542 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14543 return src[size:] 14544 } 14545 14546 // CopyOutN implements marshal.Marshallable.CopyOutN. 14547 func (s *Sigevent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14548 // Construct a slice backed by dst's underlying memory. 14549 var buf []byte 14550 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14551 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14552 hdr.Len = s.SizeBytes() 14553 hdr.Cap = s.SizeBytes() 14554 14555 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14556 // Since we bypassed the compiler's escape analysis, indicate that s 14557 // must live until the use above. 14558 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14559 return length, err 14560 } 14561 14562 // CopyOut implements marshal.Marshallable.CopyOut. 14563 func (s *Sigevent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14564 return s.CopyOutN(cc, addr, s.SizeBytes()) 14565 } 14566 14567 // CopyIn implements marshal.Marshallable.CopyIn. 14568 func (s *Sigevent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14569 // Construct a slice backed by dst's underlying memory. 14570 var buf []byte 14571 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14572 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14573 hdr.Len = s.SizeBytes() 14574 hdr.Cap = s.SizeBytes() 14575 14576 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14577 // Since we bypassed the compiler's escape analysis, indicate that s 14578 // must live until the use above. 14579 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14580 return length, err 14581 } 14582 14583 // WriteTo implements io.WriterTo.WriteTo. 14584 func (s *Sigevent) WriteTo(writer io.Writer) (int64, error) { 14585 // Construct a slice backed by dst's underlying memory. 14586 var buf []byte 14587 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14588 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14589 hdr.Len = s.SizeBytes() 14590 hdr.Cap = s.SizeBytes() 14591 14592 length, err := writer.Write(buf) 14593 // Since we bypassed the compiler's escape analysis, indicate that s 14594 // must live until the use above. 14595 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14596 return int64(length), err 14597 } 14598 14599 // SizeBytes implements marshal.Marshallable.SizeBytes. 14600 func (s *SignalInfo) SizeBytes() int { 14601 return 16 + 14602 1*(128-16) 14603 } 14604 14605 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14606 func (s *SignalInfo) MarshalBytes(dst []byte) []byte { 14607 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 14608 dst = dst[4:] 14609 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 14610 dst = dst[4:] 14611 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 14612 dst = dst[4:] 14613 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 14614 dst = dst[4:] 14615 for idx := 0; idx < (128 - 16); idx++ { 14616 dst[0] = byte(s.Fields[idx]) 14617 dst = dst[1:] 14618 } 14619 return dst 14620 } 14621 14622 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14623 func (s *SignalInfo) UnmarshalBytes(src []byte) []byte { 14624 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 14625 src = src[4:] 14626 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 14627 src = src[4:] 14628 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 14629 src = src[4:] 14630 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 14631 src = src[4:] 14632 for idx := 0; idx < (128 - 16); idx++ { 14633 s.Fields[idx] = src[0] 14634 src = src[1:] 14635 } 14636 return src 14637 } 14638 14639 // Packed implements marshal.Marshallable.Packed. 14640 // 14641 //go:nosplit 14642 func (s *SignalInfo) Packed() bool { 14643 return true 14644 } 14645 14646 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14647 func (s *SignalInfo) MarshalUnsafe(dst []byte) []byte { 14648 size := s.SizeBytes() 14649 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14650 return dst[size:] 14651 } 14652 14653 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14654 func (s *SignalInfo) UnmarshalUnsafe(src []byte) []byte { 14655 size := s.SizeBytes() 14656 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14657 return src[size:] 14658 } 14659 14660 // CopyOutN implements marshal.Marshallable.CopyOutN. 14661 func (s *SignalInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14662 // Construct a slice backed by dst's underlying memory. 14663 var buf []byte 14664 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14665 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14666 hdr.Len = s.SizeBytes() 14667 hdr.Cap = s.SizeBytes() 14668 14669 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14670 // Since we bypassed the compiler's escape analysis, indicate that s 14671 // must live until the use above. 14672 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14673 return length, err 14674 } 14675 14676 // CopyOut implements marshal.Marshallable.CopyOut. 14677 func (s *SignalInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14678 return s.CopyOutN(cc, addr, s.SizeBytes()) 14679 } 14680 14681 // CopyIn implements marshal.Marshallable.CopyIn. 14682 func (s *SignalInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14683 // Construct a slice backed by dst's underlying memory. 14684 var buf []byte 14685 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14686 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14687 hdr.Len = s.SizeBytes() 14688 hdr.Cap = s.SizeBytes() 14689 14690 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14691 // Since we bypassed the compiler's escape analysis, indicate that s 14692 // must live until the use above. 14693 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14694 return length, err 14695 } 14696 14697 // WriteTo implements io.WriterTo.WriteTo. 14698 func (s *SignalInfo) WriteTo(writer io.Writer) (int64, error) { 14699 // Construct a slice backed by dst's underlying memory. 14700 var buf []byte 14701 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14702 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14703 hdr.Len = s.SizeBytes() 14704 hdr.Cap = s.SizeBytes() 14705 14706 length, err := writer.Write(buf) 14707 // Since we bypassed the compiler's escape analysis, indicate that s 14708 // must live until the use above. 14709 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14710 return int64(length), err 14711 } 14712 14713 // SizeBytes implements marshal.Marshallable.SizeBytes. 14714 // 14715 //go:nosplit 14716 func (s *SignalSet) SizeBytes() int { 14717 return 8 14718 } 14719 14720 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14721 func (s *SignalSet) MarshalBytes(dst []byte) []byte { 14722 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*s)) 14723 return dst[8:] 14724 } 14725 14726 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14727 func (s *SignalSet) UnmarshalBytes(src []byte) []byte { 14728 *s = SignalSet(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 14729 return src[8:] 14730 } 14731 14732 // Packed implements marshal.Marshallable.Packed. 14733 // 14734 //go:nosplit 14735 func (s *SignalSet) Packed() bool { 14736 // Scalar newtypes are always packed. 14737 return true 14738 } 14739 14740 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14741 func (s *SignalSet) MarshalUnsafe(dst []byte) []byte { 14742 size := s.SizeBytes() 14743 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14744 return dst[size:] 14745 } 14746 14747 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14748 func (s *SignalSet) UnmarshalUnsafe(src []byte) []byte { 14749 size := s.SizeBytes() 14750 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14751 return src[size:] 14752 } 14753 14754 // CopyOutN implements marshal.Marshallable.CopyOutN. 14755 func (s *SignalSet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14756 // Construct a slice backed by dst's underlying memory. 14757 var buf []byte 14758 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14759 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14760 hdr.Len = s.SizeBytes() 14761 hdr.Cap = s.SizeBytes() 14762 14763 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14764 // Since we bypassed the compiler's escape analysis, indicate that s 14765 // must live until the use above. 14766 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14767 return length, err 14768 } 14769 14770 // CopyOut implements marshal.Marshallable.CopyOut. 14771 func (s *SignalSet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14772 return s.CopyOutN(cc, addr, s.SizeBytes()) 14773 } 14774 14775 // CopyIn implements marshal.Marshallable.CopyIn. 14776 func (s *SignalSet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14777 // Construct a slice backed by dst's underlying memory. 14778 var buf []byte 14779 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14780 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14781 hdr.Len = s.SizeBytes() 14782 hdr.Cap = s.SizeBytes() 14783 14784 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14785 // Since we bypassed the compiler's escape analysis, indicate that s 14786 // must live until the use above. 14787 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14788 return length, err 14789 } 14790 14791 // WriteTo implements io.WriterTo.WriteTo. 14792 func (s *SignalSet) WriteTo(writer io.Writer) (int64, error) { 14793 // Construct a slice backed by dst's underlying memory. 14794 var buf []byte 14795 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14796 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14797 hdr.Len = s.SizeBytes() 14798 hdr.Cap = s.SizeBytes() 14799 14800 length, err := writer.Write(buf) 14801 // Since we bypassed the compiler's escape analysis, indicate that s 14802 // must live until the use above. 14803 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14804 return int64(length), err 14805 } 14806 14807 // SizeBytes implements marshal.Marshallable.SizeBytes. 14808 func (s *SignalStack) SizeBytes() int { 14809 return 24 14810 } 14811 14812 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14813 func (s *SignalStack) MarshalBytes(dst []byte) []byte { 14814 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 14815 dst = dst[8:] 14816 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flags)) 14817 dst = dst[4:] 14818 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 14819 dst = dst[4:] 14820 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 14821 dst = dst[8:] 14822 return dst 14823 } 14824 14825 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14826 func (s *SignalStack) UnmarshalBytes(src []byte) []byte { 14827 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14828 src = src[8:] 14829 s.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14830 src = src[4:] 14831 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 14832 src = src[4:] 14833 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14834 src = src[8:] 14835 return src 14836 } 14837 14838 // Packed implements marshal.Marshallable.Packed. 14839 // 14840 //go:nosplit 14841 func (s *SignalStack) Packed() bool { 14842 return true 14843 } 14844 14845 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14846 func (s *SignalStack) MarshalUnsafe(dst []byte) []byte { 14847 size := s.SizeBytes() 14848 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14849 return dst[size:] 14850 } 14851 14852 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14853 func (s *SignalStack) UnmarshalUnsafe(src []byte) []byte { 14854 size := s.SizeBytes() 14855 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14856 return src[size:] 14857 } 14858 14859 // CopyOutN implements marshal.Marshallable.CopyOutN. 14860 func (s *SignalStack) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14861 // Construct a slice backed by dst's underlying memory. 14862 var buf []byte 14863 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14864 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14865 hdr.Len = s.SizeBytes() 14866 hdr.Cap = s.SizeBytes() 14867 14868 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14869 // Since we bypassed the compiler's escape analysis, indicate that s 14870 // must live until the use above. 14871 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14872 return length, err 14873 } 14874 14875 // CopyOut implements marshal.Marshallable.CopyOut. 14876 func (s *SignalStack) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14877 return s.CopyOutN(cc, addr, s.SizeBytes()) 14878 } 14879 14880 // CopyIn implements marshal.Marshallable.CopyIn. 14881 func (s *SignalStack) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14882 // Construct a slice backed by dst's underlying memory. 14883 var buf []byte 14884 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14885 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14886 hdr.Len = s.SizeBytes() 14887 hdr.Cap = s.SizeBytes() 14888 14889 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 14890 // Since we bypassed the compiler's escape analysis, indicate that s 14891 // must live until the use above. 14892 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14893 return length, err 14894 } 14895 14896 // WriteTo implements io.WriterTo.WriteTo. 14897 func (s *SignalStack) WriteTo(writer io.Writer) (int64, error) { 14898 // Construct a slice backed by dst's underlying memory. 14899 var buf []byte 14900 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14901 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14902 hdr.Len = s.SizeBytes() 14903 hdr.Cap = s.SizeBytes() 14904 14905 length, err := writer.Write(buf) 14906 // Since we bypassed the compiler's escape analysis, indicate that s 14907 // must live until the use above. 14908 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14909 return int64(length), err 14910 } 14911 14912 // SizeBytes implements marshal.Marshallable.SizeBytes. 14913 func (s *SignalfdSiginfo) SizeBytes() int { 14914 return 82 + 14915 1*48 14916 } 14917 14918 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14919 func (s *SignalfdSiginfo) MarshalBytes(dst []byte) []byte { 14920 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 14921 dst = dst[4:] 14922 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 14923 dst = dst[4:] 14924 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 14925 dst = dst[4:] 14926 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PID)) 14927 dst = dst[4:] 14928 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 14929 dst = dst[4:] 14930 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FD)) 14931 dst = dst[4:] 14932 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TID)) 14933 dst = dst[4:] 14934 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Band)) 14935 dst = dst[4:] 14936 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Overrun)) 14937 dst = dst[4:] 14938 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TrapNo)) 14939 dst = dst[4:] 14940 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Status)) 14941 dst = dst[4:] 14942 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Int)) 14943 dst = dst[4:] 14944 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ptr)) 14945 dst = dst[8:] 14946 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.UTime)) 14947 dst = dst[8:] 14948 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.STime)) 14949 dst = dst[8:] 14950 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 14951 dst = dst[8:] 14952 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.AddrLSB)) 14953 dst = dst[2:] 14954 // Padding: dst[:sizeof(uint8)*48] ~= [48]uint8{0} 14955 dst = dst[1*(48):] 14956 return dst 14957 } 14958 14959 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14960 func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) []byte { 14961 s.Signo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14962 src = src[4:] 14963 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 14964 src = src[4:] 14965 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 14966 src = src[4:] 14967 s.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14968 src = src[4:] 14969 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14970 src = src[4:] 14971 s.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 14972 src = src[4:] 14973 s.TID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14974 src = src[4:] 14975 s.Band = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14976 src = src[4:] 14977 s.Overrun = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14978 src = src[4:] 14979 s.TrapNo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14980 src = src[4:] 14981 s.Status = int32(hostarch.ByteOrder.Uint32(src[:4])) 14982 src = src[4:] 14983 s.Int = int32(hostarch.ByteOrder.Uint32(src[:4])) 14984 src = src[4:] 14985 s.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14986 src = src[8:] 14987 s.UTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14988 src = src[8:] 14989 s.STime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14990 src = src[8:] 14991 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14992 src = src[8:] 14993 s.AddrLSB = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14994 src = src[2:] 14995 // Padding: ~ copy([48]uint8(s._), src[:sizeof(uint8)*48]) 14996 src = src[1*(48):] 14997 return src 14998 } 14999 15000 // Packed implements marshal.Marshallable.Packed. 15001 // 15002 //go:nosplit 15003 func (s *SignalfdSiginfo) Packed() bool { 15004 return false 15005 } 15006 15007 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15008 func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) []byte { 15009 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15010 return s.MarshalBytes(dst) 15011 } 15012 15013 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15014 func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) []byte { 15015 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15016 return s.UnmarshalBytes(src) 15017 } 15018 15019 // CopyOutN implements marshal.Marshallable.CopyOutN. 15020 func (s *SignalfdSiginfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15021 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15022 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15023 s.MarshalBytes(buf) // escapes: fallback. 15024 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15025 } 15026 15027 // CopyOut implements marshal.Marshallable.CopyOut. 15028 func (s *SignalfdSiginfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15029 return s.CopyOutN(cc, addr, s.SizeBytes()) 15030 } 15031 15032 // CopyIn implements marshal.Marshallable.CopyIn. 15033 func (s *SignalfdSiginfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15034 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15035 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15036 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15037 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15038 // partially unmarshalled struct. 15039 s.UnmarshalBytes(buf) // escapes: fallback. 15040 return length, err 15041 } 15042 15043 // WriteTo implements io.WriterTo.WriteTo. 15044 func (s *SignalfdSiginfo) WriteTo(writer io.Writer) (int64, error) { 15045 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15046 buf := make([]byte, s.SizeBytes()) 15047 s.MarshalBytes(buf) 15048 length, err := writer.Write(buf) 15049 return int64(length), err 15050 } 15051 15052 // SizeBytes implements marshal.Marshallable.SizeBytes. 15053 func (c *ControlMessageCredentials) SizeBytes() int { 15054 return 12 15055 } 15056 15057 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15058 func (c *ControlMessageCredentials) MarshalBytes(dst []byte) []byte { 15059 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.PID)) 15060 dst = dst[4:] 15061 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.UID)) 15062 dst = dst[4:] 15063 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.GID)) 15064 dst = dst[4:] 15065 return dst 15066 } 15067 15068 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15069 func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) []byte { 15070 c.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 15071 src = src[4:] 15072 c.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15073 src = src[4:] 15074 c.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15075 src = src[4:] 15076 return src 15077 } 15078 15079 // Packed implements marshal.Marshallable.Packed. 15080 // 15081 //go:nosplit 15082 func (c *ControlMessageCredentials) Packed() bool { 15083 return true 15084 } 15085 15086 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15087 func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) []byte { 15088 size := c.SizeBytes() 15089 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15090 return dst[size:] 15091 } 15092 15093 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15094 func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) []byte { 15095 size := c.SizeBytes() 15096 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15097 return src[size:] 15098 } 15099 15100 // CopyOutN implements marshal.Marshallable.CopyOutN. 15101 func (c *ControlMessageCredentials) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15102 // Construct a slice backed by dst's underlying memory. 15103 var buf []byte 15104 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15105 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15106 hdr.Len = c.SizeBytes() 15107 hdr.Cap = c.SizeBytes() 15108 15109 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15110 // Since we bypassed the compiler's escape analysis, indicate that c 15111 // must live until the use above. 15112 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15113 return length, err 15114 } 15115 15116 // CopyOut implements marshal.Marshallable.CopyOut. 15117 func (c *ControlMessageCredentials) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15118 return c.CopyOutN(cc, addr, c.SizeBytes()) 15119 } 15120 15121 // CopyIn implements marshal.Marshallable.CopyIn. 15122 func (c *ControlMessageCredentials) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15123 // Construct a slice backed by dst's underlying memory. 15124 var buf []byte 15125 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15126 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15127 hdr.Len = c.SizeBytes() 15128 hdr.Cap = c.SizeBytes() 15129 15130 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15131 // Since we bypassed the compiler's escape analysis, indicate that c 15132 // must live until the use above. 15133 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15134 return length, err 15135 } 15136 15137 // WriteTo implements io.WriterTo.WriteTo. 15138 func (c *ControlMessageCredentials) WriteTo(writer io.Writer) (int64, error) { 15139 // Construct a slice backed by dst's underlying memory. 15140 var buf []byte 15141 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15142 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15143 hdr.Len = c.SizeBytes() 15144 hdr.Cap = c.SizeBytes() 15145 15146 length, err := writer.Write(buf) 15147 // Since we bypassed the compiler's escape analysis, indicate that c 15148 // must live until the use above. 15149 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15150 return int64(length), err 15151 } 15152 15153 // SizeBytes implements marshal.Marshallable.SizeBytes. 15154 func (c *ControlMessageHeader) SizeBytes() int { 15155 return 16 15156 } 15157 15158 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15159 func (c *ControlMessageHeader) MarshalBytes(dst []byte) []byte { 15160 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Length)) 15161 dst = dst[8:] 15162 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Level)) 15163 dst = dst[4:] 15164 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Type)) 15165 dst = dst[4:] 15166 return dst 15167 } 15168 15169 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15170 func (c *ControlMessageHeader) UnmarshalBytes(src []byte) []byte { 15171 c.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15172 src = src[8:] 15173 c.Level = int32(hostarch.ByteOrder.Uint32(src[:4])) 15174 src = src[4:] 15175 c.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 15176 src = src[4:] 15177 return src 15178 } 15179 15180 // Packed implements marshal.Marshallable.Packed. 15181 // 15182 //go:nosplit 15183 func (c *ControlMessageHeader) Packed() bool { 15184 return true 15185 } 15186 15187 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15188 func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) []byte { 15189 size := c.SizeBytes() 15190 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15191 return dst[size:] 15192 } 15193 15194 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15195 func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) []byte { 15196 size := c.SizeBytes() 15197 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15198 return src[size:] 15199 } 15200 15201 // CopyOutN implements marshal.Marshallable.CopyOutN. 15202 func (c *ControlMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15203 // Construct a slice backed by dst's underlying memory. 15204 var buf []byte 15205 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15206 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15207 hdr.Len = c.SizeBytes() 15208 hdr.Cap = c.SizeBytes() 15209 15210 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15211 // Since we bypassed the compiler's escape analysis, indicate that c 15212 // must live until the use above. 15213 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15214 return length, err 15215 } 15216 15217 // CopyOut implements marshal.Marshallable.CopyOut. 15218 func (c *ControlMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15219 return c.CopyOutN(cc, addr, c.SizeBytes()) 15220 } 15221 15222 // CopyIn implements marshal.Marshallable.CopyIn. 15223 func (c *ControlMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15224 // Construct a slice backed by dst's underlying memory. 15225 var buf []byte 15226 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15227 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15228 hdr.Len = c.SizeBytes() 15229 hdr.Cap = c.SizeBytes() 15230 15231 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15232 // Since we bypassed the compiler's escape analysis, indicate that c 15233 // must live until the use above. 15234 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15235 return length, err 15236 } 15237 15238 // WriteTo implements io.WriterTo.WriteTo. 15239 func (c *ControlMessageHeader) WriteTo(writer io.Writer) (int64, error) { 15240 // Construct a slice backed by dst's underlying memory. 15241 var buf []byte 15242 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15243 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15244 hdr.Len = c.SizeBytes() 15245 hdr.Cap = c.SizeBytes() 15246 15247 length, err := writer.Write(buf) 15248 // Since we bypassed the compiler's escape analysis, indicate that c 15249 // must live until the use above. 15250 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15251 return int64(length), err 15252 } 15253 15254 // SizeBytes implements marshal.Marshallable.SizeBytes. 15255 func (c *ControlMessageIPPacketInfo) SizeBytes() int { 15256 return 4 + 15257 (*InetAddr)(nil).SizeBytes() + 15258 (*InetAddr)(nil).SizeBytes() 15259 } 15260 15261 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15262 func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) []byte { 15263 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 15264 dst = dst[4:] 15265 dst = c.LocalAddr.MarshalUnsafe(dst) 15266 dst = c.DestinationAddr.MarshalUnsafe(dst) 15267 return dst 15268 } 15269 15270 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15271 func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) []byte { 15272 c.NIC = int32(hostarch.ByteOrder.Uint32(src[:4])) 15273 src = src[4:] 15274 src = c.LocalAddr.UnmarshalUnsafe(src) 15275 src = c.DestinationAddr.UnmarshalUnsafe(src) 15276 return src 15277 } 15278 15279 // Packed implements marshal.Marshallable.Packed. 15280 // 15281 //go:nosplit 15282 func (c *ControlMessageIPPacketInfo) Packed() bool { 15283 return c.DestinationAddr.Packed() && c.LocalAddr.Packed() 15284 } 15285 15286 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15287 func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) []byte { 15288 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15289 size := c.SizeBytes() 15290 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15291 return dst[size:] 15292 } 15293 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15294 return c.MarshalBytes(dst) 15295 } 15296 15297 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15298 func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) []byte { 15299 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15300 size := c.SizeBytes() 15301 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15302 return src[size:] 15303 } 15304 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15305 return c.UnmarshalBytes(src) 15306 } 15307 15308 // CopyOutN implements marshal.Marshallable.CopyOutN. 15309 func (c *ControlMessageIPPacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15310 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15311 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15312 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15313 c.MarshalBytes(buf) // escapes: fallback. 15314 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15315 } 15316 15317 // Construct a slice backed by dst's underlying memory. 15318 var buf []byte 15319 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15320 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15321 hdr.Len = c.SizeBytes() 15322 hdr.Cap = c.SizeBytes() 15323 15324 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15325 // Since we bypassed the compiler's escape analysis, indicate that c 15326 // must live until the use above. 15327 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15328 return length, err 15329 } 15330 15331 // CopyOut implements marshal.Marshallable.CopyOut. 15332 func (c *ControlMessageIPPacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15333 return c.CopyOutN(cc, addr, c.SizeBytes()) 15334 } 15335 15336 // CopyIn implements marshal.Marshallable.CopyIn. 15337 func (c *ControlMessageIPPacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15338 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15339 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15340 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15341 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15342 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15343 // partially unmarshalled struct. 15344 c.UnmarshalBytes(buf) // escapes: fallback. 15345 return length, err 15346 } 15347 15348 // Construct a slice backed by dst's underlying memory. 15349 var buf []byte 15350 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15351 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15352 hdr.Len = c.SizeBytes() 15353 hdr.Cap = c.SizeBytes() 15354 15355 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15356 // Since we bypassed the compiler's escape analysis, indicate that c 15357 // must live until the use above. 15358 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15359 return length, err 15360 } 15361 15362 // WriteTo implements io.WriterTo.WriteTo. 15363 func (c *ControlMessageIPPacketInfo) WriteTo(writer io.Writer) (int64, error) { 15364 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 15365 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15366 buf := make([]byte, c.SizeBytes()) 15367 c.MarshalBytes(buf) 15368 length, err := writer.Write(buf) 15369 return int64(length), err 15370 } 15371 15372 // Construct a slice backed by dst's underlying memory. 15373 var buf []byte 15374 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15375 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15376 hdr.Len = c.SizeBytes() 15377 hdr.Cap = c.SizeBytes() 15378 15379 length, err := writer.Write(buf) 15380 // Since we bypassed the compiler's escape analysis, indicate that c 15381 // must live until the use above. 15382 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15383 return int64(length), err 15384 } 15385 15386 // SizeBytes implements marshal.Marshallable.SizeBytes. 15387 func (c *ControlMessageIPv6PacketInfo) SizeBytes() int { 15388 return 4 + 15389 (*Inet6Addr)(nil).SizeBytes() 15390 } 15391 15392 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15393 func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) []byte { 15394 dst = c.Addr.MarshalUnsafe(dst) 15395 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 15396 dst = dst[4:] 15397 return dst 15398 } 15399 15400 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15401 func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) []byte { 15402 src = c.Addr.UnmarshalUnsafe(src) 15403 c.NIC = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15404 src = src[4:] 15405 return src 15406 } 15407 15408 // Packed implements marshal.Marshallable.Packed. 15409 // 15410 //go:nosplit 15411 func (c *ControlMessageIPv6PacketInfo) Packed() bool { 15412 return c.Addr.Packed() 15413 } 15414 15415 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15416 func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) []byte { 15417 if c.Addr.Packed() { 15418 size := c.SizeBytes() 15419 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 15420 return dst[size:] 15421 } 15422 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 15423 return c.MarshalBytes(dst) 15424 } 15425 15426 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15427 func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) []byte { 15428 if c.Addr.Packed() { 15429 size := c.SizeBytes() 15430 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 15431 return src[size:] 15432 } 15433 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15434 return c.UnmarshalBytes(src) 15435 } 15436 15437 // CopyOutN implements marshal.Marshallable.CopyOutN. 15438 func (c *ControlMessageIPv6PacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15439 if !c.Addr.Packed() { 15440 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15441 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15442 c.MarshalBytes(buf) // escapes: fallback. 15443 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15444 } 15445 15446 // Construct a slice backed by dst's underlying memory. 15447 var buf []byte 15448 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15449 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15450 hdr.Len = c.SizeBytes() 15451 hdr.Cap = c.SizeBytes() 15452 15453 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15454 // Since we bypassed the compiler's escape analysis, indicate that c 15455 // must live until the use above. 15456 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15457 return length, err 15458 } 15459 15460 // CopyOut implements marshal.Marshallable.CopyOut. 15461 func (c *ControlMessageIPv6PacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15462 return c.CopyOutN(cc, addr, c.SizeBytes()) 15463 } 15464 15465 // CopyIn implements marshal.Marshallable.CopyIn. 15466 func (c *ControlMessageIPv6PacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15467 if !c.Addr.Packed() { 15468 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15469 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 15470 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15471 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15472 // partially unmarshalled struct. 15473 c.UnmarshalBytes(buf) // escapes: fallback. 15474 return length, err 15475 } 15476 15477 // Construct a slice backed by dst's underlying memory. 15478 var buf []byte 15479 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15480 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15481 hdr.Len = c.SizeBytes() 15482 hdr.Cap = c.SizeBytes() 15483 15484 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15485 // Since we bypassed the compiler's escape analysis, indicate that c 15486 // must live until the use above. 15487 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15488 return length, err 15489 } 15490 15491 // WriteTo implements io.WriterTo.WriteTo. 15492 func (c *ControlMessageIPv6PacketInfo) WriteTo(writer io.Writer) (int64, error) { 15493 if !c.Addr.Packed() { 15494 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 15495 buf := make([]byte, c.SizeBytes()) 15496 c.MarshalBytes(buf) 15497 length, err := writer.Write(buf) 15498 return int64(length), err 15499 } 15500 15501 // Construct a slice backed by dst's underlying memory. 15502 var buf []byte 15503 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15504 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 15505 hdr.Len = c.SizeBytes() 15506 hdr.Cap = c.SizeBytes() 15507 15508 length, err := writer.Write(buf) 15509 // Since we bypassed the compiler's escape analysis, indicate that c 15510 // must live until the use above. 15511 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 15512 return int64(length), err 15513 } 15514 15515 // SizeBytes implements marshal.Marshallable.SizeBytes. 15516 func (i *ICMP6Filter) SizeBytes() int { 15517 return 0 + 15518 4*8 15519 } 15520 15521 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15522 func (i *ICMP6Filter) MarshalBytes(dst []byte) []byte { 15523 for idx := 0; idx < 8; idx++ { 15524 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Filter[idx])) 15525 dst = dst[4:] 15526 } 15527 return dst 15528 } 15529 15530 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15531 func (i *ICMP6Filter) UnmarshalBytes(src []byte) []byte { 15532 for idx := 0; idx < 8; idx++ { 15533 i.Filter[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 15534 src = src[4:] 15535 } 15536 return src 15537 } 15538 15539 // Packed implements marshal.Marshallable.Packed. 15540 // 15541 //go:nosplit 15542 func (i *ICMP6Filter) Packed() bool { 15543 return true 15544 } 15545 15546 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15547 func (i *ICMP6Filter) MarshalUnsafe(dst []byte) []byte { 15548 size := i.SizeBytes() 15549 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15550 return dst[size:] 15551 } 15552 15553 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15554 func (i *ICMP6Filter) UnmarshalUnsafe(src []byte) []byte { 15555 size := i.SizeBytes() 15556 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15557 return src[size:] 15558 } 15559 15560 // CopyOutN implements marshal.Marshallable.CopyOutN. 15561 func (i *ICMP6Filter) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15562 // Construct a slice backed by dst's underlying memory. 15563 var buf []byte 15564 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15565 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15566 hdr.Len = i.SizeBytes() 15567 hdr.Cap = i.SizeBytes() 15568 15569 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15570 // Since we bypassed the compiler's escape analysis, indicate that i 15571 // must live until the use above. 15572 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15573 return length, err 15574 } 15575 15576 // CopyOut implements marshal.Marshallable.CopyOut. 15577 func (i *ICMP6Filter) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15578 return i.CopyOutN(cc, addr, i.SizeBytes()) 15579 } 15580 15581 // CopyIn implements marshal.Marshallable.CopyIn. 15582 func (i *ICMP6Filter) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15583 // Construct a slice backed by dst's underlying memory. 15584 var buf []byte 15585 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15586 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15587 hdr.Len = i.SizeBytes() 15588 hdr.Cap = i.SizeBytes() 15589 15590 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15591 // Since we bypassed the compiler's escape analysis, indicate that i 15592 // must live until the use above. 15593 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15594 return length, err 15595 } 15596 15597 // WriteTo implements io.WriterTo.WriteTo. 15598 func (i *ICMP6Filter) WriteTo(writer io.Writer) (int64, error) { 15599 // Construct a slice backed by dst's underlying memory. 15600 var buf []byte 15601 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15602 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15603 hdr.Len = i.SizeBytes() 15604 hdr.Cap = i.SizeBytes() 15605 15606 length, err := writer.Write(buf) 15607 // Since we bypassed the compiler's escape analysis, indicate that i 15608 // must live until the use above. 15609 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15610 return int64(length), err 15611 } 15612 15613 // SizeBytes implements marshal.Marshallable.SizeBytes. 15614 // 15615 //go:nosplit 15616 func (i *Inet6Addr) SizeBytes() int { 15617 return 1 * 16 15618 } 15619 15620 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15621 func (i *Inet6Addr) MarshalBytes(dst []byte) []byte { 15622 for idx := 0; idx < 16; idx++ { 15623 dst[0] = byte(i[idx]) 15624 dst = dst[1:] 15625 } 15626 return dst 15627 } 15628 15629 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15630 func (i *Inet6Addr) UnmarshalBytes(src []byte) []byte { 15631 for idx := 0; idx < 16; idx++ { 15632 i[idx] = src[0] 15633 src = src[1:] 15634 } 15635 return src 15636 } 15637 15638 // Packed implements marshal.Marshallable.Packed. 15639 // 15640 //go:nosplit 15641 func (i *Inet6Addr) Packed() bool { 15642 // Array newtypes are always packed. 15643 return true 15644 } 15645 15646 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15647 func (i *Inet6Addr) MarshalUnsafe(dst []byte) []byte { 15648 size := i.SizeBytes() 15649 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 15650 return dst[size:] 15651 } 15652 15653 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15654 func (i *Inet6Addr) UnmarshalUnsafe(src []byte) []byte { 15655 size := i.SizeBytes() 15656 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15657 return src[size:] 15658 } 15659 15660 // CopyOutN implements marshal.Marshallable.CopyOutN. 15661 func (i *Inet6Addr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15662 // Construct a slice backed by dst's underlying memory. 15663 var buf []byte 15664 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15665 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15666 hdr.Len = i.SizeBytes() 15667 hdr.Cap = i.SizeBytes() 15668 15669 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15670 // Since we bypassed the compiler's escape analysis, indicate that i 15671 // must live until the use above. 15672 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15673 return length, err 15674 } 15675 15676 // CopyOut implements marshal.Marshallable.CopyOut. 15677 func (i *Inet6Addr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15678 return i.CopyOutN(cc, addr, i.SizeBytes()) 15679 } 15680 15681 // CopyIn implements marshal.Marshallable.CopyIn. 15682 func (i *Inet6Addr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15683 // Construct a slice backed by dst's underlying memory. 15684 var buf []byte 15685 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15686 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15687 hdr.Len = i.SizeBytes() 15688 hdr.Cap = i.SizeBytes() 15689 15690 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15691 // Since we bypassed the compiler's escape analysis, indicate that i 15692 // must live until the use above. 15693 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15694 return length, err 15695 } 15696 15697 // WriteTo implements io.WriterTo.WriteTo. 15698 func (i *Inet6Addr) WriteTo(writer io.Writer) (int64, error) { 15699 // Construct a slice backed by dst's underlying memory. 15700 var buf []byte 15701 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15702 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15703 hdr.Len = i.SizeBytes() 15704 hdr.Cap = i.SizeBytes() 15705 15706 length, err := writer.Write(buf) 15707 // Since we bypassed the compiler's escape analysis, indicate that i 15708 // must live until the use above. 15709 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15710 return int64(length), err 15711 } 15712 15713 // SizeBytes implements marshal.Marshallable.SizeBytes. 15714 func (i *Inet6MulticastRequest) SizeBytes() int { 15715 return 4 + 15716 (*Inet6Addr)(nil).SizeBytes() 15717 } 15718 15719 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15720 func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) []byte { 15721 dst = i.MulticastAddr.MarshalUnsafe(dst) 15722 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 15723 dst = dst[4:] 15724 return dst 15725 } 15726 15727 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15728 func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) []byte { 15729 src = i.MulticastAddr.UnmarshalUnsafe(src) 15730 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 15731 src = src[4:] 15732 return src 15733 } 15734 15735 // Packed implements marshal.Marshallable.Packed. 15736 // 15737 //go:nosplit 15738 func (i *Inet6MulticastRequest) Packed() bool { 15739 return i.MulticastAddr.Packed() 15740 } 15741 15742 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15743 func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) []byte { 15744 if i.MulticastAddr.Packed() { 15745 size := i.SizeBytes() 15746 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15747 return dst[size:] 15748 } 15749 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 15750 return i.MarshalBytes(dst) 15751 } 15752 15753 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15754 func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) []byte { 15755 if i.MulticastAddr.Packed() { 15756 size := i.SizeBytes() 15757 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15758 return src[size:] 15759 } 15760 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15761 return i.UnmarshalBytes(src) 15762 } 15763 15764 // CopyOutN implements marshal.Marshallable.CopyOutN. 15765 func (i *Inet6MulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15766 if !i.MulticastAddr.Packed() { 15767 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15768 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15769 i.MarshalBytes(buf) // escapes: fallback. 15770 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15771 } 15772 15773 // Construct a slice backed by dst's underlying memory. 15774 var buf []byte 15775 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15776 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15777 hdr.Len = i.SizeBytes() 15778 hdr.Cap = i.SizeBytes() 15779 15780 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15781 // Since we bypassed the compiler's escape analysis, indicate that i 15782 // must live until the use above. 15783 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15784 return length, err 15785 } 15786 15787 // CopyOut implements marshal.Marshallable.CopyOut. 15788 func (i *Inet6MulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15789 return i.CopyOutN(cc, addr, i.SizeBytes()) 15790 } 15791 15792 // CopyIn implements marshal.Marshallable.CopyIn. 15793 func (i *Inet6MulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15794 if !i.MulticastAddr.Packed() { 15795 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15796 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15797 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15798 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15799 // partially unmarshalled struct. 15800 i.UnmarshalBytes(buf) // escapes: fallback. 15801 return length, err 15802 } 15803 15804 // Construct a slice backed by dst's underlying memory. 15805 var buf []byte 15806 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15807 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15808 hdr.Len = i.SizeBytes() 15809 hdr.Cap = i.SizeBytes() 15810 15811 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15812 // Since we bypassed the compiler's escape analysis, indicate that i 15813 // must live until the use above. 15814 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15815 return length, err 15816 } 15817 15818 // WriteTo implements io.WriterTo.WriteTo. 15819 func (i *Inet6MulticastRequest) WriteTo(writer io.Writer) (int64, error) { 15820 if !i.MulticastAddr.Packed() { 15821 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15822 buf := make([]byte, i.SizeBytes()) 15823 i.MarshalBytes(buf) 15824 length, err := writer.Write(buf) 15825 return int64(length), err 15826 } 15827 15828 // Construct a slice backed by dst's underlying memory. 15829 var buf []byte 15830 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15831 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15832 hdr.Len = i.SizeBytes() 15833 hdr.Cap = i.SizeBytes() 15834 15835 length, err := writer.Write(buf) 15836 // Since we bypassed the compiler's escape analysis, indicate that i 15837 // must live until the use above. 15838 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15839 return int64(length), err 15840 } 15841 15842 // SizeBytes implements marshal.Marshallable.SizeBytes. 15843 // 15844 //go:nosplit 15845 func (i *InetAddr) SizeBytes() int { 15846 return 1 * 4 15847 } 15848 15849 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15850 func (i *InetAddr) MarshalBytes(dst []byte) []byte { 15851 for idx := 0; idx < 4; idx++ { 15852 dst[0] = byte(i[idx]) 15853 dst = dst[1:] 15854 } 15855 return dst 15856 } 15857 15858 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15859 func (i *InetAddr) UnmarshalBytes(src []byte) []byte { 15860 for idx := 0; idx < 4; idx++ { 15861 i[idx] = src[0] 15862 src = src[1:] 15863 } 15864 return src 15865 } 15866 15867 // Packed implements marshal.Marshallable.Packed. 15868 // 15869 //go:nosplit 15870 func (i *InetAddr) Packed() bool { 15871 // Array newtypes are always packed. 15872 return true 15873 } 15874 15875 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15876 func (i *InetAddr) MarshalUnsafe(dst []byte) []byte { 15877 size := i.SizeBytes() 15878 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 15879 return dst[size:] 15880 } 15881 15882 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15883 func (i *InetAddr) UnmarshalUnsafe(src []byte) []byte { 15884 size := i.SizeBytes() 15885 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15886 return src[size:] 15887 } 15888 15889 // CopyOutN implements marshal.Marshallable.CopyOutN. 15890 func (i *InetAddr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15891 // Construct a slice backed by dst's underlying memory. 15892 var buf []byte 15893 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15894 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15895 hdr.Len = i.SizeBytes() 15896 hdr.Cap = i.SizeBytes() 15897 15898 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15899 // Since we bypassed the compiler's escape analysis, indicate that i 15900 // must live until the use above. 15901 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15902 return length, err 15903 } 15904 15905 // CopyOut implements marshal.Marshallable.CopyOut. 15906 func (i *InetAddr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15907 return i.CopyOutN(cc, addr, i.SizeBytes()) 15908 } 15909 15910 // CopyIn implements marshal.Marshallable.CopyIn. 15911 func (i *InetAddr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15912 // Construct a slice backed by dst's underlying memory. 15913 var buf []byte 15914 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15915 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15916 hdr.Len = i.SizeBytes() 15917 hdr.Cap = i.SizeBytes() 15918 15919 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 15920 // Since we bypassed the compiler's escape analysis, indicate that i 15921 // must live until the use above. 15922 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15923 return length, err 15924 } 15925 15926 // WriteTo implements io.WriterTo.WriteTo. 15927 func (i *InetAddr) WriteTo(writer io.Writer) (int64, error) { 15928 // Construct a slice backed by dst's underlying memory. 15929 var buf []byte 15930 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15931 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 15932 hdr.Len = i.SizeBytes() 15933 hdr.Cap = i.SizeBytes() 15934 15935 length, err := writer.Write(buf) 15936 // Since we bypassed the compiler's escape analysis, indicate that i 15937 // must live until the use above. 15938 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 15939 return int64(length), err 15940 } 15941 15942 // SizeBytes implements marshal.Marshallable.SizeBytes. 15943 func (i *InetMulticastRequest) SizeBytes() int { 15944 return 0 + 15945 (*InetAddr)(nil).SizeBytes() + 15946 (*InetAddr)(nil).SizeBytes() 15947 } 15948 15949 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15950 func (i *InetMulticastRequest) MarshalBytes(dst []byte) []byte { 15951 dst = i.MulticastAddr.MarshalUnsafe(dst) 15952 dst = i.InterfaceAddr.MarshalUnsafe(dst) 15953 return dst 15954 } 15955 15956 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15957 func (i *InetMulticastRequest) UnmarshalBytes(src []byte) []byte { 15958 src = i.MulticastAddr.UnmarshalUnsafe(src) 15959 src = i.InterfaceAddr.UnmarshalUnsafe(src) 15960 return src 15961 } 15962 15963 // Packed implements marshal.Marshallable.Packed. 15964 // 15965 //go:nosplit 15966 func (i *InetMulticastRequest) Packed() bool { 15967 return i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() 15968 } 15969 15970 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15971 func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) []byte { 15972 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15973 size := i.SizeBytes() 15974 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 15975 return dst[size:] 15976 } 15977 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 15978 return i.MarshalBytes(dst) 15979 } 15980 15981 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15982 func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) []byte { 15983 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15984 size := i.SizeBytes() 15985 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 15986 return src[size:] 15987 } 15988 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15989 return i.UnmarshalBytes(src) 15990 } 15991 15992 // CopyOutN implements marshal.Marshallable.CopyOutN. 15993 func (i *InetMulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15994 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 15995 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 15996 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 15997 i.MarshalBytes(buf) // escapes: fallback. 15998 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15999 } 16000 16001 // Construct a slice backed by dst's underlying memory. 16002 var buf []byte 16003 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16004 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16005 hdr.Len = i.SizeBytes() 16006 hdr.Cap = i.SizeBytes() 16007 16008 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16009 // Since we bypassed the compiler's escape analysis, indicate that i 16010 // must live until the use above. 16011 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16012 return length, err 16013 } 16014 16015 // CopyOut implements marshal.Marshallable.CopyOut. 16016 func (i *InetMulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16017 return i.CopyOutN(cc, addr, i.SizeBytes()) 16018 } 16019 16020 // CopyIn implements marshal.Marshallable.CopyIn. 16021 func (i *InetMulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16022 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16023 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16024 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16025 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16026 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16027 // partially unmarshalled struct. 16028 i.UnmarshalBytes(buf) // escapes: fallback. 16029 return length, err 16030 } 16031 16032 // Construct a slice backed by dst's underlying memory. 16033 var buf []byte 16034 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16035 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16036 hdr.Len = i.SizeBytes() 16037 hdr.Cap = i.SizeBytes() 16038 16039 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16040 // Since we bypassed the compiler's escape analysis, indicate that i 16041 // must live until the use above. 16042 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16043 return length, err 16044 } 16045 16046 // WriteTo implements io.WriterTo.WriteTo. 16047 func (i *InetMulticastRequest) WriteTo(writer io.Writer) (int64, error) { 16048 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 16049 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 16050 buf := make([]byte, i.SizeBytes()) 16051 i.MarshalBytes(buf) 16052 length, err := writer.Write(buf) 16053 return int64(length), err 16054 } 16055 16056 // Construct a slice backed by dst's underlying memory. 16057 var buf []byte 16058 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16059 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16060 hdr.Len = i.SizeBytes() 16061 hdr.Cap = i.SizeBytes() 16062 16063 length, err := writer.Write(buf) 16064 // Since we bypassed the compiler's escape analysis, indicate that i 16065 // must live until the use above. 16066 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16067 return int64(length), err 16068 } 16069 16070 // SizeBytes implements marshal.Marshallable.SizeBytes. 16071 func (i *InetMulticastRequestWithNIC) SizeBytes() int { 16072 return 4 + 16073 (*InetMulticastRequest)(nil).SizeBytes() 16074 } 16075 16076 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16077 func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) []byte { 16078 dst = i.InetMulticastRequest.MarshalUnsafe(dst) 16079 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 16080 dst = dst[4:] 16081 return dst 16082 } 16083 16084 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16085 func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) []byte { 16086 src = i.InetMulticastRequest.UnmarshalUnsafe(src) 16087 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 16088 src = src[4:] 16089 return src 16090 } 16091 16092 // Packed implements marshal.Marshallable.Packed. 16093 // 16094 //go:nosplit 16095 func (i *InetMulticastRequestWithNIC) Packed() bool { 16096 return i.InetMulticastRequest.Packed() 16097 } 16098 16099 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16100 func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) []byte { 16101 if i.InetMulticastRequest.Packed() { 16102 size := i.SizeBytes() 16103 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 16104 return dst[size:] 16105 } 16106 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes. 16107 return i.MarshalBytes(dst) 16108 } 16109 16110 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16111 func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) []byte { 16112 if i.InetMulticastRequest.Packed() { 16113 size := i.SizeBytes() 16114 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16115 return src[size:] 16116 } 16117 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16118 return i.UnmarshalBytes(src) 16119 } 16120 16121 // CopyOutN implements marshal.Marshallable.CopyOutN. 16122 func (i *InetMulticastRequestWithNIC) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16123 if !i.InetMulticastRequest.Packed() { 16124 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 16125 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16126 i.MarshalBytes(buf) // escapes: fallback. 16127 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16128 } 16129 16130 // Construct a slice backed by dst's underlying memory. 16131 var buf []byte 16132 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16133 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16134 hdr.Len = i.SizeBytes() 16135 hdr.Cap = i.SizeBytes() 16136 16137 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16138 // Since we bypassed the compiler's escape analysis, indicate that i 16139 // must live until the use above. 16140 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16141 return length, err 16142 } 16143 16144 // CopyOut implements marshal.Marshallable.CopyOut. 16145 func (i *InetMulticastRequestWithNIC) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16146 return i.CopyOutN(cc, addr, i.SizeBytes()) 16147 } 16148 16149 // CopyIn implements marshal.Marshallable.CopyIn. 16150 func (i *InetMulticastRequestWithNIC) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16151 if !i.InetMulticastRequest.Packed() { 16152 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16153 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 16154 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16155 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16156 // partially unmarshalled struct. 16157 i.UnmarshalBytes(buf) // escapes: fallback. 16158 return length, err 16159 } 16160 16161 // Construct a slice backed by dst's underlying memory. 16162 var buf []byte 16163 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16164 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16165 hdr.Len = i.SizeBytes() 16166 hdr.Cap = i.SizeBytes() 16167 16168 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16169 // Since we bypassed the compiler's escape analysis, indicate that i 16170 // must live until the use above. 16171 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16172 return length, err 16173 } 16174 16175 // WriteTo implements io.WriterTo.WriteTo. 16176 func (i *InetMulticastRequestWithNIC) WriteTo(writer io.Writer) (int64, error) { 16177 if !i.InetMulticastRequest.Packed() { 16178 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 16179 buf := make([]byte, i.SizeBytes()) 16180 i.MarshalBytes(buf) 16181 length, err := writer.Write(buf) 16182 return int64(length), err 16183 } 16184 16185 // Construct a slice backed by dst's underlying memory. 16186 var buf []byte 16187 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16188 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16189 hdr.Len = i.SizeBytes() 16190 hdr.Cap = i.SizeBytes() 16191 16192 length, err := writer.Write(buf) 16193 // Since we bypassed the compiler's escape analysis, indicate that i 16194 // must live until the use above. 16195 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16196 return int64(length), err 16197 } 16198 16199 // SizeBytes implements marshal.Marshallable.SizeBytes. 16200 func (l *Linger) SizeBytes() int { 16201 return 8 16202 } 16203 16204 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16205 func (l *Linger) MarshalBytes(dst []byte) []byte { 16206 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.OnOff)) 16207 dst = dst[4:] 16208 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Linger)) 16209 dst = dst[4:] 16210 return dst 16211 } 16212 16213 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16214 func (l *Linger) UnmarshalBytes(src []byte) []byte { 16215 l.OnOff = int32(hostarch.ByteOrder.Uint32(src[:4])) 16216 src = src[4:] 16217 l.Linger = int32(hostarch.ByteOrder.Uint32(src[:4])) 16218 src = src[4:] 16219 return src 16220 } 16221 16222 // Packed implements marshal.Marshallable.Packed. 16223 // 16224 //go:nosplit 16225 func (l *Linger) Packed() bool { 16226 return true 16227 } 16228 16229 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16230 func (l *Linger) MarshalUnsafe(dst []byte) []byte { 16231 size := l.SizeBytes() 16232 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 16233 return dst[size:] 16234 } 16235 16236 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16237 func (l *Linger) UnmarshalUnsafe(src []byte) []byte { 16238 size := l.SizeBytes() 16239 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 16240 return src[size:] 16241 } 16242 16243 // CopyOutN implements marshal.Marshallable.CopyOutN. 16244 func (l *Linger) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16245 // Construct a slice backed by dst's underlying memory. 16246 var buf []byte 16247 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16248 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16249 hdr.Len = l.SizeBytes() 16250 hdr.Cap = l.SizeBytes() 16251 16252 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16253 // Since we bypassed the compiler's escape analysis, indicate that l 16254 // must live until the use above. 16255 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16256 return length, err 16257 } 16258 16259 // CopyOut implements marshal.Marshallable.CopyOut. 16260 func (l *Linger) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16261 return l.CopyOutN(cc, addr, l.SizeBytes()) 16262 } 16263 16264 // CopyIn implements marshal.Marshallable.CopyIn. 16265 func (l *Linger) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16266 // Construct a slice backed by dst's underlying memory. 16267 var buf []byte 16268 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16269 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 16270 hdr.Len = l.SizeBytes() 16271 hdr.Cap = l.SizeBytes() 16272 16273 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16274 // Since we bypassed the compiler's escape analysis, indicate that l 16275 // must live until the use above. 16276 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16277 return length, err 16278 } 16279 16280 // WriteTo implements io.WriterTo.WriteTo. 16281 func (l *Linger) WriteTo(writer io.Writer) (int64, 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(l))) 16286 hdr.Len = l.SizeBytes() 16287 hdr.Cap = l.SizeBytes() 16288 16289 length, err := writer.Write(buf) 16290 // Since we bypassed the compiler's escape analysis, indicate that l 16291 // must live until the use above. 16292 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 16293 return int64(length), err 16294 } 16295 16296 // SizeBytes implements marshal.Marshallable.SizeBytes. 16297 func (s *SockAddrInet) SizeBytes() int { 16298 return 4 + 16299 (*InetAddr)(nil).SizeBytes() + 16300 1*8 16301 } 16302 16303 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16304 func (s *SockAddrInet) MarshalBytes(dst []byte) []byte { 16305 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16306 dst = dst[2:] 16307 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 16308 dst = dst[2:] 16309 dst = s.Addr.MarshalUnsafe(dst) 16310 // Padding: dst[:sizeof(uint8)*8] ~= [8]uint8{0} 16311 dst = dst[1*(8):] 16312 return dst 16313 } 16314 16315 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16316 func (s *SockAddrInet) UnmarshalBytes(src []byte) []byte { 16317 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16318 src = src[2:] 16319 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16320 src = src[2:] 16321 src = s.Addr.UnmarshalUnsafe(src) 16322 // Padding: ~ copy([8]uint8(s._), src[:sizeof(uint8)*8]) 16323 src = src[1*(8):] 16324 return src 16325 } 16326 16327 // Packed implements marshal.Marshallable.Packed. 16328 // 16329 //go:nosplit 16330 func (s *SockAddrInet) Packed() bool { 16331 return s.Addr.Packed() 16332 } 16333 16334 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16335 func (s *SockAddrInet) MarshalUnsafe(dst []byte) []byte { 16336 if s.Addr.Packed() { 16337 size := s.SizeBytes() 16338 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16339 return dst[size:] 16340 } 16341 // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes. 16342 return s.MarshalBytes(dst) 16343 } 16344 16345 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16346 func (s *SockAddrInet) UnmarshalUnsafe(src []byte) []byte { 16347 if s.Addr.Packed() { 16348 size := s.SizeBytes() 16349 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16350 return src[size:] 16351 } 16352 // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16353 return s.UnmarshalBytes(src) 16354 } 16355 16356 // CopyOutN implements marshal.Marshallable.CopyOutN. 16357 func (s *SockAddrInet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16358 if !s.Addr.Packed() { 16359 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 16360 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 16361 s.MarshalBytes(buf) // escapes: fallback. 16362 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16363 } 16364 16365 // Construct a slice backed by dst's underlying memory. 16366 var buf []byte 16367 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16368 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16369 hdr.Len = s.SizeBytes() 16370 hdr.Cap = s.SizeBytes() 16371 16372 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16373 // Since we bypassed the compiler's escape analysis, indicate that s 16374 // must live until the use above. 16375 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16376 return length, err 16377 } 16378 16379 // CopyOut implements marshal.Marshallable.CopyOut. 16380 func (s *SockAddrInet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16381 return s.CopyOutN(cc, addr, s.SizeBytes()) 16382 } 16383 16384 // CopyIn implements marshal.Marshallable.CopyIn. 16385 func (s *SockAddrInet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16386 if !s.Addr.Packed() { 16387 // Type SockAddrInet doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16388 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 16389 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16390 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16391 // partially unmarshalled struct. 16392 s.UnmarshalBytes(buf) // escapes: fallback. 16393 return length, err 16394 } 16395 16396 // Construct a slice backed by dst's underlying memory. 16397 var buf []byte 16398 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16399 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16400 hdr.Len = s.SizeBytes() 16401 hdr.Cap = s.SizeBytes() 16402 16403 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16404 // Since we bypassed the compiler's escape analysis, indicate that s 16405 // must live until the use above. 16406 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16407 return length, err 16408 } 16409 16410 // WriteTo implements io.WriterTo.WriteTo. 16411 func (s *SockAddrInet) WriteTo(writer io.Writer) (int64, error) { 16412 if !s.Addr.Packed() { 16413 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 16414 buf := make([]byte, s.SizeBytes()) 16415 s.MarshalBytes(buf) 16416 length, err := writer.Write(buf) 16417 return int64(length), err 16418 } 16419 16420 // Construct a slice backed by dst's underlying memory. 16421 var buf []byte 16422 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16423 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16424 hdr.Len = s.SizeBytes() 16425 hdr.Cap = s.SizeBytes() 16426 16427 length, err := writer.Write(buf) 16428 // Since we bypassed the compiler's escape analysis, indicate that s 16429 // must live until the use above. 16430 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16431 return int64(length), err 16432 } 16433 16434 // SizeBytes implements marshal.Marshallable.SizeBytes. 16435 func (s *SockAddrInet6) SizeBytes() int { 16436 return 12 + 16437 1*16 16438 } 16439 16440 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16441 func (s *SockAddrInet6) MarshalBytes(dst []byte) []byte { 16442 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16443 dst = dst[2:] 16444 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 16445 dst = dst[2:] 16446 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flowinfo)) 16447 dst = dst[4:] 16448 for idx := 0; idx < 16; idx++ { 16449 dst[0] = byte(s.Addr[idx]) 16450 dst = dst[1:] 16451 } 16452 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Scope_id)) 16453 dst = dst[4:] 16454 return dst 16455 } 16456 16457 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16458 func (s *SockAddrInet6) UnmarshalBytes(src []byte) []byte { 16459 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16460 src = src[2:] 16461 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16462 src = src[2:] 16463 s.Flowinfo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16464 src = src[4:] 16465 for idx := 0; idx < 16; idx++ { 16466 s.Addr[idx] = src[0] 16467 src = src[1:] 16468 } 16469 s.Scope_id = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16470 src = src[4:] 16471 return src 16472 } 16473 16474 // Packed implements marshal.Marshallable.Packed. 16475 // 16476 //go:nosplit 16477 func (s *SockAddrInet6) Packed() bool { 16478 return true 16479 } 16480 16481 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16482 func (s *SockAddrInet6) MarshalUnsafe(dst []byte) []byte { 16483 size := s.SizeBytes() 16484 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16485 return dst[size:] 16486 } 16487 16488 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16489 func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) []byte { 16490 size := s.SizeBytes() 16491 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16492 return src[size:] 16493 } 16494 16495 // CopyOutN implements marshal.Marshallable.CopyOutN. 16496 func (s *SockAddrInet6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16497 // Construct a slice backed by dst's underlying memory. 16498 var buf []byte 16499 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16500 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16501 hdr.Len = s.SizeBytes() 16502 hdr.Cap = s.SizeBytes() 16503 16504 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16505 // Since we bypassed the compiler's escape analysis, indicate that s 16506 // must live until the use above. 16507 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16508 return length, err 16509 } 16510 16511 // CopyOut implements marshal.Marshallable.CopyOut. 16512 func (s *SockAddrInet6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16513 return s.CopyOutN(cc, addr, s.SizeBytes()) 16514 } 16515 16516 // CopyIn implements marshal.Marshallable.CopyIn. 16517 func (s *SockAddrInet6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16518 // Construct a slice backed by dst's underlying memory. 16519 var buf []byte 16520 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16521 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16522 hdr.Len = s.SizeBytes() 16523 hdr.Cap = s.SizeBytes() 16524 16525 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16526 // Since we bypassed the compiler's escape analysis, indicate that s 16527 // must live until the use above. 16528 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16529 return length, err 16530 } 16531 16532 // WriteTo implements io.WriterTo.WriteTo. 16533 func (s *SockAddrInet6) WriteTo(writer io.Writer) (int64, error) { 16534 // Construct a slice backed by dst's underlying memory. 16535 var buf []byte 16536 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16537 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16538 hdr.Len = s.SizeBytes() 16539 hdr.Cap = s.SizeBytes() 16540 16541 length, err := writer.Write(buf) 16542 // Since we bypassed the compiler's escape analysis, indicate that s 16543 // must live until the use above. 16544 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16545 return int64(length), err 16546 } 16547 16548 // SizeBytes implements marshal.Marshallable.SizeBytes. 16549 func (s *SockAddrLink) SizeBytes() int { 16550 return 12 + 16551 1*8 16552 } 16553 16554 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16555 func (s *SockAddrLink) MarshalBytes(dst []byte) []byte { 16556 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16557 dst = dst[2:] 16558 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Protocol)) 16559 dst = dst[2:] 16560 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.InterfaceIndex)) 16561 dst = dst[4:] 16562 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.ARPHardwareType)) 16563 dst = dst[2:] 16564 dst[0] = byte(s.PacketType) 16565 dst = dst[1:] 16566 dst[0] = byte(s.HardwareAddrLen) 16567 dst = dst[1:] 16568 for idx := 0; idx < 8; idx++ { 16569 dst[0] = byte(s.HardwareAddr[idx]) 16570 dst = dst[1:] 16571 } 16572 return dst 16573 } 16574 16575 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16576 func (s *SockAddrLink) UnmarshalBytes(src []byte) []byte { 16577 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16578 src = src[2:] 16579 s.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16580 src = src[2:] 16581 s.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 16582 src = src[4:] 16583 s.ARPHardwareType = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16584 src = src[2:] 16585 s.PacketType = src[0] 16586 src = src[1:] 16587 s.HardwareAddrLen = src[0] 16588 src = src[1:] 16589 for idx := 0; idx < 8; idx++ { 16590 s.HardwareAddr[idx] = src[0] 16591 src = src[1:] 16592 } 16593 return src 16594 } 16595 16596 // Packed implements marshal.Marshallable.Packed. 16597 // 16598 //go:nosplit 16599 func (s *SockAddrLink) Packed() bool { 16600 return true 16601 } 16602 16603 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16604 func (s *SockAddrLink) MarshalUnsafe(dst []byte) []byte { 16605 size := s.SizeBytes() 16606 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16607 return dst[size:] 16608 } 16609 16610 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16611 func (s *SockAddrLink) UnmarshalUnsafe(src []byte) []byte { 16612 size := s.SizeBytes() 16613 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16614 return src[size:] 16615 } 16616 16617 // CopyOutN implements marshal.Marshallable.CopyOutN. 16618 func (s *SockAddrLink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16619 // Construct a slice backed by dst's underlying memory. 16620 var buf []byte 16621 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16622 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16623 hdr.Len = s.SizeBytes() 16624 hdr.Cap = s.SizeBytes() 16625 16626 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16627 // Since we bypassed the compiler's escape analysis, indicate that s 16628 // must live until the use above. 16629 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16630 return length, err 16631 } 16632 16633 // CopyOut implements marshal.Marshallable.CopyOut. 16634 func (s *SockAddrLink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16635 return s.CopyOutN(cc, addr, s.SizeBytes()) 16636 } 16637 16638 // CopyIn implements marshal.Marshallable.CopyIn. 16639 func (s *SockAddrLink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16640 // Construct a slice backed by dst's underlying memory. 16641 var buf []byte 16642 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16643 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16644 hdr.Len = s.SizeBytes() 16645 hdr.Cap = s.SizeBytes() 16646 16647 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16648 // Since we bypassed the compiler's escape analysis, indicate that s 16649 // must live until the use above. 16650 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16651 return length, err 16652 } 16653 16654 // WriteTo implements io.WriterTo.WriteTo. 16655 func (s *SockAddrLink) WriteTo(writer io.Writer) (int64, error) { 16656 // Construct a slice backed by dst's underlying memory. 16657 var buf []byte 16658 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16659 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16660 hdr.Len = s.SizeBytes() 16661 hdr.Cap = s.SizeBytes() 16662 16663 length, err := writer.Write(buf) 16664 // Since we bypassed the compiler's escape analysis, indicate that s 16665 // must live until the use above. 16666 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16667 return int64(length), err 16668 } 16669 16670 // SizeBytes implements marshal.Marshallable.SizeBytes. 16671 func (s *SockAddrUnix) SizeBytes() int { 16672 return 2 + 16673 1*UnixPathMax 16674 } 16675 16676 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16677 func (s *SockAddrUnix) MarshalBytes(dst []byte) []byte { 16678 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 16679 dst = dst[2:] 16680 for idx := 0; idx < UnixPathMax; idx++ { 16681 dst[0] = byte(s.Path[idx]) 16682 dst = dst[1:] 16683 } 16684 return dst 16685 } 16686 16687 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16688 func (s *SockAddrUnix) UnmarshalBytes(src []byte) []byte { 16689 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16690 src = src[2:] 16691 for idx := 0; idx < UnixPathMax; idx++ { 16692 s.Path[idx] = int8(src[0]) 16693 src = src[1:] 16694 } 16695 return src 16696 } 16697 16698 // Packed implements marshal.Marshallable.Packed. 16699 // 16700 //go:nosplit 16701 func (s *SockAddrUnix) Packed() bool { 16702 return true 16703 } 16704 16705 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16706 func (s *SockAddrUnix) MarshalUnsafe(dst []byte) []byte { 16707 size := s.SizeBytes() 16708 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16709 return dst[size:] 16710 } 16711 16712 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16713 func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) []byte { 16714 size := s.SizeBytes() 16715 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16716 return src[size:] 16717 } 16718 16719 // CopyOutN implements marshal.Marshallable.CopyOutN. 16720 func (s *SockAddrUnix) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16721 // Construct a slice backed by dst's underlying memory. 16722 var buf []byte 16723 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16724 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16725 hdr.Len = s.SizeBytes() 16726 hdr.Cap = s.SizeBytes() 16727 16728 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16729 // Since we bypassed the compiler's escape analysis, indicate that s 16730 // must live until the use above. 16731 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16732 return length, err 16733 } 16734 16735 // CopyOut implements marshal.Marshallable.CopyOut. 16736 func (s *SockAddrUnix) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16737 return s.CopyOutN(cc, addr, s.SizeBytes()) 16738 } 16739 16740 // CopyIn implements marshal.Marshallable.CopyIn. 16741 func (s *SockAddrUnix) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16742 // Construct a slice backed by dst's underlying memory. 16743 var buf []byte 16744 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16745 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16746 hdr.Len = s.SizeBytes() 16747 hdr.Cap = s.SizeBytes() 16748 16749 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 16750 // Since we bypassed the compiler's escape analysis, indicate that s 16751 // must live until the use above. 16752 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16753 return length, err 16754 } 16755 16756 // WriteTo implements io.WriterTo.WriteTo. 16757 func (s *SockAddrUnix) WriteTo(writer io.Writer) (int64, 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(s))) 16762 hdr.Len = s.SizeBytes() 16763 hdr.Cap = s.SizeBytes() 16764 16765 length, err := writer.Write(buf) 16766 // Since we bypassed the compiler's escape analysis, indicate that s 16767 // must live until the use above. 16768 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16769 return int64(length), err 16770 } 16771 16772 // SizeBytes implements marshal.Marshallable.SizeBytes. 16773 func (t *TCPInfo) SizeBytes() int { 16774 return 224 16775 } 16776 16777 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16778 func (t *TCPInfo) MarshalBytes(dst []byte) []byte { 16779 dst[0] = byte(t.State) 16780 dst = dst[1:] 16781 dst[0] = byte(t.CaState) 16782 dst = dst[1:] 16783 dst[0] = byte(t.Retransmits) 16784 dst = dst[1:] 16785 dst[0] = byte(t.Probes) 16786 dst = dst[1:] 16787 dst[0] = byte(t.Backoff) 16788 dst = dst[1:] 16789 dst[0] = byte(t.Options) 16790 dst = dst[1:] 16791 dst[0] = byte(t.WindowScale) 16792 dst = dst[1:] 16793 dst[0] = byte(t.DeliveryRateAppLimited) 16794 dst = dst[1:] 16795 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTO)) 16796 dst = dst[4:] 16797 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ATO)) 16798 dst = dst[4:] 16799 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndMss)) 16800 dst = dst[4:] 16801 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvMss)) 16802 dst = dst[4:] 16803 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Unacked)) 16804 dst = dst[4:] 16805 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Sacked)) 16806 dst = dst[4:] 16807 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Lost)) 16808 dst = dst[4:] 16809 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Retrans)) 16810 dst = dst[4:] 16811 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Fackets)) 16812 dst = dst[4:] 16813 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataSent)) 16814 dst = dst[4:] 16815 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckSent)) 16816 dst = dst[4:] 16817 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataRecv)) 16818 dst = dst[4:] 16819 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckRecv)) 16820 dst = dst[4:] 16821 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.PMTU)) 16822 dst = dst[4:] 16823 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSsthresh)) 16824 dst = dst[4:] 16825 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTT)) 16826 dst = dst[4:] 16827 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTTVar)) 16828 dst = dst[4:] 16829 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndSsthresh)) 16830 dst = dst[4:] 16831 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndCwnd)) 16832 dst = dst[4:] 16833 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Advmss)) 16834 dst = dst[4:] 16835 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Reordering)) 16836 dst = dst[4:] 16837 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvRTT)) 16838 dst = dst[4:] 16839 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSpace)) 16840 dst = dst[4:] 16841 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.TotalRetrans)) 16842 dst = dst[4:] 16843 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.PacingRate)) 16844 dst = dst[8:] 16845 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.MaxPacingRate)) 16846 dst = dst[8:] 16847 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesAcked)) 16848 dst = dst[8:] 16849 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesReceived)) 16850 dst = dst[8:] 16851 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsOut)) 16852 dst = dst[4:] 16853 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsIn)) 16854 dst = dst[4:] 16855 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.NotSentBytes)) 16856 dst = dst[4:] 16857 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.MinRTT)) 16858 dst = dst[4:] 16859 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsIn)) 16860 dst = dst[4:] 16861 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsOut)) 16862 dst = dst[4:] 16863 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.DeliveryRate)) 16864 dst = dst[8:] 16865 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BusyTime)) 16866 dst = dst[8:] 16867 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.RwndLimited)) 16868 dst = dst[8:] 16869 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.SndBufLimited)) 16870 dst = dst[8:] 16871 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Delivered)) 16872 dst = dst[4:] 16873 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DeliveredCE)) 16874 dst = dst[4:] 16875 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesSent)) 16876 dst = dst[8:] 16877 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesRetrans)) 16878 dst = dst[8:] 16879 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DSACKDups)) 16880 dst = dst[4:] 16881 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ReordSeen)) 16882 dst = dst[4:] 16883 return dst 16884 } 16885 16886 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16887 func (t *TCPInfo) UnmarshalBytes(src []byte) []byte { 16888 t.State = uint8(src[0]) 16889 src = src[1:] 16890 t.CaState = uint8(src[0]) 16891 src = src[1:] 16892 t.Retransmits = uint8(src[0]) 16893 src = src[1:] 16894 t.Probes = uint8(src[0]) 16895 src = src[1:] 16896 t.Backoff = uint8(src[0]) 16897 src = src[1:] 16898 t.Options = uint8(src[0]) 16899 src = src[1:] 16900 t.WindowScale = uint8(src[0]) 16901 src = src[1:] 16902 t.DeliveryRateAppLimited = uint8(src[0]) 16903 src = src[1:] 16904 t.RTO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16905 src = src[4:] 16906 t.ATO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16907 src = src[4:] 16908 t.SndMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16909 src = src[4:] 16910 t.RcvMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16911 src = src[4:] 16912 t.Unacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16913 src = src[4:] 16914 t.Sacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16915 src = src[4:] 16916 t.Lost = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16917 src = src[4:] 16918 t.Retrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16919 src = src[4:] 16920 t.Fackets = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16921 src = src[4:] 16922 t.LastDataSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16923 src = src[4:] 16924 t.LastAckSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16925 src = src[4:] 16926 t.LastDataRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16927 src = src[4:] 16928 t.LastAckRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16929 src = src[4:] 16930 t.PMTU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16931 src = src[4:] 16932 t.RcvSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16933 src = src[4:] 16934 t.RTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16935 src = src[4:] 16936 t.RTTVar = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16937 src = src[4:] 16938 t.SndSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16939 src = src[4:] 16940 t.SndCwnd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16941 src = src[4:] 16942 t.Advmss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16943 src = src[4:] 16944 t.Reordering = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16945 src = src[4:] 16946 t.RcvRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16947 src = src[4:] 16948 t.RcvSpace = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16949 src = src[4:] 16950 t.TotalRetrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16951 src = src[4:] 16952 t.PacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16953 src = src[8:] 16954 t.MaxPacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16955 src = src[8:] 16956 t.BytesAcked = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16957 src = src[8:] 16958 t.BytesReceived = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16959 src = src[8:] 16960 t.SegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16961 src = src[4:] 16962 t.SegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16963 src = src[4:] 16964 t.NotSentBytes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16965 src = src[4:] 16966 t.MinRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16967 src = src[4:] 16968 t.DataSegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16969 src = src[4:] 16970 t.DataSegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16971 src = src[4:] 16972 t.DeliveryRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16973 src = src[8:] 16974 t.BusyTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16975 src = src[8:] 16976 t.RwndLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16977 src = src[8:] 16978 t.SndBufLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16979 src = src[8:] 16980 t.Delivered = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16981 src = src[4:] 16982 t.DeliveredCE = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16983 src = src[4:] 16984 t.BytesSent = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16985 src = src[8:] 16986 t.BytesRetrans = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16987 src = src[8:] 16988 t.DSACKDups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16989 src = src[4:] 16990 t.ReordSeen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16991 src = src[4:] 16992 return src 16993 } 16994 16995 // Packed implements marshal.Marshallable.Packed. 16996 // 16997 //go:nosplit 16998 func (t *TCPInfo) Packed() bool { 16999 return true 17000 } 17001 17002 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17003 func (t *TCPInfo) MarshalUnsafe(dst []byte) []byte { 17004 size := t.SizeBytes() 17005 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17006 return dst[size:] 17007 } 17008 17009 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17010 func (t *TCPInfo) UnmarshalUnsafe(src []byte) []byte { 17011 size := t.SizeBytes() 17012 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17013 return src[size:] 17014 } 17015 17016 // CopyOutN implements marshal.Marshallable.CopyOutN. 17017 func (t *TCPInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17018 // Construct a slice backed by dst's underlying memory. 17019 var buf []byte 17020 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17021 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17022 hdr.Len = t.SizeBytes() 17023 hdr.Cap = t.SizeBytes() 17024 17025 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17026 // Since we bypassed the compiler's escape analysis, indicate that t 17027 // must live until the use above. 17028 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17029 return length, err 17030 } 17031 17032 // CopyOut implements marshal.Marshallable.CopyOut. 17033 func (t *TCPInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17034 return t.CopyOutN(cc, addr, t.SizeBytes()) 17035 } 17036 17037 // CopyIn implements marshal.Marshallable.CopyIn. 17038 func (t *TCPInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17039 // Construct a slice backed by dst's underlying memory. 17040 var buf []byte 17041 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17042 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17043 hdr.Len = t.SizeBytes() 17044 hdr.Cap = t.SizeBytes() 17045 17046 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17047 // Since we bypassed the compiler's escape analysis, indicate that t 17048 // must live until the use above. 17049 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17050 return length, err 17051 } 17052 17053 // WriteTo implements io.WriterTo.WriteTo. 17054 func (t *TCPInfo) WriteTo(writer io.Writer) (int64, error) { 17055 // Construct a slice backed by dst's underlying memory. 17056 var buf []byte 17057 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17058 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17059 hdr.Len = t.SizeBytes() 17060 hdr.Cap = t.SizeBytes() 17061 17062 length, err := writer.Write(buf) 17063 // Since we bypassed the compiler's escape analysis, indicate that t 17064 // must live until the use above. 17065 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17066 return int64(length), err 17067 } 17068 17069 // SizeBytes implements marshal.Marshallable.SizeBytes. 17070 // 17071 //go:nosplit 17072 func (c *ClockT) SizeBytes() int { 17073 return 8 17074 } 17075 17076 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17077 func (c *ClockT) MarshalBytes(dst []byte) []byte { 17078 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*c)) 17079 return dst[8:] 17080 } 17081 17082 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17083 func (c *ClockT) UnmarshalBytes(src []byte) []byte { 17084 *c = ClockT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 17085 return src[8:] 17086 } 17087 17088 // Packed implements marshal.Marshallable.Packed. 17089 // 17090 //go:nosplit 17091 func (c *ClockT) Packed() bool { 17092 // Scalar newtypes are always packed. 17093 return true 17094 } 17095 17096 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17097 func (c *ClockT) MarshalUnsafe(dst []byte) []byte { 17098 size := c.SizeBytes() 17099 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 17100 return dst[size:] 17101 } 17102 17103 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17104 func (c *ClockT) UnmarshalUnsafe(src []byte) []byte { 17105 size := c.SizeBytes() 17106 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 17107 return src[size:] 17108 } 17109 17110 // CopyOutN implements marshal.Marshallable.CopyOutN. 17111 func (c *ClockT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17112 // Construct a slice backed by dst's underlying memory. 17113 var buf []byte 17114 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17115 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 17116 hdr.Len = c.SizeBytes() 17117 hdr.Cap = c.SizeBytes() 17118 17119 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17120 // Since we bypassed the compiler's escape analysis, indicate that c 17121 // must live until the use above. 17122 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 17123 return length, err 17124 } 17125 17126 // CopyOut implements marshal.Marshallable.CopyOut. 17127 func (c *ClockT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17128 return c.CopyOutN(cc, addr, c.SizeBytes()) 17129 } 17130 17131 // CopyIn implements marshal.Marshallable.CopyIn. 17132 func (c *ClockT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17133 // Construct a slice backed by dst's underlying memory. 17134 var buf []byte 17135 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17136 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 17137 hdr.Len = c.SizeBytes() 17138 hdr.Cap = c.SizeBytes() 17139 17140 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17141 // Since we bypassed the compiler's escape analysis, indicate that c 17142 // must live until the use above. 17143 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 17144 return length, err 17145 } 17146 17147 // WriteTo implements io.WriterTo.WriteTo. 17148 func (c *ClockT) WriteTo(writer io.Writer) (int64, error) { 17149 // Construct a slice backed by dst's underlying memory. 17150 var buf []byte 17151 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17152 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 17153 hdr.Len = c.SizeBytes() 17154 hdr.Cap = c.SizeBytes() 17155 17156 length, err := writer.Write(buf) 17157 // Since we bypassed the compiler's escape analysis, indicate that c 17158 // must live until the use above. 17159 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 17160 return int64(length), err 17161 } 17162 17163 // SizeBytes implements marshal.Marshallable.SizeBytes. 17164 func (i *ItimerVal) SizeBytes() int { 17165 return 0 + 17166 (*Timeval)(nil).SizeBytes() + 17167 (*Timeval)(nil).SizeBytes() 17168 } 17169 17170 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17171 func (i *ItimerVal) MarshalBytes(dst []byte) []byte { 17172 dst = i.Interval.MarshalUnsafe(dst) 17173 dst = i.Value.MarshalUnsafe(dst) 17174 return dst 17175 } 17176 17177 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17178 func (i *ItimerVal) UnmarshalBytes(src []byte) []byte { 17179 src = i.Interval.UnmarshalUnsafe(src) 17180 src = i.Value.UnmarshalUnsafe(src) 17181 return src 17182 } 17183 17184 // Packed implements marshal.Marshallable.Packed. 17185 // 17186 //go:nosplit 17187 func (i *ItimerVal) Packed() bool { 17188 return i.Interval.Packed() && i.Value.Packed() 17189 } 17190 17191 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17192 func (i *ItimerVal) MarshalUnsafe(dst []byte) []byte { 17193 if i.Interval.Packed() && i.Value.Packed() { 17194 size := i.SizeBytes() 17195 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17196 return dst[size:] 17197 } 17198 // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes. 17199 return i.MarshalBytes(dst) 17200 } 17201 17202 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17203 func (i *ItimerVal) UnmarshalUnsafe(src []byte) []byte { 17204 if i.Interval.Packed() && i.Value.Packed() { 17205 size := i.SizeBytes() 17206 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17207 return src[size:] 17208 } 17209 // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17210 return i.UnmarshalBytes(src) 17211 } 17212 17213 // CopyOutN implements marshal.Marshallable.CopyOutN. 17214 func (i *ItimerVal) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17215 if !i.Interval.Packed() && i.Value.Packed() { 17216 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 17217 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17218 i.MarshalBytes(buf) // escapes: fallback. 17219 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17220 } 17221 17222 // Construct a slice backed by dst's underlying memory. 17223 var buf []byte 17224 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17225 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17226 hdr.Len = i.SizeBytes() 17227 hdr.Cap = i.SizeBytes() 17228 17229 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17230 // Since we bypassed the compiler's escape analysis, indicate that i 17231 // must live until the use above. 17232 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17233 return length, err 17234 } 17235 17236 // CopyOut implements marshal.Marshallable.CopyOut. 17237 func (i *ItimerVal) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17238 return i.CopyOutN(cc, addr, i.SizeBytes()) 17239 } 17240 17241 // CopyIn implements marshal.Marshallable.CopyIn. 17242 func (i *ItimerVal) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17243 if !i.Interval.Packed() && i.Value.Packed() { 17244 // Type ItimerVal doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17245 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17246 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17247 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17248 // partially unmarshalled struct. 17249 i.UnmarshalBytes(buf) // escapes: fallback. 17250 return length, err 17251 } 17252 17253 // Construct a slice backed by dst's underlying memory. 17254 var buf []byte 17255 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17256 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17257 hdr.Len = i.SizeBytes() 17258 hdr.Cap = i.SizeBytes() 17259 17260 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17261 // Since we bypassed the compiler's escape analysis, indicate that i 17262 // must live until the use above. 17263 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17264 return length, err 17265 } 17266 17267 // WriteTo implements io.WriterTo.WriteTo. 17268 func (i *ItimerVal) WriteTo(writer io.Writer) (int64, error) { 17269 if !i.Interval.Packed() && i.Value.Packed() { 17270 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 17271 buf := make([]byte, i.SizeBytes()) 17272 i.MarshalBytes(buf) 17273 length, err := writer.Write(buf) 17274 return int64(length), err 17275 } 17276 17277 // Construct a slice backed by dst's underlying memory. 17278 var buf []byte 17279 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17280 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17281 hdr.Len = i.SizeBytes() 17282 hdr.Cap = i.SizeBytes() 17283 17284 length, err := writer.Write(buf) 17285 // Since we bypassed the compiler's escape analysis, indicate that i 17286 // must live until the use above. 17287 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17288 return int64(length), err 17289 } 17290 17291 // SizeBytes implements marshal.Marshallable.SizeBytes. 17292 func (i *Itimerspec) SizeBytes() int { 17293 return 0 + 17294 (*Timespec)(nil).SizeBytes() + 17295 (*Timespec)(nil).SizeBytes() 17296 } 17297 17298 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17299 func (i *Itimerspec) MarshalBytes(dst []byte) []byte { 17300 dst = i.Interval.MarshalUnsafe(dst) 17301 dst = i.Value.MarshalUnsafe(dst) 17302 return dst 17303 } 17304 17305 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17306 func (i *Itimerspec) UnmarshalBytes(src []byte) []byte { 17307 src = i.Interval.UnmarshalUnsafe(src) 17308 src = i.Value.UnmarshalUnsafe(src) 17309 return src 17310 } 17311 17312 // Packed implements marshal.Marshallable.Packed. 17313 // 17314 //go:nosplit 17315 func (i *Itimerspec) Packed() bool { 17316 return i.Interval.Packed() && i.Value.Packed() 17317 } 17318 17319 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17320 func (i *Itimerspec) MarshalUnsafe(dst []byte) []byte { 17321 if i.Interval.Packed() && i.Value.Packed() { 17322 size := i.SizeBytes() 17323 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17324 return dst[size:] 17325 } 17326 // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes. 17327 return i.MarshalBytes(dst) 17328 } 17329 17330 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17331 func (i *Itimerspec) UnmarshalUnsafe(src []byte) []byte { 17332 if i.Interval.Packed() && i.Value.Packed() { 17333 size := i.SizeBytes() 17334 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17335 return src[size:] 17336 } 17337 // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17338 return i.UnmarshalBytes(src) 17339 } 17340 17341 // CopyOutN implements marshal.Marshallable.CopyOutN. 17342 func (i *Itimerspec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17343 if !i.Interval.Packed() && i.Value.Packed() { 17344 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 17345 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17346 i.MarshalBytes(buf) // escapes: fallback. 17347 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17348 } 17349 17350 // Construct a slice backed by dst's underlying memory. 17351 var buf []byte 17352 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17353 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17354 hdr.Len = i.SizeBytes() 17355 hdr.Cap = i.SizeBytes() 17356 17357 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17358 // Since we bypassed the compiler's escape analysis, indicate that i 17359 // must live until the use above. 17360 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17361 return length, err 17362 } 17363 17364 // CopyOut implements marshal.Marshallable.CopyOut. 17365 func (i *Itimerspec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17366 return i.CopyOutN(cc, addr, i.SizeBytes()) 17367 } 17368 17369 // CopyIn implements marshal.Marshallable.CopyIn. 17370 func (i *Itimerspec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17371 if !i.Interval.Packed() && i.Value.Packed() { 17372 // Type Itimerspec doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17373 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17374 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17375 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17376 // partially unmarshalled struct. 17377 i.UnmarshalBytes(buf) // escapes: fallback. 17378 return length, err 17379 } 17380 17381 // Construct a slice backed by dst's underlying memory. 17382 var buf []byte 17383 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17384 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17385 hdr.Len = i.SizeBytes() 17386 hdr.Cap = i.SizeBytes() 17387 17388 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17389 // Since we bypassed the compiler's escape analysis, indicate that i 17390 // must live until the use above. 17391 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17392 return length, err 17393 } 17394 17395 // WriteTo implements io.WriterTo.WriteTo. 17396 func (i *Itimerspec) WriteTo(writer io.Writer) (int64, error) { 17397 if !i.Interval.Packed() && i.Value.Packed() { 17398 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 17399 buf := make([]byte, i.SizeBytes()) 17400 i.MarshalBytes(buf) 17401 length, err := writer.Write(buf) 17402 return int64(length), err 17403 } 17404 17405 // Construct a slice backed by dst's underlying memory. 17406 var buf []byte 17407 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17408 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17409 hdr.Len = i.SizeBytes() 17410 hdr.Cap = i.SizeBytes() 17411 17412 length, err := writer.Write(buf) 17413 // Since we bypassed the compiler's escape analysis, indicate that i 17414 // must live until the use above. 17415 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17416 return int64(length), err 17417 } 17418 17419 // SizeBytes implements marshal.Marshallable.SizeBytes. 17420 func (sxts *StatxTimestamp) SizeBytes() int { 17421 return 16 17422 } 17423 17424 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17425 func (sxts *StatxTimestamp) MarshalBytes(dst []byte) []byte { 17426 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sxts.Sec)) 17427 dst = dst[8:] 17428 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sxts.Nsec)) 17429 dst = dst[4:] 17430 // Padding: dst[:sizeof(int32)] ~= int32(0) 17431 dst = dst[4:] 17432 return dst 17433 } 17434 17435 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17436 func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) []byte { 17437 sxts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17438 src = src[8:] 17439 sxts.Nsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17440 src = src[4:] 17441 // Padding: var _ int32 ~= src[:sizeof(int32)] 17442 src = src[4:] 17443 return src 17444 } 17445 17446 // Packed implements marshal.Marshallable.Packed. 17447 // 17448 //go:nosplit 17449 func (sxts *StatxTimestamp) Packed() bool { 17450 return true 17451 } 17452 17453 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17454 func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) []byte { 17455 size := sxts.SizeBytes() 17456 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(size)) 17457 return dst[size:] 17458 } 17459 17460 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17461 func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) []byte { 17462 size := sxts.SizeBytes() 17463 gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(size)) 17464 return src[size:] 17465 } 17466 17467 // CopyOutN implements marshal.Marshallable.CopyOutN. 17468 func (sxts *StatxTimestamp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17469 // Construct a slice backed by dst's underlying memory. 17470 var buf []byte 17471 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17472 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 17473 hdr.Len = sxts.SizeBytes() 17474 hdr.Cap = sxts.SizeBytes() 17475 17476 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17477 // Since we bypassed the compiler's escape analysis, indicate that sxts 17478 // must live until the use above. 17479 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 17480 return length, err 17481 } 17482 17483 // CopyOut implements marshal.Marshallable.CopyOut. 17484 func (sxts *StatxTimestamp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17485 return sxts.CopyOutN(cc, addr, sxts.SizeBytes()) 17486 } 17487 17488 // CopyIn implements marshal.Marshallable.CopyIn. 17489 func (sxts *StatxTimestamp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17490 // Construct a slice backed by dst's underlying memory. 17491 var buf []byte 17492 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17493 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 17494 hdr.Len = sxts.SizeBytes() 17495 hdr.Cap = sxts.SizeBytes() 17496 17497 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17498 // Since we bypassed the compiler's escape analysis, indicate that sxts 17499 // must live until the use above. 17500 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 17501 return length, err 17502 } 17503 17504 // WriteTo implements io.WriterTo.WriteTo. 17505 func (sxts *StatxTimestamp) WriteTo(writer io.Writer) (int64, error) { 17506 // Construct a slice backed by dst's underlying memory. 17507 var buf []byte 17508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 17510 hdr.Len = sxts.SizeBytes() 17511 hdr.Cap = sxts.SizeBytes() 17512 17513 length, err := writer.Write(buf) 17514 // Since we bypassed the compiler's escape analysis, indicate that sxts 17515 // must live until the use above. 17516 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 17517 return int64(length), err 17518 } 17519 17520 // SizeBytes implements marshal.Marshallable.SizeBytes. 17521 // 17522 //go:nosplit 17523 func (t *TimeT) SizeBytes() int { 17524 return 8 17525 } 17526 17527 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17528 func (t *TimeT) MarshalBytes(dst []byte) []byte { 17529 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*t)) 17530 return dst[8:] 17531 } 17532 17533 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17534 func (t *TimeT) UnmarshalBytes(src []byte) []byte { 17535 *t = TimeT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 17536 return src[8:] 17537 } 17538 17539 // Packed implements marshal.Marshallable.Packed. 17540 // 17541 //go:nosplit 17542 func (t *TimeT) Packed() bool { 17543 // Scalar newtypes are always packed. 17544 return true 17545 } 17546 17547 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17548 func (t *TimeT) MarshalUnsafe(dst []byte) []byte { 17549 size := t.SizeBytes() 17550 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17551 return dst[size:] 17552 } 17553 17554 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17555 func (t *TimeT) UnmarshalUnsafe(src []byte) []byte { 17556 size := t.SizeBytes() 17557 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17558 return src[size:] 17559 } 17560 17561 // CopyOutN implements marshal.Marshallable.CopyOutN. 17562 func (t *TimeT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17563 // Construct a slice backed by dst's underlying memory. 17564 var buf []byte 17565 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17566 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17567 hdr.Len = t.SizeBytes() 17568 hdr.Cap = t.SizeBytes() 17569 17570 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17571 // Since we bypassed the compiler's escape analysis, indicate that t 17572 // must live until the use above. 17573 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17574 return length, err 17575 } 17576 17577 // CopyOut implements marshal.Marshallable.CopyOut. 17578 func (t *TimeT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17579 return t.CopyOutN(cc, addr, t.SizeBytes()) 17580 } 17581 17582 // CopyIn implements marshal.Marshallable.CopyIn. 17583 func (t *TimeT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17584 // Construct a slice backed by dst's underlying memory. 17585 var buf []byte 17586 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17587 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17588 hdr.Len = t.SizeBytes() 17589 hdr.Cap = t.SizeBytes() 17590 17591 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17592 // Since we bypassed the compiler's escape analysis, indicate that t 17593 // must live until the use above. 17594 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17595 return length, err 17596 } 17597 17598 // WriteTo implements io.WriterTo.WriteTo. 17599 func (t *TimeT) WriteTo(writer io.Writer) (int64, error) { 17600 // Construct a slice backed by dst's underlying memory. 17601 var buf []byte 17602 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17603 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17604 hdr.Len = t.SizeBytes() 17605 hdr.Cap = t.SizeBytes() 17606 17607 length, err := writer.Write(buf) 17608 // Since we bypassed the compiler's escape analysis, indicate that t 17609 // must live until the use above. 17610 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17611 return int64(length), err 17612 } 17613 17614 // SizeBytes implements marshal.Marshallable.SizeBytes. 17615 // 17616 //go:nosplit 17617 func (t *TimerID) SizeBytes() int { 17618 return 4 17619 } 17620 17621 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17622 func (t *TimerID) MarshalBytes(dst []byte) []byte { 17623 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*t)) 17624 return dst[4:] 17625 } 17626 17627 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17628 func (t *TimerID) UnmarshalBytes(src []byte) []byte { 17629 *t = TimerID(int32(hostarch.ByteOrder.Uint32(src[:4]))) 17630 return src[4:] 17631 } 17632 17633 // Packed implements marshal.Marshallable.Packed. 17634 // 17635 //go:nosplit 17636 func (t *TimerID) Packed() bool { 17637 // Scalar newtypes are always packed. 17638 return true 17639 } 17640 17641 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17642 func (t *TimerID) MarshalUnsafe(dst []byte) []byte { 17643 size := t.SizeBytes() 17644 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 17645 return dst[size:] 17646 } 17647 17648 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17649 func (t *TimerID) UnmarshalUnsafe(src []byte) []byte { 17650 size := t.SizeBytes() 17651 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 17652 return src[size:] 17653 } 17654 17655 // CopyOutN implements marshal.Marshallable.CopyOutN. 17656 func (t *TimerID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17657 // Construct a slice backed by dst's underlying memory. 17658 var buf []byte 17659 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17660 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17661 hdr.Len = t.SizeBytes() 17662 hdr.Cap = t.SizeBytes() 17663 17664 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17665 // Since we bypassed the compiler's escape analysis, indicate that t 17666 // must live until the use above. 17667 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17668 return length, err 17669 } 17670 17671 // CopyOut implements marshal.Marshallable.CopyOut. 17672 func (t *TimerID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17673 return t.CopyOutN(cc, addr, t.SizeBytes()) 17674 } 17675 17676 // CopyIn implements marshal.Marshallable.CopyIn. 17677 func (t *TimerID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17678 // Construct a slice backed by dst's underlying memory. 17679 var buf []byte 17680 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17681 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17682 hdr.Len = t.SizeBytes() 17683 hdr.Cap = t.SizeBytes() 17684 17685 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17686 // Since we bypassed the compiler's escape analysis, indicate that t 17687 // must live until the use above. 17688 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17689 return length, err 17690 } 17691 17692 // WriteTo implements io.WriterTo.WriteTo. 17693 func (t *TimerID) WriteTo(writer io.Writer) (int64, error) { 17694 // Construct a slice backed by dst's underlying memory. 17695 var buf []byte 17696 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17697 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 17698 hdr.Len = t.SizeBytes() 17699 hdr.Cap = t.SizeBytes() 17700 17701 length, err := writer.Write(buf) 17702 // Since we bypassed the compiler's escape analysis, indicate that t 17703 // must live until the use above. 17704 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 17705 return int64(length), err 17706 } 17707 17708 // SizeBytes implements marshal.Marshallable.SizeBytes. 17709 func (ts *Timespec) SizeBytes() int { 17710 return 16 17711 } 17712 17713 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17714 func (ts *Timespec) MarshalBytes(dst []byte) []byte { 17715 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Sec)) 17716 dst = dst[8:] 17717 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Nsec)) 17718 dst = dst[8:] 17719 return dst 17720 } 17721 17722 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17723 func (ts *Timespec) UnmarshalBytes(src []byte) []byte { 17724 ts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17725 src = src[8:] 17726 ts.Nsec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17727 src = src[8:] 17728 return src 17729 } 17730 17731 // Packed implements marshal.Marshallable.Packed. 17732 // 17733 //go:nosplit 17734 func (ts *Timespec) Packed() bool { 17735 return true 17736 } 17737 17738 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17739 func (ts *Timespec) MarshalUnsafe(dst []byte) []byte { 17740 size := ts.SizeBytes() 17741 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(size)) 17742 return dst[size:] 17743 } 17744 17745 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17746 func (ts *Timespec) UnmarshalUnsafe(src []byte) []byte { 17747 size := ts.SizeBytes() 17748 gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(size)) 17749 return src[size:] 17750 } 17751 17752 // CopyOutN implements marshal.Marshallable.CopyOutN. 17753 func (ts *Timespec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17754 // Construct a slice backed by dst's underlying memory. 17755 var buf []byte 17756 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17757 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 17758 hdr.Len = ts.SizeBytes() 17759 hdr.Cap = ts.SizeBytes() 17760 17761 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17762 // Since we bypassed the compiler's escape analysis, indicate that ts 17763 // must live until the use above. 17764 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 17765 return length, err 17766 } 17767 17768 // CopyOut implements marshal.Marshallable.CopyOut. 17769 func (ts *Timespec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17770 return ts.CopyOutN(cc, addr, ts.SizeBytes()) 17771 } 17772 17773 // CopyIn implements marshal.Marshallable.CopyIn. 17774 func (ts *Timespec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17775 // Construct a slice backed by dst's underlying memory. 17776 var buf []byte 17777 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17778 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 17779 hdr.Len = ts.SizeBytes() 17780 hdr.Cap = ts.SizeBytes() 17781 17782 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17783 // Since we bypassed the compiler's escape analysis, indicate that ts 17784 // must live until the use above. 17785 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 17786 return length, err 17787 } 17788 17789 // WriteTo implements io.WriterTo.WriteTo. 17790 func (ts *Timespec) WriteTo(writer io.Writer) (int64, error) { 17791 // Construct a slice backed by dst's underlying memory. 17792 var buf []byte 17793 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17794 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 17795 hdr.Len = ts.SizeBytes() 17796 hdr.Cap = ts.SizeBytes() 17797 17798 length, err := writer.Write(buf) 17799 // Since we bypassed the compiler's escape analysis, indicate that ts 17800 // must live until the use above. 17801 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 17802 return int64(length), err 17803 } 17804 17805 // CopyTimespecSliceIn copies in a slice of Timespec objects from the task's memory. 17806 func CopyTimespecSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timespec) (int, error) { 17807 count := len(dst) 17808 if count == 0 { 17809 return 0, nil 17810 } 17811 size := (*Timespec)(nil).SizeBytes() 17812 17813 ptr := unsafe.Pointer(&dst) 17814 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17815 17816 // Construct a slice backed by dst's underlying memory. 17817 var buf []byte 17818 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17819 hdr.Data = uintptr(val) 17820 hdr.Len = size * count 17821 hdr.Cap = size * count 17822 17823 length, err := cc.CopyInBytes(addr, buf) 17824 // Since we bypassed the compiler's escape analysis, indicate that dst 17825 // must live until the use above. 17826 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 17827 return length, err 17828 } 17829 17830 // CopyTimespecSliceOut copies a slice of Timespec objects to the task's memory. 17831 func CopyTimespecSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timespec) (int, error) { 17832 count := len(src) 17833 if count == 0 { 17834 return 0, nil 17835 } 17836 size := (*Timespec)(nil).SizeBytes() 17837 17838 ptr := unsafe.Pointer(&src) 17839 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17840 17841 // Construct a slice backed by dst's underlying memory. 17842 var buf []byte 17843 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17844 hdr.Data = uintptr(val) 17845 hdr.Len = size * count 17846 hdr.Cap = size * count 17847 17848 length, err := cc.CopyOutBytes(addr, buf) 17849 // Since we bypassed the compiler's escape analysis, indicate that src 17850 // must live until the use above. 17851 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 17852 return length, err 17853 } 17854 17855 // MarshalUnsafeTimespecSlice is like Timespec.MarshalUnsafe, but for a []Timespec. 17856 func MarshalUnsafeTimespecSlice(src []Timespec, dst []byte) []byte { 17857 count := len(src) 17858 if count == 0 { 17859 return dst 17860 } 17861 17862 size := (*Timespec)(nil).SizeBytes() 17863 buf := dst[:size*count] 17864 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 17865 return dst[size*count:] 17866 } 17867 17868 // UnmarshalUnsafeTimespecSlice is like Timespec.UnmarshalUnsafe, but for a []Timespec. 17869 func UnmarshalUnsafeTimespecSlice(dst []Timespec, src []byte) []byte { 17870 count := len(dst) 17871 if count == 0 { 17872 return src 17873 } 17874 17875 size := (*Timespec)(nil).SizeBytes() 17876 buf := src[:size*count] 17877 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 17878 return src[size*count:] 17879 } 17880 17881 // SizeBytes implements marshal.Marshallable.SizeBytes. 17882 func (tv *Timeval) SizeBytes() int { 17883 return 16 17884 } 17885 17886 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17887 func (tv *Timeval) MarshalBytes(dst []byte) []byte { 17888 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Sec)) 17889 dst = dst[8:] 17890 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Usec)) 17891 dst = dst[8:] 17892 return dst 17893 } 17894 17895 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17896 func (tv *Timeval) UnmarshalBytes(src []byte) []byte { 17897 tv.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17898 src = src[8:] 17899 tv.Usec = int64(hostarch.ByteOrder.Uint64(src[:8])) 17900 src = src[8:] 17901 return src 17902 } 17903 17904 // Packed implements marshal.Marshallable.Packed. 17905 // 17906 //go:nosplit 17907 func (tv *Timeval) Packed() bool { 17908 return true 17909 } 17910 17911 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17912 func (tv *Timeval) MarshalUnsafe(dst []byte) []byte { 17913 size := tv.SizeBytes() 17914 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(size)) 17915 return dst[size:] 17916 } 17917 17918 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17919 func (tv *Timeval) UnmarshalUnsafe(src []byte) []byte { 17920 size := tv.SizeBytes() 17921 gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(size)) 17922 return src[size:] 17923 } 17924 17925 // CopyOutN implements marshal.Marshallable.CopyOutN. 17926 func (tv *Timeval) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17927 // Construct a slice backed by dst's underlying memory. 17928 var buf []byte 17929 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17930 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 17931 hdr.Len = tv.SizeBytes() 17932 hdr.Cap = tv.SizeBytes() 17933 17934 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17935 // Since we bypassed the compiler's escape analysis, indicate that tv 17936 // must live until the use above. 17937 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 17938 return length, err 17939 } 17940 17941 // CopyOut implements marshal.Marshallable.CopyOut. 17942 func (tv *Timeval) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17943 return tv.CopyOutN(cc, addr, tv.SizeBytes()) 17944 } 17945 17946 // CopyIn implements marshal.Marshallable.CopyIn. 17947 func (tv *Timeval) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17948 // Construct a slice backed by dst's underlying memory. 17949 var buf []byte 17950 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17951 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 17952 hdr.Len = tv.SizeBytes() 17953 hdr.Cap = tv.SizeBytes() 17954 17955 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 17956 // Since we bypassed the compiler's escape analysis, indicate that tv 17957 // must live until the use above. 17958 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 17959 return length, err 17960 } 17961 17962 // WriteTo implements io.WriterTo.WriteTo. 17963 func (tv *Timeval) WriteTo(writer io.Writer) (int64, error) { 17964 // Construct a slice backed by dst's underlying memory. 17965 var buf []byte 17966 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17967 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 17968 hdr.Len = tv.SizeBytes() 17969 hdr.Cap = tv.SizeBytes() 17970 17971 length, err := writer.Write(buf) 17972 // Since we bypassed the compiler's escape analysis, indicate that tv 17973 // must live until the use above. 17974 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 17975 return int64(length), err 17976 } 17977 17978 // CopyTimevalSliceIn copies in a slice of Timeval objects from the task's memory. 17979 func CopyTimevalSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timeval) (int, error) { 17980 count := len(dst) 17981 if count == 0 { 17982 return 0, nil 17983 } 17984 size := (*Timeval)(nil).SizeBytes() 17985 17986 ptr := unsafe.Pointer(&dst) 17987 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 17988 17989 // Construct a slice backed by dst's underlying memory. 17990 var buf []byte 17991 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17992 hdr.Data = uintptr(val) 17993 hdr.Len = size * count 17994 hdr.Cap = size * count 17995 17996 length, err := cc.CopyInBytes(addr, buf) 17997 // Since we bypassed the compiler's escape analysis, indicate that dst 17998 // must live until the use above. 17999 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 18000 return length, err 18001 } 18002 18003 // CopyTimevalSliceOut copies a slice of Timeval objects to the task's memory. 18004 func CopyTimevalSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timeval) (int, error) { 18005 count := len(src) 18006 if count == 0 { 18007 return 0, nil 18008 } 18009 size := (*Timeval)(nil).SizeBytes() 18010 18011 ptr := unsafe.Pointer(&src) 18012 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 18013 18014 // Construct a slice backed by dst's underlying memory. 18015 var buf []byte 18016 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18017 hdr.Data = uintptr(val) 18018 hdr.Len = size * count 18019 hdr.Cap = size * count 18020 18021 length, err := cc.CopyOutBytes(addr, buf) 18022 // Since we bypassed the compiler's escape analysis, indicate that src 18023 // must live until the use above. 18024 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 18025 return length, err 18026 } 18027 18028 // MarshalUnsafeTimevalSlice is like Timeval.MarshalUnsafe, but for a []Timeval. 18029 func MarshalUnsafeTimevalSlice(src []Timeval, dst []byte) []byte { 18030 count := len(src) 18031 if count == 0 { 18032 return dst 18033 } 18034 18035 size := (*Timeval)(nil).SizeBytes() 18036 buf := dst[:size*count] 18037 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 18038 return dst[size*count:] 18039 } 18040 18041 // UnmarshalUnsafeTimevalSlice is like Timeval.UnmarshalUnsafe, but for a []Timeval. 18042 func UnmarshalUnsafeTimevalSlice(dst []Timeval, src []byte) []byte { 18043 count := len(dst) 18044 if count == 0 { 18045 return src 18046 } 18047 18048 size := (*Timeval)(nil).SizeBytes() 18049 buf := src[:size*count] 18050 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 18051 return src[size*count:] 18052 } 18053 18054 // SizeBytes implements marshal.Marshallable.SizeBytes. 18055 func (t *Tms) SizeBytes() int { 18056 return 0 + 18057 (*ClockT)(nil).SizeBytes() + 18058 (*ClockT)(nil).SizeBytes() + 18059 (*ClockT)(nil).SizeBytes() + 18060 (*ClockT)(nil).SizeBytes() 18061 } 18062 18063 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18064 func (t *Tms) MarshalBytes(dst []byte) []byte { 18065 dst = t.UTime.MarshalUnsafe(dst) 18066 dst = t.STime.MarshalUnsafe(dst) 18067 dst = t.CUTime.MarshalUnsafe(dst) 18068 dst = t.CSTime.MarshalUnsafe(dst) 18069 return dst 18070 } 18071 18072 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18073 func (t *Tms) UnmarshalBytes(src []byte) []byte { 18074 src = t.UTime.UnmarshalUnsafe(src) 18075 src = t.STime.UnmarshalUnsafe(src) 18076 src = t.CUTime.UnmarshalUnsafe(src) 18077 src = t.CSTime.UnmarshalUnsafe(src) 18078 return src 18079 } 18080 18081 // Packed implements marshal.Marshallable.Packed. 18082 // 18083 //go:nosplit 18084 func (t *Tms) Packed() bool { 18085 return t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() 18086 } 18087 18088 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18089 func (t *Tms) MarshalUnsafe(dst []byte) []byte { 18090 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18091 size := t.SizeBytes() 18092 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18093 return dst[size:] 18094 } 18095 // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes. 18096 return t.MarshalBytes(dst) 18097 } 18098 18099 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18100 func (t *Tms) UnmarshalUnsafe(src []byte) []byte { 18101 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18102 size := t.SizeBytes() 18103 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18104 return src[size:] 18105 } 18106 // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes. 18107 return t.UnmarshalBytes(src) 18108 } 18109 18110 // CopyOutN implements marshal.Marshallable.CopyOutN. 18111 func (t *Tms) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18112 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18113 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 18114 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 18115 t.MarshalBytes(buf) // escapes: fallback. 18116 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18117 } 18118 18119 // Construct a slice backed by dst's underlying memory. 18120 var buf []byte 18121 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18122 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18123 hdr.Len = t.SizeBytes() 18124 hdr.Cap = t.SizeBytes() 18125 18126 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18127 // Since we bypassed the compiler's escape analysis, indicate that t 18128 // must live until the use above. 18129 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18130 return length, err 18131 } 18132 18133 // CopyOut implements marshal.Marshallable.CopyOut. 18134 func (t *Tms) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18135 return t.CopyOutN(cc, addr, t.SizeBytes()) 18136 } 18137 18138 // CopyIn implements marshal.Marshallable.CopyIn. 18139 func (t *Tms) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18140 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18141 // Type Tms doesn't have a packed layout in memory, fall back to UnmarshalBytes. 18142 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 18143 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18144 // Unmarshal unconditionally. If we had a short copy-in, this results in a 18145 // partially unmarshalled struct. 18146 t.UnmarshalBytes(buf) // escapes: fallback. 18147 return length, err 18148 } 18149 18150 // Construct a slice backed by dst's underlying memory. 18151 var buf []byte 18152 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18153 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18154 hdr.Len = t.SizeBytes() 18155 hdr.Cap = t.SizeBytes() 18156 18157 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18158 // Since we bypassed the compiler's escape analysis, indicate that t 18159 // must live until the use above. 18160 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18161 return length, err 18162 } 18163 18164 // WriteTo implements io.WriterTo.WriteTo. 18165 func (t *Tms) WriteTo(writer io.Writer) (int64, error) { 18166 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 18167 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 18168 buf := make([]byte, t.SizeBytes()) 18169 t.MarshalBytes(buf) 18170 length, err := writer.Write(buf) 18171 return int64(length), err 18172 } 18173 18174 // Construct a slice backed by dst's underlying memory. 18175 var buf []byte 18176 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18177 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18178 hdr.Len = t.SizeBytes() 18179 hdr.Cap = t.SizeBytes() 18180 18181 length, err := writer.Write(buf) 18182 // Since we bypassed the compiler's escape analysis, indicate that t 18183 // must live until the use above. 18184 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18185 return int64(length), err 18186 } 18187 18188 // SizeBytes implements marshal.Marshallable.SizeBytes. 18189 func (u *Utime) SizeBytes() int { 18190 return 16 18191 } 18192 18193 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18194 func (u *Utime) MarshalBytes(dst []byte) []byte { 18195 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Actime)) 18196 dst = dst[8:] 18197 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Modtime)) 18198 dst = dst[8:] 18199 return dst 18200 } 18201 18202 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18203 func (u *Utime) UnmarshalBytes(src []byte) []byte { 18204 u.Actime = int64(hostarch.ByteOrder.Uint64(src[:8])) 18205 src = src[8:] 18206 u.Modtime = int64(hostarch.ByteOrder.Uint64(src[:8])) 18207 src = src[8:] 18208 return src 18209 } 18210 18211 // Packed implements marshal.Marshallable.Packed. 18212 // 18213 //go:nosplit 18214 func (u *Utime) Packed() bool { 18215 return true 18216 } 18217 18218 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18219 func (u *Utime) MarshalUnsafe(dst []byte) []byte { 18220 size := u.SizeBytes() 18221 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 18222 return dst[size:] 18223 } 18224 18225 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18226 func (u *Utime) UnmarshalUnsafe(src []byte) []byte { 18227 size := u.SizeBytes() 18228 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 18229 return src[size:] 18230 } 18231 18232 // CopyOutN implements marshal.Marshallable.CopyOutN. 18233 func (u *Utime) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18234 // Construct a slice backed by dst's underlying memory. 18235 var buf []byte 18236 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18237 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18238 hdr.Len = u.SizeBytes() 18239 hdr.Cap = u.SizeBytes() 18240 18241 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18242 // Since we bypassed the compiler's escape analysis, indicate that u 18243 // must live until the use above. 18244 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18245 return length, err 18246 } 18247 18248 // CopyOut implements marshal.Marshallable.CopyOut. 18249 func (u *Utime) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18250 return u.CopyOutN(cc, addr, u.SizeBytes()) 18251 } 18252 18253 // CopyIn implements marshal.Marshallable.CopyIn. 18254 func (u *Utime) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18255 // Construct a slice backed by dst's underlying memory. 18256 var buf []byte 18257 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18258 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18259 hdr.Len = u.SizeBytes() 18260 hdr.Cap = u.SizeBytes() 18261 18262 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18263 // Since we bypassed the compiler's escape analysis, indicate that u 18264 // must live until the use above. 18265 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18266 return length, err 18267 } 18268 18269 // WriteTo implements io.WriterTo.WriteTo. 18270 func (u *Utime) WriteTo(writer io.Writer) (int64, error) { 18271 // Construct a slice backed by dst's underlying memory. 18272 var buf []byte 18273 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18274 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18275 hdr.Len = u.SizeBytes() 18276 hdr.Cap = u.SizeBytes() 18277 18278 length, err := writer.Write(buf) 18279 // Since we bypassed the compiler's escape analysis, indicate that u 18280 // must live until the use above. 18281 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18282 return int64(length), err 18283 } 18284 18285 // SizeBytes implements marshal.Marshallable.SizeBytes. 18286 func (t *Termios) SizeBytes() int { 18287 return 17 + 18288 1*NumControlCharacters 18289 } 18290 18291 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18292 func (t *Termios) MarshalBytes(dst []byte) []byte { 18293 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.InputFlags)) 18294 dst = dst[4:] 18295 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.OutputFlags)) 18296 dst = dst[4:] 18297 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ControlFlags)) 18298 dst = dst[4:] 18299 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LocalFlags)) 18300 dst = dst[4:] 18301 dst[0] = byte(t.LineDiscipline) 18302 dst = dst[1:] 18303 for idx := 0; idx < NumControlCharacters; idx++ { 18304 dst[0] = byte(t.ControlCharacters[idx]) 18305 dst = dst[1:] 18306 } 18307 return dst 18308 } 18309 18310 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18311 func (t *Termios) UnmarshalBytes(src []byte) []byte { 18312 t.InputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18313 src = src[4:] 18314 t.OutputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18315 src = src[4:] 18316 t.ControlFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18317 src = src[4:] 18318 t.LocalFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18319 src = src[4:] 18320 t.LineDiscipline = uint8(src[0]) 18321 src = src[1:] 18322 for idx := 0; idx < NumControlCharacters; idx++ { 18323 t.ControlCharacters[idx] = uint8(src[0]) 18324 src = src[1:] 18325 } 18326 return src 18327 } 18328 18329 // Packed implements marshal.Marshallable.Packed. 18330 // 18331 //go:nosplit 18332 func (t *Termios) Packed() bool { 18333 return true 18334 } 18335 18336 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18337 func (t *Termios) MarshalUnsafe(dst []byte) []byte { 18338 size := t.SizeBytes() 18339 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18340 return dst[size:] 18341 } 18342 18343 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18344 func (t *Termios) UnmarshalUnsafe(src []byte) []byte { 18345 size := t.SizeBytes() 18346 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18347 return src[size:] 18348 } 18349 18350 // CopyOutN implements marshal.Marshallable.CopyOutN. 18351 func (t *Termios) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18352 // Construct a slice backed by dst's underlying memory. 18353 var buf []byte 18354 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18355 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18356 hdr.Len = t.SizeBytes() 18357 hdr.Cap = t.SizeBytes() 18358 18359 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18360 // Since we bypassed the compiler's escape analysis, indicate that t 18361 // must live until the use above. 18362 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18363 return length, err 18364 } 18365 18366 // CopyOut implements marshal.Marshallable.CopyOut. 18367 func (t *Termios) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18368 return t.CopyOutN(cc, addr, t.SizeBytes()) 18369 } 18370 18371 // CopyIn implements marshal.Marshallable.CopyIn. 18372 func (t *Termios) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18373 // Construct a slice backed by dst's underlying memory. 18374 var buf []byte 18375 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18376 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18377 hdr.Len = t.SizeBytes() 18378 hdr.Cap = t.SizeBytes() 18379 18380 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18381 // Since we bypassed the compiler's escape analysis, indicate that t 18382 // must live until the use above. 18383 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18384 return length, err 18385 } 18386 18387 // WriteTo implements io.WriterTo.WriteTo. 18388 func (t *Termios) WriteTo(writer io.Writer) (int64, error) { 18389 // Construct a slice backed by dst's underlying memory. 18390 var buf []byte 18391 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18392 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18393 hdr.Len = t.SizeBytes() 18394 hdr.Cap = t.SizeBytes() 18395 18396 length, err := writer.Write(buf) 18397 // Since we bypassed the compiler's escape analysis, indicate that t 18398 // must live until the use above. 18399 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18400 return int64(length), err 18401 } 18402 18403 // SizeBytes implements marshal.Marshallable.SizeBytes. 18404 func (w *WindowSize) SizeBytes() int { 18405 return 4 + 18406 1*4 18407 } 18408 18409 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18410 func (w *WindowSize) MarshalBytes(dst []byte) []byte { 18411 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Rows)) 18412 dst = dst[2:] 18413 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Cols)) 18414 dst = dst[2:] 18415 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 18416 dst = dst[1*(4):] 18417 return dst 18418 } 18419 18420 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18421 func (w *WindowSize) UnmarshalBytes(src []byte) []byte { 18422 w.Rows = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18423 src = src[2:] 18424 w.Cols = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18425 src = src[2:] 18426 // Padding: ~ copy([4]byte(w._), src[:sizeof(byte)*4]) 18427 src = src[1*(4):] 18428 return src 18429 } 18430 18431 // Packed implements marshal.Marshallable.Packed. 18432 // 18433 //go:nosplit 18434 func (w *WindowSize) Packed() bool { 18435 return true 18436 } 18437 18438 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18439 func (w *WindowSize) MarshalUnsafe(dst []byte) []byte { 18440 size := w.SizeBytes() 18441 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 18442 return dst[size:] 18443 } 18444 18445 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18446 func (w *WindowSize) UnmarshalUnsafe(src []byte) []byte { 18447 size := w.SizeBytes() 18448 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 18449 return src[size:] 18450 } 18451 18452 // CopyOutN implements marshal.Marshallable.CopyOutN. 18453 func (w *WindowSize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18454 // Construct a slice backed by dst's underlying memory. 18455 var buf []byte 18456 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18457 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18458 hdr.Len = w.SizeBytes() 18459 hdr.Cap = w.SizeBytes() 18460 18461 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18462 // Since we bypassed the compiler's escape analysis, indicate that w 18463 // must live until the use above. 18464 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18465 return length, err 18466 } 18467 18468 // CopyOut implements marshal.Marshallable.CopyOut. 18469 func (w *WindowSize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18470 return w.CopyOutN(cc, addr, w.SizeBytes()) 18471 } 18472 18473 // CopyIn implements marshal.Marshallable.CopyIn. 18474 func (w *WindowSize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18475 // Construct a slice backed by dst's underlying memory. 18476 var buf []byte 18477 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18478 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18479 hdr.Len = w.SizeBytes() 18480 hdr.Cap = w.SizeBytes() 18481 18482 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18483 // Since we bypassed the compiler's escape analysis, indicate that w 18484 // must live until the use above. 18485 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18486 return length, err 18487 } 18488 18489 // WriteTo implements io.WriterTo.WriteTo. 18490 func (w *WindowSize) WriteTo(writer io.Writer) (int64, error) { 18491 // Construct a slice backed by dst's underlying memory. 18492 var buf []byte 18493 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18494 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18495 hdr.Len = w.SizeBytes() 18496 hdr.Cap = w.SizeBytes() 18497 18498 length, err := writer.Write(buf) 18499 // Since we bypassed the compiler's escape analysis, indicate that w 18500 // must live until the use above. 18501 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18502 return int64(length), err 18503 } 18504 18505 // SizeBytes implements marshal.Marshallable.SizeBytes. 18506 func (w *Winsize) SizeBytes() int { 18507 return 8 18508 } 18509 18510 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18511 func (w *Winsize) MarshalBytes(dst []byte) []byte { 18512 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Row)) 18513 dst = dst[2:] 18514 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Col)) 18515 dst = dst[2:] 18516 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Xpixel)) 18517 dst = dst[2:] 18518 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Ypixel)) 18519 dst = dst[2:] 18520 return dst 18521 } 18522 18523 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18524 func (w *Winsize) UnmarshalBytes(src []byte) []byte { 18525 w.Row = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18526 src = src[2:] 18527 w.Col = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18528 src = src[2:] 18529 w.Xpixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18530 src = src[2:] 18531 w.Ypixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18532 src = src[2:] 18533 return src 18534 } 18535 18536 // Packed implements marshal.Marshallable.Packed. 18537 // 18538 //go:nosplit 18539 func (w *Winsize) Packed() bool { 18540 return true 18541 } 18542 18543 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18544 func (w *Winsize) MarshalUnsafe(dst []byte) []byte { 18545 size := w.SizeBytes() 18546 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 18547 return dst[size:] 18548 } 18549 18550 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18551 func (w *Winsize) UnmarshalUnsafe(src []byte) []byte { 18552 size := w.SizeBytes() 18553 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 18554 return src[size:] 18555 } 18556 18557 // CopyOutN implements marshal.Marshallable.CopyOutN. 18558 func (w *Winsize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18559 // Construct a slice backed by dst's underlying memory. 18560 var buf []byte 18561 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18562 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18563 hdr.Len = w.SizeBytes() 18564 hdr.Cap = w.SizeBytes() 18565 18566 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18567 // Since we bypassed the compiler's escape analysis, indicate that w 18568 // must live until the use above. 18569 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18570 return length, err 18571 } 18572 18573 // CopyOut implements marshal.Marshallable.CopyOut. 18574 func (w *Winsize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18575 return w.CopyOutN(cc, addr, w.SizeBytes()) 18576 } 18577 18578 // CopyIn implements marshal.Marshallable.CopyIn. 18579 func (w *Winsize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18580 // Construct a slice backed by dst's underlying memory. 18581 var buf []byte 18582 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18583 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18584 hdr.Len = w.SizeBytes() 18585 hdr.Cap = w.SizeBytes() 18586 18587 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18588 // Since we bypassed the compiler's escape analysis, indicate that w 18589 // must live until the use above. 18590 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18591 return length, err 18592 } 18593 18594 // WriteTo implements io.WriterTo.WriteTo. 18595 func (w *Winsize) WriteTo(writer io.Writer) (int64, error) { 18596 // Construct a slice backed by dst's underlying memory. 18597 var buf []byte 18598 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18599 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 18600 hdr.Len = w.SizeBytes() 18601 hdr.Cap = w.SizeBytes() 18602 18603 length, err := writer.Write(buf) 18604 // Since we bypassed the compiler's escape analysis, indicate that w 18605 // must live until the use above. 18606 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 18607 return int64(length), err 18608 } 18609 18610 // SizeBytes implements marshal.Marshallable.SizeBytes. 18611 func (u *UtsName) SizeBytes() int { 18612 return 0 + 18613 1*(UTSLen+1) + 18614 1*(UTSLen+1) + 18615 1*(UTSLen+1) + 18616 1*(UTSLen+1) + 18617 1*(UTSLen+1) + 18618 1*(UTSLen+1) 18619 } 18620 18621 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18622 func (u *UtsName) MarshalBytes(dst []byte) []byte { 18623 for idx := 0; idx < (UTSLen + 1); idx++ { 18624 dst[0] = byte(u.Sysname[idx]) 18625 dst = dst[1:] 18626 } 18627 for idx := 0; idx < (UTSLen + 1); idx++ { 18628 dst[0] = byte(u.Nodename[idx]) 18629 dst = dst[1:] 18630 } 18631 for idx := 0; idx < (UTSLen + 1); idx++ { 18632 dst[0] = byte(u.Release[idx]) 18633 dst = dst[1:] 18634 } 18635 for idx := 0; idx < (UTSLen + 1); idx++ { 18636 dst[0] = byte(u.Version[idx]) 18637 dst = dst[1:] 18638 } 18639 for idx := 0; idx < (UTSLen + 1); idx++ { 18640 dst[0] = byte(u.Machine[idx]) 18641 dst = dst[1:] 18642 } 18643 for idx := 0; idx < (UTSLen + 1); idx++ { 18644 dst[0] = byte(u.Domainname[idx]) 18645 dst = dst[1:] 18646 } 18647 return dst 18648 } 18649 18650 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18651 func (u *UtsName) UnmarshalBytes(src []byte) []byte { 18652 for idx := 0; idx < (UTSLen + 1); idx++ { 18653 u.Sysname[idx] = src[0] 18654 src = src[1:] 18655 } 18656 for idx := 0; idx < (UTSLen + 1); idx++ { 18657 u.Nodename[idx] = src[0] 18658 src = src[1:] 18659 } 18660 for idx := 0; idx < (UTSLen + 1); idx++ { 18661 u.Release[idx] = src[0] 18662 src = src[1:] 18663 } 18664 for idx := 0; idx < (UTSLen + 1); idx++ { 18665 u.Version[idx] = src[0] 18666 src = src[1:] 18667 } 18668 for idx := 0; idx < (UTSLen + 1); idx++ { 18669 u.Machine[idx] = src[0] 18670 src = src[1:] 18671 } 18672 for idx := 0; idx < (UTSLen + 1); idx++ { 18673 u.Domainname[idx] = src[0] 18674 src = src[1:] 18675 } 18676 return src 18677 } 18678 18679 // Packed implements marshal.Marshallable.Packed. 18680 // 18681 //go:nosplit 18682 func (u *UtsName) Packed() bool { 18683 return true 18684 } 18685 18686 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18687 func (u *UtsName) MarshalUnsafe(dst []byte) []byte { 18688 size := u.SizeBytes() 18689 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 18690 return dst[size:] 18691 } 18692 18693 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18694 func (u *UtsName) UnmarshalUnsafe(src []byte) []byte { 18695 size := u.SizeBytes() 18696 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 18697 return src[size:] 18698 } 18699 18700 // CopyOutN implements marshal.Marshallable.CopyOutN. 18701 func (u *UtsName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18702 // Construct a slice backed by dst's underlying memory. 18703 var buf []byte 18704 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18705 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18706 hdr.Len = u.SizeBytes() 18707 hdr.Cap = u.SizeBytes() 18708 18709 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18710 // Since we bypassed the compiler's escape analysis, indicate that u 18711 // must live until the use above. 18712 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18713 return length, err 18714 } 18715 18716 // CopyOut implements marshal.Marshallable.CopyOut. 18717 func (u *UtsName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18718 return u.CopyOutN(cc, addr, u.SizeBytes()) 18719 } 18720 18721 // CopyIn implements marshal.Marshallable.CopyIn. 18722 func (u *UtsName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18723 // Construct a slice backed by dst's underlying memory. 18724 var buf []byte 18725 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18726 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18727 hdr.Len = u.SizeBytes() 18728 hdr.Cap = u.SizeBytes() 18729 18730 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 18731 // Since we bypassed the compiler's escape analysis, indicate that u 18732 // must live until the use above. 18733 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18734 return length, err 18735 } 18736 18737 // WriteTo implements io.WriterTo.WriteTo. 18738 func (u *UtsName) WriteTo(writer io.Writer) (int64, error) { 18739 // Construct a slice backed by dst's underlying memory. 18740 var buf []byte 18741 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18742 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 18743 hdr.Len = u.SizeBytes() 18744 hdr.Cap = u.SizeBytes() 18745 18746 length, err := writer.Write(buf) 18747 // Since we bypassed the compiler's escape analysis, indicate that u 18748 // must live until the use above. 18749 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 18750 return int64(length), err 18751 }