github.com/metacubex/gvisor@v0.0.0-20240320004321-933faba989ec/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/metacubex/gvisor/pkg/gohacks" 7 "github.com/metacubex/gvisor/pkg/hostarch" 8 "github.com/metacubex/gvisor/pkg/marshal" 9 "io" 10 "reflect" 11 "runtime" 12 "unsafe" 13 ) 14 15 // Marshallable types used by this file. 16 var _ marshal.Marshallable = (*BPFInstruction)(nil) 17 var _ marshal.Marshallable = (*CString)(nil) 18 var _ marshal.Marshallable = (*CapUserData)(nil) 19 var _ marshal.Marshallable = (*CapUserHeader)(nil) 20 var _ marshal.Marshallable = (*ClockT)(nil) 21 var _ marshal.Marshallable = (*CloneArgs)(nil) 22 var _ marshal.Marshallable = (*ControlMessageCredentials)(nil) 23 var _ marshal.Marshallable = (*ControlMessageHeader)(nil) 24 var _ marshal.Marshallable = (*ControlMessageIPPacketInfo)(nil) 25 var _ marshal.Marshallable = (*ControlMessageIPv6PacketInfo)(nil) 26 var _ marshal.Marshallable = (*ElfHeader64)(nil) 27 var _ marshal.Marshallable = (*ElfProg64)(nil) 28 var _ marshal.Marshallable = (*ElfSection64)(nil) 29 var _ marshal.Marshallable = (*ErrorName)(nil) 30 var _ marshal.Marshallable = (*EthtoolCmd)(nil) 31 var _ marshal.Marshallable = (*EthtoolGFeatures)(nil) 32 var _ marshal.Marshallable = (*EthtoolGetFeaturesBlock)(nil) 33 var _ marshal.Marshallable = (*ExtensionName)(nil) 34 var _ marshal.Marshallable = (*FOwnerEx)(nil) 35 var _ marshal.Marshallable = (*FUSEAccessIn)(nil) 36 var _ marshal.Marshallable = (*FUSEAttr)(nil) 37 var _ marshal.Marshallable = (*FUSEAttrOut)(nil) 38 var _ marshal.Marshallable = (*FUSECreateIn)(nil) 39 var _ marshal.Marshallable = (*FUSECreateMeta)(nil) 40 var _ marshal.Marshallable = (*FUSECreateOut)(nil) 41 var _ marshal.Marshallable = (*FUSEDirent)(nil) 42 var _ marshal.Marshallable = (*FUSEDirentMeta)(nil) 43 var _ marshal.Marshallable = (*FUSEDirents)(nil) 44 var _ marshal.Marshallable = (*FUSEEmptyIn)(nil) 45 var _ marshal.Marshallable = (*FUSEEntryOut)(nil) 46 var _ marshal.Marshallable = (*FUSEFallocateIn)(nil) 47 var _ marshal.Marshallable = (*FUSEFlushIn)(nil) 48 var _ marshal.Marshallable = (*FUSEFsyncIn)(nil) 49 var _ marshal.Marshallable = (*FUSEGetAttrIn)(nil) 50 var _ marshal.Marshallable = (*FUSEHeaderIn)(nil) 51 var _ marshal.Marshallable = (*FUSEHeaderOut)(nil) 52 var _ marshal.Marshallable = (*FUSEInitIn)(nil) 53 var _ marshal.Marshallable = (*FUSEInitOut)(nil) 54 var _ marshal.Marshallable = (*FUSELinkIn)(nil) 55 var _ marshal.Marshallable = (*FUSELookupIn)(nil) 56 var _ marshal.Marshallable = (*FUSEMkdirIn)(nil) 57 var _ marshal.Marshallable = (*FUSEMkdirMeta)(nil) 58 var _ marshal.Marshallable = (*FUSEMknodIn)(nil) 59 var _ marshal.Marshallable = (*FUSEMknodMeta)(nil) 60 var _ marshal.Marshallable = (*FUSEOpID)(nil) 61 var _ marshal.Marshallable = (*FUSEOpcode)(nil) 62 var _ marshal.Marshallable = (*FUSEOpenIn)(nil) 63 var _ marshal.Marshallable = (*FUSEOpenOut)(nil) 64 var _ marshal.Marshallable = (*FUSEReadIn)(nil) 65 var _ marshal.Marshallable = (*FUSEReleaseIn)(nil) 66 var _ marshal.Marshallable = (*FUSERenameIn)(nil) 67 var _ marshal.Marshallable = (*FUSERmDirIn)(nil) 68 var _ marshal.Marshallable = (*FUSESetAttrIn)(nil) 69 var _ marshal.Marshallable = (*FUSEStatfsOut)(nil) 70 var _ marshal.Marshallable = (*FUSESymlinkIn)(nil) 71 var _ marshal.Marshallable = (*FUSEUnlinkIn)(nil) 72 var _ marshal.Marshallable = (*FUSEWriteIn)(nil) 73 var _ marshal.Marshallable = (*FUSEWriteOut)(nil) 74 var _ marshal.Marshallable = (*FUSEWritePayloadIn)(nil) 75 var _ marshal.Marshallable = (*FileMode)(nil) 76 var _ marshal.Marshallable = (*Flock)(nil) 77 var _ marshal.Marshallable = (*ICMP6Filter)(nil) 78 var _ marshal.Marshallable = (*IFConf)(nil) 79 var _ marshal.Marshallable = (*IFReq)(nil) 80 var _ marshal.Marshallable = (*IOCallback)(nil) 81 var _ marshal.Marshallable = (*IOCqRingOffsets)(nil) 82 var _ marshal.Marshallable = (*IOEvent)(nil) 83 var _ marshal.Marshallable = (*IORingIndex)(nil) 84 var _ marshal.Marshallable = (*IORings)(nil) 85 var _ marshal.Marshallable = (*IOSqRingOffsets)(nil) 86 var _ marshal.Marshallable = (*IOUring)(nil) 87 var _ marshal.Marshallable = (*IOUringCqe)(nil) 88 var _ marshal.Marshallable = (*IOUringParams)(nil) 89 var _ marshal.Marshallable = (*IOUringSqe)(nil) 90 var _ marshal.Marshallable = (*IP6TEntry)(nil) 91 var _ marshal.Marshallable = (*IP6TIP)(nil) 92 var _ marshal.Marshallable = (*IP6TReplace)(nil) 93 var _ marshal.Marshallable = (*IPCPerm)(nil) 94 var _ marshal.Marshallable = (*IPTEntry)(nil) 95 var _ marshal.Marshallable = (*IPTGetEntries)(nil) 96 var _ marshal.Marshallable = (*IPTGetinfo)(nil) 97 var _ marshal.Marshallable = (*IPTIP)(nil) 98 var _ marshal.Marshallable = (*IPTOwnerInfo)(nil) 99 var _ marshal.Marshallable = (*IPTReplace)(nil) 100 var _ marshal.Marshallable = (*Inet6Addr)(nil) 101 var _ marshal.Marshallable = (*Inet6MulticastRequest)(nil) 102 var _ marshal.Marshallable = (*InetAddr)(nil) 103 var _ marshal.Marshallable = (*InetMulticastRequest)(nil) 104 var _ marshal.Marshallable = (*InetMulticastRequestWithNIC)(nil) 105 var _ marshal.Marshallable = (*InterfaceAddrMessage)(nil) 106 var _ marshal.Marshallable = (*InterfaceInfoMessage)(nil) 107 var _ marshal.Marshallable = (*ItimerVal)(nil) 108 var _ marshal.Marshallable = (*Itimerspec)(nil) 109 var _ marshal.Marshallable = (*KernelIP6TEntry)(nil) 110 var _ marshal.Marshallable = (*KernelIP6TGetEntries)(nil) 111 var _ marshal.Marshallable = (*KernelIPTEntry)(nil) 112 var _ marshal.Marshallable = (*KernelIPTGetEntries)(nil) 113 var _ marshal.Marshallable = (*Linger)(nil) 114 var _ marshal.Marshallable = (*MqAttr)(nil) 115 var _ marshal.Marshallable = (*MsgBuf)(nil) 116 var _ marshal.Marshallable = (*MsgInfo)(nil) 117 var _ marshal.Marshallable = (*MsqidDS)(nil) 118 var _ marshal.Marshallable = (*NFNATRange)(nil) 119 var _ marshal.Marshallable = (*NFNATRange2)(nil) 120 var _ marshal.Marshallable = (*NetlinkAttrHeader)(nil) 121 var _ marshal.Marshallable = (*NetlinkErrorMessage)(nil) 122 var _ marshal.Marshallable = (*NetlinkMessageHeader)(nil) 123 var _ marshal.Marshallable = (*NfNATIPV4MultiRangeCompat)(nil) 124 var _ marshal.Marshallable = (*NfNATIPV4Range)(nil) 125 var _ marshal.Marshallable = (*NumaPolicy)(nil) 126 var _ marshal.Marshallable = (*PollFD)(nil) 127 var _ marshal.Marshallable = (*RSeqCriticalSection)(nil) 128 var _ marshal.Marshallable = (*RobustListHead)(nil) 129 var _ marshal.Marshallable = (*RouteMessage)(nil) 130 var _ marshal.Marshallable = (*RtAttr)(nil) 131 var _ marshal.Marshallable = (*Rusage)(nil) 132 var _ marshal.Marshallable = (*SeccompData)(nil) 133 var _ marshal.Marshallable = (*SemInfo)(nil) 134 var _ marshal.Marshallable = (*Sembuf)(nil) 135 var _ marshal.Marshallable = (*ShmInfo)(nil) 136 var _ marshal.Marshallable = (*ShmParams)(nil) 137 var _ marshal.Marshallable = (*ShmidDS)(nil) 138 var _ marshal.Marshallable = (*SigAction)(nil) 139 var _ marshal.Marshallable = (*Sigevent)(nil) 140 var _ marshal.Marshallable = (*SignalInfo)(nil) 141 var _ marshal.Marshallable = (*SignalSet)(nil) 142 var _ marshal.Marshallable = (*SignalStack)(nil) 143 var _ marshal.Marshallable = (*SignalfdSiginfo)(nil) 144 var _ marshal.Marshallable = (*SockAddrInet)(nil) 145 var _ marshal.Marshallable = (*SockAddrInet6)(nil) 146 var _ marshal.Marshallable = (*SockAddrLink)(nil) 147 var _ marshal.Marshallable = (*SockAddrNetlink)(nil) 148 var _ marshal.Marshallable = (*SockAddrUnix)(nil) 149 var _ marshal.Marshallable = (*SockErrCMsgIPv4)(nil) 150 var _ marshal.Marshallable = (*SockErrCMsgIPv6)(nil) 151 var _ marshal.Marshallable = (*SockExtendedErr)(nil) 152 var _ marshal.Marshallable = (*Statfs)(nil) 153 var _ marshal.Marshallable = (*Statx)(nil) 154 var _ marshal.Marshallable = (*StatxTimestamp)(nil) 155 var _ marshal.Marshallable = (*Sysinfo)(nil) 156 var _ marshal.Marshallable = (*TCPInfo)(nil) 157 var _ marshal.Marshallable = (*TableName)(nil) 158 var _ marshal.Marshallable = (*Termios)(nil) 159 var _ marshal.Marshallable = (*TimeT)(nil) 160 var _ marshal.Marshallable = (*TimerID)(nil) 161 var _ marshal.Marshallable = (*Timespec)(nil) 162 var _ marshal.Marshallable = (*Timeval)(nil) 163 var _ marshal.Marshallable = (*Tms)(nil) 164 var _ marshal.Marshallable = (*Utime)(nil) 165 var _ marshal.Marshallable = (*UtsName)(nil) 166 var _ marshal.Marshallable = (*WindowSize)(nil) 167 var _ marshal.Marshallable = (*Winsize)(nil) 168 var _ marshal.Marshallable = (*XTCounters)(nil) 169 var _ marshal.Marshallable = (*XTEntryMatch)(nil) 170 var _ marshal.Marshallable = (*XTEntryTarget)(nil) 171 var _ marshal.Marshallable = (*XTErrorTarget)(nil) 172 var _ marshal.Marshallable = (*XTGetRevision)(nil) 173 var _ marshal.Marshallable = (*XTNATTargetV0)(nil) 174 var _ marshal.Marshallable = (*XTNATTargetV1)(nil) 175 var _ marshal.Marshallable = (*XTNATTargetV2)(nil) 176 var _ marshal.Marshallable = (*XTOwnerMatchInfo)(nil) 177 var _ marshal.Marshallable = (*XTRedirectTarget)(nil) 178 var _ marshal.Marshallable = (*XTStandardTarget)(nil) 179 var _ marshal.Marshallable = (*XTTCP)(nil) 180 var _ marshal.Marshallable = (*XTUDP)(nil) 181 182 // SizeBytes implements marshal.Marshallable.SizeBytes. 183 func (i *IOCallback) SizeBytes() int { 184 return 64 185 } 186 187 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 188 func (i *IOCallback) MarshalBytes(dst []byte) []byte { 189 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 190 dst = dst[8:] 191 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 192 dst = dst[4:] 193 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 194 dst = dst[4:] 195 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.OpCode)) 196 dst = dst[2:] 197 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.ReqPrio)) 198 dst = dst[2:] 199 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.FD)) 200 dst = dst[4:] 201 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Buf)) 202 dst = dst[8:] 203 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Bytes)) 204 dst = dst[8:] 205 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Offset)) 206 dst = dst[8:] 207 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Reserved2)) 208 dst = dst[8:] 209 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 210 dst = dst[4:] 211 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ResFD)) 212 dst = dst[4:] 213 return dst 214 } 215 216 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 217 func (i *IOCallback) UnmarshalBytes(src []byte) []byte { 218 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 219 src = src[8:] 220 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 221 src = src[4:] 222 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 223 src = src[4:] 224 i.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 225 src = src[2:] 226 i.ReqPrio = int16(hostarch.ByteOrder.Uint16(src[:2])) 227 src = src[2:] 228 i.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 229 src = src[4:] 230 i.Buf = uint64(hostarch.ByteOrder.Uint64(src[:8])) 231 src = src[8:] 232 i.Bytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 233 src = src[8:] 234 i.Offset = int64(hostarch.ByteOrder.Uint64(src[:8])) 235 src = src[8:] 236 i.Reserved2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 237 src = src[8:] 238 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 239 src = src[4:] 240 i.ResFD = int32(hostarch.ByteOrder.Uint32(src[:4])) 241 src = src[4:] 242 return src 243 } 244 245 // Packed implements marshal.Marshallable.Packed. 246 //go:nosplit 247 func (i *IOCallback) Packed() bool { 248 return true 249 } 250 251 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 252 func (i *IOCallback) MarshalUnsafe(dst []byte) []byte { 253 size := i.SizeBytes() 254 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 255 return dst[size:] 256 } 257 258 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 259 func (i *IOCallback) UnmarshalUnsafe(src []byte) []byte { 260 size := i.SizeBytes() 261 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 262 return src[size:] 263 } 264 265 // CopyOutN implements marshal.Marshallable.CopyOutN. 266 func (i *IOCallback) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 267 // Construct a slice backed by dst's underlying memory. 268 var buf []byte 269 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 270 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 271 hdr.Len = i.SizeBytes() 272 hdr.Cap = i.SizeBytes() 273 274 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 275 // Since we bypassed the compiler's escape analysis, indicate that i 276 // must live until the use above. 277 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 278 return length, err 279 } 280 281 // CopyOut implements marshal.Marshallable.CopyOut. 282 func (i *IOCallback) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 283 return i.CopyOutN(cc, addr, i.SizeBytes()) 284 } 285 286 // CopyInN implements marshal.Marshallable.CopyInN. 287 func (i *IOCallback) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 288 // Construct a slice backed by dst's underlying memory. 289 var buf []byte 290 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 291 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 292 hdr.Len = i.SizeBytes() 293 hdr.Cap = i.SizeBytes() 294 295 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 296 // Since we bypassed the compiler's escape analysis, indicate that i 297 // must live until the use above. 298 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 299 return length, err 300 } 301 302 // CopyIn implements marshal.Marshallable.CopyIn. 303 func (i *IOCallback) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 304 return i.CopyInN(cc, addr, i.SizeBytes()) 305 } 306 307 // WriteTo implements io.WriterTo.WriteTo. 308 func (i *IOCallback) WriteTo(writer io.Writer) (int64, error) { 309 // Construct a slice backed by dst's underlying memory. 310 var buf []byte 311 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 312 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 313 hdr.Len = i.SizeBytes() 314 hdr.Cap = i.SizeBytes() 315 316 length, err := writer.Write(buf) 317 // Since we bypassed the compiler's escape analysis, indicate that i 318 // must live until the use above. 319 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 320 return int64(length), err 321 } 322 323 // SizeBytes implements marshal.Marshallable.SizeBytes. 324 func (i *IOEvent) SizeBytes() int { 325 return 32 326 } 327 328 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 329 func (i *IOEvent) MarshalBytes(dst []byte) []byte { 330 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Data)) 331 dst = dst[8:] 332 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Obj)) 333 dst = dst[8:] 334 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result)) 335 dst = dst[8:] 336 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Result2)) 337 dst = dst[8:] 338 return dst 339 } 340 341 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 342 func (i *IOEvent) UnmarshalBytes(src []byte) []byte { 343 i.Data = uint64(hostarch.ByteOrder.Uint64(src[:8])) 344 src = src[8:] 345 i.Obj = uint64(hostarch.ByteOrder.Uint64(src[:8])) 346 src = src[8:] 347 i.Result = int64(hostarch.ByteOrder.Uint64(src[:8])) 348 src = src[8:] 349 i.Result2 = int64(hostarch.ByteOrder.Uint64(src[:8])) 350 src = src[8:] 351 return src 352 } 353 354 // Packed implements marshal.Marshallable.Packed. 355 //go:nosplit 356 func (i *IOEvent) Packed() bool { 357 return true 358 } 359 360 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 361 func (i *IOEvent) MarshalUnsafe(dst []byte) []byte { 362 size := i.SizeBytes() 363 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 364 return dst[size:] 365 } 366 367 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 368 func (i *IOEvent) UnmarshalUnsafe(src []byte) []byte { 369 size := i.SizeBytes() 370 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 371 return src[size:] 372 } 373 374 // CopyOutN implements marshal.Marshallable.CopyOutN. 375 func (i *IOEvent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 376 // Construct a slice backed by dst's underlying memory. 377 var buf []byte 378 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 379 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 380 hdr.Len = i.SizeBytes() 381 hdr.Cap = i.SizeBytes() 382 383 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 384 // Since we bypassed the compiler's escape analysis, indicate that i 385 // must live until the use above. 386 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 387 return length, err 388 } 389 390 // CopyOut implements marshal.Marshallable.CopyOut. 391 func (i *IOEvent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 392 return i.CopyOutN(cc, addr, i.SizeBytes()) 393 } 394 395 // CopyInN implements marshal.Marshallable.CopyInN. 396 func (i *IOEvent) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 397 // Construct a slice backed by dst's underlying memory. 398 var buf []byte 399 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 400 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 401 hdr.Len = i.SizeBytes() 402 hdr.Cap = i.SizeBytes() 403 404 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 405 // Since we bypassed the compiler's escape analysis, indicate that i 406 // must live until the use above. 407 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 408 return length, err 409 } 410 411 // CopyIn implements marshal.Marshallable.CopyIn. 412 func (i *IOEvent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 413 return i.CopyInN(cc, addr, i.SizeBytes()) 414 } 415 416 // WriteTo implements io.WriterTo.WriteTo. 417 func (i *IOEvent) WriteTo(writer io.Writer) (int64, error) { 418 // Construct a slice backed by dst's underlying memory. 419 var buf []byte 420 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 421 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 422 hdr.Len = i.SizeBytes() 423 hdr.Cap = i.SizeBytes() 424 425 length, err := writer.Write(buf) 426 // Since we bypassed the compiler's escape analysis, indicate that i 427 // must live until the use above. 428 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 429 return int64(length), err 430 } 431 432 // SizeBytes implements marshal.Marshallable.SizeBytes. 433 func (b *BPFInstruction) SizeBytes() int { 434 return 8 435 } 436 437 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 438 func (b *BPFInstruction) MarshalBytes(dst []byte) []byte { 439 hostarch.ByteOrder.PutUint16(dst[:2], uint16(b.OpCode)) 440 dst = dst[2:] 441 dst[0] = byte(b.JumpIfTrue) 442 dst = dst[1:] 443 dst[0] = byte(b.JumpIfFalse) 444 dst = dst[1:] 445 hostarch.ByteOrder.PutUint32(dst[:4], uint32(b.K)) 446 dst = dst[4:] 447 return dst 448 } 449 450 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 451 func (b *BPFInstruction) UnmarshalBytes(src []byte) []byte { 452 b.OpCode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 453 src = src[2:] 454 b.JumpIfTrue = uint8(src[0]) 455 src = src[1:] 456 b.JumpIfFalse = uint8(src[0]) 457 src = src[1:] 458 b.K = uint32(hostarch.ByteOrder.Uint32(src[:4])) 459 src = src[4:] 460 return src 461 } 462 463 // Packed implements marshal.Marshallable.Packed. 464 //go:nosplit 465 func (b *BPFInstruction) Packed() bool { 466 return true 467 } 468 469 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 470 func (b *BPFInstruction) MarshalUnsafe(dst []byte) []byte { 471 size := b.SizeBytes() 472 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size)) 473 return dst[size:] 474 } 475 476 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 477 func (b *BPFInstruction) UnmarshalUnsafe(src []byte) []byte { 478 size := b.SizeBytes() 479 gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size)) 480 return src[size:] 481 } 482 483 // CopyOutN implements marshal.Marshallable.CopyOutN. 484 func (b *BPFInstruction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 485 // Construct a slice backed by dst's underlying memory. 486 var buf []byte 487 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 488 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 489 hdr.Len = b.SizeBytes() 490 hdr.Cap = b.SizeBytes() 491 492 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 493 // Since we bypassed the compiler's escape analysis, indicate that b 494 // must live until the use above. 495 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 496 return length, err 497 } 498 499 // CopyOut implements marshal.Marshallable.CopyOut. 500 func (b *BPFInstruction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 501 return b.CopyOutN(cc, addr, b.SizeBytes()) 502 } 503 504 // CopyInN implements marshal.Marshallable.CopyInN. 505 func (b *BPFInstruction) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 506 // Construct a slice backed by dst's underlying memory. 507 var buf []byte 508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 510 hdr.Len = b.SizeBytes() 511 hdr.Cap = b.SizeBytes() 512 513 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 514 // Since we bypassed the compiler's escape analysis, indicate that b 515 // must live until the use above. 516 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 517 return length, err 518 } 519 520 // CopyIn implements marshal.Marshallable.CopyIn. 521 func (b *BPFInstruction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 522 return b.CopyInN(cc, addr, b.SizeBytes()) 523 } 524 525 // WriteTo implements io.WriterTo.WriteTo. 526 func (b *BPFInstruction) WriteTo(writer io.Writer) (int64, error) { 527 // Construct a slice backed by dst's underlying memory. 528 var buf []byte 529 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 530 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 531 hdr.Len = b.SizeBytes() 532 hdr.Cap = b.SizeBytes() 533 534 length, err := writer.Write(buf) 535 // Since we bypassed the compiler's escape analysis, indicate that b 536 // must live until the use above. 537 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 538 return int64(length), err 539 } 540 541 // CopyBPFInstructionSliceIn copies in a slice of BPFInstruction objects from the task's memory. 542 func CopyBPFInstructionSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []BPFInstruction) (int, error) { 543 count := len(dst) 544 if count == 0 { 545 return 0, nil 546 } 547 size := (*BPFInstruction)(nil).SizeBytes() 548 549 ptr := unsafe.Pointer(&dst) 550 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 551 552 // Construct a slice backed by dst's underlying memory. 553 var buf []byte 554 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 555 hdr.Data = uintptr(val) 556 hdr.Len = size * count 557 hdr.Cap = size * count 558 559 length, err := cc.CopyInBytes(addr, buf) 560 // Since we bypassed the compiler's escape analysis, indicate that dst 561 // must live until the use above. 562 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 563 return length, err 564 } 565 566 // CopyBPFInstructionSliceOut copies a slice of BPFInstruction objects to the task's memory. 567 func CopyBPFInstructionSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []BPFInstruction) (int, error) { 568 count := len(src) 569 if count == 0 { 570 return 0, nil 571 } 572 size := (*BPFInstruction)(nil).SizeBytes() 573 574 ptr := unsafe.Pointer(&src) 575 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 576 577 // Construct a slice backed by dst's underlying memory. 578 var buf []byte 579 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 580 hdr.Data = uintptr(val) 581 hdr.Len = size * count 582 hdr.Cap = size * count 583 584 length, err := cc.CopyOutBytes(addr, buf) 585 // Since we bypassed the compiler's escape analysis, indicate that src 586 // must live until the use above. 587 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 588 return length, err 589 } 590 591 // MarshalUnsafeBPFInstructionSlice is like BPFInstruction.MarshalUnsafe, but for a []BPFInstruction. 592 func MarshalUnsafeBPFInstructionSlice(src []BPFInstruction, dst []byte) []byte { 593 count := len(src) 594 if count == 0 { 595 return dst 596 } 597 598 size := (*BPFInstruction)(nil).SizeBytes() 599 buf := dst[:size*count] 600 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 601 return dst[size*count:] 602 } 603 604 // UnmarshalUnsafeBPFInstructionSlice is like BPFInstruction.UnmarshalUnsafe, but for a []BPFInstruction. 605 func UnmarshalUnsafeBPFInstructionSlice(dst []BPFInstruction, src []byte) []byte { 606 count := len(dst) 607 if count == 0 { 608 return src 609 } 610 611 size := (*BPFInstruction)(nil).SizeBytes() 612 buf := src[:size*count] 613 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 614 return src[size*count:] 615 } 616 617 // SizeBytes implements marshal.Marshallable.SizeBytes. 618 func (c *CapUserData) SizeBytes() int { 619 return 12 620 } 621 622 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 623 func (c *CapUserData) MarshalBytes(dst []byte) []byte { 624 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Effective)) 625 dst = dst[4:] 626 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Permitted)) 627 dst = dst[4:] 628 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Inheritable)) 629 dst = dst[4:] 630 return dst 631 } 632 633 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 634 func (c *CapUserData) UnmarshalBytes(src []byte) []byte { 635 c.Effective = uint32(hostarch.ByteOrder.Uint32(src[:4])) 636 src = src[4:] 637 c.Permitted = uint32(hostarch.ByteOrder.Uint32(src[:4])) 638 src = src[4:] 639 c.Inheritable = uint32(hostarch.ByteOrder.Uint32(src[:4])) 640 src = src[4:] 641 return src 642 } 643 644 // Packed implements marshal.Marshallable.Packed. 645 //go:nosplit 646 func (c *CapUserData) Packed() bool { 647 return true 648 } 649 650 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 651 func (c *CapUserData) MarshalUnsafe(dst []byte) []byte { 652 size := c.SizeBytes() 653 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 654 return dst[size:] 655 } 656 657 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 658 func (c *CapUserData) UnmarshalUnsafe(src []byte) []byte { 659 size := c.SizeBytes() 660 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 661 return src[size:] 662 } 663 664 // CopyOutN implements marshal.Marshallable.CopyOutN. 665 func (c *CapUserData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 666 // Construct a slice backed by dst's underlying memory. 667 var buf []byte 668 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 669 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 670 hdr.Len = c.SizeBytes() 671 hdr.Cap = c.SizeBytes() 672 673 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 674 // Since we bypassed the compiler's escape analysis, indicate that c 675 // must live until the use above. 676 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 677 return length, err 678 } 679 680 // CopyOut implements marshal.Marshallable.CopyOut. 681 func (c *CapUserData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 682 return c.CopyOutN(cc, addr, c.SizeBytes()) 683 } 684 685 // CopyInN implements marshal.Marshallable.CopyInN. 686 func (c *CapUserData) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 687 // Construct a slice backed by dst's underlying memory. 688 var buf []byte 689 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 690 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 691 hdr.Len = c.SizeBytes() 692 hdr.Cap = c.SizeBytes() 693 694 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 695 // Since we bypassed the compiler's escape analysis, indicate that c 696 // must live until the use above. 697 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 698 return length, err 699 } 700 701 // CopyIn implements marshal.Marshallable.CopyIn. 702 func (c *CapUserData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 703 return c.CopyInN(cc, addr, c.SizeBytes()) 704 } 705 706 // WriteTo implements io.WriterTo.WriteTo. 707 func (c *CapUserData) WriteTo(writer io.Writer) (int64, error) { 708 // Construct a slice backed by dst's underlying memory. 709 var buf []byte 710 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 711 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 712 hdr.Len = c.SizeBytes() 713 hdr.Cap = c.SizeBytes() 714 715 length, err := writer.Write(buf) 716 // Since we bypassed the compiler's escape analysis, indicate that c 717 // must live until the use above. 718 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 719 return int64(length), err 720 } 721 722 // CopyCapUserDataSliceIn copies in a slice of CapUserData objects from the task's memory. 723 func CopyCapUserDataSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []CapUserData) (int, error) { 724 count := len(dst) 725 if count == 0 { 726 return 0, nil 727 } 728 size := (*CapUserData)(nil).SizeBytes() 729 730 ptr := unsafe.Pointer(&dst) 731 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 732 733 // Construct a slice backed by dst's underlying memory. 734 var buf []byte 735 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 736 hdr.Data = uintptr(val) 737 hdr.Len = size * count 738 hdr.Cap = size * count 739 740 length, err := cc.CopyInBytes(addr, buf) 741 // Since we bypassed the compiler's escape analysis, indicate that dst 742 // must live until the use above. 743 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 744 return length, err 745 } 746 747 // CopyCapUserDataSliceOut copies a slice of CapUserData objects to the task's memory. 748 func CopyCapUserDataSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []CapUserData) (int, error) { 749 count := len(src) 750 if count == 0 { 751 return 0, nil 752 } 753 size := (*CapUserData)(nil).SizeBytes() 754 755 ptr := unsafe.Pointer(&src) 756 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 757 758 // Construct a slice backed by dst's underlying memory. 759 var buf []byte 760 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 761 hdr.Data = uintptr(val) 762 hdr.Len = size * count 763 hdr.Cap = size * count 764 765 length, err := cc.CopyOutBytes(addr, buf) 766 // Since we bypassed the compiler's escape analysis, indicate that src 767 // must live until the use above. 768 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 769 return length, err 770 } 771 772 // MarshalUnsafeCapUserDataSlice is like CapUserData.MarshalUnsafe, but for a []CapUserData. 773 func MarshalUnsafeCapUserDataSlice(src []CapUserData, dst []byte) []byte { 774 count := len(src) 775 if count == 0 { 776 return dst 777 } 778 779 size := (*CapUserData)(nil).SizeBytes() 780 buf := dst[:size*count] 781 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 782 return dst[size*count:] 783 } 784 785 // UnmarshalUnsafeCapUserDataSlice is like CapUserData.UnmarshalUnsafe, but for a []CapUserData. 786 func UnmarshalUnsafeCapUserDataSlice(dst []CapUserData, src []byte) []byte { 787 count := len(dst) 788 if count == 0 { 789 return src 790 } 791 792 size := (*CapUserData)(nil).SizeBytes() 793 buf := src[:size*count] 794 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 795 return src[size*count:] 796 } 797 798 // SizeBytes implements marshal.Marshallable.SizeBytes. 799 func (c *CapUserHeader) SizeBytes() int { 800 return 8 801 } 802 803 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 804 func (c *CapUserHeader) MarshalBytes(dst []byte) []byte { 805 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Version)) 806 dst = dst[4:] 807 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Pid)) 808 dst = dst[4:] 809 return dst 810 } 811 812 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 813 func (c *CapUserHeader) UnmarshalBytes(src []byte) []byte { 814 c.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 815 src = src[4:] 816 c.Pid = int32(hostarch.ByteOrder.Uint32(src[:4])) 817 src = src[4:] 818 return src 819 } 820 821 // Packed implements marshal.Marshallable.Packed. 822 //go:nosplit 823 func (c *CapUserHeader) Packed() bool { 824 return true 825 } 826 827 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 828 func (c *CapUserHeader) MarshalUnsafe(dst []byte) []byte { 829 size := c.SizeBytes() 830 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 831 return dst[size:] 832 } 833 834 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 835 func (c *CapUserHeader) UnmarshalUnsafe(src []byte) []byte { 836 size := c.SizeBytes() 837 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 838 return src[size:] 839 } 840 841 // CopyOutN implements marshal.Marshallable.CopyOutN. 842 func (c *CapUserHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (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.CopyOutBytes(addr, buf[:limit]) // 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 // CopyOut implements marshal.Marshallable.CopyOut. 858 func (c *CapUserHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 859 return c.CopyOutN(cc, addr, c.SizeBytes()) 860 } 861 862 // CopyInN implements marshal.Marshallable.CopyInN. 863 func (c *CapUserHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 864 // Construct a slice backed by dst's underlying memory. 865 var buf []byte 866 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 867 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 868 hdr.Len = c.SizeBytes() 869 hdr.Cap = c.SizeBytes() 870 871 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 872 // Since we bypassed the compiler's escape analysis, indicate that c 873 // must live until the use above. 874 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 875 return length, err 876 } 877 878 // CopyIn implements marshal.Marshallable.CopyIn. 879 func (c *CapUserHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 880 return c.CopyInN(cc, addr, c.SizeBytes()) 881 } 882 883 // WriteTo implements io.WriterTo.WriteTo. 884 func (c *CapUserHeader) WriteTo(writer io.Writer) (int64, error) { 885 // Construct a slice backed by dst's underlying memory. 886 var buf []byte 887 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 888 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 889 hdr.Len = c.SizeBytes() 890 hdr.Cap = c.SizeBytes() 891 892 length, err := writer.Write(buf) 893 // Since we bypassed the compiler's escape analysis, indicate that c 894 // must live until the use above. 895 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 896 return int64(length), err 897 } 898 899 // SizeBytes implements marshal.Marshallable.SizeBytes. 900 func (c *CloneArgs) SizeBytes() int { 901 return 88 902 } 903 904 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 905 func (c *CloneArgs) MarshalBytes(dst []byte) []byte { 906 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Flags)) 907 dst = dst[8:] 908 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Pidfd)) 909 dst = dst[8:] 910 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.ChildTID)) 911 dst = dst[8:] 912 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.ParentTID)) 913 dst = dst[8:] 914 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.ExitSignal)) 915 dst = dst[8:] 916 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Stack)) 917 dst = dst[8:] 918 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.StackSize)) 919 dst = dst[8:] 920 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.TLS)) 921 dst = dst[8:] 922 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.SetTID)) 923 dst = dst[8:] 924 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.SetTIDSize)) 925 dst = dst[8:] 926 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Cgroup)) 927 dst = dst[8:] 928 return dst 929 } 930 931 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 932 func (c *CloneArgs) UnmarshalBytes(src []byte) []byte { 933 c.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 934 src = src[8:] 935 c.Pidfd = uint64(hostarch.ByteOrder.Uint64(src[:8])) 936 src = src[8:] 937 c.ChildTID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 938 src = src[8:] 939 c.ParentTID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 940 src = src[8:] 941 c.ExitSignal = uint64(hostarch.ByteOrder.Uint64(src[:8])) 942 src = src[8:] 943 c.Stack = uint64(hostarch.ByteOrder.Uint64(src[:8])) 944 src = src[8:] 945 c.StackSize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 946 src = src[8:] 947 c.TLS = uint64(hostarch.ByteOrder.Uint64(src[:8])) 948 src = src[8:] 949 c.SetTID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 950 src = src[8:] 951 c.SetTIDSize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 952 src = src[8:] 953 c.Cgroup = uint64(hostarch.ByteOrder.Uint64(src[:8])) 954 src = src[8:] 955 return src 956 } 957 958 // Packed implements marshal.Marshallable.Packed. 959 //go:nosplit 960 func (c *CloneArgs) Packed() bool { 961 return true 962 } 963 964 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 965 func (c *CloneArgs) MarshalUnsafe(dst []byte) []byte { 966 size := c.SizeBytes() 967 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 968 return dst[size:] 969 } 970 971 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 972 func (c *CloneArgs) UnmarshalUnsafe(src []byte) []byte { 973 size := c.SizeBytes() 974 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 975 return src[size:] 976 } 977 978 // CopyOutN implements marshal.Marshallable.CopyOutN. 979 func (c *CloneArgs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 980 // Construct a slice backed by dst's underlying memory. 981 var buf []byte 982 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 983 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 984 hdr.Len = c.SizeBytes() 985 hdr.Cap = c.SizeBytes() 986 987 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 988 // Since we bypassed the compiler's escape analysis, indicate that c 989 // must live until the use above. 990 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 991 return length, err 992 } 993 994 // CopyOut implements marshal.Marshallable.CopyOut. 995 func (c *CloneArgs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 996 return c.CopyOutN(cc, addr, c.SizeBytes()) 997 } 998 999 // CopyInN implements marshal.Marshallable.CopyInN. 1000 func (c *CloneArgs) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1001 // Construct a slice backed by dst's underlying memory. 1002 var buf []byte 1003 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1004 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 1005 hdr.Len = c.SizeBytes() 1006 hdr.Cap = c.SizeBytes() 1007 1008 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1009 // Since we bypassed the compiler's escape analysis, indicate that c 1010 // must live until the use above. 1011 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 1012 return length, err 1013 } 1014 1015 // CopyIn implements marshal.Marshallable.CopyIn. 1016 func (c *CloneArgs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1017 return c.CopyInN(cc, addr, c.SizeBytes()) 1018 } 1019 1020 // WriteTo implements io.WriterTo.WriteTo. 1021 func (c *CloneArgs) WriteTo(writer io.Writer) (int64, error) { 1022 // Construct a slice backed by dst's underlying memory. 1023 var buf []byte 1024 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1025 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 1026 hdr.Len = c.SizeBytes() 1027 hdr.Cap = c.SizeBytes() 1028 1029 length, err := writer.Write(buf) 1030 // Since we bypassed the compiler's escape analysis, indicate that c 1031 // must live until the use above. 1032 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 1033 return int64(length), err 1034 } 1035 1036 // SizeBytes implements marshal.Marshallable.SizeBytes. 1037 func (e *ElfHeader64) SizeBytes() int { 1038 return 48 + 1039 1*16 1040 } 1041 1042 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1043 func (e *ElfHeader64) MarshalBytes(dst []byte) []byte { 1044 for idx := 0; idx < 16; idx++ { 1045 dst[0] = byte(e.Ident[idx]) 1046 dst = dst[1:] 1047 } 1048 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Type)) 1049 dst = dst[2:] 1050 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Machine)) 1051 dst = dst[2:] 1052 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Version)) 1053 dst = dst[4:] 1054 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entry)) 1055 dst = dst[8:] 1056 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Phoff)) 1057 dst = dst[8:] 1058 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Shoff)) 1059 dst = dst[8:] 1060 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1061 dst = dst[4:] 1062 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Ehsize)) 1063 dst = dst[2:] 1064 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phentsize)) 1065 dst = dst[2:] 1066 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Phnum)) 1067 dst = dst[2:] 1068 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shentsize)) 1069 dst = dst[2:] 1070 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shnum)) 1071 dst = dst[2:] 1072 hostarch.ByteOrder.PutUint16(dst[:2], uint16(e.Shstrndx)) 1073 dst = dst[2:] 1074 return dst 1075 } 1076 1077 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1078 func (e *ElfHeader64) UnmarshalBytes(src []byte) []byte { 1079 for idx := 0; idx < 16; idx++ { 1080 e.Ident[idx] = src[0] 1081 src = src[1:] 1082 } 1083 e.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1084 src = src[2:] 1085 e.Machine = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1086 src = src[2:] 1087 e.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1088 src = src[4:] 1089 e.Entry = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1090 src = src[8:] 1091 e.Phoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1092 src = src[8:] 1093 e.Shoff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1094 src = src[8:] 1095 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1096 src = src[4:] 1097 e.Ehsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1098 src = src[2:] 1099 e.Phentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1100 src = src[2:] 1101 e.Phnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1102 src = src[2:] 1103 e.Shentsize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1104 src = src[2:] 1105 e.Shnum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1106 src = src[2:] 1107 e.Shstrndx = uint16(hostarch.ByteOrder.Uint16(src[:2])) 1108 src = src[2:] 1109 return src 1110 } 1111 1112 // Packed implements marshal.Marshallable.Packed. 1113 //go:nosplit 1114 func (e *ElfHeader64) Packed() bool { 1115 return true 1116 } 1117 1118 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1119 func (e *ElfHeader64) MarshalUnsafe(dst []byte) []byte { 1120 size := e.SizeBytes() 1121 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1122 return dst[size:] 1123 } 1124 1125 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1126 func (e *ElfHeader64) UnmarshalUnsafe(src []byte) []byte { 1127 size := e.SizeBytes() 1128 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1129 return src[size:] 1130 } 1131 1132 // CopyOutN implements marshal.Marshallable.CopyOutN. 1133 func (e *ElfHeader64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1134 // Construct a slice backed by dst's underlying memory. 1135 var buf []byte 1136 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1137 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1138 hdr.Len = e.SizeBytes() 1139 hdr.Cap = e.SizeBytes() 1140 1141 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1142 // Since we bypassed the compiler's escape analysis, indicate that e 1143 // must live until the use above. 1144 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1145 return length, err 1146 } 1147 1148 // CopyOut implements marshal.Marshallable.CopyOut. 1149 func (e *ElfHeader64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1150 return e.CopyOutN(cc, addr, e.SizeBytes()) 1151 } 1152 1153 // CopyInN implements marshal.Marshallable.CopyInN. 1154 func (e *ElfHeader64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1155 // Construct a slice backed by dst's underlying memory. 1156 var buf []byte 1157 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1158 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1159 hdr.Len = e.SizeBytes() 1160 hdr.Cap = e.SizeBytes() 1161 1162 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1163 // Since we bypassed the compiler's escape analysis, indicate that e 1164 // must live until the use above. 1165 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1166 return length, err 1167 } 1168 1169 // CopyIn implements marshal.Marshallable.CopyIn. 1170 func (e *ElfHeader64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1171 return e.CopyInN(cc, addr, e.SizeBytes()) 1172 } 1173 1174 // WriteTo implements io.WriterTo.WriteTo. 1175 func (e *ElfHeader64) WriteTo(writer io.Writer) (int64, error) { 1176 // Construct a slice backed by dst's underlying memory. 1177 var buf []byte 1178 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1179 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1180 hdr.Len = e.SizeBytes() 1181 hdr.Cap = e.SizeBytes() 1182 1183 length, err := writer.Write(buf) 1184 // Since we bypassed the compiler's escape analysis, indicate that e 1185 // must live until the use above. 1186 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1187 return int64(length), err 1188 } 1189 1190 // SizeBytes implements marshal.Marshallable.SizeBytes. 1191 func (e *ElfProg64) SizeBytes() int { 1192 return 56 1193 } 1194 1195 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1196 func (e *ElfProg64) MarshalBytes(dst []byte) []byte { 1197 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1198 dst = dst[4:] 1199 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Flags)) 1200 dst = dst[4:] 1201 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1202 dst = dst[8:] 1203 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Vaddr)) 1204 dst = dst[8:] 1205 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Paddr)) 1206 dst = dst[8:] 1207 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Filesz)) 1208 dst = dst[8:] 1209 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Memsz)) 1210 dst = dst[8:] 1211 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Align)) 1212 dst = dst[8:] 1213 return dst 1214 } 1215 1216 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1217 func (e *ElfProg64) UnmarshalBytes(src []byte) []byte { 1218 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1219 src = src[4:] 1220 e.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1221 src = src[4:] 1222 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1223 src = src[8:] 1224 e.Vaddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1225 src = src[8:] 1226 e.Paddr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1227 src = src[8:] 1228 e.Filesz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1229 src = src[8:] 1230 e.Memsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1231 src = src[8:] 1232 e.Align = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1233 src = src[8:] 1234 return src 1235 } 1236 1237 // Packed implements marshal.Marshallable.Packed. 1238 //go:nosplit 1239 func (e *ElfProg64) Packed() bool { 1240 return true 1241 } 1242 1243 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1244 func (e *ElfProg64) MarshalUnsafe(dst []byte) []byte { 1245 size := e.SizeBytes() 1246 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1247 return dst[size:] 1248 } 1249 1250 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1251 func (e *ElfProg64) UnmarshalUnsafe(src []byte) []byte { 1252 size := e.SizeBytes() 1253 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1254 return src[size:] 1255 } 1256 1257 // CopyOutN implements marshal.Marshallable.CopyOutN. 1258 func (e *ElfProg64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, 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 := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 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 length, err 1271 } 1272 1273 // CopyOut implements marshal.Marshallable.CopyOut. 1274 func (e *ElfProg64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1275 return e.CopyOutN(cc, addr, e.SizeBytes()) 1276 } 1277 1278 // CopyInN implements marshal.Marshallable.CopyInN. 1279 func (e *ElfProg64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1280 // Construct a slice backed by dst's underlying memory. 1281 var buf []byte 1282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1284 hdr.Len = e.SizeBytes() 1285 hdr.Cap = e.SizeBytes() 1286 1287 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1288 // Since we bypassed the compiler's escape analysis, indicate that e 1289 // must live until the use above. 1290 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1291 return length, err 1292 } 1293 1294 // CopyIn implements marshal.Marshallable.CopyIn. 1295 func (e *ElfProg64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1296 return e.CopyInN(cc, addr, e.SizeBytes()) 1297 } 1298 1299 // WriteTo implements io.WriterTo.WriteTo. 1300 func (e *ElfProg64) WriteTo(writer io.Writer) (int64, error) { 1301 // Construct a slice backed by dst's underlying memory. 1302 var buf []byte 1303 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1304 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1305 hdr.Len = e.SizeBytes() 1306 hdr.Cap = e.SizeBytes() 1307 1308 length, err := writer.Write(buf) 1309 // Since we bypassed the compiler's escape analysis, indicate that e 1310 // must live until the use above. 1311 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1312 return int64(length), err 1313 } 1314 1315 // SizeBytes implements marshal.Marshallable.SizeBytes. 1316 func (e *ElfSection64) SizeBytes() int { 1317 return 64 1318 } 1319 1320 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1321 func (e *ElfSection64) MarshalBytes(dst []byte) []byte { 1322 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Name)) 1323 dst = dst[4:] 1324 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Type)) 1325 dst = dst[4:] 1326 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Flags)) 1327 dst = dst[8:] 1328 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addr)) 1329 dst = dst[8:] 1330 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Off)) 1331 dst = dst[8:] 1332 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Size)) 1333 dst = dst[8:] 1334 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Link)) 1335 dst = dst[4:] 1336 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Info)) 1337 dst = dst[4:] 1338 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Addralign)) 1339 dst = dst[8:] 1340 hostarch.ByteOrder.PutUint64(dst[:8], uint64(e.Entsize)) 1341 dst = dst[8:] 1342 return dst 1343 } 1344 1345 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1346 func (e *ElfSection64) UnmarshalBytes(src []byte) []byte { 1347 e.Name = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1348 src = src[4:] 1349 e.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1350 src = src[4:] 1351 e.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1352 src = src[8:] 1353 e.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1354 src = src[8:] 1355 e.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1356 src = src[8:] 1357 e.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1358 src = src[8:] 1359 e.Link = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1360 src = src[4:] 1361 e.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1362 src = src[4:] 1363 e.Addralign = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1364 src = src[8:] 1365 e.Entsize = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1366 src = src[8:] 1367 return src 1368 } 1369 1370 // Packed implements marshal.Marshallable.Packed. 1371 //go:nosplit 1372 func (e *ElfSection64) Packed() bool { 1373 return true 1374 } 1375 1376 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1377 func (e *ElfSection64) MarshalUnsafe(dst []byte) []byte { 1378 size := e.SizeBytes() 1379 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 1380 return dst[size:] 1381 } 1382 1383 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1384 func (e *ElfSection64) UnmarshalUnsafe(src []byte) []byte { 1385 size := e.SizeBytes() 1386 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 1387 return src[size:] 1388 } 1389 1390 // CopyOutN implements marshal.Marshallable.CopyOutN. 1391 func (e *ElfSection64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1392 // Construct a slice backed by dst's underlying memory. 1393 var buf []byte 1394 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1395 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1396 hdr.Len = e.SizeBytes() 1397 hdr.Cap = e.SizeBytes() 1398 1399 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1400 // Since we bypassed the compiler's escape analysis, indicate that e 1401 // must live until the use above. 1402 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1403 return length, err 1404 } 1405 1406 // CopyOut implements marshal.Marshallable.CopyOut. 1407 func (e *ElfSection64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1408 return e.CopyOutN(cc, addr, e.SizeBytes()) 1409 } 1410 1411 // CopyInN implements marshal.Marshallable.CopyInN. 1412 func (e *ElfSection64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1413 // Construct a slice backed by dst's underlying memory. 1414 var buf []byte 1415 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1416 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1417 hdr.Len = e.SizeBytes() 1418 hdr.Cap = e.SizeBytes() 1419 1420 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1421 // Since we bypassed the compiler's escape analysis, indicate that e 1422 // must live until the use above. 1423 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1424 return length, err 1425 } 1426 1427 // CopyIn implements marshal.Marshallable.CopyIn. 1428 func (e *ElfSection64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1429 return e.CopyInN(cc, addr, e.SizeBytes()) 1430 } 1431 1432 // WriteTo implements io.WriterTo.WriteTo. 1433 func (e *ElfSection64) WriteTo(writer io.Writer) (int64, error) { 1434 // Construct a slice backed by dst's underlying memory. 1435 var buf []byte 1436 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1437 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1438 hdr.Len = e.SizeBytes() 1439 hdr.Cap = e.SizeBytes() 1440 1441 length, err := writer.Write(buf) 1442 // Since we bypassed the compiler's escape analysis, indicate that e 1443 // must live until the use above. 1444 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1445 return int64(length), err 1446 } 1447 1448 // SizeBytes implements marshal.Marshallable.SizeBytes. 1449 func (s *SockErrCMsgIPv4) SizeBytes() int { 1450 return 0 + 1451 (*SockExtendedErr)(nil).SizeBytes() + 1452 (*SockAddrInet)(nil).SizeBytes() 1453 } 1454 1455 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1456 func (s *SockErrCMsgIPv4) MarshalBytes(dst []byte) []byte { 1457 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1458 dst = s.Offender.MarshalUnsafe(dst) 1459 return dst 1460 } 1461 1462 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1463 func (s *SockErrCMsgIPv4) UnmarshalBytes(src []byte) []byte { 1464 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1465 src = s.Offender.UnmarshalUnsafe(src) 1466 return src 1467 } 1468 1469 // Packed implements marshal.Marshallable.Packed. 1470 //go:nosplit 1471 func (s *SockErrCMsgIPv4) Packed() bool { 1472 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1473 } 1474 1475 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1476 func (s *SockErrCMsgIPv4) MarshalUnsafe(dst []byte) []byte { 1477 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1478 size := s.SizeBytes() 1479 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1480 return dst[size:] 1481 } 1482 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to MarshalBytes. 1483 return s.MarshalBytes(dst) 1484 } 1485 1486 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1487 func (s *SockErrCMsgIPv4) UnmarshalUnsafe(src []byte) []byte { 1488 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1489 size := s.SizeBytes() 1490 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1491 return src[size:] 1492 } 1493 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1494 return s.UnmarshalBytes(src) 1495 } 1496 1497 // CopyOutN implements marshal.Marshallable.CopyOutN. 1498 func (s *SockErrCMsgIPv4) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1499 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1500 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1501 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1502 s.MarshalBytes(buf) // escapes: fallback. 1503 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1504 } 1505 1506 // Construct a slice backed by dst's underlying memory. 1507 var buf []byte 1508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1510 hdr.Len = s.SizeBytes() 1511 hdr.Cap = s.SizeBytes() 1512 1513 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1514 // Since we bypassed the compiler's escape analysis, indicate that s 1515 // must live until the use above. 1516 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1517 return length, err 1518 } 1519 1520 // CopyOut implements marshal.Marshallable.CopyOut. 1521 func (s *SockErrCMsgIPv4) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1522 return s.CopyOutN(cc, addr, s.SizeBytes()) 1523 } 1524 1525 // CopyInN implements marshal.Marshallable.CopyInN. 1526 func (s *SockErrCMsgIPv4) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1527 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1528 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1529 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1530 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1531 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1532 // partially unmarshalled struct. 1533 s.UnmarshalBytes(buf) // escapes: fallback. 1534 return length, err 1535 } 1536 1537 // Construct a slice backed by dst's underlying memory. 1538 var buf []byte 1539 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1540 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1541 hdr.Len = s.SizeBytes() 1542 hdr.Cap = s.SizeBytes() 1543 1544 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1545 // Since we bypassed the compiler's escape analysis, indicate that s 1546 // must live until the use above. 1547 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1548 return length, err 1549 } 1550 1551 // CopyIn implements marshal.Marshallable.CopyIn. 1552 func (s *SockErrCMsgIPv4) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1553 return s.CopyInN(cc, addr, s.SizeBytes()) 1554 } 1555 1556 // WriteTo implements io.WriterTo.WriteTo. 1557 func (s *SockErrCMsgIPv4) WriteTo(writer io.Writer) (int64, error) { 1558 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1559 // Type SockErrCMsgIPv4 doesn't have a packed layout in memory, fall back to MarshalBytes. 1560 buf := make([]byte, s.SizeBytes()) 1561 s.MarshalBytes(buf) 1562 length, err := writer.Write(buf) 1563 return int64(length), err 1564 } 1565 1566 // Construct a slice backed by dst's underlying memory. 1567 var buf []byte 1568 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1569 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1570 hdr.Len = s.SizeBytes() 1571 hdr.Cap = s.SizeBytes() 1572 1573 length, err := writer.Write(buf) 1574 // Since we bypassed the compiler's escape analysis, indicate that s 1575 // must live until the use above. 1576 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1577 return int64(length), err 1578 } 1579 1580 // SizeBytes implements marshal.Marshallable.SizeBytes. 1581 func (s *SockErrCMsgIPv6) SizeBytes() int { 1582 return 0 + 1583 (*SockExtendedErr)(nil).SizeBytes() + 1584 (*SockAddrInet6)(nil).SizeBytes() 1585 } 1586 1587 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1588 func (s *SockErrCMsgIPv6) MarshalBytes(dst []byte) []byte { 1589 dst = s.SockExtendedErr.MarshalUnsafe(dst) 1590 dst = s.Offender.MarshalUnsafe(dst) 1591 return dst 1592 } 1593 1594 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1595 func (s *SockErrCMsgIPv6) UnmarshalBytes(src []byte) []byte { 1596 src = s.SockExtendedErr.UnmarshalUnsafe(src) 1597 src = s.Offender.UnmarshalUnsafe(src) 1598 return src 1599 } 1600 1601 // Packed implements marshal.Marshallable.Packed. 1602 //go:nosplit 1603 func (s *SockErrCMsgIPv6) Packed() bool { 1604 return s.Offender.Packed() && s.SockExtendedErr.Packed() 1605 } 1606 1607 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1608 func (s *SockErrCMsgIPv6) MarshalUnsafe(dst []byte) []byte { 1609 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1610 size := s.SizeBytes() 1611 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1612 return dst[size:] 1613 } 1614 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to MarshalBytes. 1615 return s.MarshalBytes(dst) 1616 } 1617 1618 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1619 func (s *SockErrCMsgIPv6) UnmarshalUnsafe(src []byte) []byte { 1620 if s.Offender.Packed() && s.SockExtendedErr.Packed() { 1621 size := s.SizeBytes() 1622 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1623 return src[size:] 1624 } 1625 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1626 return s.UnmarshalBytes(src) 1627 } 1628 1629 // CopyOutN implements marshal.Marshallable.CopyOutN. 1630 func (s *SockErrCMsgIPv6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1631 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1632 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1633 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1634 s.MarshalBytes(buf) // escapes: fallback. 1635 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1636 } 1637 1638 // Construct a slice backed by dst's underlying memory. 1639 var buf []byte 1640 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1641 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1642 hdr.Len = s.SizeBytes() 1643 hdr.Cap = s.SizeBytes() 1644 1645 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1646 // Since we bypassed the compiler's escape analysis, indicate that s 1647 // must live until the use above. 1648 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1649 return length, err 1650 } 1651 1652 // CopyOut implements marshal.Marshallable.CopyOut. 1653 func (s *SockErrCMsgIPv6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1654 return s.CopyOutN(cc, addr, s.SizeBytes()) 1655 } 1656 1657 // CopyInN implements marshal.Marshallable.CopyInN. 1658 func (s *SockErrCMsgIPv6) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1659 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1660 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1661 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1662 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1663 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1664 // partially unmarshalled struct. 1665 s.UnmarshalBytes(buf) // escapes: fallback. 1666 return length, err 1667 } 1668 1669 // Construct a slice backed by dst's underlying memory. 1670 var buf []byte 1671 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1672 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1673 hdr.Len = s.SizeBytes() 1674 hdr.Cap = s.SizeBytes() 1675 1676 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1677 // Since we bypassed the compiler's escape analysis, indicate that s 1678 // must live until the use above. 1679 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1680 return length, err 1681 } 1682 1683 // CopyIn implements marshal.Marshallable.CopyIn. 1684 func (s *SockErrCMsgIPv6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1685 return s.CopyInN(cc, addr, s.SizeBytes()) 1686 } 1687 1688 // WriteTo implements io.WriterTo.WriteTo. 1689 func (s *SockErrCMsgIPv6) WriteTo(writer io.Writer) (int64, error) { 1690 if !s.Offender.Packed() && s.SockExtendedErr.Packed() { 1691 // Type SockErrCMsgIPv6 doesn't have a packed layout in memory, fall back to MarshalBytes. 1692 buf := make([]byte, s.SizeBytes()) 1693 s.MarshalBytes(buf) 1694 length, err := writer.Write(buf) 1695 return int64(length), err 1696 } 1697 1698 // Construct a slice backed by dst's underlying memory. 1699 var buf []byte 1700 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1701 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1702 hdr.Len = s.SizeBytes() 1703 hdr.Cap = s.SizeBytes() 1704 1705 length, err := writer.Write(buf) 1706 // Since we bypassed the compiler's escape analysis, indicate that s 1707 // must live until the use above. 1708 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1709 return int64(length), err 1710 } 1711 1712 // SizeBytes implements marshal.Marshallable.SizeBytes. 1713 func (s *SockExtendedErr) SizeBytes() int { 1714 return 16 1715 } 1716 1717 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1718 func (s *SockExtendedErr) MarshalBytes(dst []byte) []byte { 1719 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 1720 dst = dst[4:] 1721 dst[0] = byte(s.Origin) 1722 dst = dst[1:] 1723 dst[0] = byte(s.Type) 1724 dst = dst[1:] 1725 dst[0] = byte(s.Code) 1726 dst = dst[1:] 1727 dst[0] = byte(s.Pad) 1728 dst = dst[1:] 1729 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Info)) 1730 dst = dst[4:] 1731 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Data)) 1732 dst = dst[4:] 1733 return dst 1734 } 1735 1736 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1737 func (s *SockExtendedErr) UnmarshalBytes(src []byte) []byte { 1738 s.Errno = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1739 src = src[4:] 1740 s.Origin = uint8(src[0]) 1741 src = src[1:] 1742 s.Type = uint8(src[0]) 1743 src = src[1:] 1744 s.Code = uint8(src[0]) 1745 src = src[1:] 1746 s.Pad = uint8(src[0]) 1747 src = src[1:] 1748 s.Info = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1749 src = src[4:] 1750 s.Data = uint32(hostarch.ByteOrder.Uint32(src[:4])) 1751 src = src[4:] 1752 return src 1753 } 1754 1755 // Packed implements marshal.Marshallable.Packed. 1756 //go:nosplit 1757 func (s *SockExtendedErr) Packed() bool { 1758 return true 1759 } 1760 1761 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1762 func (s *SockExtendedErr) MarshalUnsafe(dst []byte) []byte { 1763 size := s.SizeBytes() 1764 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1765 return dst[size:] 1766 } 1767 1768 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1769 func (s *SockExtendedErr) UnmarshalUnsafe(src []byte) []byte { 1770 size := s.SizeBytes() 1771 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1772 return src[size:] 1773 } 1774 1775 // CopyOutN implements marshal.Marshallable.CopyOutN. 1776 func (s *SockExtendedErr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1777 // Construct a slice backed by dst's underlying memory. 1778 var buf []byte 1779 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1780 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1781 hdr.Len = s.SizeBytes() 1782 hdr.Cap = s.SizeBytes() 1783 1784 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1785 // Since we bypassed the compiler's escape analysis, indicate that s 1786 // must live until the use above. 1787 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1788 return length, err 1789 } 1790 1791 // CopyOut implements marshal.Marshallable.CopyOut. 1792 func (s *SockExtendedErr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1793 return s.CopyOutN(cc, addr, s.SizeBytes()) 1794 } 1795 1796 // CopyInN implements marshal.Marshallable.CopyInN. 1797 func (s *SockExtendedErr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1798 // Construct a slice backed by dst's underlying memory. 1799 var buf []byte 1800 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1801 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1802 hdr.Len = s.SizeBytes() 1803 hdr.Cap = s.SizeBytes() 1804 1805 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1806 // Since we bypassed the compiler's escape analysis, indicate that s 1807 // must live until the use above. 1808 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1809 return length, err 1810 } 1811 1812 // CopyIn implements marshal.Marshallable.CopyIn. 1813 func (s *SockExtendedErr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1814 return s.CopyInN(cc, addr, s.SizeBytes()) 1815 } 1816 1817 // WriteTo implements io.WriterTo.WriteTo. 1818 func (s *SockExtendedErr) WriteTo(writer io.Writer) (int64, error) { 1819 // Construct a slice backed by dst's underlying memory. 1820 var buf []byte 1821 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1822 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1823 hdr.Len = s.SizeBytes() 1824 hdr.Cap = s.SizeBytes() 1825 1826 length, err := writer.Write(buf) 1827 // Since we bypassed the compiler's escape analysis, indicate that s 1828 // must live until the use above. 1829 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1830 return int64(length), err 1831 } 1832 1833 // SizeBytes implements marshal.Marshallable.SizeBytes. 1834 func (f *FOwnerEx) SizeBytes() int { 1835 return 8 1836 } 1837 1838 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1839 func (f *FOwnerEx) MarshalBytes(dst []byte) []byte { 1840 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 1841 dst = dst[4:] 1842 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1843 dst = dst[4:] 1844 return dst 1845 } 1846 1847 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1848 func (f *FOwnerEx) UnmarshalBytes(src []byte) []byte { 1849 f.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 1850 src = src[4:] 1851 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1852 src = src[4:] 1853 return src 1854 } 1855 1856 // Packed implements marshal.Marshallable.Packed. 1857 //go:nosplit 1858 func (f *FOwnerEx) Packed() bool { 1859 return true 1860 } 1861 1862 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1863 func (f *FOwnerEx) MarshalUnsafe(dst []byte) []byte { 1864 size := f.SizeBytes() 1865 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1866 return dst[size:] 1867 } 1868 1869 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1870 func (f *FOwnerEx) UnmarshalUnsafe(src []byte) []byte { 1871 size := f.SizeBytes() 1872 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1873 return src[size:] 1874 } 1875 1876 // CopyOutN implements marshal.Marshallable.CopyOutN. 1877 func (f *FOwnerEx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1878 // Construct a slice backed by dst's underlying memory. 1879 var buf []byte 1880 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1881 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1882 hdr.Len = f.SizeBytes() 1883 hdr.Cap = f.SizeBytes() 1884 1885 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1886 // Since we bypassed the compiler's escape analysis, indicate that f 1887 // must live until the use above. 1888 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1889 return length, err 1890 } 1891 1892 // CopyOut implements marshal.Marshallable.CopyOut. 1893 func (f *FOwnerEx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1894 return f.CopyOutN(cc, addr, f.SizeBytes()) 1895 } 1896 1897 // CopyInN implements marshal.Marshallable.CopyInN. 1898 func (f *FOwnerEx) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1899 // Construct a slice backed by dst's underlying memory. 1900 var buf []byte 1901 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1902 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1903 hdr.Len = f.SizeBytes() 1904 hdr.Cap = f.SizeBytes() 1905 1906 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 1907 // Since we bypassed the compiler's escape analysis, indicate that f 1908 // must live until the use above. 1909 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1910 return length, err 1911 } 1912 1913 // CopyIn implements marshal.Marshallable.CopyIn. 1914 func (f *FOwnerEx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1915 return f.CopyInN(cc, addr, f.SizeBytes()) 1916 } 1917 1918 // WriteTo implements io.WriterTo.WriteTo. 1919 func (f *FOwnerEx) WriteTo(writer io.Writer) (int64, error) { 1920 // Construct a slice backed by dst's underlying memory. 1921 var buf []byte 1922 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1923 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1924 hdr.Len = f.SizeBytes() 1925 hdr.Cap = f.SizeBytes() 1926 1927 length, err := writer.Write(buf) 1928 // Since we bypassed the compiler's escape analysis, indicate that f 1929 // must live until the use above. 1930 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1931 return int64(length), err 1932 } 1933 1934 // SizeBytes implements marshal.Marshallable.SizeBytes. 1935 func (f *Flock) SizeBytes() int { 1936 return 24 + 1937 1*4 + 1938 1*4 1939 } 1940 1941 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1942 func (f *Flock) MarshalBytes(dst []byte) []byte { 1943 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Type)) 1944 dst = dst[2:] 1945 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.Whence)) 1946 dst = dst[2:] 1947 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1948 dst = dst[1*(4):] 1949 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Start)) 1950 dst = dst[8:] 1951 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Len)) 1952 dst = dst[8:] 1953 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 1954 dst = dst[4:] 1955 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 1956 dst = dst[1*(4):] 1957 return dst 1958 } 1959 1960 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1961 func (f *Flock) UnmarshalBytes(src []byte) []byte { 1962 f.Type = int16(hostarch.ByteOrder.Uint16(src[:2])) 1963 src = src[2:] 1964 f.Whence = int16(hostarch.ByteOrder.Uint16(src[:2])) 1965 src = src[2:] 1966 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1967 src = src[1*(4):] 1968 f.Start = int64(hostarch.ByteOrder.Uint64(src[:8])) 1969 src = src[8:] 1970 f.Len = int64(hostarch.ByteOrder.Uint64(src[:8])) 1971 src = src[8:] 1972 f.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 1973 src = src[4:] 1974 // Padding: ~ copy([4]byte(f._), src[:sizeof(byte)*4]) 1975 src = src[1*(4):] 1976 return src 1977 } 1978 1979 // Packed implements marshal.Marshallable.Packed. 1980 //go:nosplit 1981 func (f *Flock) Packed() bool { 1982 return true 1983 } 1984 1985 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1986 func (f *Flock) MarshalUnsafe(dst []byte) []byte { 1987 size := f.SizeBytes() 1988 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1989 return dst[size:] 1990 } 1991 1992 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1993 func (f *Flock) UnmarshalUnsafe(src []byte) []byte { 1994 size := f.SizeBytes() 1995 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1996 return src[size:] 1997 } 1998 1999 // CopyOutN implements marshal.Marshallable.CopyOutN. 2000 func (f *Flock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2001 // Construct a slice backed by dst's underlying memory. 2002 var buf []byte 2003 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2004 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2005 hdr.Len = f.SizeBytes() 2006 hdr.Cap = f.SizeBytes() 2007 2008 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2009 // Since we bypassed the compiler's escape analysis, indicate that f 2010 // must live until the use above. 2011 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2012 return length, err 2013 } 2014 2015 // CopyOut implements marshal.Marshallable.CopyOut. 2016 func (f *Flock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2017 return f.CopyOutN(cc, addr, f.SizeBytes()) 2018 } 2019 2020 // CopyInN implements marshal.Marshallable.CopyInN. 2021 func (f *Flock) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2022 // Construct a slice backed by dst's underlying memory. 2023 var buf []byte 2024 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2025 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2026 hdr.Len = f.SizeBytes() 2027 hdr.Cap = f.SizeBytes() 2028 2029 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2030 // Since we bypassed the compiler's escape analysis, indicate that f 2031 // must live until the use above. 2032 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2033 return length, err 2034 } 2035 2036 // CopyIn implements marshal.Marshallable.CopyIn. 2037 func (f *Flock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2038 return f.CopyInN(cc, addr, f.SizeBytes()) 2039 } 2040 2041 // WriteTo implements io.WriterTo.WriteTo. 2042 func (f *Flock) WriteTo(writer io.Writer) (int64, error) { 2043 // Construct a slice backed by dst's underlying memory. 2044 var buf []byte 2045 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2046 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2047 hdr.Len = f.SizeBytes() 2048 hdr.Cap = f.SizeBytes() 2049 2050 length, err := writer.Write(buf) 2051 // Since we bypassed the compiler's escape analysis, indicate that f 2052 // must live until the use above. 2053 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2054 return int64(length), err 2055 } 2056 2057 // SizeBytes implements marshal.Marshallable.SizeBytes. 2058 //go:nosplit 2059 func (m *FileMode) SizeBytes() int { 2060 return 2 2061 } 2062 2063 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2064 func (m *FileMode) MarshalBytes(dst []byte) []byte { 2065 hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m)) 2066 return dst[2:] 2067 } 2068 2069 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2070 func (m *FileMode) UnmarshalBytes(src []byte) []byte { 2071 *m = FileMode(uint16(hostarch.ByteOrder.Uint16(src[:2]))) 2072 return src[2:] 2073 } 2074 2075 // Packed implements marshal.Marshallable.Packed. 2076 //go:nosplit 2077 func (m *FileMode) Packed() bool { 2078 // Scalar newtypes are always packed. 2079 return true 2080 } 2081 2082 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2083 func (m *FileMode) MarshalUnsafe(dst []byte) []byte { 2084 size := m.SizeBytes() 2085 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 2086 return dst[size:] 2087 } 2088 2089 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2090 func (m *FileMode) UnmarshalUnsafe(src []byte) []byte { 2091 size := m.SizeBytes() 2092 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 2093 return src[size:] 2094 } 2095 2096 // CopyOutN implements marshal.Marshallable.CopyOutN. 2097 func (m *FileMode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2098 // Construct a slice backed by dst's underlying memory. 2099 var buf []byte 2100 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2101 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2102 hdr.Len = m.SizeBytes() 2103 hdr.Cap = m.SizeBytes() 2104 2105 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2106 // Since we bypassed the compiler's escape analysis, indicate that m 2107 // must live until the use above. 2108 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2109 return length, err 2110 } 2111 2112 // CopyOut implements marshal.Marshallable.CopyOut. 2113 func (m *FileMode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2114 return m.CopyOutN(cc, addr, m.SizeBytes()) 2115 } 2116 2117 // CopyInN implements marshal.Marshallable.CopyInN. 2118 func (m *FileMode) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2119 // Construct a slice backed by dst's underlying memory. 2120 var buf []byte 2121 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2122 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2123 hdr.Len = m.SizeBytes() 2124 hdr.Cap = m.SizeBytes() 2125 2126 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2127 // Since we bypassed the compiler's escape analysis, indicate that m 2128 // must live until the use above. 2129 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2130 return length, err 2131 } 2132 2133 // CopyIn implements marshal.Marshallable.CopyIn. 2134 func (m *FileMode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2135 return m.CopyInN(cc, addr, m.SizeBytes()) 2136 } 2137 2138 // WriteTo implements io.WriterTo.WriteTo. 2139 func (m *FileMode) WriteTo(writer io.Writer) (int64, error) { 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(m))) 2144 hdr.Len = m.SizeBytes() 2145 hdr.Cap = m.SizeBytes() 2146 2147 length, err := writer.Write(buf) 2148 // Since we bypassed the compiler's escape analysis, indicate that m 2149 // must live until the use above. 2150 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2151 return int64(length), err 2152 } 2153 2154 // SizeBytes implements marshal.Marshallable.SizeBytes. 2155 func (s *Statx) SizeBytes() int { 2156 return 80 + 2157 (*StatxTimestamp)(nil).SizeBytes() + 2158 (*StatxTimestamp)(nil).SizeBytes() + 2159 (*StatxTimestamp)(nil).SizeBytes() + 2160 (*StatxTimestamp)(nil).SizeBytes() 2161 } 2162 2163 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2164 func (s *Statx) MarshalBytes(dst []byte) []byte { 2165 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask)) 2166 dst = dst[4:] 2167 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Blksize)) 2168 dst = dst[4:] 2169 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Attributes)) 2170 dst = dst[8:] 2171 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Nlink)) 2172 dst = dst[4:] 2173 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 2174 dst = dst[4:] 2175 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.GID)) 2176 dst = dst[4:] 2177 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Mode)) 2178 dst = dst[2:] 2179 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 2180 dst = dst[2:] 2181 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ino)) 2182 dst = dst[8:] 2183 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 2184 dst = dst[8:] 2185 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2186 dst = dst[8:] 2187 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.AttributesMask)) 2188 dst = dst[8:] 2189 dst = s.Atime.MarshalUnsafe(dst) 2190 dst = s.Btime.MarshalUnsafe(dst) 2191 dst = s.Ctime.MarshalUnsafe(dst) 2192 dst = s.Mtime.MarshalUnsafe(dst) 2193 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMajor)) 2194 dst = dst[4:] 2195 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.RdevMinor)) 2196 dst = dst[4:] 2197 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMajor)) 2198 dst = dst[4:] 2199 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.DevMinor)) 2200 dst = dst[4:] 2201 return dst 2202 } 2203 2204 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2205 func (s *Statx) UnmarshalBytes(src []byte) []byte { 2206 s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2207 src = src[4:] 2208 s.Blksize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2209 src = src[4:] 2210 s.Attributes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2211 src = src[8:] 2212 s.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2213 src = src[4:] 2214 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2215 src = src[4:] 2216 s.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2217 src = src[4:] 2218 s.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 2219 src = src[2:] 2220 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 2221 src = src[2:] 2222 s.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2223 src = src[8:] 2224 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2225 src = src[8:] 2226 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2227 src = src[8:] 2228 s.AttributesMask = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2229 src = src[8:] 2230 src = s.Atime.UnmarshalUnsafe(src) 2231 src = s.Btime.UnmarshalUnsafe(src) 2232 src = s.Ctime.UnmarshalUnsafe(src) 2233 src = s.Mtime.UnmarshalUnsafe(src) 2234 s.RdevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2235 src = src[4:] 2236 s.RdevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2237 src = src[4:] 2238 s.DevMajor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2239 src = src[4:] 2240 s.DevMinor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2241 src = src[4:] 2242 return src 2243 } 2244 2245 // Packed implements marshal.Marshallable.Packed. 2246 //go:nosplit 2247 func (s *Statx) Packed() bool { 2248 return s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() 2249 } 2250 2251 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2252 func (s *Statx) MarshalUnsafe(dst []byte) []byte { 2253 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2254 size := s.SizeBytes() 2255 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2256 return dst[size:] 2257 } 2258 // Type Statx doesn't have a packed layout in memory, fallback to MarshalBytes. 2259 return s.MarshalBytes(dst) 2260 } 2261 2262 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2263 func (s *Statx) UnmarshalUnsafe(src []byte) []byte { 2264 if s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2265 size := s.SizeBytes() 2266 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2267 return src[size:] 2268 } 2269 // Type Statx doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2270 return s.UnmarshalBytes(src) 2271 } 2272 2273 // CopyOutN implements marshal.Marshallable.CopyOutN. 2274 func (s *Statx) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2275 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2276 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2277 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2278 s.MarshalBytes(buf) // escapes: fallback. 2279 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2280 } 2281 2282 // Construct a slice backed by dst's underlying memory. 2283 var buf []byte 2284 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2285 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2286 hdr.Len = s.SizeBytes() 2287 hdr.Cap = s.SizeBytes() 2288 2289 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2290 // Since we bypassed the compiler's escape analysis, indicate that s 2291 // must live until the use above. 2292 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2293 return length, err 2294 } 2295 2296 // CopyOut implements marshal.Marshallable.CopyOut. 2297 func (s *Statx) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2298 return s.CopyOutN(cc, addr, s.SizeBytes()) 2299 } 2300 2301 // CopyInN implements marshal.Marshallable.CopyInN. 2302 func (s *Statx) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2303 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2304 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2305 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2306 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2307 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2308 // partially unmarshalled struct. 2309 s.UnmarshalBytes(buf) // escapes: fallback. 2310 return length, err 2311 } 2312 2313 // Construct a slice backed by dst's underlying memory. 2314 var buf []byte 2315 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2316 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2317 hdr.Len = s.SizeBytes() 2318 hdr.Cap = s.SizeBytes() 2319 2320 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2321 // Since we bypassed the compiler's escape analysis, indicate that s 2322 // must live until the use above. 2323 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2324 return length, err 2325 } 2326 2327 // CopyIn implements marshal.Marshallable.CopyIn. 2328 func (s *Statx) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2329 return s.CopyInN(cc, addr, s.SizeBytes()) 2330 } 2331 2332 // WriteTo implements io.WriterTo.WriteTo. 2333 func (s *Statx) WriteTo(writer io.Writer) (int64, error) { 2334 if !s.Atime.Packed() && s.Btime.Packed() && s.Ctime.Packed() && s.Mtime.Packed() { 2335 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2336 buf := make([]byte, s.SizeBytes()) 2337 s.MarshalBytes(buf) 2338 length, err := writer.Write(buf) 2339 return int64(length), err 2340 } 2341 2342 // Construct a slice backed by dst's underlying memory. 2343 var buf []byte 2344 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2345 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2346 hdr.Len = s.SizeBytes() 2347 hdr.Cap = s.SizeBytes() 2348 2349 length, err := writer.Write(buf) 2350 // Since we bypassed the compiler's escape analysis, indicate that s 2351 // must live until the use above. 2352 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2353 return int64(length), err 2354 } 2355 2356 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2357 func (s *Statx) CheckedMarshal(dst []byte) ([]byte, bool) { 2358 if s.SizeBytes() > len(dst) { 2359 return dst, false 2360 } 2361 return s.MarshalUnsafe(dst), true 2362 } 2363 2364 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2365 func (s *Statx) CheckedUnmarshal(src []byte) ([]byte, bool) { 2366 if s.SizeBytes() > len(src) { 2367 return src, false 2368 } 2369 return s.UnmarshalUnsafe(src), true 2370 } 2371 2372 // CopyStatxSliceIn copies in a slice of Statx objects from the task's memory. 2373 func CopyStatxSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Statx) (int, error) { 2374 count := len(dst) 2375 if count == 0 { 2376 return 0, nil 2377 } 2378 size := (*Statx)(nil).SizeBytes() 2379 2380 if !dst[0].Packed() { 2381 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2382 buf := cc.CopyScratchBuffer(size * count) 2383 length, err := cc.CopyInBytes(addr, buf) 2384 2385 // Unmarshal as much as possible, even on error. First handle full objects. 2386 limit := length/size 2387 for idx := 0; idx < limit; idx++ { 2388 buf = dst[idx].UnmarshalBytes(buf) 2389 } 2390 2391 // Handle any final partial object. buf is guaranteed to be long enough for the 2392 // final element, but may not contain valid data for the entire range. This may 2393 // result in unmarshalling zero values for some parts of the object. 2394 if length%size != 0 { 2395 dst[limit].UnmarshalBytes(buf) 2396 } 2397 2398 return length, err 2399 } 2400 2401 ptr := unsafe.Pointer(&dst) 2402 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2403 2404 // Construct a slice backed by dst's underlying memory. 2405 var buf []byte 2406 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2407 hdr.Data = uintptr(val) 2408 hdr.Len = size * count 2409 hdr.Cap = size * count 2410 2411 length, err := cc.CopyInBytes(addr, buf) 2412 // Since we bypassed the compiler's escape analysis, indicate that dst 2413 // must live until the use above. 2414 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 2415 return length, err 2416 } 2417 2418 // CopyStatxSliceOut copies a slice of Statx objects to the task's memory. 2419 func CopyStatxSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Statx) (int, error) { 2420 count := len(src) 2421 if count == 0 { 2422 return 0, nil 2423 } 2424 size := (*Statx)(nil).SizeBytes() 2425 2426 if !src[0].Packed() { 2427 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2428 buf := cc.CopyScratchBuffer(size * count) 2429 curBuf := buf 2430 for idx := 0; idx < count; idx++ { 2431 curBuf = src[idx].MarshalBytes(curBuf) 2432 } 2433 return cc.CopyOutBytes(addr, buf) 2434 } 2435 2436 ptr := unsafe.Pointer(&src) 2437 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2438 2439 // Construct a slice backed by dst's underlying memory. 2440 var buf []byte 2441 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2442 hdr.Data = uintptr(val) 2443 hdr.Len = size * count 2444 hdr.Cap = size * count 2445 2446 length, err := cc.CopyOutBytes(addr, buf) 2447 // Since we bypassed the compiler's escape analysis, indicate that src 2448 // must live until the use above. 2449 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2450 return length, err 2451 } 2452 2453 // MarshalUnsafeStatxSlice is like Statx.MarshalUnsafe, but for a []Statx. 2454 func MarshalUnsafeStatxSlice(src []Statx, dst []byte) []byte { 2455 count := len(src) 2456 if count == 0 { 2457 return dst 2458 } 2459 2460 if !src[0].Packed() { 2461 // Type Statx doesn't have a packed layout in memory, fall back to MarshalBytes. 2462 for idx := 0; idx < count; idx++ { 2463 dst = src[idx].MarshalBytes(dst) 2464 } 2465 return dst 2466 } 2467 2468 size := (*Statx)(nil).SizeBytes() 2469 buf := dst[:size*count] 2470 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2471 return dst[size*count:] 2472 } 2473 2474 // UnmarshalUnsafeStatxSlice is like Statx.UnmarshalUnsafe, but for a []Statx. 2475 func UnmarshalUnsafeStatxSlice(dst []Statx, src []byte) []byte { 2476 count := len(dst) 2477 if count == 0 { 2478 return src 2479 } 2480 2481 if !dst[0].Packed() { 2482 // Type Statx doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2483 for idx := 0; idx < count; idx++ { 2484 src = dst[idx].UnmarshalBytes(src) 2485 } 2486 return src 2487 } 2488 2489 size := (*Statx)(nil).SizeBytes() 2490 buf := src[:size*count] 2491 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2492 return src[size*count:] 2493 } 2494 2495 // SizeBytes implements marshal.Marshallable.SizeBytes. 2496 func (s *Statfs) SizeBytes() int { 2497 return 80 + 2498 4*2 + 2499 8*4 2500 } 2501 2502 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2503 func (s *Statfs) MarshalBytes(dst []byte) []byte { 2504 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type)) 2505 dst = dst[8:] 2506 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize)) 2507 dst = dst[8:] 2508 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 2509 dst = dst[8:] 2510 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksFree)) 2511 dst = dst[8:] 2512 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksAvailable)) 2513 dst = dst[8:] 2514 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Files)) 2515 dst = dst[8:] 2516 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FilesFree)) 2517 dst = dst[8:] 2518 for idx := 0; idx < 2; idx++ { 2519 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FSID[idx])) 2520 dst = dst[4:] 2521 } 2522 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength)) 2523 dst = dst[8:] 2524 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FragmentSize)) 2525 dst = dst[8:] 2526 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 2527 dst = dst[8:] 2528 for idx := 0; idx < 4; idx++ { 2529 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Spare[idx])) 2530 dst = dst[8:] 2531 } 2532 return dst 2533 } 2534 2535 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2536 func (s *Statfs) UnmarshalBytes(src []byte) []byte { 2537 s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2538 src = src[8:] 2539 s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2540 src = src[8:] 2541 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2542 src = src[8:] 2543 s.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2544 src = src[8:] 2545 s.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2546 src = src[8:] 2547 s.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2548 src = src[8:] 2549 s.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2550 src = src[8:] 2551 for idx := 0; idx < 2; idx++ { 2552 s.FSID[idx] = int32(hostarch.ByteOrder.Uint32(src[:4])) 2553 src = src[4:] 2554 } 2555 s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2556 src = src[8:] 2557 s.FragmentSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 2558 src = src[8:] 2559 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2560 src = src[8:] 2561 for idx := 0; idx < 4; idx++ { 2562 s.Spare[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2563 src = src[8:] 2564 } 2565 return src 2566 } 2567 2568 // Packed implements marshal.Marshallable.Packed. 2569 //go:nosplit 2570 func (s *Statfs) Packed() bool { 2571 return true 2572 } 2573 2574 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2575 func (s *Statfs) MarshalUnsafe(dst []byte) []byte { 2576 size := s.SizeBytes() 2577 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 2578 return dst[size:] 2579 } 2580 2581 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2582 func (s *Statfs) UnmarshalUnsafe(src []byte) []byte { 2583 size := s.SizeBytes() 2584 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 2585 return src[size:] 2586 } 2587 2588 // CopyOutN implements marshal.Marshallable.CopyOutN. 2589 func (s *Statfs) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2590 // Construct a slice backed by dst's underlying memory. 2591 var buf []byte 2592 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2593 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2594 hdr.Len = s.SizeBytes() 2595 hdr.Cap = s.SizeBytes() 2596 2597 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2598 // Since we bypassed the compiler's escape analysis, indicate that s 2599 // must live until the use above. 2600 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2601 return length, err 2602 } 2603 2604 // CopyOut implements marshal.Marshallable.CopyOut. 2605 func (s *Statfs) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2606 return s.CopyOutN(cc, addr, s.SizeBytes()) 2607 } 2608 2609 // CopyInN implements marshal.Marshallable.CopyInN. 2610 func (s *Statfs) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2611 // Construct a slice backed by dst's underlying memory. 2612 var buf []byte 2613 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2614 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2615 hdr.Len = s.SizeBytes() 2616 hdr.Cap = s.SizeBytes() 2617 2618 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2619 // Since we bypassed the compiler's escape analysis, indicate that s 2620 // must live until the use above. 2621 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2622 return length, err 2623 } 2624 2625 // CopyIn implements marshal.Marshallable.CopyIn. 2626 func (s *Statfs) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2627 return s.CopyInN(cc, addr, s.SizeBytes()) 2628 } 2629 2630 // WriteTo implements io.WriterTo.WriteTo. 2631 func (s *Statfs) WriteTo(writer io.Writer) (int64, error) { 2632 // Construct a slice backed by dst's underlying memory. 2633 var buf []byte 2634 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2635 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 2636 hdr.Len = s.SizeBytes() 2637 hdr.Cap = s.SizeBytes() 2638 2639 length, err := writer.Write(buf) 2640 // Since we bypassed the compiler's escape analysis, indicate that s 2641 // must live until the use above. 2642 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 2643 return int64(length), err 2644 } 2645 2646 // Packed implements marshal.Marshallable.Packed. 2647 //go:nosplit 2648 func (s *CString) Packed() bool { 2649 // Type CString is dynamic so it might have slice/string headers. Hence, it is not packed. 2650 return false 2651 } 2652 2653 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2654 func (s *CString) MarshalUnsafe(dst []byte) []byte { 2655 // Type CString doesn't have a packed layout in memory, fallback to MarshalBytes. 2656 return s.MarshalBytes(dst) 2657 } 2658 2659 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2660 func (s *CString) UnmarshalUnsafe(src []byte) []byte { 2661 // Type CString doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2662 return s.UnmarshalBytes(src) 2663 } 2664 2665 // CopyOutN implements marshal.Marshallable.CopyOutN. 2666 //go:nosplit 2667 func (s *CString) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2668 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2669 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2670 s.MarshalBytes(buf) // escapes: fallback. 2671 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2672 } 2673 2674 // CopyOut implements marshal.Marshallable.CopyOut. 2675 func (s *CString) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2676 return s.CopyOutN(cc, addr, s.SizeBytes()) 2677 } 2678 2679 // CopyInN implements marshal.Marshallable.CopyInN. 2680 //go:nosplit 2681 func (s *CString) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2682 // Type CString doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2683 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 2684 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2685 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2686 // partially unmarshalled struct. 2687 s.UnmarshalBytes(buf) // escapes: fallback. 2688 return length, err 2689 } 2690 2691 // CopyIn implements marshal.Marshallable.CopyIn. 2692 func (s *CString) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2693 return s.CopyInN(cc, addr, s.SizeBytes()) 2694 } 2695 2696 // WriteTo implements io.WriterTo.WriteTo. 2697 func (s *CString) WriteTo(writer io.Writer) (int64, error) { 2698 // Type CString doesn't have a packed layout in memory, fall back to MarshalBytes. 2699 buf := make([]byte, s.SizeBytes()) 2700 s.MarshalBytes(buf) 2701 length, err := writer.Write(buf) 2702 return int64(length), err 2703 } 2704 2705 // SizeBytes implements marshal.Marshallable.SizeBytes. 2706 func (f *FUSEAccessIn) SizeBytes() int { 2707 return 8 2708 } 2709 2710 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2711 func (f *FUSEAccessIn) MarshalBytes(dst []byte) []byte { 2712 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mask)) 2713 dst = dst[4:] 2714 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2715 dst = dst[4:] 2716 return dst 2717 } 2718 2719 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2720 func (f *FUSEAccessIn) UnmarshalBytes(src []byte) []byte { 2721 f.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2722 src = src[4:] 2723 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2724 src = src[4:] 2725 return src 2726 } 2727 2728 // Packed implements marshal.Marshallable.Packed. 2729 //go:nosplit 2730 func (f *FUSEAccessIn) Packed() bool { 2731 return true 2732 } 2733 2734 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2735 func (f *FUSEAccessIn) MarshalUnsafe(dst []byte) []byte { 2736 size := f.SizeBytes() 2737 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 2738 return dst[size:] 2739 } 2740 2741 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2742 func (f *FUSEAccessIn) UnmarshalUnsafe(src []byte) []byte { 2743 size := f.SizeBytes() 2744 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 2745 return src[size:] 2746 } 2747 2748 // CopyOutN implements marshal.Marshallable.CopyOutN. 2749 func (f *FUSEAccessIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2750 // Construct a slice backed by dst's underlying memory. 2751 var buf []byte 2752 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2753 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2754 hdr.Len = f.SizeBytes() 2755 hdr.Cap = f.SizeBytes() 2756 2757 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2758 // Since we bypassed the compiler's escape analysis, indicate that f 2759 // must live until the use above. 2760 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2761 return length, err 2762 } 2763 2764 // CopyOut implements marshal.Marshallable.CopyOut. 2765 func (f *FUSEAccessIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2766 return f.CopyOutN(cc, addr, f.SizeBytes()) 2767 } 2768 2769 // CopyInN implements marshal.Marshallable.CopyInN. 2770 func (f *FUSEAccessIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2771 // Construct a slice backed by dst's underlying memory. 2772 var buf []byte 2773 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2774 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2775 hdr.Len = f.SizeBytes() 2776 hdr.Cap = f.SizeBytes() 2777 2778 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2779 // Since we bypassed the compiler's escape analysis, indicate that f 2780 // must live until the use above. 2781 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2782 return length, err 2783 } 2784 2785 // CopyIn implements marshal.Marshallable.CopyIn. 2786 func (f *FUSEAccessIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2787 return f.CopyInN(cc, addr, f.SizeBytes()) 2788 } 2789 2790 // WriteTo implements io.WriterTo.WriteTo. 2791 func (f *FUSEAccessIn) WriteTo(writer io.Writer) (int64, error) { 2792 // Construct a slice backed by dst's underlying memory. 2793 var buf []byte 2794 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2795 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 2796 hdr.Len = f.SizeBytes() 2797 hdr.Cap = f.SizeBytes() 2798 2799 length, err := writer.Write(buf) 2800 // Since we bypassed the compiler's escape analysis, indicate that f 2801 // must live until the use above. 2802 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 2803 return int64(length), err 2804 } 2805 2806 // SizeBytes implements marshal.Marshallable.SizeBytes. 2807 func (a *FUSEAttr) SizeBytes() int { 2808 return 88 2809 } 2810 2811 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2812 func (a *FUSEAttr) MarshalBytes(dst []byte) []byte { 2813 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ino)) 2814 dst = dst[8:] 2815 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Size)) 2816 dst = dst[8:] 2817 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Blocks)) 2818 dst = dst[8:] 2819 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Atime)) 2820 dst = dst[8:] 2821 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Mtime)) 2822 dst = dst[8:] 2823 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Ctime)) 2824 dst = dst[8:] 2825 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.AtimeNsec)) 2826 dst = dst[4:] 2827 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.MtimeNsec)) 2828 dst = dst[4:] 2829 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.CtimeNsec)) 2830 dst = dst[4:] 2831 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Mode)) 2832 dst = dst[4:] 2833 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Nlink)) 2834 dst = dst[4:] 2835 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.UID)) 2836 dst = dst[4:] 2837 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.GID)) 2838 dst = dst[4:] 2839 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.Rdev)) 2840 dst = dst[4:] 2841 hostarch.ByteOrder.PutUint32(dst[:4], uint32(a.BlkSize)) 2842 dst = dst[4:] 2843 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2844 dst = dst[4:] 2845 return dst 2846 } 2847 2848 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2849 func (a *FUSEAttr) UnmarshalBytes(src []byte) []byte { 2850 a.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2851 src = src[8:] 2852 a.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2853 src = src[8:] 2854 a.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2855 src = src[8:] 2856 a.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2857 src = src[8:] 2858 a.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2859 src = src[8:] 2860 a.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2861 src = src[8:] 2862 a.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2863 src = src[4:] 2864 a.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2865 src = src[4:] 2866 a.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2867 src = src[4:] 2868 a.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2869 src = src[4:] 2870 a.Nlink = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2871 src = src[4:] 2872 a.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2873 src = src[4:] 2874 a.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2875 src = src[4:] 2876 a.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2877 src = src[4:] 2878 a.BlkSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2879 src = src[4:] 2880 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2881 src = src[4:] 2882 return src 2883 } 2884 2885 // Packed implements marshal.Marshallable.Packed. 2886 //go:nosplit 2887 func (a *FUSEAttr) Packed() bool { 2888 return true 2889 } 2890 2891 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2892 func (a *FUSEAttr) MarshalUnsafe(dst []byte) []byte { 2893 size := a.SizeBytes() 2894 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size)) 2895 return dst[size:] 2896 } 2897 2898 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2899 func (a *FUSEAttr) UnmarshalUnsafe(src []byte) []byte { 2900 size := a.SizeBytes() 2901 gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size)) 2902 return src[size:] 2903 } 2904 2905 // CopyOutN implements marshal.Marshallable.CopyOutN. 2906 func (a *FUSEAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2907 // Construct a slice backed by dst's underlying memory. 2908 var buf []byte 2909 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2910 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2911 hdr.Len = a.SizeBytes() 2912 hdr.Cap = a.SizeBytes() 2913 2914 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2915 // Since we bypassed the compiler's escape analysis, indicate that a 2916 // must live until the use above. 2917 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2918 return length, err 2919 } 2920 2921 // CopyOut implements marshal.Marshallable.CopyOut. 2922 func (a *FUSEAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2923 return a.CopyOutN(cc, addr, a.SizeBytes()) 2924 } 2925 2926 // CopyInN implements marshal.Marshallable.CopyInN. 2927 func (a *FUSEAttr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2928 // Construct a slice backed by dst's underlying memory. 2929 var buf []byte 2930 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2931 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2932 hdr.Len = a.SizeBytes() 2933 hdr.Cap = a.SizeBytes() 2934 2935 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 2936 // Since we bypassed the compiler's escape analysis, indicate that a 2937 // must live until the use above. 2938 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2939 return length, err 2940 } 2941 2942 // CopyIn implements marshal.Marshallable.CopyIn. 2943 func (a *FUSEAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2944 return a.CopyInN(cc, addr, a.SizeBytes()) 2945 } 2946 2947 // WriteTo implements io.WriterTo.WriteTo. 2948 func (a *FUSEAttr) WriteTo(writer io.Writer) (int64, error) { 2949 // Construct a slice backed by dst's underlying memory. 2950 var buf []byte 2951 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2952 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 2953 hdr.Len = a.SizeBytes() 2954 hdr.Cap = a.SizeBytes() 2955 2956 length, err := writer.Write(buf) 2957 // Since we bypassed the compiler's escape analysis, indicate that a 2958 // must live until the use above. 2959 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 2960 return int64(length), err 2961 } 2962 2963 // SizeBytes implements marshal.Marshallable.SizeBytes. 2964 func (f *FUSEAttrOut) SizeBytes() int { 2965 return 16 + 2966 (*FUSEAttr)(nil).SizeBytes() 2967 } 2968 2969 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2970 func (f *FUSEAttrOut) MarshalBytes(dst []byte) []byte { 2971 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 2972 dst = dst[8:] 2973 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNsec)) 2974 dst = dst[4:] 2975 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2976 dst = dst[4:] 2977 dst = f.Attr.MarshalUnsafe(dst) 2978 return dst 2979 } 2980 2981 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2982 func (f *FUSEAttrOut) UnmarshalBytes(src []byte) []byte { 2983 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 2984 src = src[8:] 2985 f.AttrValidNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2986 src = src[4:] 2987 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2988 src = src[4:] 2989 src = f.Attr.UnmarshalUnsafe(src) 2990 return src 2991 } 2992 2993 // Packed implements marshal.Marshallable.Packed. 2994 //go:nosplit 2995 func (f *FUSEAttrOut) Packed() bool { 2996 return f.Attr.Packed() 2997 } 2998 2999 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3000 func (f *FUSEAttrOut) MarshalUnsafe(dst []byte) []byte { 3001 if f.Attr.Packed() { 3002 size := f.SizeBytes() 3003 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3004 return dst[size:] 3005 } 3006 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3007 return f.MarshalBytes(dst) 3008 } 3009 3010 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3011 func (f *FUSEAttrOut) UnmarshalUnsafe(src []byte) []byte { 3012 if f.Attr.Packed() { 3013 size := f.SizeBytes() 3014 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3015 return src[size:] 3016 } 3017 // Type FUSEAttrOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3018 return f.UnmarshalBytes(src) 3019 } 3020 3021 // CopyOutN implements marshal.Marshallable.CopyOutN. 3022 func (f *FUSEAttrOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3023 if !f.Attr.Packed() { 3024 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3025 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3026 f.MarshalBytes(buf) // escapes: fallback. 3027 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3028 } 3029 3030 // Construct a slice backed by dst's underlying memory. 3031 var buf []byte 3032 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3033 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3034 hdr.Len = f.SizeBytes() 3035 hdr.Cap = f.SizeBytes() 3036 3037 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3038 // Since we bypassed the compiler's escape analysis, indicate that f 3039 // must live until the use above. 3040 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3041 return length, err 3042 } 3043 3044 // CopyOut implements marshal.Marshallable.CopyOut. 3045 func (f *FUSEAttrOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3046 return f.CopyOutN(cc, addr, f.SizeBytes()) 3047 } 3048 3049 // CopyInN implements marshal.Marshallable.CopyInN. 3050 func (f *FUSEAttrOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3051 if !f.Attr.Packed() { 3052 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3053 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3054 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3055 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3056 // partially unmarshalled struct. 3057 f.UnmarshalBytes(buf) // escapes: fallback. 3058 return length, err 3059 } 3060 3061 // Construct a slice backed by dst's underlying memory. 3062 var buf []byte 3063 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3064 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3065 hdr.Len = f.SizeBytes() 3066 hdr.Cap = f.SizeBytes() 3067 3068 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3069 // Since we bypassed the compiler's escape analysis, indicate that f 3070 // must live until the use above. 3071 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3072 return length, err 3073 } 3074 3075 // CopyIn implements marshal.Marshallable.CopyIn. 3076 func (f *FUSEAttrOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3077 return f.CopyInN(cc, addr, f.SizeBytes()) 3078 } 3079 3080 // WriteTo implements io.WriterTo.WriteTo. 3081 func (f *FUSEAttrOut) WriteTo(writer io.Writer) (int64, error) { 3082 if !f.Attr.Packed() { 3083 // Type FUSEAttrOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3084 buf := make([]byte, f.SizeBytes()) 3085 f.MarshalBytes(buf) 3086 length, err := writer.Write(buf) 3087 return int64(length), err 3088 } 3089 3090 // Construct a slice backed by dst's underlying memory. 3091 var buf []byte 3092 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3093 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3094 hdr.Len = f.SizeBytes() 3095 hdr.Cap = f.SizeBytes() 3096 3097 length, err := writer.Write(buf) 3098 // Since we bypassed the compiler's escape analysis, indicate that f 3099 // must live until the use above. 3100 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3101 return int64(length), err 3102 } 3103 3104 // Packed implements marshal.Marshallable.Packed. 3105 //go:nosplit 3106 func (r *FUSECreateIn) Packed() bool { 3107 // Type FUSECreateIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3108 return false 3109 } 3110 3111 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3112 func (r *FUSECreateIn) MarshalUnsafe(dst []byte) []byte { 3113 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3114 return r.MarshalBytes(dst) 3115 } 3116 3117 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3118 func (r *FUSECreateIn) UnmarshalUnsafe(src []byte) []byte { 3119 // Type FUSECreateIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3120 return r.UnmarshalBytes(src) 3121 } 3122 3123 // CopyOutN implements marshal.Marshallable.CopyOutN. 3124 //go:nosplit 3125 func (r *FUSECreateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3126 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3127 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3128 r.MarshalBytes(buf) // escapes: fallback. 3129 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3130 } 3131 3132 // CopyOut implements marshal.Marshallable.CopyOut. 3133 func (r *FUSECreateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3134 return r.CopyOutN(cc, addr, r.SizeBytes()) 3135 } 3136 3137 // CopyInN implements marshal.Marshallable.CopyInN. 3138 //go:nosplit 3139 func (r *FUSECreateIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3140 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3141 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3142 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3143 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3144 // partially unmarshalled struct. 3145 r.UnmarshalBytes(buf) // escapes: fallback. 3146 return length, err 3147 } 3148 3149 // CopyIn implements marshal.Marshallable.CopyIn. 3150 func (r *FUSECreateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3151 return r.CopyInN(cc, addr, r.SizeBytes()) 3152 } 3153 3154 // WriteTo implements io.WriterTo.WriteTo. 3155 func (r *FUSECreateIn) WriteTo(writer io.Writer) (int64, error) { 3156 // Type FUSECreateIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3157 buf := make([]byte, r.SizeBytes()) 3158 r.MarshalBytes(buf) 3159 length, err := writer.Write(buf) 3160 return int64(length), err 3161 } 3162 3163 // SizeBytes implements marshal.Marshallable.SizeBytes. 3164 func (f *FUSECreateMeta) SizeBytes() int { 3165 return 16 3166 } 3167 3168 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3169 func (f *FUSECreateMeta) MarshalBytes(dst []byte) []byte { 3170 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 3171 dst = dst[4:] 3172 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 3173 dst = dst[4:] 3174 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 3175 dst = dst[4:] 3176 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3177 dst = dst[4:] 3178 return dst 3179 } 3180 3181 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3182 func (f *FUSECreateMeta) UnmarshalBytes(src []byte) []byte { 3183 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3184 src = src[4:] 3185 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3186 src = src[4:] 3187 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3188 src = src[4:] 3189 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3190 src = src[4:] 3191 return src 3192 } 3193 3194 // Packed implements marshal.Marshallable.Packed. 3195 //go:nosplit 3196 func (f *FUSECreateMeta) Packed() bool { 3197 return true 3198 } 3199 3200 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3201 func (f *FUSECreateMeta) MarshalUnsafe(dst []byte) []byte { 3202 size := f.SizeBytes() 3203 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3204 return dst[size:] 3205 } 3206 3207 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3208 func (f *FUSECreateMeta) UnmarshalUnsafe(src []byte) []byte { 3209 size := f.SizeBytes() 3210 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3211 return src[size:] 3212 } 3213 3214 // CopyOutN implements marshal.Marshallable.CopyOutN. 3215 func (f *FUSECreateMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3216 // Construct a slice backed by dst's underlying memory. 3217 var buf []byte 3218 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3219 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3220 hdr.Len = f.SizeBytes() 3221 hdr.Cap = f.SizeBytes() 3222 3223 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3224 // Since we bypassed the compiler's escape analysis, indicate that f 3225 // must live until the use above. 3226 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3227 return length, err 3228 } 3229 3230 // CopyOut implements marshal.Marshallable.CopyOut. 3231 func (f *FUSECreateMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3232 return f.CopyOutN(cc, addr, f.SizeBytes()) 3233 } 3234 3235 // CopyInN implements marshal.Marshallable.CopyInN. 3236 func (f *FUSECreateMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3237 // Construct a slice backed by dst's underlying memory. 3238 var buf []byte 3239 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3240 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3241 hdr.Len = f.SizeBytes() 3242 hdr.Cap = f.SizeBytes() 3243 3244 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3245 // Since we bypassed the compiler's escape analysis, indicate that f 3246 // must live until the use above. 3247 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3248 return length, err 3249 } 3250 3251 // CopyIn implements marshal.Marshallable.CopyIn. 3252 func (f *FUSECreateMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3253 return f.CopyInN(cc, addr, f.SizeBytes()) 3254 } 3255 3256 // WriteTo implements io.WriterTo.WriteTo. 3257 func (f *FUSECreateMeta) WriteTo(writer io.Writer) (int64, error) { 3258 // Construct a slice backed by dst's underlying memory. 3259 var buf []byte 3260 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3261 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3262 hdr.Len = f.SizeBytes() 3263 hdr.Cap = f.SizeBytes() 3264 3265 length, err := writer.Write(buf) 3266 // Since we bypassed the compiler's escape analysis, indicate that f 3267 // must live until the use above. 3268 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3269 return int64(length), err 3270 } 3271 3272 // SizeBytes implements marshal.Marshallable.SizeBytes. 3273 func (f *FUSECreateOut) SizeBytes() int { 3274 return 0 + 3275 (*FUSEEntryOut)(nil).SizeBytes() + 3276 (*FUSEOpenOut)(nil).SizeBytes() 3277 } 3278 3279 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3280 func (f *FUSECreateOut) MarshalBytes(dst []byte) []byte { 3281 dst = f.FUSEEntryOut.MarshalUnsafe(dst) 3282 dst = f.FUSEOpenOut.MarshalUnsafe(dst) 3283 return dst 3284 } 3285 3286 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3287 func (f *FUSECreateOut) UnmarshalBytes(src []byte) []byte { 3288 src = f.FUSEEntryOut.UnmarshalUnsafe(src) 3289 src = f.FUSEOpenOut.UnmarshalUnsafe(src) 3290 return src 3291 } 3292 3293 // Packed implements marshal.Marshallable.Packed. 3294 //go:nosplit 3295 func (f *FUSECreateOut) Packed() bool { 3296 return f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() 3297 } 3298 3299 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3300 func (f *FUSECreateOut) MarshalUnsafe(dst []byte) []byte { 3301 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3302 size := f.SizeBytes() 3303 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3304 return dst[size:] 3305 } 3306 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3307 return f.MarshalBytes(dst) 3308 } 3309 3310 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3311 func (f *FUSECreateOut) UnmarshalUnsafe(src []byte) []byte { 3312 if f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3313 size := f.SizeBytes() 3314 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3315 return src[size:] 3316 } 3317 // Type FUSECreateOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3318 return f.UnmarshalBytes(src) 3319 } 3320 3321 // CopyOutN implements marshal.Marshallable.CopyOutN. 3322 func (f *FUSECreateOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3323 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3324 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3325 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3326 f.MarshalBytes(buf) // escapes: fallback. 3327 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3328 } 3329 3330 // Construct a slice backed by dst's underlying memory. 3331 var buf []byte 3332 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3333 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3334 hdr.Len = f.SizeBytes() 3335 hdr.Cap = f.SizeBytes() 3336 3337 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3338 // Since we bypassed the compiler's escape analysis, indicate that f 3339 // must live until the use above. 3340 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3341 return length, err 3342 } 3343 3344 // CopyOut implements marshal.Marshallable.CopyOut. 3345 func (f *FUSECreateOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3346 return f.CopyOutN(cc, addr, f.SizeBytes()) 3347 } 3348 3349 // CopyInN implements marshal.Marshallable.CopyInN. 3350 func (f *FUSECreateOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3351 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3352 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3353 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3354 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3355 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3356 // partially unmarshalled struct. 3357 f.UnmarshalBytes(buf) // escapes: fallback. 3358 return length, err 3359 } 3360 3361 // Construct a slice backed by dst's underlying memory. 3362 var buf []byte 3363 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3364 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3365 hdr.Len = f.SizeBytes() 3366 hdr.Cap = f.SizeBytes() 3367 3368 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3369 // Since we bypassed the compiler's escape analysis, indicate that f 3370 // must live until the use above. 3371 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3372 return length, err 3373 } 3374 3375 // CopyIn implements marshal.Marshallable.CopyIn. 3376 func (f *FUSECreateOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3377 return f.CopyInN(cc, addr, f.SizeBytes()) 3378 } 3379 3380 // WriteTo implements io.WriterTo.WriteTo. 3381 func (f *FUSECreateOut) WriteTo(writer io.Writer) (int64, error) { 3382 if !f.FUSEEntryOut.Packed() && f.FUSEOpenOut.Packed() { 3383 // Type FUSECreateOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3384 buf := make([]byte, f.SizeBytes()) 3385 f.MarshalBytes(buf) 3386 length, err := writer.Write(buf) 3387 return int64(length), err 3388 } 3389 3390 // Construct a slice backed by dst's underlying memory. 3391 var buf []byte 3392 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3393 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3394 hdr.Len = f.SizeBytes() 3395 hdr.Cap = f.SizeBytes() 3396 3397 length, err := writer.Write(buf) 3398 // Since we bypassed the compiler's escape analysis, indicate that f 3399 // must live until the use above. 3400 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3401 return int64(length), err 3402 } 3403 3404 // Packed implements marshal.Marshallable.Packed. 3405 //go:nosplit 3406 func (r *FUSEDirent) Packed() bool { 3407 // Type FUSEDirent is dynamic so it might have slice/string headers. Hence, it is not packed. 3408 return false 3409 } 3410 3411 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3412 func (r *FUSEDirent) MarshalUnsafe(dst []byte) []byte { 3413 // Type FUSEDirent doesn't have a packed layout in memory, fallback to MarshalBytes. 3414 return r.MarshalBytes(dst) 3415 } 3416 3417 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3418 func (r *FUSEDirent) UnmarshalUnsafe(src []byte) []byte { 3419 // Type FUSEDirent doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3420 return r.UnmarshalBytes(src) 3421 } 3422 3423 // CopyOutN implements marshal.Marshallable.CopyOutN. 3424 //go:nosplit 3425 func (r *FUSEDirent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3426 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3427 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3428 r.MarshalBytes(buf) // escapes: fallback. 3429 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3430 } 3431 3432 // CopyOut implements marshal.Marshallable.CopyOut. 3433 func (r *FUSEDirent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3434 return r.CopyOutN(cc, addr, r.SizeBytes()) 3435 } 3436 3437 // CopyInN implements marshal.Marshallable.CopyInN. 3438 //go:nosplit 3439 func (r *FUSEDirent) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3440 // Type FUSEDirent doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3441 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3442 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3443 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3444 // partially unmarshalled struct. 3445 r.UnmarshalBytes(buf) // escapes: fallback. 3446 return length, err 3447 } 3448 3449 // CopyIn implements marshal.Marshallable.CopyIn. 3450 func (r *FUSEDirent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3451 return r.CopyInN(cc, addr, r.SizeBytes()) 3452 } 3453 3454 // WriteTo implements io.WriterTo.WriteTo. 3455 func (r *FUSEDirent) WriteTo(writer io.Writer) (int64, error) { 3456 // Type FUSEDirent doesn't have a packed layout in memory, fall back to MarshalBytes. 3457 buf := make([]byte, r.SizeBytes()) 3458 r.MarshalBytes(buf) 3459 length, err := writer.Write(buf) 3460 return int64(length), err 3461 } 3462 3463 // SizeBytes implements marshal.Marshallable.SizeBytes. 3464 func (f *FUSEDirentMeta) SizeBytes() int { 3465 return 24 3466 } 3467 3468 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3469 func (f *FUSEDirentMeta) MarshalBytes(dst []byte) []byte { 3470 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ino)) 3471 dst = dst[8:] 3472 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Off)) 3473 dst = dst[8:] 3474 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLen)) 3475 dst = dst[4:] 3476 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Type)) 3477 dst = dst[4:] 3478 return dst 3479 } 3480 3481 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3482 func (f *FUSEDirentMeta) UnmarshalBytes(src []byte) []byte { 3483 f.Ino = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3484 src = src[8:] 3485 f.Off = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3486 src = src[8:] 3487 f.NameLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3488 src = src[4:] 3489 f.Type = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3490 src = src[4:] 3491 return src 3492 } 3493 3494 // Packed implements marshal.Marshallable.Packed. 3495 //go:nosplit 3496 func (f *FUSEDirentMeta) Packed() bool { 3497 return true 3498 } 3499 3500 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3501 func (f *FUSEDirentMeta) MarshalUnsafe(dst []byte) []byte { 3502 size := f.SizeBytes() 3503 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3504 return dst[size:] 3505 } 3506 3507 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3508 func (f *FUSEDirentMeta) UnmarshalUnsafe(src []byte) []byte { 3509 size := f.SizeBytes() 3510 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3511 return src[size:] 3512 } 3513 3514 // CopyOutN implements marshal.Marshallable.CopyOutN. 3515 func (f *FUSEDirentMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3516 // Construct a slice backed by dst's underlying memory. 3517 var buf []byte 3518 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3519 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3520 hdr.Len = f.SizeBytes() 3521 hdr.Cap = f.SizeBytes() 3522 3523 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3524 // Since we bypassed the compiler's escape analysis, indicate that f 3525 // must live until the use above. 3526 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3527 return length, err 3528 } 3529 3530 // CopyOut implements marshal.Marshallable.CopyOut. 3531 func (f *FUSEDirentMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3532 return f.CopyOutN(cc, addr, f.SizeBytes()) 3533 } 3534 3535 // CopyInN implements marshal.Marshallable.CopyInN. 3536 func (f *FUSEDirentMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3537 // Construct a slice backed by dst's underlying memory. 3538 var buf []byte 3539 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3540 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3541 hdr.Len = f.SizeBytes() 3542 hdr.Cap = f.SizeBytes() 3543 3544 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3545 // Since we bypassed the compiler's escape analysis, indicate that f 3546 // must live until the use above. 3547 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3548 return length, err 3549 } 3550 3551 // CopyIn implements marshal.Marshallable.CopyIn. 3552 func (f *FUSEDirentMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3553 return f.CopyInN(cc, addr, f.SizeBytes()) 3554 } 3555 3556 // WriteTo implements io.WriterTo.WriteTo. 3557 func (f *FUSEDirentMeta) WriteTo(writer io.Writer) (int64, error) { 3558 // Construct a slice backed by dst's underlying memory. 3559 var buf []byte 3560 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3561 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3562 hdr.Len = f.SizeBytes() 3563 hdr.Cap = f.SizeBytes() 3564 3565 length, err := writer.Write(buf) 3566 // Since we bypassed the compiler's escape analysis, indicate that f 3567 // must live until the use above. 3568 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3569 return int64(length), err 3570 } 3571 3572 // Packed implements marshal.Marshallable.Packed. 3573 //go:nosplit 3574 func (r *FUSEDirents) Packed() bool { 3575 // Type FUSEDirents is dynamic so it might have slice/string headers. Hence, it is not packed. 3576 return false 3577 } 3578 3579 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3580 func (r *FUSEDirents) MarshalUnsafe(dst []byte) []byte { 3581 // Type FUSEDirents doesn't have a packed layout in memory, fallback to MarshalBytes. 3582 return r.MarshalBytes(dst) 3583 } 3584 3585 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3586 func (r *FUSEDirents) UnmarshalUnsafe(src []byte) []byte { 3587 // Type FUSEDirents doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3588 return r.UnmarshalBytes(src) 3589 } 3590 3591 // CopyOutN implements marshal.Marshallable.CopyOutN. 3592 //go:nosplit 3593 func (r *FUSEDirents) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3594 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3595 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3596 r.MarshalBytes(buf) // escapes: fallback. 3597 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3598 } 3599 3600 // CopyOut implements marshal.Marshallable.CopyOut. 3601 func (r *FUSEDirents) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3602 return r.CopyOutN(cc, addr, r.SizeBytes()) 3603 } 3604 3605 // CopyInN implements marshal.Marshallable.CopyInN. 3606 //go:nosplit 3607 func (r *FUSEDirents) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3608 // Type FUSEDirents doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3609 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3610 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3611 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3612 // partially unmarshalled struct. 3613 r.UnmarshalBytes(buf) // escapes: fallback. 3614 return length, err 3615 } 3616 3617 // CopyIn implements marshal.Marshallable.CopyIn. 3618 func (r *FUSEDirents) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3619 return r.CopyInN(cc, addr, r.SizeBytes()) 3620 } 3621 3622 // WriteTo implements io.WriterTo.WriteTo. 3623 func (r *FUSEDirents) WriteTo(writer io.Writer) (int64, error) { 3624 // Type FUSEDirents doesn't have a packed layout in memory, fall back to MarshalBytes. 3625 buf := make([]byte, r.SizeBytes()) 3626 r.MarshalBytes(buf) 3627 length, err := writer.Write(buf) 3628 return int64(length), err 3629 } 3630 3631 // Packed implements marshal.Marshallable.Packed. 3632 //go:nosplit 3633 func (r *FUSEEmptyIn) Packed() bool { 3634 // Type FUSEEmptyIn is dynamic so it might have slice/string headers. Hence, it is not packed. 3635 return false 3636 } 3637 3638 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3639 func (r *FUSEEmptyIn) MarshalUnsafe(dst []byte) []byte { 3640 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to MarshalBytes. 3641 return r.MarshalBytes(dst) 3642 } 3643 3644 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3645 func (r *FUSEEmptyIn) UnmarshalUnsafe(src []byte) []byte { 3646 // Type FUSEEmptyIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3647 return r.UnmarshalBytes(src) 3648 } 3649 3650 // CopyOutN implements marshal.Marshallable.CopyOutN. 3651 //go:nosplit 3652 func (r *FUSEEmptyIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3653 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3654 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3655 r.MarshalBytes(buf) // escapes: fallback. 3656 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3657 } 3658 3659 // CopyOut implements marshal.Marshallable.CopyOut. 3660 func (r *FUSEEmptyIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3661 return r.CopyOutN(cc, addr, r.SizeBytes()) 3662 } 3663 3664 // CopyInN implements marshal.Marshallable.CopyInN. 3665 //go:nosplit 3666 func (r *FUSEEmptyIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3667 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3668 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3669 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3670 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3671 // partially unmarshalled struct. 3672 r.UnmarshalBytes(buf) // escapes: fallback. 3673 return length, err 3674 } 3675 3676 // CopyIn implements marshal.Marshallable.CopyIn. 3677 func (r *FUSEEmptyIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3678 return r.CopyInN(cc, addr, r.SizeBytes()) 3679 } 3680 3681 // WriteTo implements io.WriterTo.WriteTo. 3682 func (r *FUSEEmptyIn) WriteTo(writer io.Writer) (int64, error) { 3683 // Type FUSEEmptyIn doesn't have a packed layout in memory, fall back to MarshalBytes. 3684 buf := make([]byte, r.SizeBytes()) 3685 r.MarshalBytes(buf) 3686 length, err := writer.Write(buf) 3687 return int64(length), err 3688 } 3689 3690 // SizeBytes implements marshal.Marshallable.SizeBytes. 3691 func (f *FUSEEntryOut) SizeBytes() int { 3692 return 40 + 3693 (*FUSEAttr)(nil).SizeBytes() 3694 } 3695 3696 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3697 func (f *FUSEEntryOut) MarshalBytes(dst []byte) []byte { 3698 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 3699 dst = dst[8:] 3700 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Generation)) 3701 dst = dst[8:] 3702 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.EntryValid)) 3703 dst = dst[8:] 3704 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.AttrValid)) 3705 dst = dst[8:] 3706 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.EntryValidNSec)) 3707 dst = dst[4:] 3708 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AttrValidNSec)) 3709 dst = dst[4:] 3710 dst = f.Attr.MarshalUnsafe(dst) 3711 return dst 3712 } 3713 3714 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3715 func (f *FUSEEntryOut) UnmarshalBytes(src []byte) []byte { 3716 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3717 src = src[8:] 3718 f.Generation = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3719 src = src[8:] 3720 f.EntryValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3721 src = src[8:] 3722 f.AttrValid = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3723 src = src[8:] 3724 f.EntryValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3725 src = src[4:] 3726 f.AttrValidNSec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3727 src = src[4:] 3728 src = f.Attr.UnmarshalUnsafe(src) 3729 return src 3730 } 3731 3732 // Packed implements marshal.Marshallable.Packed. 3733 //go:nosplit 3734 func (f *FUSEEntryOut) Packed() bool { 3735 return f.Attr.Packed() 3736 } 3737 3738 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3739 func (f *FUSEEntryOut) MarshalUnsafe(dst []byte) []byte { 3740 if f.Attr.Packed() { 3741 size := f.SizeBytes() 3742 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3743 return dst[size:] 3744 } 3745 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to MarshalBytes. 3746 return f.MarshalBytes(dst) 3747 } 3748 3749 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3750 func (f *FUSEEntryOut) UnmarshalUnsafe(src []byte) []byte { 3751 if f.Attr.Packed() { 3752 size := f.SizeBytes() 3753 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3754 return src[size:] 3755 } 3756 // Type FUSEEntryOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3757 return f.UnmarshalBytes(src) 3758 } 3759 3760 // CopyOutN implements marshal.Marshallable.CopyOutN. 3761 func (f *FUSEEntryOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3762 if !f.Attr.Packed() { 3763 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3764 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3765 f.MarshalBytes(buf) // escapes: fallback. 3766 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3767 } 3768 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.CopyOutBytes(addr, buf[:limit]) // 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 // CopyOut implements marshal.Marshallable.CopyOut. 3784 func (f *FUSEEntryOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3785 return f.CopyOutN(cc, addr, f.SizeBytes()) 3786 } 3787 3788 // CopyInN implements marshal.Marshallable.CopyInN. 3789 func (f *FUSEEntryOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3790 if !f.Attr.Packed() { 3791 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3792 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 3793 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3794 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3795 // partially unmarshalled struct. 3796 f.UnmarshalBytes(buf) // escapes: fallback. 3797 return length, err 3798 } 3799 3800 // Construct a slice backed by dst's underlying memory. 3801 var buf []byte 3802 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3803 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3804 hdr.Len = f.SizeBytes() 3805 hdr.Cap = f.SizeBytes() 3806 3807 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3808 // Since we bypassed the compiler's escape analysis, indicate that f 3809 // must live until the use above. 3810 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3811 return length, err 3812 } 3813 3814 // CopyIn implements marshal.Marshallable.CopyIn. 3815 func (f *FUSEEntryOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3816 return f.CopyInN(cc, addr, f.SizeBytes()) 3817 } 3818 3819 // WriteTo implements io.WriterTo.WriteTo. 3820 func (f *FUSEEntryOut) WriteTo(writer io.Writer) (int64, error) { 3821 if !f.Attr.Packed() { 3822 // Type FUSEEntryOut doesn't have a packed layout in memory, fall back to MarshalBytes. 3823 buf := make([]byte, f.SizeBytes()) 3824 f.MarshalBytes(buf) 3825 length, err := writer.Write(buf) 3826 return int64(length), err 3827 } 3828 3829 // Construct a slice backed by dst's underlying memory. 3830 var buf []byte 3831 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3832 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3833 hdr.Len = f.SizeBytes() 3834 hdr.Cap = f.SizeBytes() 3835 3836 length, err := writer.Write(buf) 3837 // Since we bypassed the compiler's escape analysis, indicate that f 3838 // must live until the use above. 3839 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3840 return int64(length), err 3841 } 3842 3843 // SizeBytes implements marshal.Marshallable.SizeBytes. 3844 func (f *FUSEFallocateIn) SizeBytes() int { 3845 return 32 3846 } 3847 3848 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3849 func (f *FUSEFallocateIn) MarshalBytes(dst []byte) []byte { 3850 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3851 dst = dst[8:] 3852 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 3853 dst = dst[8:] 3854 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Length)) 3855 dst = dst[8:] 3856 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 3857 dst = dst[4:] 3858 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3859 dst = dst[4:] 3860 return dst 3861 } 3862 3863 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3864 func (f *FUSEFallocateIn) UnmarshalBytes(src []byte) []byte { 3865 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3866 src = src[8:] 3867 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3868 src = src[8:] 3869 f.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3870 src = src[8:] 3871 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3872 src = src[4:] 3873 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3874 src = src[4:] 3875 return src 3876 } 3877 3878 // Packed implements marshal.Marshallable.Packed. 3879 //go:nosplit 3880 func (f *FUSEFallocateIn) Packed() bool { 3881 return true 3882 } 3883 3884 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3885 func (f *FUSEFallocateIn) MarshalUnsafe(dst []byte) []byte { 3886 size := f.SizeBytes() 3887 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3888 return dst[size:] 3889 } 3890 3891 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3892 func (f *FUSEFallocateIn) UnmarshalUnsafe(src []byte) []byte { 3893 size := f.SizeBytes() 3894 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 3895 return src[size:] 3896 } 3897 3898 // CopyOutN implements marshal.Marshallable.CopyOutN. 3899 func (f *FUSEFallocateIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3900 // Construct a slice backed by dst's underlying memory. 3901 var buf []byte 3902 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3903 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3904 hdr.Len = f.SizeBytes() 3905 hdr.Cap = f.SizeBytes() 3906 3907 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3908 // Since we bypassed the compiler's escape analysis, indicate that f 3909 // must live until the use above. 3910 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3911 return length, err 3912 } 3913 3914 // CopyOut implements marshal.Marshallable.CopyOut. 3915 func (f *FUSEFallocateIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3916 return f.CopyOutN(cc, addr, f.SizeBytes()) 3917 } 3918 3919 // CopyInN implements marshal.Marshallable.CopyInN. 3920 func (f *FUSEFallocateIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3921 // Construct a slice backed by dst's underlying memory. 3922 var buf []byte 3923 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3924 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3925 hdr.Len = f.SizeBytes() 3926 hdr.Cap = f.SizeBytes() 3927 3928 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 3929 // Since we bypassed the compiler's escape analysis, indicate that f 3930 // must live until the use above. 3931 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3932 return length, err 3933 } 3934 3935 // CopyIn implements marshal.Marshallable.CopyIn. 3936 func (f *FUSEFallocateIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3937 return f.CopyInN(cc, addr, f.SizeBytes()) 3938 } 3939 3940 // WriteTo implements io.WriterTo.WriteTo. 3941 func (f *FUSEFallocateIn) WriteTo(writer io.Writer) (int64, error) { 3942 // Construct a slice backed by dst's underlying memory. 3943 var buf []byte 3944 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3945 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 3946 hdr.Len = f.SizeBytes() 3947 hdr.Cap = f.SizeBytes() 3948 3949 length, err := writer.Write(buf) 3950 // Since we bypassed the compiler's escape analysis, indicate that f 3951 // must live until the use above. 3952 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 3953 return int64(length), err 3954 } 3955 3956 // SizeBytes implements marshal.Marshallable.SizeBytes. 3957 func (f *FUSEFlushIn) SizeBytes() int { 3958 return 24 3959 } 3960 3961 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3962 func (f *FUSEFlushIn) MarshalBytes(dst []byte) []byte { 3963 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 3964 dst = dst[8:] 3965 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3966 dst = dst[4:] 3967 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3968 dst = dst[4:] 3969 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 3970 dst = dst[8:] 3971 return dst 3972 } 3973 3974 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3975 func (f *FUSEFlushIn) UnmarshalBytes(src []byte) []byte { 3976 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3977 src = src[8:] 3978 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3979 src = src[4:] 3980 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3981 src = src[4:] 3982 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3983 src = src[8:] 3984 return src 3985 } 3986 3987 // Packed implements marshal.Marshallable.Packed. 3988 //go:nosplit 3989 func (f *FUSEFlushIn) Packed() bool { 3990 return true 3991 } 3992 3993 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3994 func (f *FUSEFlushIn) MarshalUnsafe(dst []byte) []byte { 3995 size := f.SizeBytes() 3996 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 3997 return dst[size:] 3998 } 3999 4000 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4001 func (f *FUSEFlushIn) UnmarshalUnsafe(src []byte) []byte { 4002 size := f.SizeBytes() 4003 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4004 return src[size:] 4005 } 4006 4007 // CopyOutN implements marshal.Marshallable.CopyOutN. 4008 func (f *FUSEFlushIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4009 // Construct a slice backed by dst's underlying memory. 4010 var buf []byte 4011 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4012 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4013 hdr.Len = f.SizeBytes() 4014 hdr.Cap = f.SizeBytes() 4015 4016 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4017 // Since we bypassed the compiler's escape analysis, indicate that f 4018 // must live until the use above. 4019 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4020 return length, err 4021 } 4022 4023 // CopyOut implements marshal.Marshallable.CopyOut. 4024 func (f *FUSEFlushIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4025 return f.CopyOutN(cc, addr, f.SizeBytes()) 4026 } 4027 4028 // CopyInN implements marshal.Marshallable.CopyInN. 4029 func (f *FUSEFlushIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4030 // Construct a slice backed by dst's underlying memory. 4031 var buf []byte 4032 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4033 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4034 hdr.Len = f.SizeBytes() 4035 hdr.Cap = f.SizeBytes() 4036 4037 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4038 // Since we bypassed the compiler's escape analysis, indicate that f 4039 // must live until the use above. 4040 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4041 return length, err 4042 } 4043 4044 // CopyIn implements marshal.Marshallable.CopyIn. 4045 func (f *FUSEFlushIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4046 return f.CopyInN(cc, addr, f.SizeBytes()) 4047 } 4048 4049 // WriteTo implements io.WriterTo.WriteTo. 4050 func (f *FUSEFlushIn) WriteTo(writer io.Writer) (int64, error) { 4051 // Construct a slice backed by dst's underlying memory. 4052 var buf []byte 4053 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4054 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4055 hdr.Len = f.SizeBytes() 4056 hdr.Cap = f.SizeBytes() 4057 4058 length, err := writer.Write(buf) 4059 // Since we bypassed the compiler's escape analysis, indicate that f 4060 // must live until the use above. 4061 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4062 return int64(length), err 4063 } 4064 4065 // SizeBytes implements marshal.Marshallable.SizeBytes. 4066 func (f *FUSEFsyncIn) SizeBytes() int { 4067 return 16 4068 } 4069 4070 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4071 func (f *FUSEFsyncIn) MarshalBytes(dst []byte) []byte { 4072 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 4073 dst = dst[8:] 4074 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FsyncFlags)) 4075 dst = dst[4:] 4076 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4077 dst = dst[4:] 4078 return dst 4079 } 4080 4081 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4082 func (f *FUSEFsyncIn) UnmarshalBytes(src []byte) []byte { 4083 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4084 src = src[8:] 4085 f.FsyncFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4086 src = src[4:] 4087 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4088 src = src[4:] 4089 return src 4090 } 4091 4092 // Packed implements marshal.Marshallable.Packed. 4093 //go:nosplit 4094 func (f *FUSEFsyncIn) Packed() bool { 4095 return true 4096 } 4097 4098 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4099 func (f *FUSEFsyncIn) MarshalUnsafe(dst []byte) []byte { 4100 size := f.SizeBytes() 4101 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4102 return dst[size:] 4103 } 4104 4105 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4106 func (f *FUSEFsyncIn) UnmarshalUnsafe(src []byte) []byte { 4107 size := f.SizeBytes() 4108 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4109 return src[size:] 4110 } 4111 4112 // CopyOutN implements marshal.Marshallable.CopyOutN. 4113 func (f *FUSEFsyncIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4114 // Construct a slice backed by dst's underlying memory. 4115 var buf []byte 4116 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4117 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4118 hdr.Len = f.SizeBytes() 4119 hdr.Cap = f.SizeBytes() 4120 4121 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4122 // Since we bypassed the compiler's escape analysis, indicate that f 4123 // must live until the use above. 4124 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4125 return length, err 4126 } 4127 4128 // CopyOut implements marshal.Marshallable.CopyOut. 4129 func (f *FUSEFsyncIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4130 return f.CopyOutN(cc, addr, f.SizeBytes()) 4131 } 4132 4133 // CopyInN implements marshal.Marshallable.CopyInN. 4134 func (f *FUSEFsyncIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4135 // Construct a slice backed by dst's underlying memory. 4136 var buf []byte 4137 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4138 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4139 hdr.Len = f.SizeBytes() 4140 hdr.Cap = f.SizeBytes() 4141 4142 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4143 // Since we bypassed the compiler's escape analysis, indicate that f 4144 // must live until the use above. 4145 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4146 return length, err 4147 } 4148 4149 // CopyIn implements marshal.Marshallable.CopyIn. 4150 func (f *FUSEFsyncIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4151 return f.CopyInN(cc, addr, f.SizeBytes()) 4152 } 4153 4154 // WriteTo implements io.WriterTo.WriteTo. 4155 func (f *FUSEFsyncIn) WriteTo(writer io.Writer) (int64, error) { 4156 // Construct a slice backed by dst's underlying memory. 4157 var buf []byte 4158 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4159 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4160 hdr.Len = f.SizeBytes() 4161 hdr.Cap = f.SizeBytes() 4162 4163 length, err := writer.Write(buf) 4164 // Since we bypassed the compiler's escape analysis, indicate that f 4165 // must live until the use above. 4166 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4167 return int64(length), err 4168 } 4169 4170 // SizeBytes implements marshal.Marshallable.SizeBytes. 4171 func (f *FUSEGetAttrIn) SizeBytes() int { 4172 return 16 4173 } 4174 4175 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4176 func (f *FUSEGetAttrIn) MarshalBytes(dst []byte) []byte { 4177 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GetAttrFlags)) 4178 dst = dst[4:] 4179 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4180 dst = dst[4:] 4181 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 4182 dst = dst[8:] 4183 return dst 4184 } 4185 4186 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4187 func (f *FUSEGetAttrIn) UnmarshalBytes(src []byte) []byte { 4188 f.GetAttrFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4189 src = src[4:] 4190 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4191 src = src[4:] 4192 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4193 src = src[8:] 4194 return src 4195 } 4196 4197 // Packed implements marshal.Marshallable.Packed. 4198 //go:nosplit 4199 func (f *FUSEGetAttrIn) Packed() bool { 4200 return true 4201 } 4202 4203 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4204 func (f *FUSEGetAttrIn) MarshalUnsafe(dst []byte) []byte { 4205 size := f.SizeBytes() 4206 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4207 return dst[size:] 4208 } 4209 4210 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4211 func (f *FUSEGetAttrIn) UnmarshalUnsafe(src []byte) []byte { 4212 size := f.SizeBytes() 4213 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4214 return src[size:] 4215 } 4216 4217 // CopyOutN implements marshal.Marshallable.CopyOutN. 4218 func (f *FUSEGetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4219 // Construct a slice backed by dst's underlying memory. 4220 var buf []byte 4221 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4222 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4223 hdr.Len = f.SizeBytes() 4224 hdr.Cap = f.SizeBytes() 4225 4226 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4227 // Since we bypassed the compiler's escape analysis, indicate that f 4228 // must live until the use above. 4229 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4230 return length, err 4231 } 4232 4233 // CopyOut implements marshal.Marshallable.CopyOut. 4234 func (f *FUSEGetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4235 return f.CopyOutN(cc, addr, f.SizeBytes()) 4236 } 4237 4238 // CopyInN implements marshal.Marshallable.CopyInN. 4239 func (f *FUSEGetAttrIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4240 // Construct a slice backed by dst's underlying memory. 4241 var buf []byte 4242 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4243 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4244 hdr.Len = f.SizeBytes() 4245 hdr.Cap = f.SizeBytes() 4246 4247 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4248 // Since we bypassed the compiler's escape analysis, indicate that f 4249 // must live until the use above. 4250 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4251 return length, err 4252 } 4253 4254 // CopyIn implements marshal.Marshallable.CopyIn. 4255 func (f *FUSEGetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4256 return f.CopyInN(cc, addr, f.SizeBytes()) 4257 } 4258 4259 // WriteTo implements io.WriterTo.WriteTo. 4260 func (f *FUSEGetAttrIn) WriteTo(writer io.Writer) (int64, error) { 4261 // Construct a slice backed by dst's underlying memory. 4262 var buf []byte 4263 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4264 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4265 hdr.Len = f.SizeBytes() 4266 hdr.Cap = f.SizeBytes() 4267 4268 length, err := writer.Write(buf) 4269 // Since we bypassed the compiler's escape analysis, indicate that f 4270 // must live until the use above. 4271 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4272 return int64(length), err 4273 } 4274 4275 // SizeBytes implements marshal.Marshallable.SizeBytes. 4276 func (f *FUSEHeaderIn) SizeBytes() int { 4277 return 28 + 4278 (*FUSEOpcode)(nil).SizeBytes() + 4279 (*FUSEOpID)(nil).SizeBytes() 4280 } 4281 4282 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4283 func (f *FUSEHeaderIn) MarshalBytes(dst []byte) []byte { 4284 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 4285 dst = dst[4:] 4286 dst = f.Opcode.MarshalUnsafe(dst) 4287 dst = f.Unique.MarshalUnsafe(dst) 4288 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.NodeID)) 4289 dst = dst[8:] 4290 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 4291 dst = dst[4:] 4292 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 4293 dst = dst[4:] 4294 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.PID)) 4295 dst = dst[4:] 4296 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4297 dst = dst[4:] 4298 return dst 4299 } 4300 4301 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4302 func (f *FUSEHeaderIn) UnmarshalBytes(src []byte) []byte { 4303 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4304 src = src[4:] 4305 src = f.Opcode.UnmarshalUnsafe(src) 4306 src = f.Unique.UnmarshalUnsafe(src) 4307 f.NodeID = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4308 src = src[8:] 4309 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4310 src = src[4:] 4311 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4312 src = src[4:] 4313 f.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4314 src = src[4:] 4315 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4316 src = src[4:] 4317 return src 4318 } 4319 4320 // Packed implements marshal.Marshallable.Packed. 4321 //go:nosplit 4322 func (f *FUSEHeaderIn) Packed() bool { 4323 return f.Opcode.Packed() && f.Unique.Packed() 4324 } 4325 4326 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4327 func (f *FUSEHeaderIn) MarshalUnsafe(dst []byte) []byte { 4328 if f.Opcode.Packed() && f.Unique.Packed() { 4329 size := f.SizeBytes() 4330 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4331 return dst[size:] 4332 } 4333 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4334 return f.MarshalBytes(dst) 4335 } 4336 4337 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4338 func (f *FUSEHeaderIn) UnmarshalUnsafe(src []byte) []byte { 4339 if f.Opcode.Packed() && f.Unique.Packed() { 4340 size := f.SizeBytes() 4341 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4342 return src[size:] 4343 } 4344 // Type FUSEHeaderIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4345 return f.UnmarshalBytes(src) 4346 } 4347 4348 // CopyOutN implements marshal.Marshallable.CopyOutN. 4349 func (f *FUSEHeaderIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4350 if !f.Opcode.Packed() && f.Unique.Packed() { 4351 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4352 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4353 f.MarshalBytes(buf) // escapes: fallback. 4354 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4355 } 4356 4357 // Construct a slice backed by dst's underlying memory. 4358 var buf []byte 4359 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4360 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4361 hdr.Len = f.SizeBytes() 4362 hdr.Cap = f.SizeBytes() 4363 4364 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4365 // Since we bypassed the compiler's escape analysis, indicate that f 4366 // must live until the use above. 4367 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4368 return length, err 4369 } 4370 4371 // CopyOut implements marshal.Marshallable.CopyOut. 4372 func (f *FUSEHeaderIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4373 return f.CopyOutN(cc, addr, f.SizeBytes()) 4374 } 4375 4376 // CopyInN implements marshal.Marshallable.CopyInN. 4377 func (f *FUSEHeaderIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4378 if !f.Opcode.Packed() && f.Unique.Packed() { 4379 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4380 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4381 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4382 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4383 // partially unmarshalled struct. 4384 f.UnmarshalBytes(buf) // escapes: fallback. 4385 return length, err 4386 } 4387 4388 // Construct a slice backed by dst's underlying memory. 4389 var buf []byte 4390 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4391 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4392 hdr.Len = f.SizeBytes() 4393 hdr.Cap = f.SizeBytes() 4394 4395 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4396 // Since we bypassed the compiler's escape analysis, indicate that f 4397 // must live until the use above. 4398 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4399 return length, err 4400 } 4401 4402 // CopyIn implements marshal.Marshallable.CopyIn. 4403 func (f *FUSEHeaderIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4404 return f.CopyInN(cc, addr, f.SizeBytes()) 4405 } 4406 4407 // WriteTo implements io.WriterTo.WriteTo. 4408 func (f *FUSEHeaderIn) WriteTo(writer io.Writer) (int64, error) { 4409 if !f.Opcode.Packed() && f.Unique.Packed() { 4410 // Type FUSEHeaderIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4411 buf := make([]byte, f.SizeBytes()) 4412 f.MarshalBytes(buf) 4413 length, err := writer.Write(buf) 4414 return int64(length), err 4415 } 4416 4417 // Construct a slice backed by dst's underlying memory. 4418 var buf []byte 4419 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4420 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4421 hdr.Len = f.SizeBytes() 4422 hdr.Cap = f.SizeBytes() 4423 4424 length, err := writer.Write(buf) 4425 // Since we bypassed the compiler's escape analysis, indicate that f 4426 // must live until the use above. 4427 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4428 return int64(length), err 4429 } 4430 4431 // SizeBytes implements marshal.Marshallable.SizeBytes. 4432 func (f *FUSEHeaderOut) SizeBytes() int { 4433 return 8 + 4434 (*FUSEOpID)(nil).SizeBytes() 4435 } 4436 4437 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4438 func (f *FUSEHeaderOut) MarshalBytes(dst []byte) []byte { 4439 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Len)) 4440 dst = dst[4:] 4441 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Error)) 4442 dst = dst[4:] 4443 dst = f.Unique.MarshalUnsafe(dst) 4444 return dst 4445 } 4446 4447 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4448 func (f *FUSEHeaderOut) UnmarshalBytes(src []byte) []byte { 4449 f.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4450 src = src[4:] 4451 f.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 4452 src = src[4:] 4453 src = f.Unique.UnmarshalUnsafe(src) 4454 return src 4455 } 4456 4457 // Packed implements marshal.Marshallable.Packed. 4458 //go:nosplit 4459 func (f *FUSEHeaderOut) Packed() bool { 4460 return f.Unique.Packed() 4461 } 4462 4463 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4464 func (f *FUSEHeaderOut) MarshalUnsafe(dst []byte) []byte { 4465 if f.Unique.Packed() { 4466 size := f.SizeBytes() 4467 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4468 return dst[size:] 4469 } 4470 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to MarshalBytes. 4471 return f.MarshalBytes(dst) 4472 } 4473 4474 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4475 func (f *FUSEHeaderOut) UnmarshalUnsafe(src []byte) []byte { 4476 if f.Unique.Packed() { 4477 size := f.SizeBytes() 4478 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4479 return src[size:] 4480 } 4481 // Type FUSEHeaderOut doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4482 return f.UnmarshalBytes(src) 4483 } 4484 4485 // CopyOutN implements marshal.Marshallable.CopyOutN. 4486 func (f *FUSEHeaderOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4487 if !f.Unique.Packed() { 4488 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4489 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4490 f.MarshalBytes(buf) // escapes: fallback. 4491 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4492 } 4493 4494 // Construct a slice backed by dst's underlying memory. 4495 var buf []byte 4496 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4497 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4498 hdr.Len = f.SizeBytes() 4499 hdr.Cap = f.SizeBytes() 4500 4501 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4502 // Since we bypassed the compiler's escape analysis, indicate that f 4503 // must live until the use above. 4504 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4505 return length, err 4506 } 4507 4508 // CopyOut implements marshal.Marshallable.CopyOut. 4509 func (f *FUSEHeaderOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4510 return f.CopyOutN(cc, addr, f.SizeBytes()) 4511 } 4512 4513 // CopyInN implements marshal.Marshallable.CopyInN. 4514 func (f *FUSEHeaderOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4515 if !f.Unique.Packed() { 4516 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4517 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 4518 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4519 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4520 // partially unmarshalled struct. 4521 f.UnmarshalBytes(buf) // escapes: fallback. 4522 return length, err 4523 } 4524 4525 // Construct a slice backed by dst's underlying memory. 4526 var buf []byte 4527 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4528 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4529 hdr.Len = f.SizeBytes() 4530 hdr.Cap = f.SizeBytes() 4531 4532 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4533 // Since we bypassed the compiler's escape analysis, indicate that f 4534 // must live until the use above. 4535 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4536 return length, err 4537 } 4538 4539 // CopyIn implements marshal.Marshallable.CopyIn. 4540 func (f *FUSEHeaderOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4541 return f.CopyInN(cc, addr, f.SizeBytes()) 4542 } 4543 4544 // WriteTo implements io.WriterTo.WriteTo. 4545 func (f *FUSEHeaderOut) WriteTo(writer io.Writer) (int64, error) { 4546 if !f.Unique.Packed() { 4547 // Type FUSEHeaderOut doesn't have a packed layout in memory, fall back to MarshalBytes. 4548 buf := make([]byte, f.SizeBytes()) 4549 f.MarshalBytes(buf) 4550 length, err := writer.Write(buf) 4551 return int64(length), err 4552 } 4553 4554 // Construct a slice backed by dst's underlying memory. 4555 var buf []byte 4556 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4557 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4558 hdr.Len = f.SizeBytes() 4559 hdr.Cap = f.SizeBytes() 4560 4561 length, err := writer.Write(buf) 4562 // Since we bypassed the compiler's escape analysis, indicate that f 4563 // must live until the use above. 4564 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4565 return int64(length), err 4566 } 4567 4568 // SizeBytes implements marshal.Marshallable.SizeBytes. 4569 func (f *FUSEInitIn) SizeBytes() int { 4570 return 16 4571 } 4572 4573 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4574 func (f *FUSEInitIn) MarshalBytes(dst []byte) []byte { 4575 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4576 dst = dst[4:] 4577 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4578 dst = dst[4:] 4579 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4580 dst = dst[4:] 4581 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4582 dst = dst[4:] 4583 return dst 4584 } 4585 4586 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4587 func (f *FUSEInitIn) UnmarshalBytes(src []byte) []byte { 4588 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4589 src = src[4:] 4590 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4591 src = src[4:] 4592 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4593 src = src[4:] 4594 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4595 src = src[4:] 4596 return src 4597 } 4598 4599 // Packed implements marshal.Marshallable.Packed. 4600 //go:nosplit 4601 func (f *FUSEInitIn) Packed() bool { 4602 return true 4603 } 4604 4605 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4606 func (f *FUSEInitIn) MarshalUnsafe(dst []byte) []byte { 4607 size := f.SizeBytes() 4608 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4609 return dst[size:] 4610 } 4611 4612 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4613 func (f *FUSEInitIn) UnmarshalUnsafe(src []byte) []byte { 4614 size := f.SizeBytes() 4615 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4616 return src[size:] 4617 } 4618 4619 // CopyOutN implements marshal.Marshallable.CopyOutN. 4620 func (f *FUSEInitIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4621 // Construct a slice backed by dst's underlying memory. 4622 var buf []byte 4623 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4624 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4625 hdr.Len = f.SizeBytes() 4626 hdr.Cap = f.SizeBytes() 4627 4628 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4629 // Since we bypassed the compiler's escape analysis, indicate that f 4630 // must live until the use above. 4631 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4632 return length, err 4633 } 4634 4635 // CopyOut implements marshal.Marshallable.CopyOut. 4636 func (f *FUSEInitIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4637 return f.CopyOutN(cc, addr, f.SizeBytes()) 4638 } 4639 4640 // CopyInN implements marshal.Marshallable.CopyInN. 4641 func (f *FUSEInitIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4642 // Construct a slice backed by dst's underlying memory. 4643 var buf []byte 4644 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4645 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4646 hdr.Len = f.SizeBytes() 4647 hdr.Cap = f.SizeBytes() 4648 4649 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4650 // Since we bypassed the compiler's escape analysis, indicate that f 4651 // must live until the use above. 4652 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4653 return length, err 4654 } 4655 4656 // CopyIn implements marshal.Marshallable.CopyIn. 4657 func (f *FUSEInitIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4658 return f.CopyInN(cc, addr, f.SizeBytes()) 4659 } 4660 4661 // WriteTo implements io.WriterTo.WriteTo. 4662 func (f *FUSEInitIn) WriteTo(writer io.Writer) (int64, error) { 4663 // Construct a slice backed by dst's underlying memory. 4664 var buf []byte 4665 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4666 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4667 hdr.Len = f.SizeBytes() 4668 hdr.Cap = f.SizeBytes() 4669 4670 length, err := writer.Write(buf) 4671 // Since we bypassed the compiler's escape analysis, indicate that f 4672 // must live until the use above. 4673 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4674 return int64(length), err 4675 } 4676 4677 // SizeBytes implements marshal.Marshallable.SizeBytes. 4678 func (f *FUSEInitOut) SizeBytes() int { 4679 return 32 + 4680 4*8 4681 } 4682 4683 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4684 func (f *FUSEInitOut) MarshalBytes(dst []byte) []byte { 4685 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Major)) 4686 dst = dst[4:] 4687 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Minor)) 4688 dst = dst[4:] 4689 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxReadahead)) 4690 dst = dst[4:] 4691 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 4692 dst = dst[4:] 4693 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxBackground)) 4694 dst = dst[2:] 4695 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.CongestionThreshold)) 4696 dst = dst[2:] 4697 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MaxWrite)) 4698 dst = dst[4:] 4699 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.TimeGran)) 4700 dst = dst[4:] 4701 hostarch.ByteOrder.PutUint16(dst[:2], uint16(f.MaxPages)) 4702 dst = dst[2:] 4703 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 4704 dst = dst[2:] 4705 // Padding: dst[:sizeof(uint32)*8] ~= [8]uint32{0} 4706 dst = dst[4*(8):] 4707 return dst 4708 } 4709 4710 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4711 func (f *FUSEInitOut) UnmarshalBytes(src []byte) []byte { 4712 f.Major = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4713 src = src[4:] 4714 f.Minor = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4715 src = src[4:] 4716 f.MaxReadahead = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4717 src = src[4:] 4718 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4719 src = src[4:] 4720 f.MaxBackground = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4721 src = src[2:] 4722 f.CongestionThreshold = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4723 src = src[2:] 4724 f.MaxWrite = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4725 src = src[4:] 4726 f.TimeGran = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4727 src = src[4:] 4728 f.MaxPages = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4729 src = src[2:] 4730 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 4731 src = src[2:] 4732 // Padding: ~ copy([8]uint32(f._), src[:sizeof(uint32)*8]) 4733 src = src[4*(8):] 4734 return src 4735 } 4736 4737 // Packed implements marshal.Marshallable.Packed. 4738 //go:nosplit 4739 func (f *FUSEInitOut) Packed() bool { 4740 return true 4741 } 4742 4743 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4744 func (f *FUSEInitOut) MarshalUnsafe(dst []byte) []byte { 4745 size := f.SizeBytes() 4746 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 4747 return dst[size:] 4748 } 4749 4750 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4751 func (f *FUSEInitOut) UnmarshalUnsafe(src []byte) []byte { 4752 size := f.SizeBytes() 4753 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 4754 return src[size:] 4755 } 4756 4757 // CopyOutN implements marshal.Marshallable.CopyOutN. 4758 func (f *FUSEInitOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4759 // Construct a slice backed by dst's underlying memory. 4760 var buf []byte 4761 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4762 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4763 hdr.Len = f.SizeBytes() 4764 hdr.Cap = f.SizeBytes() 4765 4766 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4767 // Since we bypassed the compiler's escape analysis, indicate that f 4768 // must live until the use above. 4769 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4770 return length, err 4771 } 4772 4773 // CopyOut implements marshal.Marshallable.CopyOut. 4774 func (f *FUSEInitOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4775 return f.CopyOutN(cc, addr, f.SizeBytes()) 4776 } 4777 4778 // CopyInN implements marshal.Marshallable.CopyInN. 4779 func (f *FUSEInitOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4780 // Construct a slice backed by dst's underlying memory. 4781 var buf []byte 4782 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4783 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4784 hdr.Len = f.SizeBytes() 4785 hdr.Cap = f.SizeBytes() 4786 4787 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 4788 // Since we bypassed the compiler's escape analysis, indicate that f 4789 // must live until the use above. 4790 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4791 return length, err 4792 } 4793 4794 // CopyIn implements marshal.Marshallable.CopyIn. 4795 func (f *FUSEInitOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4796 return f.CopyInN(cc, addr, f.SizeBytes()) 4797 } 4798 4799 // WriteTo implements io.WriterTo.WriteTo. 4800 func (f *FUSEInitOut) WriteTo(writer io.Writer) (int64, error) { 4801 // Construct a slice backed by dst's underlying memory. 4802 var buf []byte 4803 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4804 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 4805 hdr.Len = f.SizeBytes() 4806 hdr.Cap = f.SizeBytes() 4807 4808 length, err := writer.Write(buf) 4809 // Since we bypassed the compiler's escape analysis, indicate that f 4810 // must live until the use above. 4811 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 4812 return int64(length), err 4813 } 4814 4815 // Packed implements marshal.Marshallable.Packed. 4816 //go:nosplit 4817 func (r *FUSELinkIn) Packed() bool { 4818 // Type FUSELinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4819 return false 4820 } 4821 4822 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4823 func (r *FUSELinkIn) MarshalUnsafe(dst []byte) []byte { 4824 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4825 return r.MarshalBytes(dst) 4826 } 4827 4828 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4829 func (r *FUSELinkIn) UnmarshalUnsafe(src []byte) []byte { 4830 // Type FUSELinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4831 return r.UnmarshalBytes(src) 4832 } 4833 4834 // CopyOutN implements marshal.Marshallable.CopyOutN. 4835 //go:nosplit 4836 func (r *FUSELinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4837 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4838 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4839 r.MarshalBytes(buf) // escapes: fallback. 4840 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4841 } 4842 4843 // CopyOut implements marshal.Marshallable.CopyOut. 4844 func (r *FUSELinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4845 return r.CopyOutN(cc, addr, r.SizeBytes()) 4846 } 4847 4848 // CopyInN implements marshal.Marshallable.CopyInN. 4849 //go:nosplit 4850 func (r *FUSELinkIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4851 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4852 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4853 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4854 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4855 // partially unmarshalled struct. 4856 r.UnmarshalBytes(buf) // escapes: fallback. 4857 return length, err 4858 } 4859 4860 // CopyIn implements marshal.Marshallable.CopyIn. 4861 func (r *FUSELinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4862 return r.CopyInN(cc, addr, r.SizeBytes()) 4863 } 4864 4865 // WriteTo implements io.WriterTo.WriteTo. 4866 func (r *FUSELinkIn) WriteTo(writer io.Writer) (int64, error) { 4867 // Type FUSELinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4868 buf := make([]byte, r.SizeBytes()) 4869 r.MarshalBytes(buf) 4870 length, err := writer.Write(buf) 4871 return int64(length), err 4872 } 4873 4874 // Packed implements marshal.Marshallable.Packed. 4875 //go:nosplit 4876 func (r *FUSELookupIn) Packed() bool { 4877 // Type FUSELookupIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4878 return false 4879 } 4880 4881 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4882 func (r *FUSELookupIn) MarshalUnsafe(dst []byte) []byte { 4883 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4884 return r.MarshalBytes(dst) 4885 } 4886 4887 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4888 func (r *FUSELookupIn) UnmarshalUnsafe(src []byte) []byte { 4889 // Type FUSELookupIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4890 return r.UnmarshalBytes(src) 4891 } 4892 4893 // CopyOutN implements marshal.Marshallable.CopyOutN. 4894 //go:nosplit 4895 func (r *FUSELookupIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4896 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4897 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4898 r.MarshalBytes(buf) // escapes: fallback. 4899 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4900 } 4901 4902 // CopyOut implements marshal.Marshallable.CopyOut. 4903 func (r *FUSELookupIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4904 return r.CopyOutN(cc, addr, r.SizeBytes()) 4905 } 4906 4907 // CopyInN implements marshal.Marshallable.CopyInN. 4908 //go:nosplit 4909 func (r *FUSELookupIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4910 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4911 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4912 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4913 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4914 // partially unmarshalled struct. 4915 r.UnmarshalBytes(buf) // escapes: fallback. 4916 return length, err 4917 } 4918 4919 // CopyIn implements marshal.Marshallable.CopyIn. 4920 func (r *FUSELookupIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4921 return r.CopyInN(cc, addr, r.SizeBytes()) 4922 } 4923 4924 // WriteTo implements io.WriterTo.WriteTo. 4925 func (r *FUSELookupIn) WriteTo(writer io.Writer) (int64, error) { 4926 // Type FUSELookupIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4927 buf := make([]byte, r.SizeBytes()) 4928 r.MarshalBytes(buf) 4929 length, err := writer.Write(buf) 4930 return int64(length), err 4931 } 4932 4933 // Packed implements marshal.Marshallable.Packed. 4934 //go:nosplit 4935 func (r *FUSEMkdirIn) Packed() bool { 4936 // Type FUSEMkdirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 4937 return false 4938 } 4939 4940 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4941 func (r *FUSEMkdirIn) MarshalUnsafe(dst []byte) []byte { 4942 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 4943 return r.MarshalBytes(dst) 4944 } 4945 4946 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4947 func (r *FUSEMkdirIn) UnmarshalUnsafe(src []byte) []byte { 4948 // Type FUSEMkdirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4949 return r.UnmarshalBytes(src) 4950 } 4951 4952 // CopyOutN implements marshal.Marshallable.CopyOutN. 4953 //go:nosplit 4954 func (r *FUSEMkdirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4955 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4956 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4957 r.MarshalBytes(buf) // escapes: fallback. 4958 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4959 } 4960 4961 // CopyOut implements marshal.Marshallable.CopyOut. 4962 func (r *FUSEMkdirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4963 return r.CopyOutN(cc, addr, r.SizeBytes()) 4964 } 4965 4966 // CopyInN implements marshal.Marshallable.CopyInN. 4967 //go:nosplit 4968 func (r *FUSEMkdirIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4969 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4970 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 4971 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4972 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4973 // partially unmarshalled struct. 4974 r.UnmarshalBytes(buf) // escapes: fallback. 4975 return length, err 4976 } 4977 4978 // CopyIn implements marshal.Marshallable.CopyIn. 4979 func (r *FUSEMkdirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4980 return r.CopyInN(cc, addr, r.SizeBytes()) 4981 } 4982 4983 // WriteTo implements io.WriterTo.WriteTo. 4984 func (r *FUSEMkdirIn) WriteTo(writer io.Writer) (int64, error) { 4985 // Type FUSEMkdirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 4986 buf := make([]byte, r.SizeBytes()) 4987 r.MarshalBytes(buf) 4988 length, err := writer.Write(buf) 4989 return int64(length), err 4990 } 4991 4992 // SizeBytes implements marshal.Marshallable.SizeBytes. 4993 func (f *FUSEMkdirMeta) SizeBytes() int { 4994 return 8 4995 } 4996 4997 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4998 func (f *FUSEMkdirMeta) MarshalBytes(dst []byte) []byte { 4999 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5000 dst = dst[4:] 5001 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 5002 dst = dst[4:] 5003 return dst 5004 } 5005 5006 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5007 func (f *FUSEMkdirMeta) UnmarshalBytes(src []byte) []byte { 5008 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5009 src = src[4:] 5010 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5011 src = src[4:] 5012 return src 5013 } 5014 5015 // Packed implements marshal.Marshallable.Packed. 5016 //go:nosplit 5017 func (f *FUSEMkdirMeta) Packed() bool { 5018 return true 5019 } 5020 5021 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5022 func (f *FUSEMkdirMeta) MarshalUnsafe(dst []byte) []byte { 5023 size := f.SizeBytes() 5024 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5025 return dst[size:] 5026 } 5027 5028 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5029 func (f *FUSEMkdirMeta) UnmarshalUnsafe(src []byte) []byte { 5030 size := f.SizeBytes() 5031 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5032 return src[size:] 5033 } 5034 5035 // CopyOutN implements marshal.Marshallable.CopyOutN. 5036 func (f *FUSEMkdirMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5037 // Construct a slice backed by dst's underlying memory. 5038 var buf []byte 5039 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5040 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5041 hdr.Len = f.SizeBytes() 5042 hdr.Cap = f.SizeBytes() 5043 5044 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5045 // Since we bypassed the compiler's escape analysis, indicate that f 5046 // must live until the use above. 5047 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5048 return length, err 5049 } 5050 5051 // CopyOut implements marshal.Marshallable.CopyOut. 5052 func (f *FUSEMkdirMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5053 return f.CopyOutN(cc, addr, f.SizeBytes()) 5054 } 5055 5056 // CopyInN implements marshal.Marshallable.CopyInN. 5057 func (f *FUSEMkdirMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5058 // Construct a slice backed by dst's underlying memory. 5059 var buf []byte 5060 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5061 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5062 hdr.Len = f.SizeBytes() 5063 hdr.Cap = f.SizeBytes() 5064 5065 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5066 // Since we bypassed the compiler's escape analysis, indicate that f 5067 // must live until the use above. 5068 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5069 return length, err 5070 } 5071 5072 // CopyIn implements marshal.Marshallable.CopyIn. 5073 func (f *FUSEMkdirMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5074 return f.CopyInN(cc, addr, f.SizeBytes()) 5075 } 5076 5077 // WriteTo implements io.WriterTo.WriteTo. 5078 func (f *FUSEMkdirMeta) WriteTo(writer io.Writer) (int64, error) { 5079 // Construct a slice backed by dst's underlying memory. 5080 var buf []byte 5081 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5082 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5083 hdr.Len = f.SizeBytes() 5084 hdr.Cap = f.SizeBytes() 5085 5086 length, err := writer.Write(buf) 5087 // Since we bypassed the compiler's escape analysis, indicate that f 5088 // must live until the use above. 5089 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5090 return int64(length), err 5091 } 5092 5093 // Packed implements marshal.Marshallable.Packed. 5094 //go:nosplit 5095 func (r *FUSEMknodIn) Packed() bool { 5096 // Type FUSEMknodIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5097 return false 5098 } 5099 5100 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5101 func (r *FUSEMknodIn) MarshalUnsafe(dst []byte) []byte { 5102 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5103 return r.MarshalBytes(dst) 5104 } 5105 5106 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5107 func (r *FUSEMknodIn) UnmarshalUnsafe(src []byte) []byte { 5108 // Type FUSEMknodIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5109 return r.UnmarshalBytes(src) 5110 } 5111 5112 // CopyOutN implements marshal.Marshallable.CopyOutN. 5113 //go:nosplit 5114 func (r *FUSEMknodIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5115 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5116 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5117 r.MarshalBytes(buf) // escapes: fallback. 5118 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5119 } 5120 5121 // CopyOut implements marshal.Marshallable.CopyOut. 5122 func (r *FUSEMknodIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5123 return r.CopyOutN(cc, addr, r.SizeBytes()) 5124 } 5125 5126 // CopyInN implements marshal.Marshallable.CopyInN. 5127 //go:nosplit 5128 func (r *FUSEMknodIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5129 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5130 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5131 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5132 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5133 // partially unmarshalled struct. 5134 r.UnmarshalBytes(buf) // escapes: fallback. 5135 return length, err 5136 } 5137 5138 // CopyIn implements marshal.Marshallable.CopyIn. 5139 func (r *FUSEMknodIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5140 return r.CopyInN(cc, addr, r.SizeBytes()) 5141 } 5142 5143 // WriteTo implements io.WriterTo.WriteTo. 5144 func (r *FUSEMknodIn) WriteTo(writer io.Writer) (int64, error) { 5145 // Type FUSEMknodIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5146 buf := make([]byte, r.SizeBytes()) 5147 r.MarshalBytes(buf) 5148 length, err := writer.Write(buf) 5149 return int64(length), err 5150 } 5151 5152 // SizeBytes implements marshal.Marshallable.SizeBytes. 5153 func (f *FUSEMknodMeta) SizeBytes() int { 5154 return 16 5155 } 5156 5157 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5158 func (f *FUSEMknodMeta) MarshalBytes(dst []byte) []byte { 5159 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 5160 dst = dst[4:] 5161 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Rdev)) 5162 dst = dst[4:] 5163 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Umask)) 5164 dst = dst[4:] 5165 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5166 dst = dst[4:] 5167 return dst 5168 } 5169 5170 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5171 func (f *FUSEMknodMeta) UnmarshalBytes(src []byte) []byte { 5172 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5173 src = src[4:] 5174 f.Rdev = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5175 src = src[4:] 5176 f.Umask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5177 src = src[4:] 5178 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5179 src = src[4:] 5180 return src 5181 } 5182 5183 // Packed implements marshal.Marshallable.Packed. 5184 //go:nosplit 5185 func (f *FUSEMknodMeta) Packed() bool { 5186 return true 5187 } 5188 5189 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5190 func (f *FUSEMknodMeta) MarshalUnsafe(dst []byte) []byte { 5191 size := f.SizeBytes() 5192 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5193 return dst[size:] 5194 } 5195 5196 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5197 func (f *FUSEMknodMeta) UnmarshalUnsafe(src []byte) []byte { 5198 size := f.SizeBytes() 5199 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5200 return src[size:] 5201 } 5202 5203 // CopyOutN implements marshal.Marshallable.CopyOutN. 5204 func (f *FUSEMknodMeta) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5205 // Construct a slice backed by dst's underlying memory. 5206 var buf []byte 5207 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5208 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5209 hdr.Len = f.SizeBytes() 5210 hdr.Cap = f.SizeBytes() 5211 5212 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5213 // Since we bypassed the compiler's escape analysis, indicate that f 5214 // must live until the use above. 5215 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5216 return length, err 5217 } 5218 5219 // CopyOut implements marshal.Marshallable.CopyOut. 5220 func (f *FUSEMknodMeta) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5221 return f.CopyOutN(cc, addr, f.SizeBytes()) 5222 } 5223 5224 // CopyInN implements marshal.Marshallable.CopyInN. 5225 func (f *FUSEMknodMeta) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5226 // Construct a slice backed by dst's underlying memory. 5227 var buf []byte 5228 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5229 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5230 hdr.Len = f.SizeBytes() 5231 hdr.Cap = f.SizeBytes() 5232 5233 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5234 // Since we bypassed the compiler's escape analysis, indicate that f 5235 // must live until the use above. 5236 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5237 return length, err 5238 } 5239 5240 // CopyIn implements marshal.Marshallable.CopyIn. 5241 func (f *FUSEMknodMeta) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5242 return f.CopyInN(cc, addr, f.SizeBytes()) 5243 } 5244 5245 // WriteTo implements io.WriterTo.WriteTo. 5246 func (f *FUSEMknodMeta) WriteTo(writer io.Writer) (int64, error) { 5247 // Construct a slice backed by dst's underlying memory. 5248 var buf []byte 5249 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5250 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5251 hdr.Len = f.SizeBytes() 5252 hdr.Cap = f.SizeBytes() 5253 5254 length, err := writer.Write(buf) 5255 // Since we bypassed the compiler's escape analysis, indicate that f 5256 // must live until the use above. 5257 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5258 return int64(length), err 5259 } 5260 5261 // SizeBytes implements marshal.Marshallable.SizeBytes. 5262 //go:nosplit 5263 func (f *FUSEOpID) SizeBytes() int { 5264 return 8 5265 } 5266 5267 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5268 func (f *FUSEOpID) MarshalBytes(dst []byte) []byte { 5269 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f)) 5270 return dst[8:] 5271 } 5272 5273 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5274 func (f *FUSEOpID) UnmarshalBytes(src []byte) []byte { 5275 *f = FUSEOpID(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 5276 return src[8:] 5277 } 5278 5279 // Packed implements marshal.Marshallable.Packed. 5280 //go:nosplit 5281 func (f *FUSEOpID) Packed() bool { 5282 // Scalar newtypes are always packed. 5283 return true 5284 } 5285 5286 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5287 func (f *FUSEOpID) MarshalUnsafe(dst []byte) []byte { 5288 size := f.SizeBytes() 5289 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5290 return dst[size:] 5291 } 5292 5293 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5294 func (f *FUSEOpID) UnmarshalUnsafe(src []byte) []byte { 5295 size := f.SizeBytes() 5296 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5297 return src[size:] 5298 } 5299 5300 // CopyOutN implements marshal.Marshallable.CopyOutN. 5301 func (f *FUSEOpID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5302 // Construct a slice backed by dst's underlying memory. 5303 var buf []byte 5304 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5305 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5306 hdr.Len = f.SizeBytes() 5307 hdr.Cap = f.SizeBytes() 5308 5309 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5310 // Since we bypassed the compiler's escape analysis, indicate that f 5311 // must live until the use above. 5312 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5313 return length, err 5314 } 5315 5316 // CopyOut implements marshal.Marshallable.CopyOut. 5317 func (f *FUSEOpID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5318 return f.CopyOutN(cc, addr, f.SizeBytes()) 5319 } 5320 5321 // CopyInN implements marshal.Marshallable.CopyInN. 5322 func (f *FUSEOpID) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5323 // Construct a slice backed by dst's underlying memory. 5324 var buf []byte 5325 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5326 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5327 hdr.Len = f.SizeBytes() 5328 hdr.Cap = f.SizeBytes() 5329 5330 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5331 // Since we bypassed the compiler's escape analysis, indicate that f 5332 // must live until the use above. 5333 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5334 return length, err 5335 } 5336 5337 // CopyIn implements marshal.Marshallable.CopyIn. 5338 func (f *FUSEOpID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5339 return f.CopyInN(cc, addr, f.SizeBytes()) 5340 } 5341 5342 // WriteTo implements io.WriterTo.WriteTo. 5343 func (f *FUSEOpID) WriteTo(writer io.Writer) (int64, error) { 5344 // Construct a slice backed by dst's underlying memory. 5345 var buf []byte 5346 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5347 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5348 hdr.Len = f.SizeBytes() 5349 hdr.Cap = f.SizeBytes() 5350 5351 length, err := writer.Write(buf) 5352 // Since we bypassed the compiler's escape analysis, indicate that f 5353 // must live until the use above. 5354 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5355 return int64(length), err 5356 } 5357 5358 // SizeBytes implements marshal.Marshallable.SizeBytes. 5359 //go:nosplit 5360 func (f *FUSEOpcode) SizeBytes() int { 5361 return 4 5362 } 5363 5364 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5365 func (f *FUSEOpcode) MarshalBytes(dst []byte) []byte { 5366 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*f)) 5367 return dst[4:] 5368 } 5369 5370 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5371 func (f *FUSEOpcode) UnmarshalBytes(src []byte) []byte { 5372 *f = FUSEOpcode(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 5373 return src[4:] 5374 } 5375 5376 // Packed implements marshal.Marshallable.Packed. 5377 //go:nosplit 5378 func (f *FUSEOpcode) Packed() bool { 5379 // Scalar newtypes are always packed. 5380 return true 5381 } 5382 5383 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5384 func (f *FUSEOpcode) MarshalUnsafe(dst []byte) []byte { 5385 size := f.SizeBytes() 5386 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5387 return dst[size:] 5388 } 5389 5390 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5391 func (f *FUSEOpcode) UnmarshalUnsafe(src []byte) []byte { 5392 size := f.SizeBytes() 5393 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5394 return src[size:] 5395 } 5396 5397 // CopyOutN implements marshal.Marshallable.CopyOutN. 5398 func (f *FUSEOpcode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5399 // Construct a slice backed by dst's underlying memory. 5400 var buf []byte 5401 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5402 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5403 hdr.Len = f.SizeBytes() 5404 hdr.Cap = f.SizeBytes() 5405 5406 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5407 // Since we bypassed the compiler's escape analysis, indicate that f 5408 // must live until the use above. 5409 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5410 return length, err 5411 } 5412 5413 // CopyOut implements marshal.Marshallable.CopyOut. 5414 func (f *FUSEOpcode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5415 return f.CopyOutN(cc, addr, f.SizeBytes()) 5416 } 5417 5418 // CopyInN implements marshal.Marshallable.CopyInN. 5419 func (f *FUSEOpcode) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5420 // Construct a slice backed by dst's underlying memory. 5421 var buf []byte 5422 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5423 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5424 hdr.Len = f.SizeBytes() 5425 hdr.Cap = f.SizeBytes() 5426 5427 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5428 // Since we bypassed the compiler's escape analysis, indicate that f 5429 // must live until the use above. 5430 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5431 return length, err 5432 } 5433 5434 // CopyIn implements marshal.Marshallable.CopyIn. 5435 func (f *FUSEOpcode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5436 return f.CopyInN(cc, addr, f.SizeBytes()) 5437 } 5438 5439 // WriteTo implements io.WriterTo.WriteTo. 5440 func (f *FUSEOpcode) WriteTo(writer io.Writer) (int64, error) { 5441 // Construct a slice backed by dst's underlying memory. 5442 var buf []byte 5443 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5444 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5445 hdr.Len = f.SizeBytes() 5446 hdr.Cap = f.SizeBytes() 5447 5448 length, err := writer.Write(buf) 5449 // Since we bypassed the compiler's escape analysis, indicate that f 5450 // must live until the use above. 5451 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5452 return int64(length), err 5453 } 5454 5455 // SizeBytes implements marshal.Marshallable.SizeBytes. 5456 func (f *FUSEOpenIn) SizeBytes() int { 5457 return 8 5458 } 5459 5460 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5461 func (f *FUSEOpenIn) MarshalBytes(dst []byte) []byte { 5462 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5463 dst = dst[4:] 5464 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5465 dst = dst[4:] 5466 return dst 5467 } 5468 5469 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5470 func (f *FUSEOpenIn) UnmarshalBytes(src []byte) []byte { 5471 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5472 src = src[4:] 5473 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5474 src = src[4:] 5475 return src 5476 } 5477 5478 // Packed implements marshal.Marshallable.Packed. 5479 //go:nosplit 5480 func (f *FUSEOpenIn) Packed() bool { 5481 return true 5482 } 5483 5484 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5485 func (f *FUSEOpenIn) MarshalUnsafe(dst []byte) []byte { 5486 size := f.SizeBytes() 5487 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5488 return dst[size:] 5489 } 5490 5491 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5492 func (f *FUSEOpenIn) UnmarshalUnsafe(src []byte) []byte { 5493 size := f.SizeBytes() 5494 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5495 return src[size:] 5496 } 5497 5498 // CopyOutN implements marshal.Marshallable.CopyOutN. 5499 func (f *FUSEOpenIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5500 // Construct a slice backed by dst's underlying memory. 5501 var buf []byte 5502 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5503 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5504 hdr.Len = f.SizeBytes() 5505 hdr.Cap = f.SizeBytes() 5506 5507 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5508 // Since we bypassed the compiler's escape analysis, indicate that f 5509 // must live until the use above. 5510 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5511 return length, err 5512 } 5513 5514 // CopyOut implements marshal.Marshallable.CopyOut. 5515 func (f *FUSEOpenIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5516 return f.CopyOutN(cc, addr, f.SizeBytes()) 5517 } 5518 5519 // CopyInN implements marshal.Marshallable.CopyInN. 5520 func (f *FUSEOpenIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5521 // Construct a slice backed by dst's underlying memory. 5522 var buf []byte 5523 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5524 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5525 hdr.Len = f.SizeBytes() 5526 hdr.Cap = f.SizeBytes() 5527 5528 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5529 // Since we bypassed the compiler's escape analysis, indicate that f 5530 // must live until the use above. 5531 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5532 return length, err 5533 } 5534 5535 // CopyIn implements marshal.Marshallable.CopyIn. 5536 func (f *FUSEOpenIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5537 return f.CopyInN(cc, addr, f.SizeBytes()) 5538 } 5539 5540 // WriteTo implements io.WriterTo.WriteTo. 5541 func (f *FUSEOpenIn) WriteTo(writer io.Writer) (int64, error) { 5542 // Construct a slice backed by dst's underlying memory. 5543 var buf []byte 5544 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5545 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5546 hdr.Len = f.SizeBytes() 5547 hdr.Cap = f.SizeBytes() 5548 5549 length, err := writer.Write(buf) 5550 // Since we bypassed the compiler's escape analysis, indicate that f 5551 // must live until the use above. 5552 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5553 return int64(length), err 5554 } 5555 5556 // SizeBytes implements marshal.Marshallable.SizeBytes. 5557 func (f *FUSEOpenOut) SizeBytes() int { 5558 return 16 5559 } 5560 5561 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5562 func (f *FUSEOpenOut) MarshalBytes(dst []byte) []byte { 5563 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5564 dst = dst[8:] 5565 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.OpenFlag)) 5566 dst = dst[4:] 5567 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5568 dst = dst[4:] 5569 return dst 5570 } 5571 5572 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5573 func (f *FUSEOpenOut) UnmarshalBytes(src []byte) []byte { 5574 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5575 src = src[8:] 5576 f.OpenFlag = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5577 src = src[4:] 5578 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5579 src = src[4:] 5580 return src 5581 } 5582 5583 // Packed implements marshal.Marshallable.Packed. 5584 //go:nosplit 5585 func (f *FUSEOpenOut) Packed() bool { 5586 return true 5587 } 5588 5589 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5590 func (f *FUSEOpenOut) MarshalUnsafe(dst []byte) []byte { 5591 size := f.SizeBytes() 5592 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5593 return dst[size:] 5594 } 5595 5596 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5597 func (f *FUSEOpenOut) UnmarshalUnsafe(src []byte) []byte { 5598 size := f.SizeBytes() 5599 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5600 return src[size:] 5601 } 5602 5603 // CopyOutN implements marshal.Marshallable.CopyOutN. 5604 func (f *FUSEOpenOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5605 // Construct a slice backed by dst's underlying memory. 5606 var buf []byte 5607 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5608 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5609 hdr.Len = f.SizeBytes() 5610 hdr.Cap = f.SizeBytes() 5611 5612 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5613 // Since we bypassed the compiler's escape analysis, indicate that f 5614 // must live until the use above. 5615 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5616 return length, err 5617 } 5618 5619 // CopyOut implements marshal.Marshallable.CopyOut. 5620 func (f *FUSEOpenOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5621 return f.CopyOutN(cc, addr, f.SizeBytes()) 5622 } 5623 5624 // CopyInN implements marshal.Marshallable.CopyInN. 5625 func (f *FUSEOpenOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5626 // Construct a slice backed by dst's underlying memory. 5627 var buf []byte 5628 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5629 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5630 hdr.Len = f.SizeBytes() 5631 hdr.Cap = f.SizeBytes() 5632 5633 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5634 // Since we bypassed the compiler's escape analysis, indicate that f 5635 // must live until the use above. 5636 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5637 return length, err 5638 } 5639 5640 // CopyIn implements marshal.Marshallable.CopyIn. 5641 func (f *FUSEOpenOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5642 return f.CopyInN(cc, addr, f.SizeBytes()) 5643 } 5644 5645 // WriteTo implements io.WriterTo.WriteTo. 5646 func (f *FUSEOpenOut) WriteTo(writer io.Writer) (int64, error) { 5647 // Construct a slice backed by dst's underlying memory. 5648 var buf []byte 5649 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5650 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5651 hdr.Len = f.SizeBytes() 5652 hdr.Cap = f.SizeBytes() 5653 5654 length, err := writer.Write(buf) 5655 // Since we bypassed the compiler's escape analysis, indicate that f 5656 // must live until the use above. 5657 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5658 return int64(length), err 5659 } 5660 5661 // SizeBytes implements marshal.Marshallable.SizeBytes. 5662 func (f *FUSEReadIn) SizeBytes() int { 5663 return 40 5664 } 5665 5666 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5667 func (f *FUSEReadIn) MarshalBytes(dst []byte) []byte { 5668 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5669 dst = dst[8:] 5670 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 5671 dst = dst[8:] 5672 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 5673 dst = dst[4:] 5674 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReadFlags)) 5675 dst = dst[4:] 5676 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5677 dst = dst[8:] 5678 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5679 dst = dst[4:] 5680 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 5681 dst = dst[4:] 5682 return dst 5683 } 5684 5685 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5686 func (f *FUSEReadIn) UnmarshalBytes(src []byte) []byte { 5687 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5688 src = src[8:] 5689 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5690 src = src[8:] 5691 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5692 src = src[4:] 5693 f.ReadFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5694 src = src[4:] 5695 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5696 src = src[8:] 5697 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5698 src = src[4:] 5699 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 5700 src = src[4:] 5701 return src 5702 } 5703 5704 // Packed implements marshal.Marshallable.Packed. 5705 //go:nosplit 5706 func (f *FUSEReadIn) Packed() bool { 5707 return true 5708 } 5709 5710 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5711 func (f *FUSEReadIn) MarshalUnsafe(dst []byte) []byte { 5712 size := f.SizeBytes() 5713 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5714 return dst[size:] 5715 } 5716 5717 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5718 func (f *FUSEReadIn) UnmarshalUnsafe(src []byte) []byte { 5719 size := f.SizeBytes() 5720 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5721 return src[size:] 5722 } 5723 5724 // CopyOutN implements marshal.Marshallable.CopyOutN. 5725 func (f *FUSEReadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5726 // Construct a slice backed by dst's underlying memory. 5727 var buf []byte 5728 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5729 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5730 hdr.Len = f.SizeBytes() 5731 hdr.Cap = f.SizeBytes() 5732 5733 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5734 // Since we bypassed the compiler's escape analysis, indicate that f 5735 // must live until the use above. 5736 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5737 return length, err 5738 } 5739 5740 // CopyOut implements marshal.Marshallable.CopyOut. 5741 func (f *FUSEReadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5742 return f.CopyOutN(cc, addr, f.SizeBytes()) 5743 } 5744 5745 // CopyInN implements marshal.Marshallable.CopyInN. 5746 func (f *FUSEReadIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5747 // Construct a slice backed by dst's underlying memory. 5748 var buf []byte 5749 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5750 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5751 hdr.Len = f.SizeBytes() 5752 hdr.Cap = f.SizeBytes() 5753 5754 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5755 // Since we bypassed the compiler's escape analysis, indicate that f 5756 // must live until the use above. 5757 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5758 return length, err 5759 } 5760 5761 // CopyIn implements marshal.Marshallable.CopyIn. 5762 func (f *FUSEReadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5763 return f.CopyInN(cc, addr, f.SizeBytes()) 5764 } 5765 5766 // WriteTo implements io.WriterTo.WriteTo. 5767 func (f *FUSEReadIn) WriteTo(writer io.Writer) (int64, error) { 5768 // Construct a slice backed by dst's underlying memory. 5769 var buf []byte 5770 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5771 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5772 hdr.Len = f.SizeBytes() 5773 hdr.Cap = f.SizeBytes() 5774 5775 length, err := writer.Write(buf) 5776 // Since we bypassed the compiler's escape analysis, indicate that f 5777 // must live until the use above. 5778 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5779 return int64(length), err 5780 } 5781 5782 // SizeBytes implements marshal.Marshallable.SizeBytes. 5783 func (f *FUSEReleaseIn) SizeBytes() int { 5784 return 24 5785 } 5786 5787 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 5788 func (f *FUSEReleaseIn) MarshalBytes(dst []byte) []byte { 5789 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 5790 dst = dst[8:] 5791 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 5792 dst = dst[4:] 5793 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.ReleaseFlags)) 5794 dst = dst[4:] 5795 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 5796 dst = dst[8:] 5797 return dst 5798 } 5799 5800 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 5801 func (f *FUSEReleaseIn) UnmarshalBytes(src []byte) []byte { 5802 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5803 src = src[8:] 5804 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5805 src = src[4:] 5806 f.ReleaseFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 5807 src = src[4:] 5808 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 5809 src = src[8:] 5810 return src 5811 } 5812 5813 // Packed implements marshal.Marshallable.Packed. 5814 //go:nosplit 5815 func (f *FUSEReleaseIn) Packed() bool { 5816 return true 5817 } 5818 5819 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5820 func (f *FUSEReleaseIn) MarshalUnsafe(dst []byte) []byte { 5821 size := f.SizeBytes() 5822 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 5823 return dst[size:] 5824 } 5825 5826 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5827 func (f *FUSEReleaseIn) UnmarshalUnsafe(src []byte) []byte { 5828 size := f.SizeBytes() 5829 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 5830 return src[size:] 5831 } 5832 5833 // CopyOutN implements marshal.Marshallable.CopyOutN. 5834 func (f *FUSEReleaseIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5835 // Construct a slice backed by dst's underlying memory. 5836 var buf []byte 5837 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5838 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5839 hdr.Len = f.SizeBytes() 5840 hdr.Cap = f.SizeBytes() 5841 5842 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5843 // Since we bypassed the compiler's escape analysis, indicate that f 5844 // must live until the use above. 5845 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5846 return length, err 5847 } 5848 5849 // CopyOut implements marshal.Marshallable.CopyOut. 5850 func (f *FUSEReleaseIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5851 return f.CopyOutN(cc, addr, f.SizeBytes()) 5852 } 5853 5854 // CopyInN implements marshal.Marshallable.CopyInN. 5855 func (f *FUSEReleaseIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5856 // Construct a slice backed by dst's underlying memory. 5857 var buf []byte 5858 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5859 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5860 hdr.Len = f.SizeBytes() 5861 hdr.Cap = f.SizeBytes() 5862 5863 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 5864 // Since we bypassed the compiler's escape analysis, indicate that f 5865 // must live until the use above. 5866 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5867 return length, err 5868 } 5869 5870 // CopyIn implements marshal.Marshallable.CopyIn. 5871 func (f *FUSEReleaseIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5872 return f.CopyInN(cc, addr, f.SizeBytes()) 5873 } 5874 5875 // WriteTo implements io.WriterTo.WriteTo. 5876 func (f *FUSEReleaseIn) WriteTo(writer io.Writer) (int64, error) { 5877 // Construct a slice backed by dst's underlying memory. 5878 var buf []byte 5879 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 5880 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 5881 hdr.Len = f.SizeBytes() 5882 hdr.Cap = f.SizeBytes() 5883 5884 length, err := writer.Write(buf) 5885 // Since we bypassed the compiler's escape analysis, indicate that f 5886 // must live until the use above. 5887 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 5888 return int64(length), err 5889 } 5890 5891 // Packed implements marshal.Marshallable.Packed. 5892 //go:nosplit 5893 func (r *FUSERenameIn) Packed() bool { 5894 // Type FUSERenameIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5895 return false 5896 } 5897 5898 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5899 func (r *FUSERenameIn) MarshalUnsafe(dst []byte) []byte { 5900 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5901 return r.MarshalBytes(dst) 5902 } 5903 5904 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5905 func (r *FUSERenameIn) UnmarshalUnsafe(src []byte) []byte { 5906 // Type FUSERenameIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5907 return r.UnmarshalBytes(src) 5908 } 5909 5910 // CopyOutN implements marshal.Marshallable.CopyOutN. 5911 //go:nosplit 5912 func (r *FUSERenameIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5913 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5914 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5915 r.MarshalBytes(buf) // escapes: fallback. 5916 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5917 } 5918 5919 // CopyOut implements marshal.Marshallable.CopyOut. 5920 func (r *FUSERenameIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5921 return r.CopyOutN(cc, addr, r.SizeBytes()) 5922 } 5923 5924 // CopyInN implements marshal.Marshallable.CopyInN. 5925 //go:nosplit 5926 func (r *FUSERenameIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5927 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5928 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5929 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5930 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5931 // partially unmarshalled struct. 5932 r.UnmarshalBytes(buf) // escapes: fallback. 5933 return length, err 5934 } 5935 5936 // CopyIn implements marshal.Marshallable.CopyIn. 5937 func (r *FUSERenameIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5938 return r.CopyInN(cc, addr, r.SizeBytes()) 5939 } 5940 5941 // WriteTo implements io.WriterTo.WriteTo. 5942 func (r *FUSERenameIn) WriteTo(writer io.Writer) (int64, error) { 5943 // Type FUSERenameIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5944 buf := make([]byte, r.SizeBytes()) 5945 r.MarshalBytes(buf) 5946 length, err := writer.Write(buf) 5947 return int64(length), err 5948 } 5949 5950 // Packed implements marshal.Marshallable.Packed. 5951 //go:nosplit 5952 func (r *FUSERmDirIn) Packed() bool { 5953 // Type FUSERmDirIn is dynamic so it might have slice/string headers. Hence, it is not packed. 5954 return false 5955 } 5956 5957 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 5958 func (r *FUSERmDirIn) MarshalUnsafe(dst []byte) []byte { 5959 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to MarshalBytes. 5960 return r.MarshalBytes(dst) 5961 } 5962 5963 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 5964 func (r *FUSERmDirIn) UnmarshalUnsafe(src []byte) []byte { 5965 // Type FUSERmDirIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 5966 return r.UnmarshalBytes(src) 5967 } 5968 5969 // CopyOutN implements marshal.Marshallable.CopyOutN. 5970 //go:nosplit 5971 func (r *FUSERmDirIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5972 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 5973 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5974 r.MarshalBytes(buf) // escapes: fallback. 5975 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 5976 } 5977 5978 // CopyOut implements marshal.Marshallable.CopyOut. 5979 func (r *FUSERmDirIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5980 return r.CopyOutN(cc, addr, r.SizeBytes()) 5981 } 5982 5983 // CopyInN implements marshal.Marshallable.CopyInN. 5984 //go:nosplit 5985 func (r *FUSERmDirIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 5986 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 5987 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 5988 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 5989 // Unmarshal unconditionally. If we had a short copy-in, this results in a 5990 // partially unmarshalled struct. 5991 r.UnmarshalBytes(buf) // escapes: fallback. 5992 return length, err 5993 } 5994 5995 // CopyIn implements marshal.Marshallable.CopyIn. 5996 func (r *FUSERmDirIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 5997 return r.CopyInN(cc, addr, r.SizeBytes()) 5998 } 5999 6000 // WriteTo implements io.WriterTo.WriteTo. 6001 func (r *FUSERmDirIn) WriteTo(writer io.Writer) (int64, error) { 6002 // Type FUSERmDirIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6003 buf := make([]byte, r.SizeBytes()) 6004 r.MarshalBytes(buf) 6005 length, err := writer.Write(buf) 6006 return int64(length), err 6007 } 6008 6009 // SizeBytes implements marshal.Marshallable.SizeBytes. 6010 func (f *FUSESetAttrIn) SizeBytes() int { 6011 return 88 6012 } 6013 6014 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6015 func (f *FUSESetAttrIn) MarshalBytes(dst []byte) []byte { 6016 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Valid)) 6017 dst = dst[4:] 6018 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6019 dst = dst[4:] 6020 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 6021 dst = dst[8:] 6022 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Size)) 6023 dst = dst[8:] 6024 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 6025 dst = dst[8:] 6026 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Atime)) 6027 dst = dst[8:] 6028 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Mtime)) 6029 dst = dst[8:] 6030 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Ctime)) 6031 dst = dst[8:] 6032 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.AtimeNsec)) 6033 dst = dst[4:] 6034 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.MtimeNsec)) 6035 dst = dst[4:] 6036 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.CtimeNsec)) 6037 dst = dst[4:] 6038 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Mode)) 6039 dst = dst[4:] 6040 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6041 dst = dst[4:] 6042 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.UID)) 6043 dst = dst[4:] 6044 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.GID)) 6045 dst = dst[4:] 6046 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6047 dst = dst[4:] 6048 return dst 6049 } 6050 6051 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6052 func (f *FUSESetAttrIn) UnmarshalBytes(src []byte) []byte { 6053 f.Valid = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6054 src = src[4:] 6055 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6056 src = src[4:] 6057 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6058 src = src[8:] 6059 f.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6060 src = src[8:] 6061 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6062 src = src[8:] 6063 f.Atime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6064 src = src[8:] 6065 f.Mtime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6066 src = src[8:] 6067 f.Ctime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6068 src = src[8:] 6069 f.AtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6070 src = src[4:] 6071 f.MtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6072 src = src[4:] 6073 f.CtimeNsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6074 src = src[4:] 6075 f.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6076 src = src[4:] 6077 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6078 src = src[4:] 6079 f.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6080 src = src[4:] 6081 f.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6082 src = src[4:] 6083 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6084 src = src[4:] 6085 return src 6086 } 6087 6088 // Packed implements marshal.Marshallable.Packed. 6089 //go:nosplit 6090 func (f *FUSESetAttrIn) Packed() bool { 6091 return true 6092 } 6093 6094 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6095 func (f *FUSESetAttrIn) MarshalUnsafe(dst []byte) []byte { 6096 size := f.SizeBytes() 6097 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6098 return dst[size:] 6099 } 6100 6101 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6102 func (f *FUSESetAttrIn) UnmarshalUnsafe(src []byte) []byte { 6103 size := f.SizeBytes() 6104 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6105 return src[size:] 6106 } 6107 6108 // CopyOutN implements marshal.Marshallable.CopyOutN. 6109 func (f *FUSESetAttrIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6110 // Construct a slice backed by dst's underlying memory. 6111 var buf []byte 6112 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6113 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6114 hdr.Len = f.SizeBytes() 6115 hdr.Cap = f.SizeBytes() 6116 6117 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6118 // Since we bypassed the compiler's escape analysis, indicate that f 6119 // must live until the use above. 6120 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6121 return length, err 6122 } 6123 6124 // CopyOut implements marshal.Marshallable.CopyOut. 6125 func (f *FUSESetAttrIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6126 return f.CopyOutN(cc, addr, f.SizeBytes()) 6127 } 6128 6129 // CopyInN implements marshal.Marshallable.CopyInN. 6130 func (f *FUSESetAttrIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6131 // Construct a slice backed by dst's underlying memory. 6132 var buf []byte 6133 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6134 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6135 hdr.Len = f.SizeBytes() 6136 hdr.Cap = f.SizeBytes() 6137 6138 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6139 // Since we bypassed the compiler's escape analysis, indicate that f 6140 // must live until the use above. 6141 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6142 return length, err 6143 } 6144 6145 // CopyIn implements marshal.Marshallable.CopyIn. 6146 func (f *FUSESetAttrIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6147 return f.CopyInN(cc, addr, f.SizeBytes()) 6148 } 6149 6150 // WriteTo implements io.WriterTo.WriteTo. 6151 func (f *FUSESetAttrIn) WriteTo(writer io.Writer) (int64, error) { 6152 // Construct a slice backed by dst's underlying memory. 6153 var buf []byte 6154 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6155 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6156 hdr.Len = f.SizeBytes() 6157 hdr.Cap = f.SizeBytes() 6158 6159 length, err := writer.Write(buf) 6160 // Since we bypassed the compiler's escape analysis, indicate that f 6161 // must live until the use above. 6162 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6163 return int64(length), err 6164 } 6165 6166 // SizeBytes implements marshal.Marshallable.SizeBytes. 6167 func (f *FUSEStatfsOut) SizeBytes() int { 6168 return 56 + 6169 4*6 6170 } 6171 6172 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6173 func (f *FUSEStatfsOut) MarshalBytes(dst []byte) []byte { 6174 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Blocks)) 6175 dst = dst[8:] 6176 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksFree)) 6177 dst = dst[8:] 6178 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.BlocksAvailable)) 6179 dst = dst[8:] 6180 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Files)) 6181 dst = dst[8:] 6182 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.FilesFree)) 6183 dst = dst[8:] 6184 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.BlockSize)) 6185 dst = dst[4:] 6186 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.NameLength)) 6187 dst = dst[4:] 6188 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.FragmentSize)) 6189 dst = dst[4:] 6190 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6191 dst = dst[4:] 6192 for idx := 0; idx < 6; idx++ { 6193 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Spare[idx])) 6194 dst = dst[4:] 6195 } 6196 return dst 6197 } 6198 6199 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6200 func (f *FUSEStatfsOut) UnmarshalBytes(src []byte) []byte { 6201 f.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6202 src = src[8:] 6203 f.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6204 src = src[8:] 6205 f.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6206 src = src[8:] 6207 f.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6208 src = src[8:] 6209 f.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6210 src = src[8:] 6211 f.BlockSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6212 src = src[4:] 6213 f.NameLength = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6214 src = src[4:] 6215 f.FragmentSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6216 src = src[4:] 6217 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6218 src = src[4:] 6219 for idx := 0; idx < 6; idx++ { 6220 f.Spare[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6221 src = src[4:] 6222 } 6223 return src 6224 } 6225 6226 // Packed implements marshal.Marshallable.Packed. 6227 //go:nosplit 6228 func (f *FUSEStatfsOut) Packed() bool { 6229 return true 6230 } 6231 6232 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6233 func (f *FUSEStatfsOut) MarshalUnsafe(dst []byte) []byte { 6234 size := f.SizeBytes() 6235 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6236 return dst[size:] 6237 } 6238 6239 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6240 func (f *FUSEStatfsOut) UnmarshalUnsafe(src []byte) []byte { 6241 size := f.SizeBytes() 6242 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6243 return src[size:] 6244 } 6245 6246 // CopyOutN implements marshal.Marshallable.CopyOutN. 6247 func (f *FUSEStatfsOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6248 // Construct a slice backed by dst's underlying memory. 6249 var buf []byte 6250 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6251 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6252 hdr.Len = f.SizeBytes() 6253 hdr.Cap = f.SizeBytes() 6254 6255 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6256 // Since we bypassed the compiler's escape analysis, indicate that f 6257 // must live until the use above. 6258 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6259 return length, err 6260 } 6261 6262 // CopyOut implements marshal.Marshallable.CopyOut. 6263 func (f *FUSEStatfsOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6264 return f.CopyOutN(cc, addr, f.SizeBytes()) 6265 } 6266 6267 // CopyInN implements marshal.Marshallable.CopyInN. 6268 func (f *FUSEStatfsOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6269 // Construct a slice backed by dst's underlying memory. 6270 var buf []byte 6271 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6272 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6273 hdr.Len = f.SizeBytes() 6274 hdr.Cap = f.SizeBytes() 6275 6276 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6277 // Since we bypassed the compiler's escape analysis, indicate that f 6278 // must live until the use above. 6279 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6280 return length, err 6281 } 6282 6283 // CopyIn implements marshal.Marshallable.CopyIn. 6284 func (f *FUSEStatfsOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6285 return f.CopyInN(cc, addr, f.SizeBytes()) 6286 } 6287 6288 // WriteTo implements io.WriterTo.WriteTo. 6289 func (f *FUSEStatfsOut) WriteTo(writer io.Writer) (int64, error) { 6290 // Construct a slice backed by dst's underlying memory. 6291 var buf []byte 6292 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6293 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6294 hdr.Len = f.SizeBytes() 6295 hdr.Cap = f.SizeBytes() 6296 6297 length, err := writer.Write(buf) 6298 // Since we bypassed the compiler's escape analysis, indicate that f 6299 // must live until the use above. 6300 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6301 return int64(length), err 6302 } 6303 6304 // Packed implements marshal.Marshallable.Packed. 6305 //go:nosplit 6306 func (r *FUSESymlinkIn) Packed() bool { 6307 // Type FUSESymlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6308 return false 6309 } 6310 6311 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6312 func (r *FUSESymlinkIn) MarshalUnsafe(dst []byte) []byte { 6313 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6314 return r.MarshalBytes(dst) 6315 } 6316 6317 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6318 func (r *FUSESymlinkIn) UnmarshalUnsafe(src []byte) []byte { 6319 // Type FUSESymlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6320 return r.UnmarshalBytes(src) 6321 } 6322 6323 // CopyOutN implements marshal.Marshallable.CopyOutN. 6324 //go:nosplit 6325 func (r *FUSESymlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6326 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6327 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6328 r.MarshalBytes(buf) // escapes: fallback. 6329 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6330 } 6331 6332 // CopyOut implements marshal.Marshallable.CopyOut. 6333 func (r *FUSESymlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6334 return r.CopyOutN(cc, addr, r.SizeBytes()) 6335 } 6336 6337 // CopyInN implements marshal.Marshallable.CopyInN. 6338 //go:nosplit 6339 func (r *FUSESymlinkIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6340 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6341 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6342 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6343 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6344 // partially unmarshalled struct. 6345 r.UnmarshalBytes(buf) // escapes: fallback. 6346 return length, err 6347 } 6348 6349 // CopyIn implements marshal.Marshallable.CopyIn. 6350 func (r *FUSESymlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6351 return r.CopyInN(cc, addr, r.SizeBytes()) 6352 } 6353 6354 // WriteTo implements io.WriterTo.WriteTo. 6355 func (r *FUSESymlinkIn) WriteTo(writer io.Writer) (int64, error) { 6356 // Type FUSESymlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6357 buf := make([]byte, r.SizeBytes()) 6358 r.MarshalBytes(buf) 6359 length, err := writer.Write(buf) 6360 return int64(length), err 6361 } 6362 6363 // Packed implements marshal.Marshallable.Packed. 6364 //go:nosplit 6365 func (r *FUSEUnlinkIn) Packed() bool { 6366 // Type FUSEUnlinkIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6367 return false 6368 } 6369 6370 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6371 func (r *FUSEUnlinkIn) MarshalUnsafe(dst []byte) []byte { 6372 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6373 return r.MarshalBytes(dst) 6374 } 6375 6376 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6377 func (r *FUSEUnlinkIn) UnmarshalUnsafe(src []byte) []byte { 6378 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6379 return r.UnmarshalBytes(src) 6380 } 6381 6382 // CopyOutN implements marshal.Marshallable.CopyOutN. 6383 //go:nosplit 6384 func (r *FUSEUnlinkIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6385 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6386 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6387 r.MarshalBytes(buf) // escapes: fallback. 6388 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6389 } 6390 6391 // CopyOut implements marshal.Marshallable.CopyOut. 6392 func (r *FUSEUnlinkIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6393 return r.CopyOutN(cc, addr, r.SizeBytes()) 6394 } 6395 6396 // CopyInN implements marshal.Marshallable.CopyInN. 6397 //go:nosplit 6398 func (r *FUSEUnlinkIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6399 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6400 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6401 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6402 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6403 // partially unmarshalled struct. 6404 r.UnmarshalBytes(buf) // escapes: fallback. 6405 return length, err 6406 } 6407 6408 // CopyIn implements marshal.Marshallable.CopyIn. 6409 func (r *FUSEUnlinkIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6410 return r.CopyInN(cc, addr, r.SizeBytes()) 6411 } 6412 6413 // WriteTo implements io.WriterTo.WriteTo. 6414 func (r *FUSEUnlinkIn) WriteTo(writer io.Writer) (int64, error) { 6415 // Type FUSEUnlinkIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6416 buf := make([]byte, r.SizeBytes()) 6417 r.MarshalBytes(buf) 6418 length, err := writer.Write(buf) 6419 return int64(length), err 6420 } 6421 6422 // SizeBytes implements marshal.Marshallable.SizeBytes. 6423 func (f *FUSEWriteIn) SizeBytes() int { 6424 return 40 6425 } 6426 6427 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6428 func (f *FUSEWriteIn) MarshalBytes(dst []byte) []byte { 6429 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Fh)) 6430 dst = dst[8:] 6431 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.Offset)) 6432 dst = dst[8:] 6433 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 6434 dst = dst[4:] 6435 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.WriteFlags)) 6436 dst = dst[4:] 6437 hostarch.ByteOrder.PutUint64(dst[:8], uint64(f.LockOwner)) 6438 dst = dst[8:] 6439 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Flags)) 6440 dst = dst[4:] 6441 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6442 dst = dst[4:] 6443 return dst 6444 } 6445 6446 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6447 func (f *FUSEWriteIn) UnmarshalBytes(src []byte) []byte { 6448 f.Fh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6449 src = src[8:] 6450 f.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6451 src = src[8:] 6452 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6453 src = src[4:] 6454 f.WriteFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6455 src = src[4:] 6456 f.LockOwner = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6457 src = src[8:] 6458 f.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6459 src = src[4:] 6460 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6461 src = src[4:] 6462 return src 6463 } 6464 6465 // Packed implements marshal.Marshallable.Packed. 6466 //go:nosplit 6467 func (f *FUSEWriteIn) Packed() bool { 6468 return true 6469 } 6470 6471 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6472 func (f *FUSEWriteIn) MarshalUnsafe(dst []byte) []byte { 6473 size := f.SizeBytes() 6474 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6475 return dst[size:] 6476 } 6477 6478 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6479 func (f *FUSEWriteIn) UnmarshalUnsafe(src []byte) []byte { 6480 size := f.SizeBytes() 6481 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6482 return src[size:] 6483 } 6484 6485 // CopyOutN implements marshal.Marshallable.CopyOutN. 6486 func (f *FUSEWriteIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6487 // Construct a slice backed by dst's underlying memory. 6488 var buf []byte 6489 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6490 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6491 hdr.Len = f.SizeBytes() 6492 hdr.Cap = f.SizeBytes() 6493 6494 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6495 // Since we bypassed the compiler's escape analysis, indicate that f 6496 // must live until the use above. 6497 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6498 return length, err 6499 } 6500 6501 // CopyOut implements marshal.Marshallable.CopyOut. 6502 func (f *FUSEWriteIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6503 return f.CopyOutN(cc, addr, f.SizeBytes()) 6504 } 6505 6506 // CopyInN implements marshal.Marshallable.CopyInN. 6507 func (f *FUSEWriteIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6508 // Construct a slice backed by dst's underlying memory. 6509 var buf []byte 6510 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6511 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6512 hdr.Len = f.SizeBytes() 6513 hdr.Cap = f.SizeBytes() 6514 6515 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6516 // Since we bypassed the compiler's escape analysis, indicate that f 6517 // must live until the use above. 6518 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6519 return length, err 6520 } 6521 6522 // CopyIn implements marshal.Marshallable.CopyIn. 6523 func (f *FUSEWriteIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6524 return f.CopyInN(cc, addr, f.SizeBytes()) 6525 } 6526 6527 // WriteTo implements io.WriterTo.WriteTo. 6528 func (f *FUSEWriteIn) WriteTo(writer io.Writer) (int64, error) { 6529 // Construct a slice backed by dst's underlying memory. 6530 var buf []byte 6531 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6532 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6533 hdr.Len = f.SizeBytes() 6534 hdr.Cap = f.SizeBytes() 6535 6536 length, err := writer.Write(buf) 6537 // Since we bypassed the compiler's escape analysis, indicate that f 6538 // must live until the use above. 6539 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6540 return int64(length), err 6541 } 6542 6543 // SizeBytes implements marshal.Marshallable.SizeBytes. 6544 func (f *FUSEWriteOut) SizeBytes() int { 6545 return 8 6546 } 6547 6548 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6549 func (f *FUSEWriteOut) MarshalBytes(dst []byte) []byte { 6550 hostarch.ByteOrder.PutUint32(dst[:4], uint32(f.Size)) 6551 dst = dst[4:] 6552 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 6553 dst = dst[4:] 6554 return dst 6555 } 6556 6557 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6558 func (f *FUSEWriteOut) UnmarshalBytes(src []byte) []byte { 6559 f.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6560 src = src[4:] 6561 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 6562 src = src[4:] 6563 return src 6564 } 6565 6566 // Packed implements marshal.Marshallable.Packed. 6567 //go:nosplit 6568 func (f *FUSEWriteOut) Packed() bool { 6569 return true 6570 } 6571 6572 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6573 func (f *FUSEWriteOut) MarshalUnsafe(dst []byte) []byte { 6574 size := f.SizeBytes() 6575 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 6576 return dst[size:] 6577 } 6578 6579 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6580 func (f *FUSEWriteOut) UnmarshalUnsafe(src []byte) []byte { 6581 size := f.SizeBytes() 6582 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 6583 return src[size:] 6584 } 6585 6586 // CopyOutN implements marshal.Marshallable.CopyOutN. 6587 func (f *FUSEWriteOut) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6588 // Construct a slice backed by dst's underlying memory. 6589 var buf []byte 6590 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6591 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6592 hdr.Len = f.SizeBytes() 6593 hdr.Cap = f.SizeBytes() 6594 6595 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6596 // Since we bypassed the compiler's escape analysis, indicate that f 6597 // must live until the use above. 6598 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6599 return length, err 6600 } 6601 6602 // CopyOut implements marshal.Marshallable.CopyOut. 6603 func (f *FUSEWriteOut) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6604 return f.CopyOutN(cc, addr, f.SizeBytes()) 6605 } 6606 6607 // CopyInN implements marshal.Marshallable.CopyInN. 6608 func (f *FUSEWriteOut) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6609 // Construct a slice backed by dst's underlying memory. 6610 var buf []byte 6611 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6612 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6613 hdr.Len = f.SizeBytes() 6614 hdr.Cap = f.SizeBytes() 6615 6616 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6617 // Since we bypassed the compiler's escape analysis, indicate that f 6618 // must live until the use above. 6619 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6620 return length, err 6621 } 6622 6623 // CopyIn implements marshal.Marshallable.CopyIn. 6624 func (f *FUSEWriteOut) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6625 return f.CopyInN(cc, addr, f.SizeBytes()) 6626 } 6627 6628 // WriteTo implements io.WriterTo.WriteTo. 6629 func (f *FUSEWriteOut) WriteTo(writer io.Writer) (int64, error) { 6630 // Construct a slice backed by dst's underlying memory. 6631 var buf []byte 6632 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6633 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 6634 hdr.Len = f.SizeBytes() 6635 hdr.Cap = f.SizeBytes() 6636 6637 length, err := writer.Write(buf) 6638 // Since we bypassed the compiler's escape analysis, indicate that f 6639 // must live until the use above. 6640 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 6641 return int64(length), err 6642 } 6643 6644 // Packed implements marshal.Marshallable.Packed. 6645 //go:nosplit 6646 func (r *FUSEWritePayloadIn) Packed() bool { 6647 // Type FUSEWritePayloadIn is dynamic so it might have slice/string headers. Hence, it is not packed. 6648 return false 6649 } 6650 6651 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6652 func (r *FUSEWritePayloadIn) MarshalUnsafe(dst []byte) []byte { 6653 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to MarshalBytes. 6654 return r.MarshalBytes(dst) 6655 } 6656 6657 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6658 func (r *FUSEWritePayloadIn) UnmarshalUnsafe(src []byte) []byte { 6659 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fallback to UnmarshalBytes. 6660 return r.UnmarshalBytes(src) 6661 } 6662 6663 // CopyOutN implements marshal.Marshallable.CopyOutN. 6664 //go:nosplit 6665 func (r *FUSEWritePayloadIn) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6666 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6667 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6668 r.MarshalBytes(buf) // escapes: fallback. 6669 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6670 } 6671 6672 // CopyOut implements marshal.Marshallable.CopyOut. 6673 func (r *FUSEWritePayloadIn) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6674 return r.CopyOutN(cc, addr, r.SizeBytes()) 6675 } 6676 6677 // CopyInN implements marshal.Marshallable.CopyInN. 6678 //go:nosplit 6679 func (r *FUSEWritePayloadIn) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6680 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to UnmarshalBytes. 6681 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 6682 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 6683 // Unmarshal unconditionally. If we had a short copy-in, this results in a 6684 // partially unmarshalled struct. 6685 r.UnmarshalBytes(buf) // escapes: fallback. 6686 return length, err 6687 } 6688 6689 // CopyIn implements marshal.Marshallable.CopyIn. 6690 func (r *FUSEWritePayloadIn) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6691 return r.CopyInN(cc, addr, r.SizeBytes()) 6692 } 6693 6694 // WriteTo implements io.WriterTo.WriteTo. 6695 func (r *FUSEWritePayloadIn) WriteTo(writer io.Writer) (int64, error) { 6696 // Type FUSEWritePayloadIn doesn't have a packed layout in memory, fall back to MarshalBytes. 6697 buf := make([]byte, r.SizeBytes()) 6698 r.MarshalBytes(buf) 6699 length, err := writer.Write(buf) 6700 return int64(length), err 6701 } 6702 6703 // SizeBytes implements marshal.Marshallable.SizeBytes. 6704 func (r *RobustListHead) SizeBytes() int { 6705 return 24 6706 } 6707 6708 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6709 func (r *RobustListHead) MarshalBytes(dst []byte) []byte { 6710 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.List)) 6711 dst = dst[8:] 6712 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.FutexOffset)) 6713 dst = dst[8:] 6714 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ListOpPending)) 6715 dst = dst[8:] 6716 return dst 6717 } 6718 6719 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6720 func (r *RobustListHead) UnmarshalBytes(src []byte) []byte { 6721 r.List = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6722 src = src[8:] 6723 r.FutexOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6724 src = src[8:] 6725 r.ListOpPending = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6726 src = src[8:] 6727 return src 6728 } 6729 6730 // Packed implements marshal.Marshallable.Packed. 6731 //go:nosplit 6732 func (r *RobustListHead) Packed() bool { 6733 return true 6734 } 6735 6736 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6737 func (r *RobustListHead) MarshalUnsafe(dst []byte) []byte { 6738 size := r.SizeBytes() 6739 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 6740 return dst[size:] 6741 } 6742 6743 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6744 func (r *RobustListHead) UnmarshalUnsafe(src []byte) []byte { 6745 size := r.SizeBytes() 6746 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 6747 return src[size:] 6748 } 6749 6750 // CopyOutN implements marshal.Marshallable.CopyOutN. 6751 func (r *RobustListHead) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6752 // Construct a slice backed by dst's underlying memory. 6753 var buf []byte 6754 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6755 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6756 hdr.Len = r.SizeBytes() 6757 hdr.Cap = r.SizeBytes() 6758 6759 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6760 // Since we bypassed the compiler's escape analysis, indicate that r 6761 // must live until the use above. 6762 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6763 return length, err 6764 } 6765 6766 // CopyOut implements marshal.Marshallable.CopyOut. 6767 func (r *RobustListHead) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6768 return r.CopyOutN(cc, addr, r.SizeBytes()) 6769 } 6770 6771 // CopyInN implements marshal.Marshallable.CopyInN. 6772 func (r *RobustListHead) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6773 // Construct a slice backed by dst's underlying memory. 6774 var buf []byte 6775 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6776 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6777 hdr.Len = r.SizeBytes() 6778 hdr.Cap = r.SizeBytes() 6779 6780 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6781 // Since we bypassed the compiler's escape analysis, indicate that r 6782 // must live until the use above. 6783 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6784 return length, err 6785 } 6786 6787 // CopyIn implements marshal.Marshallable.CopyIn. 6788 func (r *RobustListHead) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6789 return r.CopyInN(cc, addr, r.SizeBytes()) 6790 } 6791 6792 // WriteTo implements io.WriterTo.WriteTo. 6793 func (r *RobustListHead) WriteTo(writer io.Writer) (int64, error) { 6794 // Construct a slice backed by dst's underlying memory. 6795 var buf []byte 6796 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6797 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 6798 hdr.Len = r.SizeBytes() 6799 hdr.Cap = r.SizeBytes() 6800 6801 length, err := writer.Write(buf) 6802 // Since we bypassed the compiler's escape analysis, indicate that r 6803 // must live until the use above. 6804 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 6805 return int64(length), err 6806 } 6807 6808 // SizeBytes implements marshal.Marshallable.SizeBytes. 6809 func (i *IOCqRingOffsets) SizeBytes() int { 6810 return 40 6811 } 6812 6813 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6814 func (i *IOCqRingOffsets) MarshalBytes(dst []byte) []byte { 6815 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 6816 dst = dst[4:] 6817 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 6818 dst = dst[4:] 6819 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 6820 dst = dst[4:] 6821 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 6822 dst = dst[4:] 6823 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Overflow)) 6824 dst = dst[4:] 6825 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Cqes)) 6826 dst = dst[4:] 6827 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 6828 dst = dst[4:] 6829 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 6830 dst = dst[4:] 6831 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 6832 dst = dst[8:] 6833 return dst 6834 } 6835 6836 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6837 func (i *IOCqRingOffsets) UnmarshalBytes(src []byte) []byte { 6838 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6839 src = src[4:] 6840 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6841 src = src[4:] 6842 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6843 src = src[4:] 6844 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6845 src = src[4:] 6846 i.Overflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6847 src = src[4:] 6848 i.Cqes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6849 src = src[4:] 6850 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6851 src = src[4:] 6852 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 6853 src = src[4:] 6854 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 6855 src = src[8:] 6856 return src 6857 } 6858 6859 // Packed implements marshal.Marshallable.Packed. 6860 //go:nosplit 6861 func (i *IOCqRingOffsets) Packed() bool { 6862 return true 6863 } 6864 6865 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6866 func (i *IOCqRingOffsets) MarshalUnsafe(dst []byte) []byte { 6867 size := i.SizeBytes() 6868 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6869 return dst[size:] 6870 } 6871 6872 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6873 func (i *IOCqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 6874 size := i.SizeBytes() 6875 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6876 return src[size:] 6877 } 6878 6879 // CopyOutN implements marshal.Marshallable.CopyOutN. 6880 func (i *IOCqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6881 // Construct a slice backed by dst's underlying memory. 6882 var buf []byte 6883 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6884 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6885 hdr.Len = i.SizeBytes() 6886 hdr.Cap = i.SizeBytes() 6887 6888 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6889 // Since we bypassed the compiler's escape analysis, indicate that i 6890 // must live until the use above. 6891 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6892 return length, err 6893 } 6894 6895 // CopyOut implements marshal.Marshallable.CopyOut. 6896 func (i *IOCqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6897 return i.CopyOutN(cc, addr, i.SizeBytes()) 6898 } 6899 6900 // CopyInN implements marshal.Marshallable.CopyInN. 6901 func (i *IOCqRingOffsets) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6902 // Construct a slice backed by dst's underlying memory. 6903 var buf []byte 6904 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6905 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6906 hdr.Len = i.SizeBytes() 6907 hdr.Cap = i.SizeBytes() 6908 6909 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 6910 // Since we bypassed the compiler's escape analysis, indicate that i 6911 // must live until the use above. 6912 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6913 return length, err 6914 } 6915 6916 // CopyIn implements marshal.Marshallable.CopyIn. 6917 func (i *IOCqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6918 return i.CopyInN(cc, addr, i.SizeBytes()) 6919 } 6920 6921 // WriteTo implements io.WriterTo.WriteTo. 6922 func (i *IOCqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 6923 // Construct a slice backed by dst's underlying memory. 6924 var buf []byte 6925 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6926 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6927 hdr.Len = i.SizeBytes() 6928 hdr.Cap = i.SizeBytes() 6929 6930 length, err := writer.Write(buf) 6931 // Since we bypassed the compiler's escape analysis, indicate that i 6932 // must live until the use above. 6933 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6934 return int64(length), err 6935 } 6936 6937 // SizeBytes implements marshal.Marshallable.SizeBytes. 6938 //go:nosplit 6939 func (i *IORingIndex) SizeBytes() int { 6940 return 4 6941 } 6942 6943 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 6944 func (i *IORingIndex) MarshalBytes(dst []byte) []byte { 6945 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i)) 6946 return dst[4:] 6947 } 6948 6949 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 6950 func (i *IORingIndex) UnmarshalBytes(src []byte) []byte { 6951 *i = IORingIndex(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 6952 return src[4:] 6953 } 6954 6955 // Packed implements marshal.Marshallable.Packed. 6956 //go:nosplit 6957 func (i *IORingIndex) Packed() bool { 6958 // Scalar newtypes are always packed. 6959 return true 6960 } 6961 6962 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 6963 func (i *IORingIndex) MarshalUnsafe(dst []byte) []byte { 6964 size := i.SizeBytes() 6965 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 6966 return dst[size:] 6967 } 6968 6969 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 6970 func (i *IORingIndex) UnmarshalUnsafe(src []byte) []byte { 6971 size := i.SizeBytes() 6972 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 6973 return src[size:] 6974 } 6975 6976 // CopyOutN implements marshal.Marshallable.CopyOutN. 6977 func (i *IORingIndex) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6978 // Construct a slice backed by dst's underlying memory. 6979 var buf []byte 6980 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 6981 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 6982 hdr.Len = i.SizeBytes() 6983 hdr.Cap = i.SizeBytes() 6984 6985 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 6986 // Since we bypassed the compiler's escape analysis, indicate that i 6987 // must live until the use above. 6988 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 6989 return length, err 6990 } 6991 6992 // CopyOut implements marshal.Marshallable.CopyOut. 6993 func (i *IORingIndex) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 6994 return i.CopyOutN(cc, addr, i.SizeBytes()) 6995 } 6996 6997 // CopyInN implements marshal.Marshallable.CopyInN. 6998 func (i *IORingIndex) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 6999 // Construct a slice backed by dst's underlying memory. 7000 var buf []byte 7001 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7002 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7003 hdr.Len = i.SizeBytes() 7004 hdr.Cap = i.SizeBytes() 7005 7006 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7007 // Since we bypassed the compiler's escape analysis, indicate that i 7008 // must live until the use above. 7009 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7010 return length, err 7011 } 7012 7013 // CopyIn implements marshal.Marshallable.CopyIn. 7014 func (i *IORingIndex) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7015 return i.CopyInN(cc, addr, i.SizeBytes()) 7016 } 7017 7018 // WriteTo implements io.WriterTo.WriteTo. 7019 func (i *IORingIndex) WriteTo(writer io.Writer) (int64, error) { 7020 // Construct a slice backed by dst's underlying memory. 7021 var buf []byte 7022 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7023 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7024 hdr.Len = i.SizeBytes() 7025 hdr.Cap = i.SizeBytes() 7026 7027 length, err := writer.Write(buf) 7028 // Since we bypassed the compiler's escape analysis, indicate that i 7029 // must live until the use above. 7030 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7031 return int64(length), err 7032 } 7033 7034 // SizeBytes implements marshal.Marshallable.SizeBytes. 7035 func (i *IORings) SizeBytes() int { 7036 return 32 + 7037 (*IOUring)(nil).SizeBytes() + 7038 (*IOUring)(nil).SizeBytes() + 7039 1*32 7040 } 7041 7042 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7043 func (i *IORings) MarshalBytes(dst []byte) []byte { 7044 dst = i.Sq.MarshalUnsafe(dst) 7045 dst = i.Cq.MarshalUnsafe(dst) 7046 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingMask)) 7047 dst = dst[4:] 7048 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingMask)) 7049 dst = dst[4:] 7050 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqRingEntries)) 7051 dst = dst[4:] 7052 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqRingEntries)) 7053 dst = dst[4:] 7054 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqDropped)) 7055 dst = dst[4:] 7056 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.sqFlags)) 7057 dst = dst[4:] 7058 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.cqFlags)) 7059 dst = dst[4:] 7060 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqOverflow)) 7061 dst = dst[4:] 7062 // Padding: dst[:sizeof(byte)*32] ~= [32]byte{0} 7063 dst = dst[1*(32):] 7064 return dst 7065 } 7066 7067 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7068 func (i *IORings) UnmarshalBytes(src []byte) []byte { 7069 src = i.Sq.UnmarshalUnsafe(src) 7070 src = i.Cq.UnmarshalUnsafe(src) 7071 i.SqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7072 src = src[4:] 7073 i.CqRingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7074 src = src[4:] 7075 i.SqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7076 src = src[4:] 7077 i.CqRingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7078 src = src[4:] 7079 i.sqDropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7080 src = src[4:] 7081 i.sqFlags = int32(hostarch.ByteOrder.Uint32(src[:4])) 7082 src = src[4:] 7083 i.cqFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7084 src = src[4:] 7085 i.CqOverflow = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7086 src = src[4:] 7087 // Padding: ~ copy([32]byte(i._), src[:sizeof(byte)*32]) 7088 src = src[1*(32):] 7089 return src 7090 } 7091 7092 // Packed implements marshal.Marshallable.Packed. 7093 //go:nosplit 7094 func (i *IORings) Packed() bool { 7095 return i.Cq.Packed() && i.Sq.Packed() 7096 } 7097 7098 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7099 func (i *IORings) MarshalUnsafe(dst []byte) []byte { 7100 if i.Cq.Packed() && i.Sq.Packed() { 7101 size := i.SizeBytes() 7102 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7103 return dst[size:] 7104 } 7105 // Type IORings doesn't have a packed layout in memory, fallback to MarshalBytes. 7106 return i.MarshalBytes(dst) 7107 } 7108 7109 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7110 func (i *IORings) UnmarshalUnsafe(src []byte) []byte { 7111 if i.Cq.Packed() && i.Sq.Packed() { 7112 size := i.SizeBytes() 7113 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7114 return src[size:] 7115 } 7116 // Type IORings doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7117 return i.UnmarshalBytes(src) 7118 } 7119 7120 // CopyOutN implements marshal.Marshallable.CopyOutN. 7121 func (i *IORings) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7122 if !i.Cq.Packed() && i.Sq.Packed() { 7123 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 7124 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7125 i.MarshalBytes(buf) // escapes: fallback. 7126 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7127 } 7128 7129 // Construct a slice backed by dst's underlying memory. 7130 var buf []byte 7131 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7132 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7133 hdr.Len = i.SizeBytes() 7134 hdr.Cap = i.SizeBytes() 7135 7136 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7137 // Since we bypassed the compiler's escape analysis, indicate that i 7138 // must live until the use above. 7139 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7140 return length, err 7141 } 7142 7143 // CopyOut implements marshal.Marshallable.CopyOut. 7144 func (i *IORings) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7145 return i.CopyOutN(cc, addr, i.SizeBytes()) 7146 } 7147 7148 // CopyInN implements marshal.Marshallable.CopyInN. 7149 func (i *IORings) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7150 if !i.Cq.Packed() && i.Sq.Packed() { 7151 // Type IORings doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7152 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7153 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7154 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7155 // partially unmarshalled struct. 7156 i.UnmarshalBytes(buf) // escapes: fallback. 7157 return length, err 7158 } 7159 7160 // Construct a slice backed by dst's underlying memory. 7161 var buf []byte 7162 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7163 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7164 hdr.Len = i.SizeBytes() 7165 hdr.Cap = i.SizeBytes() 7166 7167 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7168 // Since we bypassed the compiler's escape analysis, indicate that i 7169 // must live until the use above. 7170 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7171 return length, err 7172 } 7173 7174 // CopyIn implements marshal.Marshallable.CopyIn. 7175 func (i *IORings) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7176 return i.CopyInN(cc, addr, i.SizeBytes()) 7177 } 7178 7179 // WriteTo implements io.WriterTo.WriteTo. 7180 func (i *IORings) WriteTo(writer io.Writer) (int64, error) { 7181 if !i.Cq.Packed() && i.Sq.Packed() { 7182 // Type IORings doesn't have a packed layout in memory, fall back to MarshalBytes. 7183 buf := make([]byte, i.SizeBytes()) 7184 i.MarshalBytes(buf) 7185 length, err := writer.Write(buf) 7186 return int64(length), err 7187 } 7188 7189 // Construct a slice backed by dst's underlying memory. 7190 var buf []byte 7191 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7192 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7193 hdr.Len = i.SizeBytes() 7194 hdr.Cap = i.SizeBytes() 7195 7196 length, err := writer.Write(buf) 7197 // Since we bypassed the compiler's escape analysis, indicate that i 7198 // must live until the use above. 7199 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7200 return int64(length), err 7201 } 7202 7203 // SizeBytes implements marshal.Marshallable.SizeBytes. 7204 func (i *IOSqRingOffsets) SizeBytes() int { 7205 return 40 7206 } 7207 7208 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7209 func (i *IOSqRingOffsets) MarshalBytes(dst []byte) []byte { 7210 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 7211 dst = dst[4:] 7212 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 7213 dst = dst[4:] 7214 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingMask)) 7215 dst = dst[4:] 7216 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.RingEntries)) 7217 dst = dst[4:] 7218 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7219 dst = dst[4:] 7220 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Dropped)) 7221 dst = dst[4:] 7222 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Array)) 7223 dst = dst[4:] 7224 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv1)) 7225 dst = dst[4:] 7226 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Resv2)) 7227 dst = dst[8:] 7228 return dst 7229 } 7230 7231 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7232 func (i *IOSqRingOffsets) UnmarshalBytes(src []byte) []byte { 7233 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7234 src = src[4:] 7235 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7236 src = src[4:] 7237 i.RingMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7238 src = src[4:] 7239 i.RingEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7240 src = src[4:] 7241 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7242 src = src[4:] 7243 i.Dropped = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7244 src = src[4:] 7245 i.Array = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7246 src = src[4:] 7247 i.Resv1 = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7248 src = src[4:] 7249 i.Resv2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7250 src = src[8:] 7251 return src 7252 } 7253 7254 // Packed implements marshal.Marshallable.Packed. 7255 //go:nosplit 7256 func (i *IOSqRingOffsets) Packed() bool { 7257 return true 7258 } 7259 7260 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7261 func (i *IOSqRingOffsets) MarshalUnsafe(dst []byte) []byte { 7262 size := i.SizeBytes() 7263 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7264 return dst[size:] 7265 } 7266 7267 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7268 func (i *IOSqRingOffsets) UnmarshalUnsafe(src []byte) []byte { 7269 size := i.SizeBytes() 7270 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7271 return src[size:] 7272 } 7273 7274 // CopyOutN implements marshal.Marshallable.CopyOutN. 7275 func (i *IOSqRingOffsets) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7276 // Construct a slice backed by dst's underlying memory. 7277 var buf []byte 7278 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7279 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7280 hdr.Len = i.SizeBytes() 7281 hdr.Cap = i.SizeBytes() 7282 7283 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7284 // Since we bypassed the compiler's escape analysis, indicate that i 7285 // must live until the use above. 7286 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7287 return length, err 7288 } 7289 7290 // CopyOut implements marshal.Marshallable.CopyOut. 7291 func (i *IOSqRingOffsets) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7292 return i.CopyOutN(cc, addr, i.SizeBytes()) 7293 } 7294 7295 // CopyInN implements marshal.Marshallable.CopyInN. 7296 func (i *IOSqRingOffsets) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7297 // Construct a slice backed by dst's underlying memory. 7298 var buf []byte 7299 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7300 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7301 hdr.Len = i.SizeBytes() 7302 hdr.Cap = i.SizeBytes() 7303 7304 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7305 // Since we bypassed the compiler's escape analysis, indicate that i 7306 // must live until the use above. 7307 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7308 return length, err 7309 } 7310 7311 // CopyIn implements marshal.Marshallable.CopyIn. 7312 func (i *IOSqRingOffsets) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7313 return i.CopyInN(cc, addr, i.SizeBytes()) 7314 } 7315 7316 // WriteTo implements io.WriterTo.WriteTo. 7317 func (i *IOSqRingOffsets) WriteTo(writer io.Writer) (int64, error) { 7318 // Construct a slice backed by dst's underlying memory. 7319 var buf []byte 7320 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7321 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7322 hdr.Len = i.SizeBytes() 7323 hdr.Cap = i.SizeBytes() 7324 7325 length, err := writer.Write(buf) 7326 // Since we bypassed the compiler's escape analysis, indicate that i 7327 // must live until the use above. 7328 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7329 return int64(length), err 7330 } 7331 7332 // SizeBytes implements marshal.Marshallable.SizeBytes. 7333 func (i *IOUring) SizeBytes() int { 7334 return 8 + 7335 1*60 + 7336 1*60 7337 } 7338 7339 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7340 func (i *IOUring) MarshalBytes(dst []byte) []byte { 7341 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Head)) 7342 dst = dst[4:] 7343 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 7344 dst = dst[1*(60):] 7345 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Tail)) 7346 dst = dst[4:] 7347 // Padding: dst[:sizeof(byte)*60] ~= [60]byte{0} 7348 dst = dst[1*(60):] 7349 return dst 7350 } 7351 7352 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7353 func (i *IOUring) UnmarshalBytes(src []byte) []byte { 7354 i.Head = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7355 src = src[4:] 7356 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 7357 src = src[1*(60):] 7358 i.Tail = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7359 src = src[4:] 7360 // Padding: ~ copy([60]byte(i._), src[:sizeof(byte)*60]) 7361 src = src[1*(60):] 7362 return src 7363 } 7364 7365 // Packed implements marshal.Marshallable.Packed. 7366 //go:nosplit 7367 func (i *IOUring) Packed() bool { 7368 return true 7369 } 7370 7371 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7372 func (i *IOUring) MarshalUnsafe(dst []byte) []byte { 7373 size := i.SizeBytes() 7374 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7375 return dst[size:] 7376 } 7377 7378 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7379 func (i *IOUring) UnmarshalUnsafe(src []byte) []byte { 7380 size := i.SizeBytes() 7381 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7382 return src[size:] 7383 } 7384 7385 // CopyOutN implements marshal.Marshallable.CopyOutN. 7386 func (i *IOUring) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7387 // Construct a slice backed by dst's underlying memory. 7388 var buf []byte 7389 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7390 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7391 hdr.Len = i.SizeBytes() 7392 hdr.Cap = i.SizeBytes() 7393 7394 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7395 // Since we bypassed the compiler's escape analysis, indicate that i 7396 // must live until the use above. 7397 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7398 return length, err 7399 } 7400 7401 // CopyOut implements marshal.Marshallable.CopyOut. 7402 func (i *IOUring) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7403 return i.CopyOutN(cc, addr, i.SizeBytes()) 7404 } 7405 7406 // CopyInN implements marshal.Marshallable.CopyInN. 7407 func (i *IOUring) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7408 // Construct a slice backed by dst's underlying memory. 7409 var buf []byte 7410 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7411 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7412 hdr.Len = i.SizeBytes() 7413 hdr.Cap = i.SizeBytes() 7414 7415 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7416 // Since we bypassed the compiler's escape analysis, indicate that i 7417 // must live until the use above. 7418 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7419 return length, err 7420 } 7421 7422 // CopyIn implements marshal.Marshallable.CopyIn. 7423 func (i *IOUring) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7424 return i.CopyInN(cc, addr, i.SizeBytes()) 7425 } 7426 7427 // WriteTo implements io.WriterTo.WriteTo. 7428 func (i *IOUring) WriteTo(writer io.Writer) (int64, error) { 7429 // Construct a slice backed by dst's underlying memory. 7430 var buf []byte 7431 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7432 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7433 hdr.Len = i.SizeBytes() 7434 hdr.Cap = i.SizeBytes() 7435 7436 length, err := writer.Write(buf) 7437 // Since we bypassed the compiler's escape analysis, indicate that i 7438 // must live until the use above. 7439 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7440 return int64(length), err 7441 } 7442 7443 // SizeBytes implements marshal.Marshallable.SizeBytes. 7444 func (i *IOUringCqe) SizeBytes() int { 7445 return 16 7446 } 7447 7448 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7449 func (i *IOUringCqe) MarshalBytes(dst []byte) []byte { 7450 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 7451 dst = dst[8:] 7452 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Res)) 7453 dst = dst[4:] 7454 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7455 dst = dst[4:] 7456 return dst 7457 } 7458 7459 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7460 func (i *IOUringCqe) UnmarshalBytes(src []byte) []byte { 7461 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7462 src = src[8:] 7463 i.Res = int32(hostarch.ByteOrder.Uint32(src[:4])) 7464 src = src[4:] 7465 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7466 src = src[4:] 7467 return src 7468 } 7469 7470 // Packed implements marshal.Marshallable.Packed. 7471 //go:nosplit 7472 func (i *IOUringCqe) Packed() bool { 7473 return true 7474 } 7475 7476 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7477 func (i *IOUringCqe) MarshalUnsafe(dst []byte) []byte { 7478 size := i.SizeBytes() 7479 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7480 return dst[size:] 7481 } 7482 7483 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7484 func (i *IOUringCqe) UnmarshalUnsafe(src []byte) []byte { 7485 size := i.SizeBytes() 7486 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7487 return src[size:] 7488 } 7489 7490 // CopyOutN implements marshal.Marshallable.CopyOutN. 7491 func (i *IOUringCqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7492 // Construct a slice backed by dst's underlying memory. 7493 var buf []byte 7494 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7495 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7496 hdr.Len = i.SizeBytes() 7497 hdr.Cap = i.SizeBytes() 7498 7499 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7500 // Since we bypassed the compiler's escape analysis, indicate that i 7501 // must live until the use above. 7502 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7503 return length, err 7504 } 7505 7506 // CopyOut implements marshal.Marshallable.CopyOut. 7507 func (i *IOUringCqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7508 return i.CopyOutN(cc, addr, i.SizeBytes()) 7509 } 7510 7511 // CopyInN implements marshal.Marshallable.CopyInN. 7512 func (i *IOUringCqe) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7513 // Construct a slice backed by dst's underlying memory. 7514 var buf []byte 7515 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7516 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7517 hdr.Len = i.SizeBytes() 7518 hdr.Cap = i.SizeBytes() 7519 7520 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7521 // Since we bypassed the compiler's escape analysis, indicate that i 7522 // must live until the use above. 7523 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7524 return length, err 7525 } 7526 7527 // CopyIn implements marshal.Marshallable.CopyIn. 7528 func (i *IOUringCqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7529 return i.CopyInN(cc, addr, i.SizeBytes()) 7530 } 7531 7532 // WriteTo implements io.WriterTo.WriteTo. 7533 func (i *IOUringCqe) WriteTo(writer io.Writer) (int64, error) { 7534 // Construct a slice backed by dst's underlying memory. 7535 var buf []byte 7536 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7537 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7538 hdr.Len = i.SizeBytes() 7539 hdr.Cap = i.SizeBytes() 7540 7541 length, err := writer.Write(buf) 7542 // Since we bypassed the compiler's escape analysis, indicate that i 7543 // must live until the use above. 7544 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7545 return int64(length), err 7546 } 7547 7548 // SizeBytes implements marshal.Marshallable.SizeBytes. 7549 func (i *IOUringParams) SizeBytes() int { 7550 return 28 + 7551 4*3 + 7552 (*IOSqRingOffsets)(nil).SizeBytes() + 7553 (*IOCqRingOffsets)(nil).SizeBytes() 7554 } 7555 7556 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7557 func (i *IOUringParams) MarshalBytes(dst []byte) []byte { 7558 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqEntries)) 7559 dst = dst[4:] 7560 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CqEntries)) 7561 dst = dst[4:] 7562 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 7563 dst = dst[4:] 7564 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadCPU)) 7565 dst = dst[4:] 7566 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SqThreadIdle)) 7567 dst = dst[4:] 7568 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Features)) 7569 dst = dst[4:] 7570 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.WqFd)) 7571 dst = dst[4:] 7572 for idx := 0; idx < 3; idx++ { 7573 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Resv[idx])) 7574 dst = dst[4:] 7575 } 7576 dst = i.SqOff.MarshalUnsafe(dst) 7577 dst = i.CqOff.MarshalUnsafe(dst) 7578 return dst 7579 } 7580 7581 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7582 func (i *IOUringParams) UnmarshalBytes(src []byte) []byte { 7583 i.SqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7584 src = src[4:] 7585 i.CqEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7586 src = src[4:] 7587 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7588 src = src[4:] 7589 i.SqThreadCPU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7590 src = src[4:] 7591 i.SqThreadIdle = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7592 src = src[4:] 7593 i.Features = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7594 src = src[4:] 7595 i.WqFd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7596 src = src[4:] 7597 for idx := 0; idx < 3; idx++ { 7598 i.Resv[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7599 src = src[4:] 7600 } 7601 src = i.SqOff.UnmarshalUnsafe(src) 7602 src = i.CqOff.UnmarshalUnsafe(src) 7603 return src 7604 } 7605 7606 // Packed implements marshal.Marshallable.Packed. 7607 //go:nosplit 7608 func (i *IOUringParams) Packed() bool { 7609 return i.CqOff.Packed() && i.SqOff.Packed() 7610 } 7611 7612 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7613 func (i *IOUringParams) MarshalUnsafe(dst []byte) []byte { 7614 if i.CqOff.Packed() && i.SqOff.Packed() { 7615 size := i.SizeBytes() 7616 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7617 return dst[size:] 7618 } 7619 // Type IOUringParams doesn't have a packed layout in memory, fallback to MarshalBytes. 7620 return i.MarshalBytes(dst) 7621 } 7622 7623 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7624 func (i *IOUringParams) UnmarshalUnsafe(src []byte) []byte { 7625 if i.CqOff.Packed() && i.SqOff.Packed() { 7626 size := i.SizeBytes() 7627 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7628 return src[size:] 7629 } 7630 // Type IOUringParams doesn't have a packed layout in memory, fallback to UnmarshalBytes. 7631 return i.UnmarshalBytes(src) 7632 } 7633 7634 // CopyOutN implements marshal.Marshallable.CopyOutN. 7635 func (i *IOUringParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7636 if !i.CqOff.Packed() && i.SqOff.Packed() { 7637 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7638 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7639 i.MarshalBytes(buf) // escapes: fallback. 7640 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7641 } 7642 7643 // Construct a slice backed by dst's underlying memory. 7644 var buf []byte 7645 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7646 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7647 hdr.Len = i.SizeBytes() 7648 hdr.Cap = i.SizeBytes() 7649 7650 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7651 // Since we bypassed the compiler's escape analysis, indicate that i 7652 // must live until the use above. 7653 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7654 return length, err 7655 } 7656 7657 // CopyOut implements marshal.Marshallable.CopyOut. 7658 func (i *IOUringParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7659 return i.CopyOutN(cc, addr, i.SizeBytes()) 7660 } 7661 7662 // CopyInN implements marshal.Marshallable.CopyInN. 7663 func (i *IOUringParams) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7664 if !i.CqOff.Packed() && i.SqOff.Packed() { 7665 // Type IOUringParams doesn't have a packed layout in memory, fall back to UnmarshalBytes. 7666 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 7667 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7668 // Unmarshal unconditionally. If we had a short copy-in, this results in a 7669 // partially unmarshalled struct. 7670 i.UnmarshalBytes(buf) // escapes: fallback. 7671 return length, err 7672 } 7673 7674 // Construct a slice backed by dst's underlying memory. 7675 var buf []byte 7676 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7677 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7678 hdr.Len = i.SizeBytes() 7679 hdr.Cap = i.SizeBytes() 7680 7681 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7682 // Since we bypassed the compiler's escape analysis, indicate that i 7683 // must live until the use above. 7684 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7685 return length, err 7686 } 7687 7688 // CopyIn implements marshal.Marshallable.CopyIn. 7689 func (i *IOUringParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7690 return i.CopyInN(cc, addr, i.SizeBytes()) 7691 } 7692 7693 // WriteTo implements io.WriterTo.WriteTo. 7694 func (i *IOUringParams) WriteTo(writer io.Writer) (int64, error) { 7695 if !i.CqOff.Packed() && i.SqOff.Packed() { 7696 // Type IOUringParams doesn't have a packed layout in memory, fall back to MarshalBytes. 7697 buf := make([]byte, i.SizeBytes()) 7698 i.MarshalBytes(buf) 7699 length, err := writer.Write(buf) 7700 return int64(length), err 7701 } 7702 7703 // Construct a slice backed by dst's underlying memory. 7704 var buf []byte 7705 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7706 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7707 hdr.Len = i.SizeBytes() 7708 hdr.Cap = i.SizeBytes() 7709 7710 length, err := writer.Write(buf) 7711 // Since we bypassed the compiler's escape analysis, indicate that i 7712 // must live until the use above. 7713 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7714 return int64(length), err 7715 } 7716 7717 // SizeBytes implements marshal.Marshallable.SizeBytes. 7718 func (i *IOUringSqe) SizeBytes() int { 7719 return 64 7720 } 7721 7722 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7723 func (i *IOUringSqe) MarshalBytes(dst []byte) []byte { 7724 dst[0] = byte(i.Opcode) 7725 dst = dst[1:] 7726 dst[0] = byte(i.Flags) 7727 dst = dst[1:] 7728 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.IoPrio)) 7729 dst = dst[2:] 7730 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Fd)) 7731 dst = dst[4:] 7732 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.OffOrAddrOrCmdOp)) 7733 dst = dst[8:] 7734 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.AddrOrSpliceOff)) 7735 dst = dst[8:] 7736 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 7737 dst = dst[4:] 7738 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.specialFlags)) 7739 dst = dst[4:] 7740 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.UserData)) 7741 dst = dst[8:] 7742 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.BufIndexOrGroup)) 7743 dst = dst[2:] 7744 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.personality)) 7745 dst = dst[2:] 7746 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.spliceFDOrFileIndex)) 7747 dst = dst[4:] 7748 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.addr3)) 7749 dst = dst[8:] 7750 // Padding: dst[:sizeof(uint64)] ~= uint64(0) 7751 dst = dst[8:] 7752 return dst 7753 } 7754 7755 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7756 func (i *IOUringSqe) UnmarshalBytes(src []byte) []byte { 7757 i.Opcode = uint8(src[0]) 7758 src = src[1:] 7759 i.Flags = uint8(src[0]) 7760 src = src[1:] 7761 i.IoPrio = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7762 src = src[2:] 7763 i.Fd = int32(hostarch.ByteOrder.Uint32(src[:4])) 7764 src = src[4:] 7765 i.OffOrAddrOrCmdOp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7766 src = src[8:] 7767 i.AddrOrSpliceOff = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7768 src = src[8:] 7769 i.Len = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7770 src = src[4:] 7771 i.specialFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7772 src = src[4:] 7773 i.UserData = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7774 src = src[8:] 7775 i.BufIndexOrGroup = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7776 src = src[2:] 7777 i.personality = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7778 src = src[2:] 7779 i.spliceFDOrFileIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 7780 src = src[4:] 7781 i.addr3 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7782 src = src[8:] 7783 // Padding: var _ uint64 ~= src[:sizeof(uint64)] 7784 src = src[8:] 7785 return src 7786 } 7787 7788 // Packed implements marshal.Marshallable.Packed. 7789 //go:nosplit 7790 func (i *IOUringSqe) Packed() bool { 7791 return true 7792 } 7793 7794 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7795 func (i *IOUringSqe) MarshalUnsafe(dst []byte) []byte { 7796 size := i.SizeBytes() 7797 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7798 return dst[size:] 7799 } 7800 7801 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7802 func (i *IOUringSqe) UnmarshalUnsafe(src []byte) []byte { 7803 size := i.SizeBytes() 7804 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7805 return src[size:] 7806 } 7807 7808 // CopyOutN implements marshal.Marshallable.CopyOutN. 7809 func (i *IOUringSqe) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, 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(i))) 7814 hdr.Len = i.SizeBytes() 7815 hdr.Cap = i.SizeBytes() 7816 7817 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7818 // Since we bypassed the compiler's escape analysis, indicate that i 7819 // must live until the use above. 7820 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7821 return length, err 7822 } 7823 7824 // CopyOut implements marshal.Marshallable.CopyOut. 7825 func (i *IOUringSqe) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7826 return i.CopyOutN(cc, addr, i.SizeBytes()) 7827 } 7828 7829 // CopyInN implements marshal.Marshallable.CopyInN. 7830 func (i *IOUringSqe) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7831 // Construct a slice backed by dst's underlying memory. 7832 var buf []byte 7833 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7834 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7835 hdr.Len = i.SizeBytes() 7836 hdr.Cap = i.SizeBytes() 7837 7838 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7839 // Since we bypassed the compiler's escape analysis, indicate that i 7840 // must live until the use above. 7841 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7842 return length, err 7843 } 7844 7845 // CopyIn implements marshal.Marshallable.CopyIn. 7846 func (i *IOUringSqe) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7847 return i.CopyInN(cc, addr, i.SizeBytes()) 7848 } 7849 7850 // WriteTo implements io.WriterTo.WriteTo. 7851 func (i *IOUringSqe) WriteTo(writer io.Writer) (int64, error) { 7852 // Construct a slice backed by dst's underlying memory. 7853 var buf []byte 7854 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7855 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7856 hdr.Len = i.SizeBytes() 7857 hdr.Cap = i.SizeBytes() 7858 7859 length, err := writer.Write(buf) 7860 // Since we bypassed the compiler's escape analysis, indicate that i 7861 // must live until the use above. 7862 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7863 return int64(length), err 7864 } 7865 7866 // SizeBytes implements marshal.Marshallable.SizeBytes. 7867 func (i *IPCPerm) SizeBytes() int { 7868 return 48 7869 } 7870 7871 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 7872 func (i *IPCPerm) MarshalBytes(dst []byte) []byte { 7873 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Key)) 7874 dst = dst[4:] 7875 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 7876 dst = dst[4:] 7877 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 7878 dst = dst[4:] 7879 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CUID)) 7880 dst = dst[4:] 7881 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.CGID)) 7882 dst = dst[4:] 7883 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Mode)) 7884 dst = dst[2:] 7885 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7886 dst = dst[2:] 7887 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Seq)) 7888 dst = dst[2:] 7889 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 7890 dst = dst[2:] 7891 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 7892 dst = dst[4:] 7893 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused1)) 7894 dst = dst[8:] 7895 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.unused2)) 7896 dst = dst[8:] 7897 return dst 7898 } 7899 7900 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 7901 func (i *IPCPerm) UnmarshalBytes(src []byte) []byte { 7902 i.Key = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7903 src = src[4:] 7904 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7905 src = src[4:] 7906 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7907 src = src[4:] 7908 i.CUID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7909 src = src[4:] 7910 i.CGID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 7911 src = src[4:] 7912 i.Mode = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7913 src = src[2:] 7914 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7915 src = src[2:] 7916 i.Seq = uint16(hostarch.ByteOrder.Uint16(src[:2])) 7917 src = src[2:] 7918 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 7919 src = src[2:] 7920 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 7921 src = src[4:] 7922 i.unused1 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7923 src = src[8:] 7924 i.unused2 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 7925 src = src[8:] 7926 return src 7927 } 7928 7929 // Packed implements marshal.Marshallable.Packed. 7930 //go:nosplit 7931 func (i *IPCPerm) Packed() bool { 7932 return true 7933 } 7934 7935 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 7936 func (i *IPCPerm) MarshalUnsafe(dst []byte) []byte { 7937 size := i.SizeBytes() 7938 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 7939 return dst[size:] 7940 } 7941 7942 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 7943 func (i *IPCPerm) UnmarshalUnsafe(src []byte) []byte { 7944 size := i.SizeBytes() 7945 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 7946 return src[size:] 7947 } 7948 7949 // CopyOutN implements marshal.Marshallable.CopyOutN. 7950 func (i *IPCPerm) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7951 // Construct a slice backed by dst's underlying memory. 7952 var buf []byte 7953 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7954 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7955 hdr.Len = i.SizeBytes() 7956 hdr.Cap = i.SizeBytes() 7957 7958 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 7959 // Since we bypassed the compiler's escape analysis, indicate that i 7960 // must live until the use above. 7961 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7962 return length, err 7963 } 7964 7965 // CopyOut implements marshal.Marshallable.CopyOut. 7966 func (i *IPCPerm) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7967 return i.CopyOutN(cc, addr, i.SizeBytes()) 7968 } 7969 7970 // CopyInN implements marshal.Marshallable.CopyInN. 7971 func (i *IPCPerm) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 7972 // Construct a slice backed by dst's underlying memory. 7973 var buf []byte 7974 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7975 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7976 hdr.Len = i.SizeBytes() 7977 hdr.Cap = i.SizeBytes() 7978 7979 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 7980 // Since we bypassed the compiler's escape analysis, indicate that i 7981 // must live until the use above. 7982 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 7983 return length, err 7984 } 7985 7986 // CopyIn implements marshal.Marshallable.CopyIn. 7987 func (i *IPCPerm) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 7988 return i.CopyInN(cc, addr, i.SizeBytes()) 7989 } 7990 7991 // WriteTo implements io.WriterTo.WriteTo. 7992 func (i *IPCPerm) WriteTo(writer io.Writer) (int64, error) { 7993 // Construct a slice backed by dst's underlying memory. 7994 var buf []byte 7995 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 7996 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 7997 hdr.Len = i.SizeBytes() 7998 hdr.Cap = i.SizeBytes() 7999 8000 length, err := writer.Write(buf) 8001 // Since we bypassed the compiler's escape analysis, indicate that i 8002 // must live until the use above. 8003 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 8004 return int64(length), err 8005 } 8006 8007 // SizeBytes implements marshal.Marshallable.SizeBytes. 8008 func (s *Sysinfo) SizeBytes() int { 8009 return 78 + 8010 8*3 + 8011 1*6 8012 } 8013 8014 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8015 func (s *Sysinfo) MarshalBytes(dst []byte) []byte { 8016 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Uptime)) 8017 dst = dst[8:] 8018 for idx := 0; idx < 3; idx++ { 8019 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Loads[idx])) 8020 dst = dst[8:] 8021 } 8022 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalRAM)) 8023 dst = dst[8:] 8024 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeRAM)) 8025 dst = dst[8:] 8026 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SharedRAM)) 8027 dst = dst[8:] 8028 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BufferRAM)) 8029 dst = dst[8:] 8030 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalSwap)) 8031 dst = dst[8:] 8032 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeSwap)) 8033 dst = dst[8:] 8034 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Procs)) 8035 dst = dst[2:] 8036 // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0} 8037 dst = dst[1*(6):] 8038 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.TotalHigh)) 8039 dst = dst[8:] 8040 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FreeHigh)) 8041 dst = dst[8:] 8042 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Unit)) 8043 dst = dst[4:] 8044 return dst 8045 } 8046 8047 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8048 func (s *Sysinfo) UnmarshalBytes(src []byte) []byte { 8049 s.Uptime = int64(hostarch.ByteOrder.Uint64(src[:8])) 8050 src = src[8:] 8051 for idx := 0; idx < 3; idx++ { 8052 s.Loads[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8053 src = src[8:] 8054 } 8055 s.TotalRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8056 src = src[8:] 8057 s.FreeRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8058 src = src[8:] 8059 s.SharedRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8060 src = src[8:] 8061 s.BufferRAM = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8062 src = src[8:] 8063 s.TotalSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8064 src = src[8:] 8065 s.FreeSwap = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8066 src = src[8:] 8067 s.Procs = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8068 src = src[2:] 8069 // Padding: ~ copy([6]byte(s._), src[:sizeof(byte)*6]) 8070 src = src[1*(6):] 8071 s.TotalHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8072 src = src[8:] 8073 s.FreeHigh = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8074 src = src[8:] 8075 s.Unit = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8076 src = src[4:] 8077 return src 8078 } 8079 8080 // Packed implements marshal.Marshallable.Packed. 8081 //go:nosplit 8082 func (s *Sysinfo) Packed() bool { 8083 return false 8084 } 8085 8086 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8087 func (s *Sysinfo) MarshalUnsafe(dst []byte) []byte { 8088 // Type Sysinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 8089 return s.MarshalBytes(dst) 8090 } 8091 8092 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8093 func (s *Sysinfo) UnmarshalUnsafe(src []byte) []byte { 8094 // Type Sysinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8095 return s.UnmarshalBytes(src) 8096 } 8097 8098 // CopyOutN implements marshal.Marshallable.CopyOutN. 8099 func (s *Sysinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8100 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8101 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 8102 s.MarshalBytes(buf) // escapes: fallback. 8103 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8104 } 8105 8106 // CopyOut implements marshal.Marshallable.CopyOut. 8107 func (s *Sysinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8108 return s.CopyOutN(cc, addr, s.SizeBytes()) 8109 } 8110 8111 // CopyInN implements marshal.Marshallable.CopyInN. 8112 func (s *Sysinfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8113 // Type Sysinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8114 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 8115 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8116 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8117 // partially unmarshalled struct. 8118 s.UnmarshalBytes(buf) // escapes: fallback. 8119 return length, err 8120 } 8121 8122 // CopyIn implements marshal.Marshallable.CopyIn. 8123 func (s *Sysinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8124 return s.CopyInN(cc, addr, s.SizeBytes()) 8125 } 8126 8127 // WriteTo implements io.WriterTo.WriteTo. 8128 func (s *Sysinfo) WriteTo(writer io.Writer) (int64, error) { 8129 // Type Sysinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8130 buf := make([]byte, s.SizeBytes()) 8131 s.MarshalBytes(buf) 8132 length, err := writer.Write(buf) 8133 return int64(length), err 8134 } 8135 8136 // SizeBytes implements marshal.Marshallable.SizeBytes. 8137 //go:nosplit 8138 func (n *NumaPolicy) SizeBytes() int { 8139 return 4 8140 } 8141 8142 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8143 func (n *NumaPolicy) MarshalBytes(dst []byte) []byte { 8144 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*n)) 8145 return dst[4:] 8146 } 8147 8148 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8149 func (n *NumaPolicy) UnmarshalBytes(src []byte) []byte { 8150 *n = NumaPolicy(int32(hostarch.ByteOrder.Uint32(src[:4]))) 8151 return src[4:] 8152 } 8153 8154 // Packed implements marshal.Marshallable.Packed. 8155 //go:nosplit 8156 func (n *NumaPolicy) Packed() bool { 8157 // Scalar newtypes are always packed. 8158 return true 8159 } 8160 8161 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8162 func (n *NumaPolicy) MarshalUnsafe(dst []byte) []byte { 8163 size := n.SizeBytes() 8164 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 8165 return dst[size:] 8166 } 8167 8168 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8169 func (n *NumaPolicy) UnmarshalUnsafe(src []byte) []byte { 8170 size := n.SizeBytes() 8171 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 8172 return src[size:] 8173 } 8174 8175 // CopyOutN implements marshal.Marshallable.CopyOutN. 8176 func (n *NumaPolicy) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8177 // Construct a slice backed by dst's underlying memory. 8178 var buf []byte 8179 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8180 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8181 hdr.Len = n.SizeBytes() 8182 hdr.Cap = n.SizeBytes() 8183 8184 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8185 // Since we bypassed the compiler's escape analysis, indicate that n 8186 // must live until the use above. 8187 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8188 return length, err 8189 } 8190 8191 // CopyOut implements marshal.Marshallable.CopyOut. 8192 func (n *NumaPolicy) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8193 return n.CopyOutN(cc, addr, n.SizeBytes()) 8194 } 8195 8196 // CopyInN implements marshal.Marshallable.CopyInN. 8197 func (n *NumaPolicy) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8198 // Construct a slice backed by dst's underlying memory. 8199 var buf []byte 8200 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8201 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8202 hdr.Len = n.SizeBytes() 8203 hdr.Cap = n.SizeBytes() 8204 8205 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8206 // Since we bypassed the compiler's escape analysis, indicate that n 8207 // must live until the use above. 8208 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8209 return length, err 8210 } 8211 8212 // CopyIn implements marshal.Marshallable.CopyIn. 8213 func (n *NumaPolicy) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8214 return n.CopyInN(cc, addr, n.SizeBytes()) 8215 } 8216 8217 // WriteTo implements io.WriterTo.WriteTo. 8218 func (n *NumaPolicy) WriteTo(writer io.Writer) (int64, error) { 8219 // Construct a slice backed by dst's underlying memory. 8220 var buf []byte 8221 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8222 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 8223 hdr.Len = n.SizeBytes() 8224 hdr.Cap = n.SizeBytes() 8225 8226 length, err := writer.Write(buf) 8227 // Since we bypassed the compiler's escape analysis, indicate that n 8228 // must live until the use above. 8229 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 8230 return int64(length), err 8231 } 8232 8233 // SizeBytes implements marshal.Marshallable.SizeBytes. 8234 func (m *MqAttr) SizeBytes() int { 8235 return 32 + 8236 8*4 8237 } 8238 8239 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8240 func (m *MqAttr) MarshalBytes(dst []byte) []byte { 8241 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqFlags)) 8242 dst = dst[8:] 8243 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMaxmsg)) 8244 dst = dst[8:] 8245 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqMsgsize)) 8246 dst = dst[8:] 8247 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MqCurmsgs)) 8248 dst = dst[8:] 8249 // Padding: dst[:sizeof(int64)*4] ~= [4]int64{0} 8250 dst = dst[8*(4):] 8251 return dst 8252 } 8253 8254 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8255 func (m *MqAttr) UnmarshalBytes(src []byte) []byte { 8256 m.MqFlags = int64(hostarch.ByteOrder.Uint64(src[:8])) 8257 src = src[8:] 8258 m.MqMaxmsg = int64(hostarch.ByteOrder.Uint64(src[:8])) 8259 src = src[8:] 8260 m.MqMsgsize = int64(hostarch.ByteOrder.Uint64(src[:8])) 8261 src = src[8:] 8262 m.MqCurmsgs = int64(hostarch.ByteOrder.Uint64(src[:8])) 8263 src = src[8:] 8264 // Padding: ~ copy([4]int64(m._), src[:sizeof(int64)*4]) 8265 src = src[8*(4):] 8266 return src 8267 } 8268 8269 // Packed implements marshal.Marshallable.Packed. 8270 //go:nosplit 8271 func (m *MqAttr) Packed() bool { 8272 return true 8273 } 8274 8275 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8276 func (m *MqAttr) MarshalUnsafe(dst []byte) []byte { 8277 size := m.SizeBytes() 8278 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 8279 return dst[size:] 8280 } 8281 8282 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8283 func (m *MqAttr) UnmarshalUnsafe(src []byte) []byte { 8284 size := m.SizeBytes() 8285 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 8286 return src[size:] 8287 } 8288 8289 // CopyOutN implements marshal.Marshallable.CopyOutN. 8290 func (m *MqAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8291 // Construct a slice backed by dst's underlying memory. 8292 var buf []byte 8293 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8294 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8295 hdr.Len = m.SizeBytes() 8296 hdr.Cap = m.SizeBytes() 8297 8298 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8299 // Since we bypassed the compiler's escape analysis, indicate that m 8300 // must live until the use above. 8301 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8302 return length, err 8303 } 8304 8305 // CopyOut implements marshal.Marshallable.CopyOut. 8306 func (m *MqAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8307 return m.CopyOutN(cc, addr, m.SizeBytes()) 8308 } 8309 8310 // CopyInN implements marshal.Marshallable.CopyInN. 8311 func (m *MqAttr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8312 // Construct a slice backed by dst's underlying memory. 8313 var buf []byte 8314 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8315 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8316 hdr.Len = m.SizeBytes() 8317 hdr.Cap = m.SizeBytes() 8318 8319 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8320 // Since we bypassed the compiler's escape analysis, indicate that m 8321 // must live until the use above. 8322 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8323 return length, err 8324 } 8325 8326 // CopyIn implements marshal.Marshallable.CopyIn. 8327 func (m *MqAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8328 return m.CopyInN(cc, addr, m.SizeBytes()) 8329 } 8330 8331 // WriteTo implements io.WriterTo.WriteTo. 8332 func (m *MqAttr) WriteTo(writer io.Writer) (int64, error) { 8333 // Construct a slice backed by dst's underlying memory. 8334 var buf []byte 8335 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8336 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8337 hdr.Len = m.SizeBytes() 8338 hdr.Cap = m.SizeBytes() 8339 8340 length, err := writer.Write(buf) 8341 // Since we bypassed the compiler's escape analysis, indicate that m 8342 // must live until the use above. 8343 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8344 return int64(length), err 8345 } 8346 8347 // Packed implements marshal.Marshallable.Packed. 8348 //go:nosplit 8349 func (b *MsgBuf) Packed() bool { 8350 // Type MsgBuf is dynamic so it might have slice/string headers. Hence, it is not packed. 8351 return false 8352 } 8353 8354 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8355 func (b *MsgBuf) MarshalUnsafe(dst []byte) []byte { 8356 // Type MsgBuf doesn't have a packed layout in memory, fallback to MarshalBytes. 8357 return b.MarshalBytes(dst) 8358 } 8359 8360 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8361 func (b *MsgBuf) UnmarshalUnsafe(src []byte) []byte { 8362 // Type MsgBuf doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8363 return b.UnmarshalBytes(src) 8364 } 8365 8366 // CopyOutN implements marshal.Marshallable.CopyOutN. 8367 //go:nosplit 8368 func (b *MsgBuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8369 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 8370 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 8371 b.MarshalBytes(buf) // escapes: fallback. 8372 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8373 } 8374 8375 // CopyOut implements marshal.Marshallable.CopyOut. 8376 func (b *MsgBuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8377 return b.CopyOutN(cc, addr, b.SizeBytes()) 8378 } 8379 8380 // CopyInN implements marshal.Marshallable.CopyInN. 8381 //go:nosplit 8382 func (b *MsgBuf) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8383 // Type MsgBuf doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8384 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 8385 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 8386 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8387 // partially unmarshalled struct. 8388 b.UnmarshalBytes(buf) // escapes: fallback. 8389 return length, err 8390 } 8391 8392 // CopyIn implements marshal.Marshallable.CopyIn. 8393 func (b *MsgBuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8394 return b.CopyInN(cc, addr, b.SizeBytes()) 8395 } 8396 8397 // WriteTo implements io.WriterTo.WriteTo. 8398 func (b *MsgBuf) WriteTo(writer io.Writer) (int64, error) { 8399 // Type MsgBuf doesn't have a packed layout in memory, fall back to MarshalBytes. 8400 buf := make([]byte, b.SizeBytes()) 8401 b.MarshalBytes(buf) 8402 length, err := writer.Write(buf) 8403 return int64(length), err 8404 } 8405 8406 // SizeBytes implements marshal.Marshallable.SizeBytes. 8407 func (m *MsgInfo) SizeBytes() int { 8408 return 30 8409 } 8410 8411 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8412 func (m *MsgInfo) MarshalBytes(dst []byte) []byte { 8413 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgPool)) 8414 dst = dst[4:] 8415 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMap)) 8416 dst = dst[4:] 8417 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMax)) 8418 dst = dst[4:] 8419 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMnb)) 8420 dst = dst[4:] 8421 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgMni)) 8422 dst = dst[4:] 8423 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgSsz)) 8424 dst = dst[4:] 8425 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgTql)) 8426 dst = dst[4:] 8427 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.MsgSeg)) 8428 dst = dst[2:] 8429 return dst 8430 } 8431 8432 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8433 func (m *MsgInfo) UnmarshalBytes(src []byte) []byte { 8434 m.MsgPool = int32(hostarch.ByteOrder.Uint32(src[:4])) 8435 src = src[4:] 8436 m.MsgMap = int32(hostarch.ByteOrder.Uint32(src[:4])) 8437 src = src[4:] 8438 m.MsgMax = int32(hostarch.ByteOrder.Uint32(src[:4])) 8439 src = src[4:] 8440 m.MsgMnb = int32(hostarch.ByteOrder.Uint32(src[:4])) 8441 src = src[4:] 8442 m.MsgMni = int32(hostarch.ByteOrder.Uint32(src[:4])) 8443 src = src[4:] 8444 m.MsgSsz = int32(hostarch.ByteOrder.Uint32(src[:4])) 8445 src = src[4:] 8446 m.MsgTql = int32(hostarch.ByteOrder.Uint32(src[:4])) 8447 src = src[4:] 8448 m.MsgSeg = uint16(hostarch.ByteOrder.Uint16(src[:2])) 8449 src = src[2:] 8450 return src 8451 } 8452 8453 // Packed implements marshal.Marshallable.Packed. 8454 //go:nosplit 8455 func (m *MsgInfo) Packed() bool { 8456 return false 8457 } 8458 8459 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8460 func (m *MsgInfo) MarshalUnsafe(dst []byte) []byte { 8461 // Type MsgInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 8462 return m.MarshalBytes(dst) 8463 } 8464 8465 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8466 func (m *MsgInfo) UnmarshalUnsafe(src []byte) []byte { 8467 // Type MsgInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8468 return m.UnmarshalBytes(src) 8469 } 8470 8471 // CopyOutN implements marshal.Marshallable.CopyOutN. 8472 func (m *MsgInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8473 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8474 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8475 m.MarshalBytes(buf) // escapes: fallback. 8476 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8477 } 8478 8479 // CopyOut implements marshal.Marshallable.CopyOut. 8480 func (m *MsgInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8481 return m.CopyOutN(cc, addr, m.SizeBytes()) 8482 } 8483 8484 // CopyInN implements marshal.Marshallable.CopyInN. 8485 func (m *MsgInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8486 // Type MsgInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8487 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8488 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8489 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8490 // partially unmarshalled struct. 8491 m.UnmarshalBytes(buf) // escapes: fallback. 8492 return length, err 8493 } 8494 8495 // CopyIn implements marshal.Marshallable.CopyIn. 8496 func (m *MsgInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8497 return m.CopyInN(cc, addr, m.SizeBytes()) 8498 } 8499 8500 // WriteTo implements io.WriterTo.WriteTo. 8501 func (m *MsgInfo) WriteTo(writer io.Writer) (int64, error) { 8502 // Type MsgInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 8503 buf := make([]byte, m.SizeBytes()) 8504 m.MarshalBytes(buf) 8505 length, err := writer.Write(buf) 8506 return int64(length), err 8507 } 8508 8509 // SizeBytes implements marshal.Marshallable.SizeBytes. 8510 func (m *MsqidDS) SizeBytes() int { 8511 return 48 + 8512 (*IPCPerm)(nil).SizeBytes() + 8513 (*TimeT)(nil).SizeBytes() + 8514 (*TimeT)(nil).SizeBytes() + 8515 (*TimeT)(nil).SizeBytes() 8516 } 8517 8518 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8519 func (m *MsqidDS) MarshalBytes(dst []byte) []byte { 8520 dst = m.MsgPerm.MarshalUnsafe(dst) 8521 dst = m.MsgStime.MarshalUnsafe(dst) 8522 dst = m.MsgRtime.MarshalUnsafe(dst) 8523 dst = m.MsgCtime.MarshalUnsafe(dst) 8524 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgCbytes)) 8525 dst = dst[8:] 8526 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQnum)) 8527 dst = dst[8:] 8528 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.MsgQbytes)) 8529 dst = dst[8:] 8530 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLspid)) 8531 dst = dst[4:] 8532 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.MsgLrpid)) 8533 dst = dst[4:] 8534 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused4)) 8535 dst = dst[8:] 8536 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.unused5)) 8537 dst = dst[8:] 8538 return dst 8539 } 8540 8541 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8542 func (m *MsqidDS) UnmarshalBytes(src []byte) []byte { 8543 src = m.MsgPerm.UnmarshalUnsafe(src) 8544 src = m.MsgStime.UnmarshalUnsafe(src) 8545 src = m.MsgRtime.UnmarshalUnsafe(src) 8546 src = m.MsgCtime.UnmarshalUnsafe(src) 8547 m.MsgCbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8548 src = src[8:] 8549 m.MsgQnum = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8550 src = src[8:] 8551 m.MsgQbytes = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8552 src = src[8:] 8553 m.MsgLspid = int32(hostarch.ByteOrder.Uint32(src[:4])) 8554 src = src[4:] 8555 m.MsgLrpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 8556 src = src[4:] 8557 m.unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8558 src = src[8:] 8559 m.unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 8560 src = src[8:] 8561 return src 8562 } 8563 8564 // Packed implements marshal.Marshallable.Packed. 8565 //go:nosplit 8566 func (m *MsqidDS) Packed() bool { 8567 return m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() 8568 } 8569 8570 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8571 func (m *MsqidDS) MarshalUnsafe(dst []byte) []byte { 8572 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8573 size := m.SizeBytes() 8574 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 8575 return dst[size:] 8576 } 8577 // Type MsqidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 8578 return m.MarshalBytes(dst) 8579 } 8580 8581 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8582 func (m *MsqidDS) UnmarshalUnsafe(src []byte) []byte { 8583 if m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8584 size := m.SizeBytes() 8585 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 8586 return src[size:] 8587 } 8588 // Type MsqidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 8589 return m.UnmarshalBytes(src) 8590 } 8591 8592 // CopyOutN implements marshal.Marshallable.CopyOutN. 8593 func (m *MsqidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8594 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8595 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8596 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8597 m.MarshalBytes(buf) // escapes: fallback. 8598 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8599 } 8600 8601 // Construct a slice backed by dst's underlying memory. 8602 var buf []byte 8603 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8604 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8605 hdr.Len = m.SizeBytes() 8606 hdr.Cap = m.SizeBytes() 8607 8608 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8609 // Since we bypassed the compiler's escape analysis, indicate that m 8610 // must live until the use above. 8611 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8612 return length, err 8613 } 8614 8615 // CopyOut implements marshal.Marshallable.CopyOut. 8616 func (m *MsqidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8617 return m.CopyOutN(cc, addr, m.SizeBytes()) 8618 } 8619 8620 // CopyInN implements marshal.Marshallable.CopyInN. 8621 func (m *MsqidDS) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8622 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8623 // Type MsqidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 8624 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 8625 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8626 // Unmarshal unconditionally. If we had a short copy-in, this results in a 8627 // partially unmarshalled struct. 8628 m.UnmarshalBytes(buf) // escapes: fallback. 8629 return length, err 8630 } 8631 8632 // Construct a slice backed by dst's underlying memory. 8633 var buf []byte 8634 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8635 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8636 hdr.Len = m.SizeBytes() 8637 hdr.Cap = m.SizeBytes() 8638 8639 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8640 // Since we bypassed the compiler's escape analysis, indicate that m 8641 // must live until the use above. 8642 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8643 return length, err 8644 } 8645 8646 // CopyIn implements marshal.Marshallable.CopyIn. 8647 func (m *MsqidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8648 return m.CopyInN(cc, addr, m.SizeBytes()) 8649 } 8650 8651 // WriteTo implements io.WriterTo.WriteTo. 8652 func (m *MsqidDS) WriteTo(writer io.Writer) (int64, error) { 8653 if !m.MsgCtime.Packed() && m.MsgPerm.Packed() && m.MsgRtime.Packed() && m.MsgStime.Packed() { 8654 // Type MsqidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 8655 buf := make([]byte, m.SizeBytes()) 8656 m.MarshalBytes(buf) 8657 length, err := writer.Write(buf) 8658 return int64(length), err 8659 } 8660 8661 // Construct a slice backed by dst's underlying memory. 8662 var buf []byte 8663 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8664 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 8665 hdr.Len = m.SizeBytes() 8666 hdr.Cap = m.SizeBytes() 8667 8668 length, err := writer.Write(buf) 8669 // Since we bypassed the compiler's escape analysis, indicate that m 8670 // must live until the use above. 8671 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 8672 return int64(length), err 8673 } 8674 8675 // SizeBytes implements marshal.Marshallable.SizeBytes. 8676 //go:nosplit 8677 func (e *EthtoolCmd) SizeBytes() int { 8678 return 4 8679 } 8680 8681 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8682 func (e *EthtoolCmd) MarshalBytes(dst []byte) []byte { 8683 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*e)) 8684 return dst[4:] 8685 } 8686 8687 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8688 func (e *EthtoolCmd) UnmarshalBytes(src []byte) []byte { 8689 *e = EthtoolCmd(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 8690 return src[4:] 8691 } 8692 8693 // Packed implements marshal.Marshallable.Packed. 8694 //go:nosplit 8695 func (e *EthtoolCmd) Packed() bool { 8696 // Scalar newtypes are always packed. 8697 return true 8698 } 8699 8700 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8701 func (e *EthtoolCmd) MarshalUnsafe(dst []byte) []byte { 8702 size := e.SizeBytes() 8703 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8704 return dst[size:] 8705 } 8706 8707 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8708 func (e *EthtoolCmd) UnmarshalUnsafe(src []byte) []byte { 8709 size := e.SizeBytes() 8710 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8711 return src[size:] 8712 } 8713 8714 // CopyOutN implements marshal.Marshallable.CopyOutN. 8715 func (e *EthtoolCmd) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8716 // Construct a slice backed by dst's underlying memory. 8717 var buf []byte 8718 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8719 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8720 hdr.Len = e.SizeBytes() 8721 hdr.Cap = e.SizeBytes() 8722 8723 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8724 // Since we bypassed the compiler's escape analysis, indicate that e 8725 // must live until the use above. 8726 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8727 return length, err 8728 } 8729 8730 // CopyOut implements marshal.Marshallable.CopyOut. 8731 func (e *EthtoolCmd) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8732 return e.CopyOutN(cc, addr, e.SizeBytes()) 8733 } 8734 8735 // CopyInN implements marshal.Marshallable.CopyInN. 8736 func (e *EthtoolCmd) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8737 // Construct a slice backed by dst's underlying memory. 8738 var buf []byte 8739 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8740 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8741 hdr.Len = e.SizeBytes() 8742 hdr.Cap = e.SizeBytes() 8743 8744 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8745 // Since we bypassed the compiler's escape analysis, indicate that e 8746 // must live until the use above. 8747 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8748 return length, err 8749 } 8750 8751 // CopyIn implements marshal.Marshallable.CopyIn. 8752 func (e *EthtoolCmd) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8753 return e.CopyInN(cc, addr, e.SizeBytes()) 8754 } 8755 8756 // WriteTo implements io.WriterTo.WriteTo. 8757 func (e *EthtoolCmd) WriteTo(writer io.Writer) (int64, error) { 8758 // Construct a slice backed by dst's underlying memory. 8759 var buf []byte 8760 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8761 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8762 hdr.Len = e.SizeBytes() 8763 hdr.Cap = e.SizeBytes() 8764 8765 length, err := writer.Write(buf) 8766 // Since we bypassed the compiler's escape analysis, indicate that e 8767 // must live until the use above. 8768 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8769 return int64(length), err 8770 } 8771 8772 // SizeBytes implements marshal.Marshallable.SizeBytes. 8773 func (e *EthtoolGFeatures) SizeBytes() int { 8774 return 8 8775 } 8776 8777 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8778 func (e *EthtoolGFeatures) MarshalBytes(dst []byte) []byte { 8779 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Cmd)) 8780 dst = dst[4:] 8781 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Size)) 8782 dst = dst[4:] 8783 return dst 8784 } 8785 8786 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8787 func (e *EthtoolGFeatures) UnmarshalBytes(src []byte) []byte { 8788 e.Cmd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8789 src = src[4:] 8790 e.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8791 src = src[4:] 8792 return src 8793 } 8794 8795 // Packed implements marshal.Marshallable.Packed. 8796 //go:nosplit 8797 func (e *EthtoolGFeatures) Packed() bool { 8798 return true 8799 } 8800 8801 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8802 func (e *EthtoolGFeatures) MarshalUnsafe(dst []byte) []byte { 8803 size := e.SizeBytes() 8804 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8805 return dst[size:] 8806 } 8807 8808 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8809 func (e *EthtoolGFeatures) UnmarshalUnsafe(src []byte) []byte { 8810 size := e.SizeBytes() 8811 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8812 return src[size:] 8813 } 8814 8815 // CopyOutN implements marshal.Marshallable.CopyOutN. 8816 func (e *EthtoolGFeatures) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8817 // Construct a slice backed by dst's underlying memory. 8818 var buf []byte 8819 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8820 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8821 hdr.Len = e.SizeBytes() 8822 hdr.Cap = e.SizeBytes() 8823 8824 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8825 // Since we bypassed the compiler's escape analysis, indicate that e 8826 // must live until the use above. 8827 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8828 return length, err 8829 } 8830 8831 // CopyOut implements marshal.Marshallable.CopyOut. 8832 func (e *EthtoolGFeatures) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8833 return e.CopyOutN(cc, addr, e.SizeBytes()) 8834 } 8835 8836 // CopyInN implements marshal.Marshallable.CopyInN. 8837 func (e *EthtoolGFeatures) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8838 // Construct a slice backed by dst's underlying memory. 8839 var buf []byte 8840 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8841 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8842 hdr.Len = e.SizeBytes() 8843 hdr.Cap = e.SizeBytes() 8844 8845 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8846 // Since we bypassed the compiler's escape analysis, indicate that e 8847 // must live until the use above. 8848 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8849 return length, err 8850 } 8851 8852 // CopyIn implements marshal.Marshallable.CopyIn. 8853 func (e *EthtoolGFeatures) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8854 return e.CopyInN(cc, addr, e.SizeBytes()) 8855 } 8856 8857 // WriteTo implements io.WriterTo.WriteTo. 8858 func (e *EthtoolGFeatures) WriteTo(writer io.Writer) (int64, error) { 8859 // Construct a slice backed by dst's underlying memory. 8860 var buf []byte 8861 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8862 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8863 hdr.Len = e.SizeBytes() 8864 hdr.Cap = e.SizeBytes() 8865 8866 length, err := writer.Write(buf) 8867 // Since we bypassed the compiler's escape analysis, indicate that e 8868 // must live until the use above. 8869 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8870 return int64(length), err 8871 } 8872 8873 // SizeBytes implements marshal.Marshallable.SizeBytes. 8874 func (e *EthtoolGetFeaturesBlock) SizeBytes() int { 8875 return 16 8876 } 8877 8878 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8879 func (e *EthtoolGetFeaturesBlock) MarshalBytes(dst []byte) []byte { 8880 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Available)) 8881 dst = dst[4:] 8882 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Requested)) 8883 dst = dst[4:] 8884 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.Active)) 8885 dst = dst[4:] 8886 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.NeverChanged)) 8887 dst = dst[4:] 8888 return dst 8889 } 8890 8891 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 8892 func (e *EthtoolGetFeaturesBlock) UnmarshalBytes(src []byte) []byte { 8893 e.Available = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8894 src = src[4:] 8895 e.Requested = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8896 src = src[4:] 8897 e.Active = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8898 src = src[4:] 8899 e.NeverChanged = uint32(hostarch.ByteOrder.Uint32(src[:4])) 8900 src = src[4:] 8901 return src 8902 } 8903 8904 // Packed implements marshal.Marshallable.Packed. 8905 //go:nosplit 8906 func (e *EthtoolGetFeaturesBlock) Packed() bool { 8907 return true 8908 } 8909 8910 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 8911 func (e *EthtoolGetFeaturesBlock) MarshalUnsafe(dst []byte) []byte { 8912 size := e.SizeBytes() 8913 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 8914 return dst[size:] 8915 } 8916 8917 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 8918 func (e *EthtoolGetFeaturesBlock) UnmarshalUnsafe(src []byte) []byte { 8919 size := e.SizeBytes() 8920 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 8921 return src[size:] 8922 } 8923 8924 // CopyOutN implements marshal.Marshallable.CopyOutN. 8925 func (e *EthtoolGetFeaturesBlock) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8926 // Construct a slice backed by dst's underlying memory. 8927 var buf []byte 8928 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8929 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8930 hdr.Len = e.SizeBytes() 8931 hdr.Cap = e.SizeBytes() 8932 8933 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 8934 // Since we bypassed the compiler's escape analysis, indicate that e 8935 // must live until the use above. 8936 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8937 return length, err 8938 } 8939 8940 // CopyOut implements marshal.Marshallable.CopyOut. 8941 func (e *EthtoolGetFeaturesBlock) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8942 return e.CopyOutN(cc, addr, e.SizeBytes()) 8943 } 8944 8945 // CopyInN implements marshal.Marshallable.CopyInN. 8946 func (e *EthtoolGetFeaturesBlock) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 8947 // Construct a slice backed by dst's underlying memory. 8948 var buf []byte 8949 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8950 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8951 hdr.Len = e.SizeBytes() 8952 hdr.Cap = e.SizeBytes() 8953 8954 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 8955 // Since we bypassed the compiler's escape analysis, indicate that e 8956 // must live until the use above. 8957 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8958 return length, err 8959 } 8960 8961 // CopyIn implements marshal.Marshallable.CopyIn. 8962 func (e *EthtoolGetFeaturesBlock) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 8963 return e.CopyInN(cc, addr, e.SizeBytes()) 8964 } 8965 8966 // WriteTo implements io.WriterTo.WriteTo. 8967 func (e *EthtoolGetFeaturesBlock) WriteTo(writer io.Writer) (int64, error) { 8968 // Construct a slice backed by dst's underlying memory. 8969 var buf []byte 8970 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 8971 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 8972 hdr.Len = e.SizeBytes() 8973 hdr.Cap = e.SizeBytes() 8974 8975 length, err := writer.Write(buf) 8976 // Since we bypassed the compiler's escape analysis, indicate that e 8977 // must live until the use above. 8978 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 8979 return int64(length), err 8980 } 8981 8982 // SizeBytes implements marshal.Marshallable.SizeBytes. 8983 func (i *IFConf) SizeBytes() int { 8984 return 12 + 8985 1*4 8986 } 8987 8988 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 8989 func (i *IFConf) MarshalBytes(dst []byte) []byte { 8990 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Len)) 8991 dst = dst[4:] 8992 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 8993 dst = dst[1*(4):] 8994 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Ptr)) 8995 dst = dst[8:] 8996 return dst 8997 } 8998 8999 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9000 func (i *IFConf) UnmarshalBytes(src []byte) []byte { 9001 i.Len = int32(hostarch.ByteOrder.Uint32(src[:4])) 9002 src = src[4:] 9003 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 9004 src = src[1*(4):] 9005 i.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 9006 src = src[8:] 9007 return src 9008 } 9009 9010 // Packed implements marshal.Marshallable.Packed. 9011 //go:nosplit 9012 func (i *IFConf) Packed() bool { 9013 return true 9014 } 9015 9016 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9017 func (i *IFConf) MarshalUnsafe(dst []byte) []byte { 9018 size := i.SizeBytes() 9019 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9020 return dst[size:] 9021 } 9022 9023 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9024 func (i *IFConf) UnmarshalUnsafe(src []byte) []byte { 9025 size := i.SizeBytes() 9026 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9027 return src[size:] 9028 } 9029 9030 // CopyOutN implements marshal.Marshallable.CopyOutN. 9031 func (i *IFConf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9032 // Construct a slice backed by dst's underlying memory. 9033 var buf []byte 9034 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9035 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9036 hdr.Len = i.SizeBytes() 9037 hdr.Cap = i.SizeBytes() 9038 9039 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9040 // Since we bypassed the compiler's escape analysis, indicate that i 9041 // must live until the use above. 9042 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9043 return length, err 9044 } 9045 9046 // CopyOut implements marshal.Marshallable.CopyOut. 9047 func (i *IFConf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9048 return i.CopyOutN(cc, addr, i.SizeBytes()) 9049 } 9050 9051 // CopyInN implements marshal.Marshallable.CopyInN. 9052 func (i *IFConf) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9053 // Construct a slice backed by dst's underlying memory. 9054 var buf []byte 9055 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9056 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9057 hdr.Len = i.SizeBytes() 9058 hdr.Cap = i.SizeBytes() 9059 9060 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9061 // Since we bypassed the compiler's escape analysis, indicate that i 9062 // must live until the use above. 9063 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9064 return length, err 9065 } 9066 9067 // CopyIn implements marshal.Marshallable.CopyIn. 9068 func (i *IFConf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9069 return i.CopyInN(cc, addr, i.SizeBytes()) 9070 } 9071 9072 // WriteTo implements io.WriterTo.WriteTo. 9073 func (i *IFConf) WriteTo(writer io.Writer) (int64, error) { 9074 // Construct a slice backed by dst's underlying memory. 9075 var buf []byte 9076 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9077 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9078 hdr.Len = i.SizeBytes() 9079 hdr.Cap = i.SizeBytes() 9080 9081 length, err := writer.Write(buf) 9082 // Since we bypassed the compiler's escape analysis, indicate that i 9083 // must live until the use above. 9084 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9085 return int64(length), err 9086 } 9087 9088 // SizeBytes implements marshal.Marshallable.SizeBytes. 9089 func (ifr *IFReq) SizeBytes() int { 9090 return 0 + 9091 1*IFNAMSIZ + 9092 1*24 9093 } 9094 9095 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9096 func (ifr *IFReq) MarshalBytes(dst []byte) []byte { 9097 for idx := 0; idx < IFNAMSIZ; idx++ { 9098 dst[0] = byte(ifr.IFName[idx]) 9099 dst = dst[1:] 9100 } 9101 for idx := 0; idx < 24; idx++ { 9102 dst[0] = byte(ifr.Data[idx]) 9103 dst = dst[1:] 9104 } 9105 return dst 9106 } 9107 9108 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9109 func (ifr *IFReq) UnmarshalBytes(src []byte) []byte { 9110 for idx := 0; idx < IFNAMSIZ; idx++ { 9111 ifr.IFName[idx] = src[0] 9112 src = src[1:] 9113 } 9114 for idx := 0; idx < 24; idx++ { 9115 ifr.Data[idx] = src[0] 9116 src = src[1:] 9117 } 9118 return src 9119 } 9120 9121 // Packed implements marshal.Marshallable.Packed. 9122 //go:nosplit 9123 func (ifr *IFReq) Packed() bool { 9124 return true 9125 } 9126 9127 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9128 func (ifr *IFReq) MarshalUnsafe(dst []byte) []byte { 9129 size := ifr.SizeBytes() 9130 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ifr), uintptr(size)) 9131 return dst[size:] 9132 } 9133 9134 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9135 func (ifr *IFReq) UnmarshalUnsafe(src []byte) []byte { 9136 size := ifr.SizeBytes() 9137 gohacks.Memmove(unsafe.Pointer(ifr), unsafe.Pointer(&src[0]), uintptr(size)) 9138 return src[size:] 9139 } 9140 9141 // CopyOutN implements marshal.Marshallable.CopyOutN. 9142 func (ifr *IFReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9143 // Construct a slice backed by dst's underlying memory. 9144 var buf []byte 9145 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9146 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 9147 hdr.Len = ifr.SizeBytes() 9148 hdr.Cap = ifr.SizeBytes() 9149 9150 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9151 // Since we bypassed the compiler's escape analysis, indicate that ifr 9152 // must live until the use above. 9153 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 9154 return length, err 9155 } 9156 9157 // CopyOut implements marshal.Marshallable.CopyOut. 9158 func (ifr *IFReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9159 return ifr.CopyOutN(cc, addr, ifr.SizeBytes()) 9160 } 9161 9162 // CopyInN implements marshal.Marshallable.CopyInN. 9163 func (ifr *IFReq) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9164 // Construct a slice backed by dst's underlying memory. 9165 var buf []byte 9166 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9167 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 9168 hdr.Len = ifr.SizeBytes() 9169 hdr.Cap = ifr.SizeBytes() 9170 9171 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9172 // Since we bypassed the compiler's escape analysis, indicate that ifr 9173 // must live until the use above. 9174 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 9175 return length, err 9176 } 9177 9178 // CopyIn implements marshal.Marshallable.CopyIn. 9179 func (ifr *IFReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9180 return ifr.CopyInN(cc, addr, ifr.SizeBytes()) 9181 } 9182 9183 // WriteTo implements io.WriterTo.WriteTo. 9184 func (ifr *IFReq) WriteTo(writer io.Writer) (int64, error) { 9185 // Construct a slice backed by dst's underlying memory. 9186 var buf []byte 9187 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9188 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ifr))) 9189 hdr.Len = ifr.SizeBytes() 9190 hdr.Cap = ifr.SizeBytes() 9191 9192 length, err := writer.Write(buf) 9193 // Since we bypassed the compiler's escape analysis, indicate that ifr 9194 // must live until the use above. 9195 runtime.KeepAlive(ifr) // escapes: replaced by intrinsic. 9196 return int64(length), err 9197 } 9198 9199 // SizeBytes implements marshal.Marshallable.SizeBytes. 9200 //go:nosplit 9201 func (en *ErrorName) SizeBytes() int { 9202 return 1 * XT_FUNCTION_MAXNAMELEN 9203 } 9204 9205 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9206 func (en *ErrorName) MarshalBytes(dst []byte) []byte { 9207 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 9208 dst[0] = byte(en[idx]) 9209 dst = dst[1:] 9210 } 9211 return dst 9212 } 9213 9214 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9215 func (en *ErrorName) UnmarshalBytes(src []byte) []byte { 9216 for idx := 0; idx < XT_FUNCTION_MAXNAMELEN; idx++ { 9217 en[idx] = src[0] 9218 src = src[1:] 9219 } 9220 return src 9221 } 9222 9223 // Packed implements marshal.Marshallable.Packed. 9224 //go:nosplit 9225 func (en *ErrorName) Packed() bool { 9226 // Array newtypes are always packed. 9227 return true 9228 } 9229 9230 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9231 func (en *ErrorName) MarshalUnsafe(dst []byte) []byte { 9232 size := en.SizeBytes() 9233 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 9234 return dst[size:] 9235 } 9236 9237 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9238 func (en *ErrorName) UnmarshalUnsafe(src []byte) []byte { 9239 size := en.SizeBytes() 9240 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 9241 return src[size:] 9242 } 9243 9244 // CopyOutN implements marshal.Marshallable.CopyOutN. 9245 func (en *ErrorName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9246 // Construct a slice backed by dst's underlying memory. 9247 var buf []byte 9248 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9249 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9250 hdr.Len = en.SizeBytes() 9251 hdr.Cap = en.SizeBytes() 9252 9253 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9254 // Since we bypassed the compiler's escape analysis, indicate that en 9255 // must live until the use above. 9256 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9257 return length, err 9258 } 9259 9260 // CopyOut implements marshal.Marshallable.CopyOut. 9261 func (en *ErrorName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9262 return en.CopyOutN(cc, addr, en.SizeBytes()) 9263 } 9264 9265 // CopyInN implements marshal.Marshallable.CopyInN. 9266 func (en *ErrorName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9267 // Construct a slice backed by dst's underlying memory. 9268 var buf []byte 9269 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9270 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9271 hdr.Len = en.SizeBytes() 9272 hdr.Cap = en.SizeBytes() 9273 9274 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9275 // Since we bypassed the compiler's escape analysis, indicate that en 9276 // must live until the use above. 9277 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9278 return length, err 9279 } 9280 9281 // CopyIn implements marshal.Marshallable.CopyIn. 9282 func (en *ErrorName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9283 return en.CopyInN(cc, addr, en.SizeBytes()) 9284 } 9285 9286 // WriteTo implements io.WriterTo.WriteTo. 9287 func (en *ErrorName) WriteTo(writer io.Writer) (int64, error) { 9288 // Construct a slice backed by dst's underlying memory. 9289 var buf []byte 9290 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9291 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9292 hdr.Len = en.SizeBytes() 9293 hdr.Cap = en.SizeBytes() 9294 9295 length, err := writer.Write(buf) 9296 // Since we bypassed the compiler's escape analysis, indicate that en 9297 // must live until the use above. 9298 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9299 return int64(length), err 9300 } 9301 9302 // SizeBytes implements marshal.Marshallable.SizeBytes. 9303 //go:nosplit 9304 func (en *ExtensionName) SizeBytes() int { 9305 return 1 * XT_EXTENSION_MAXNAMELEN 9306 } 9307 9308 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9309 func (en *ExtensionName) MarshalBytes(dst []byte) []byte { 9310 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 9311 dst[0] = byte(en[idx]) 9312 dst = dst[1:] 9313 } 9314 return dst 9315 } 9316 9317 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9318 func (en *ExtensionName) UnmarshalBytes(src []byte) []byte { 9319 for idx := 0; idx < XT_EXTENSION_MAXNAMELEN; idx++ { 9320 en[idx] = src[0] 9321 src = src[1:] 9322 } 9323 return src 9324 } 9325 9326 // Packed implements marshal.Marshallable.Packed. 9327 //go:nosplit 9328 func (en *ExtensionName) Packed() bool { 9329 // Array newtypes are always packed. 9330 return true 9331 } 9332 9333 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9334 func (en *ExtensionName) MarshalUnsafe(dst []byte) []byte { 9335 size := en.SizeBytes() 9336 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&en[0]), uintptr(size)) 9337 return dst[size:] 9338 } 9339 9340 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9341 func (en *ExtensionName) UnmarshalUnsafe(src []byte) []byte { 9342 size := en.SizeBytes() 9343 gohacks.Memmove(unsafe.Pointer(en), unsafe.Pointer(&src[0]), uintptr(size)) 9344 return src[size:] 9345 } 9346 9347 // CopyOutN implements marshal.Marshallable.CopyOutN. 9348 func (en *ExtensionName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9349 // Construct a slice backed by dst's underlying memory. 9350 var buf []byte 9351 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9352 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9353 hdr.Len = en.SizeBytes() 9354 hdr.Cap = en.SizeBytes() 9355 9356 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9357 // Since we bypassed the compiler's escape analysis, indicate that en 9358 // must live until the use above. 9359 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9360 return length, err 9361 } 9362 9363 // CopyOut implements marshal.Marshallable.CopyOut. 9364 func (en *ExtensionName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9365 return en.CopyOutN(cc, addr, en.SizeBytes()) 9366 } 9367 9368 // CopyInN implements marshal.Marshallable.CopyInN. 9369 func (en *ExtensionName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9370 // Construct a slice backed by dst's underlying memory. 9371 var buf []byte 9372 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9373 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(en))) 9374 hdr.Len = en.SizeBytes() 9375 hdr.Cap = en.SizeBytes() 9376 9377 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9378 // Since we bypassed the compiler's escape analysis, indicate that en 9379 // must live until the use above. 9380 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9381 return length, err 9382 } 9383 9384 // CopyIn implements marshal.Marshallable.CopyIn. 9385 func (en *ExtensionName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9386 return en.CopyInN(cc, addr, en.SizeBytes()) 9387 } 9388 9389 // WriteTo implements io.WriterTo.WriteTo. 9390 func (en *ExtensionName) WriteTo(writer io.Writer) (int64, error) { 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(en))) 9395 hdr.Len = en.SizeBytes() 9396 hdr.Cap = en.SizeBytes() 9397 9398 length, err := writer.Write(buf) 9399 // Since we bypassed the compiler's escape analysis, indicate that en 9400 // must live until the use above. 9401 runtime.KeepAlive(en) // escapes: replaced by intrinsic. 9402 return int64(length), err 9403 } 9404 9405 // SizeBytes implements marshal.Marshallable.SizeBytes. 9406 func (i *IPTEntry) SizeBytes() int { 9407 return 12 + 9408 (*IPTIP)(nil).SizeBytes() + 9409 (*XTCounters)(nil).SizeBytes() 9410 } 9411 9412 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9413 func (i *IPTEntry) MarshalBytes(dst []byte) []byte { 9414 dst = i.IP.MarshalUnsafe(dst) 9415 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 9416 dst = dst[4:] 9417 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 9418 dst = dst[2:] 9419 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 9420 dst = dst[2:] 9421 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 9422 dst = dst[4:] 9423 dst = i.Counters.MarshalUnsafe(dst) 9424 return dst 9425 } 9426 9427 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9428 func (i *IPTEntry) UnmarshalBytes(src []byte) []byte { 9429 src = i.IP.UnmarshalUnsafe(src) 9430 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9431 src = src[4:] 9432 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9433 src = src[2:] 9434 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9435 src = src[2:] 9436 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9437 src = src[4:] 9438 src = i.Counters.UnmarshalUnsafe(src) 9439 return src 9440 } 9441 9442 // Packed implements marshal.Marshallable.Packed. 9443 //go:nosplit 9444 func (i *IPTEntry) Packed() bool { 9445 return i.Counters.Packed() && i.IP.Packed() 9446 } 9447 9448 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9449 func (i *IPTEntry) MarshalUnsafe(dst []byte) []byte { 9450 if i.Counters.Packed() && i.IP.Packed() { 9451 size := i.SizeBytes() 9452 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9453 return dst[size:] 9454 } 9455 // Type IPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 9456 return i.MarshalBytes(dst) 9457 } 9458 9459 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9460 func (i *IPTEntry) UnmarshalUnsafe(src []byte) []byte { 9461 if i.Counters.Packed() && i.IP.Packed() { 9462 size := i.SizeBytes() 9463 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9464 return src[size:] 9465 } 9466 // Type IPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9467 return i.UnmarshalBytes(src) 9468 } 9469 9470 // CopyOutN implements marshal.Marshallable.CopyOutN. 9471 func (i *IPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9472 if !i.Counters.Packed() && i.IP.Packed() { 9473 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9474 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9475 i.MarshalBytes(buf) // escapes: fallback. 9476 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9477 } 9478 9479 // Construct a slice backed by dst's underlying memory. 9480 var buf []byte 9481 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9482 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9483 hdr.Len = i.SizeBytes() 9484 hdr.Cap = i.SizeBytes() 9485 9486 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9487 // Since we bypassed the compiler's escape analysis, indicate that i 9488 // must live until the use above. 9489 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9490 return length, err 9491 } 9492 9493 // CopyOut implements marshal.Marshallable.CopyOut. 9494 func (i *IPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9495 return i.CopyOutN(cc, addr, i.SizeBytes()) 9496 } 9497 9498 // CopyInN implements marshal.Marshallable.CopyInN. 9499 func (i *IPTEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9500 if !i.Counters.Packed() && i.IP.Packed() { 9501 // Type IPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9502 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9503 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9504 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9505 // partially unmarshalled struct. 9506 i.UnmarshalBytes(buf) // escapes: fallback. 9507 return length, err 9508 } 9509 9510 // Construct a slice backed by dst's underlying memory. 9511 var buf []byte 9512 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9513 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9514 hdr.Len = i.SizeBytes() 9515 hdr.Cap = i.SizeBytes() 9516 9517 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9518 // Since we bypassed the compiler's escape analysis, indicate that i 9519 // must live until the use above. 9520 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9521 return length, err 9522 } 9523 9524 // CopyIn implements marshal.Marshallable.CopyIn. 9525 func (i *IPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9526 return i.CopyInN(cc, addr, i.SizeBytes()) 9527 } 9528 9529 // WriteTo implements io.WriterTo.WriteTo. 9530 func (i *IPTEntry) WriteTo(writer io.Writer) (int64, error) { 9531 if !i.Counters.Packed() && i.IP.Packed() { 9532 // Type IPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 9533 buf := make([]byte, i.SizeBytes()) 9534 i.MarshalBytes(buf) 9535 length, err := writer.Write(buf) 9536 return int64(length), err 9537 } 9538 9539 // Construct a slice backed by dst's underlying memory. 9540 var buf []byte 9541 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9542 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9543 hdr.Len = i.SizeBytes() 9544 hdr.Cap = i.SizeBytes() 9545 9546 length, err := writer.Write(buf) 9547 // Since we bypassed the compiler's escape analysis, indicate that i 9548 // must live until the use above. 9549 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9550 return int64(length), err 9551 } 9552 9553 // SizeBytes implements marshal.Marshallable.SizeBytes. 9554 func (i *IPTGetEntries) SizeBytes() int { 9555 return 4 + 9556 (*TableName)(nil).SizeBytes() + 9557 1*4 9558 } 9559 9560 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9561 func (i *IPTGetEntries) MarshalBytes(dst []byte) []byte { 9562 dst = i.Name.MarshalUnsafe(dst) 9563 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9564 dst = dst[4:] 9565 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 9566 dst = dst[1*(4):] 9567 return dst 9568 } 9569 9570 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9571 func (i *IPTGetEntries) UnmarshalBytes(src []byte) []byte { 9572 src = i.Name.UnmarshalUnsafe(src) 9573 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9574 src = src[4:] 9575 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 9576 src = src[1*(4):] 9577 return src 9578 } 9579 9580 // Packed implements marshal.Marshallable.Packed. 9581 //go:nosplit 9582 func (i *IPTGetEntries) Packed() bool { 9583 return i.Name.Packed() 9584 } 9585 9586 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9587 func (i *IPTGetEntries) MarshalUnsafe(dst []byte) []byte { 9588 if i.Name.Packed() { 9589 size := i.SizeBytes() 9590 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9591 return dst[size:] 9592 } 9593 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 9594 return i.MarshalBytes(dst) 9595 } 9596 9597 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9598 func (i *IPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 9599 if i.Name.Packed() { 9600 size := i.SizeBytes() 9601 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9602 return src[size:] 9603 } 9604 // Type IPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9605 return i.UnmarshalBytes(src) 9606 } 9607 9608 // CopyOutN implements marshal.Marshallable.CopyOutN. 9609 func (i *IPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9610 if !i.Name.Packed() { 9611 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9612 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9613 i.MarshalBytes(buf) // escapes: fallback. 9614 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9615 } 9616 9617 // Construct a slice backed by dst's underlying memory. 9618 var buf []byte 9619 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9620 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9621 hdr.Len = i.SizeBytes() 9622 hdr.Cap = i.SizeBytes() 9623 9624 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9625 // Since we bypassed the compiler's escape analysis, indicate that i 9626 // must live until the use above. 9627 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9628 return length, err 9629 } 9630 9631 // CopyOut implements marshal.Marshallable.CopyOut. 9632 func (i *IPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9633 return i.CopyOutN(cc, addr, i.SizeBytes()) 9634 } 9635 9636 // CopyInN implements marshal.Marshallable.CopyInN. 9637 func (i *IPTGetEntries) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9638 if !i.Name.Packed() { 9639 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9640 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9641 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9642 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9643 // partially unmarshalled struct. 9644 i.UnmarshalBytes(buf) // escapes: fallback. 9645 return length, err 9646 } 9647 9648 // Construct a slice backed by dst's underlying memory. 9649 var buf []byte 9650 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9651 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9652 hdr.Len = i.SizeBytes() 9653 hdr.Cap = i.SizeBytes() 9654 9655 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9656 // Since we bypassed the compiler's escape analysis, indicate that i 9657 // must live until the use above. 9658 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9659 return length, err 9660 } 9661 9662 // CopyIn implements marshal.Marshallable.CopyIn. 9663 func (i *IPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9664 return i.CopyInN(cc, addr, i.SizeBytes()) 9665 } 9666 9667 // WriteTo implements io.WriterTo.WriteTo. 9668 func (i *IPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 9669 if !i.Name.Packed() { 9670 // Type IPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 9671 buf := make([]byte, i.SizeBytes()) 9672 i.MarshalBytes(buf) 9673 length, err := writer.Write(buf) 9674 return int64(length), err 9675 } 9676 9677 // Construct a slice backed by dst's underlying memory. 9678 var buf []byte 9679 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9680 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9681 hdr.Len = i.SizeBytes() 9682 hdr.Cap = i.SizeBytes() 9683 9684 length, err := writer.Write(buf) 9685 // Since we bypassed the compiler's escape analysis, indicate that i 9686 // must live until the use above. 9687 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9688 return int64(length), err 9689 } 9690 9691 // SizeBytes implements marshal.Marshallable.SizeBytes. 9692 func (i *IPTGetinfo) SizeBytes() int { 9693 return 12 + 9694 (*TableName)(nil).SizeBytes() + 9695 4*NF_INET_NUMHOOKS + 9696 4*NF_INET_NUMHOOKS 9697 } 9698 9699 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9700 func (i *IPTGetinfo) MarshalBytes(dst []byte) []byte { 9701 dst = i.Name.MarshalUnsafe(dst) 9702 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 9703 dst = dst[4:] 9704 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9705 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 9706 dst = dst[4:] 9707 } 9708 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9709 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 9710 dst = dst[4:] 9711 } 9712 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 9713 dst = dst[4:] 9714 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 9715 dst = dst[4:] 9716 return dst 9717 } 9718 9719 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9720 func (i *IPTGetinfo) UnmarshalBytes(src []byte) []byte { 9721 src = i.Name.UnmarshalUnsafe(src) 9722 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9723 src = src[4:] 9724 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9725 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9726 src = src[4:] 9727 } 9728 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 9729 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9730 src = src[4:] 9731 } 9732 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9733 src = src[4:] 9734 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 9735 src = src[4:] 9736 return src 9737 } 9738 9739 // Packed implements marshal.Marshallable.Packed. 9740 //go:nosplit 9741 func (i *IPTGetinfo) Packed() bool { 9742 return i.Name.Packed() 9743 } 9744 9745 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9746 func (i *IPTGetinfo) MarshalUnsafe(dst []byte) []byte { 9747 if i.Name.Packed() { 9748 size := i.SizeBytes() 9749 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9750 return dst[size:] 9751 } 9752 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to MarshalBytes. 9753 return i.MarshalBytes(dst) 9754 } 9755 9756 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9757 func (i *IPTGetinfo) UnmarshalUnsafe(src []byte) []byte { 9758 if i.Name.Packed() { 9759 size := i.SizeBytes() 9760 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9761 return src[size:] 9762 } 9763 // Type IPTGetinfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9764 return i.UnmarshalBytes(src) 9765 } 9766 9767 // CopyOutN implements marshal.Marshallable.CopyOutN. 9768 func (i *IPTGetinfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9769 if !i.Name.Packed() { 9770 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9771 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9772 i.MarshalBytes(buf) // escapes: fallback. 9773 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9774 } 9775 9776 // Construct a slice backed by dst's underlying memory. 9777 var buf []byte 9778 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9779 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9780 hdr.Len = i.SizeBytes() 9781 hdr.Cap = i.SizeBytes() 9782 9783 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9784 // Since we bypassed the compiler's escape analysis, indicate that i 9785 // must live until the use above. 9786 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9787 return length, err 9788 } 9789 9790 // CopyOut implements marshal.Marshallable.CopyOut. 9791 func (i *IPTGetinfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9792 return i.CopyOutN(cc, addr, i.SizeBytes()) 9793 } 9794 9795 // CopyInN implements marshal.Marshallable.CopyInN. 9796 func (i *IPTGetinfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9797 if !i.Name.Packed() { 9798 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9799 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9800 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9801 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9802 // partially unmarshalled struct. 9803 i.UnmarshalBytes(buf) // escapes: fallback. 9804 return length, err 9805 } 9806 9807 // Construct a slice backed by dst's underlying memory. 9808 var buf []byte 9809 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9810 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9811 hdr.Len = i.SizeBytes() 9812 hdr.Cap = i.SizeBytes() 9813 9814 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9815 // Since we bypassed the compiler's escape analysis, indicate that i 9816 // must live until the use above. 9817 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9818 return length, err 9819 } 9820 9821 // CopyIn implements marshal.Marshallable.CopyIn. 9822 func (i *IPTGetinfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9823 return i.CopyInN(cc, addr, i.SizeBytes()) 9824 } 9825 9826 // WriteTo implements io.WriterTo.WriteTo. 9827 func (i *IPTGetinfo) WriteTo(writer io.Writer) (int64, error) { 9828 if !i.Name.Packed() { 9829 // Type IPTGetinfo doesn't have a packed layout in memory, fall back to MarshalBytes. 9830 buf := make([]byte, i.SizeBytes()) 9831 i.MarshalBytes(buf) 9832 length, err := writer.Write(buf) 9833 return int64(length), err 9834 } 9835 9836 // Construct a slice backed by dst's underlying memory. 9837 var buf []byte 9838 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9839 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9840 hdr.Len = i.SizeBytes() 9841 hdr.Cap = i.SizeBytes() 9842 9843 length, err := writer.Write(buf) 9844 // Since we bypassed the compiler's escape analysis, indicate that i 9845 // must live until the use above. 9846 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9847 return int64(length), err 9848 } 9849 9850 // SizeBytes implements marshal.Marshallable.SizeBytes. 9851 func (i *IPTIP) SizeBytes() int { 9852 return 4 + 9853 (*InetAddr)(nil).SizeBytes() + 9854 (*InetAddr)(nil).SizeBytes() + 9855 (*InetAddr)(nil).SizeBytes() + 9856 (*InetAddr)(nil).SizeBytes() + 9857 1*IFNAMSIZ + 9858 1*IFNAMSIZ + 9859 1*IFNAMSIZ + 9860 1*IFNAMSIZ 9861 } 9862 9863 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 9864 func (i *IPTIP) MarshalBytes(dst []byte) []byte { 9865 dst = i.Src.MarshalUnsafe(dst) 9866 dst = i.Dst.MarshalUnsafe(dst) 9867 dst = i.SrcMask.MarshalUnsafe(dst) 9868 dst = i.DstMask.MarshalUnsafe(dst) 9869 for idx := 0; idx < IFNAMSIZ; idx++ { 9870 dst[0] = byte(i.InputInterface[idx]) 9871 dst = dst[1:] 9872 } 9873 for idx := 0; idx < IFNAMSIZ; idx++ { 9874 dst[0] = byte(i.OutputInterface[idx]) 9875 dst = dst[1:] 9876 } 9877 for idx := 0; idx < IFNAMSIZ; idx++ { 9878 dst[0] = byte(i.InputInterfaceMask[idx]) 9879 dst = dst[1:] 9880 } 9881 for idx := 0; idx < IFNAMSIZ; idx++ { 9882 dst[0] = byte(i.OutputInterfaceMask[idx]) 9883 dst = dst[1:] 9884 } 9885 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 9886 dst = dst[2:] 9887 dst[0] = byte(i.Flags) 9888 dst = dst[1:] 9889 dst[0] = byte(i.InverseFlags) 9890 dst = dst[1:] 9891 return dst 9892 } 9893 9894 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 9895 func (i *IPTIP) UnmarshalBytes(src []byte) []byte { 9896 src = i.Src.UnmarshalUnsafe(src) 9897 src = i.Dst.UnmarshalUnsafe(src) 9898 src = i.SrcMask.UnmarshalUnsafe(src) 9899 src = i.DstMask.UnmarshalUnsafe(src) 9900 for idx := 0; idx < IFNAMSIZ; idx++ { 9901 i.InputInterface[idx] = src[0] 9902 src = src[1:] 9903 } 9904 for idx := 0; idx < IFNAMSIZ; idx++ { 9905 i.OutputInterface[idx] = src[0] 9906 src = src[1:] 9907 } 9908 for idx := 0; idx < IFNAMSIZ; idx++ { 9909 i.InputInterfaceMask[idx] = src[0] 9910 src = src[1:] 9911 } 9912 for idx := 0; idx < IFNAMSIZ; idx++ { 9913 i.OutputInterfaceMask[idx] = src[0] 9914 src = src[1:] 9915 } 9916 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 9917 src = src[2:] 9918 i.Flags = uint8(src[0]) 9919 src = src[1:] 9920 i.InverseFlags = uint8(src[0]) 9921 src = src[1:] 9922 return src 9923 } 9924 9925 // Packed implements marshal.Marshallable.Packed. 9926 //go:nosplit 9927 func (i *IPTIP) Packed() bool { 9928 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 9929 } 9930 9931 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 9932 func (i *IPTIP) MarshalUnsafe(dst []byte) []byte { 9933 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9934 size := i.SizeBytes() 9935 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 9936 return dst[size:] 9937 } 9938 // Type IPTIP doesn't have a packed layout in memory, fallback to MarshalBytes. 9939 return i.MarshalBytes(dst) 9940 } 9941 9942 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 9943 func (i *IPTIP) UnmarshalUnsafe(src []byte) []byte { 9944 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9945 size := i.SizeBytes() 9946 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 9947 return src[size:] 9948 } 9949 // Type IPTIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 9950 return i.UnmarshalBytes(src) 9951 } 9952 9953 // CopyOutN implements marshal.Marshallable.CopyOutN. 9954 func (i *IPTIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9955 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9956 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 9957 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9958 i.MarshalBytes(buf) // escapes: fallback. 9959 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9960 } 9961 9962 // Construct a slice backed by dst's underlying memory. 9963 var buf []byte 9964 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9965 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9966 hdr.Len = i.SizeBytes() 9967 hdr.Cap = i.SizeBytes() 9968 9969 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 9970 // Since we bypassed the compiler's escape analysis, indicate that i 9971 // must live until the use above. 9972 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 9973 return length, err 9974 } 9975 9976 // CopyOut implements marshal.Marshallable.CopyOut. 9977 func (i *IPTIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 9978 return i.CopyOutN(cc, addr, i.SizeBytes()) 9979 } 9980 9981 // CopyInN implements marshal.Marshallable.CopyInN. 9982 func (i *IPTIP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 9983 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 9984 // Type IPTIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 9985 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 9986 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 9987 // Unmarshal unconditionally. If we had a short copy-in, this results in a 9988 // partially unmarshalled struct. 9989 i.UnmarshalBytes(buf) // escapes: fallback. 9990 return length, err 9991 } 9992 9993 // Construct a slice backed by dst's underlying memory. 9994 var buf []byte 9995 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 9996 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 9997 hdr.Len = i.SizeBytes() 9998 hdr.Cap = i.SizeBytes() 9999 10000 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10001 // Since we bypassed the compiler's escape analysis, indicate that i 10002 // must live until the use above. 10003 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10004 return length, err 10005 } 10006 10007 // CopyIn implements marshal.Marshallable.CopyIn. 10008 func (i *IPTIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10009 return i.CopyInN(cc, addr, i.SizeBytes()) 10010 } 10011 10012 // WriteTo implements io.WriterTo.WriteTo. 10013 func (i *IPTIP) WriteTo(writer io.Writer) (int64, error) { 10014 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 10015 // Type IPTIP doesn't have a packed layout in memory, fall back to MarshalBytes. 10016 buf := make([]byte, i.SizeBytes()) 10017 i.MarshalBytes(buf) 10018 length, err := writer.Write(buf) 10019 return int64(length), err 10020 } 10021 10022 // Construct a slice backed by dst's underlying memory. 10023 var buf []byte 10024 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10025 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10026 hdr.Len = i.SizeBytes() 10027 hdr.Cap = i.SizeBytes() 10028 10029 length, err := writer.Write(buf) 10030 // Since we bypassed the compiler's escape analysis, indicate that i 10031 // must live until the use above. 10032 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10033 return int64(length), err 10034 } 10035 10036 // SizeBytes implements marshal.Marshallable.SizeBytes. 10037 func (i *IPTOwnerInfo) SizeBytes() int { 10038 return 18 + 10039 1*16 10040 } 10041 10042 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10043 func (i *IPTOwnerInfo) MarshalBytes(dst []byte) []byte { 10044 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.UID)) 10045 dst = dst[4:] 10046 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.GID)) 10047 dst = dst[4:] 10048 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.PID)) 10049 dst = dst[4:] 10050 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.SID)) 10051 dst = dst[4:] 10052 for idx := 0; idx < 16; idx++ { 10053 dst[0] = byte(i.Comm[idx]) 10054 dst = dst[1:] 10055 } 10056 dst[0] = byte(i.Match) 10057 dst = dst[1:] 10058 dst[0] = byte(i.Invert) 10059 dst = dst[1:] 10060 return dst 10061 } 10062 10063 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10064 func (i *IPTOwnerInfo) UnmarshalBytes(src []byte) []byte { 10065 i.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10066 src = src[4:] 10067 i.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10068 src = src[4:] 10069 i.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10070 src = src[4:] 10071 i.SID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10072 src = src[4:] 10073 for idx := 0; idx < 16; idx++ { 10074 i.Comm[idx] = src[0] 10075 src = src[1:] 10076 } 10077 i.Match = uint8(src[0]) 10078 src = src[1:] 10079 i.Invert = uint8(src[0]) 10080 src = src[1:] 10081 return src 10082 } 10083 10084 // Packed implements marshal.Marshallable.Packed. 10085 //go:nosplit 10086 func (i *IPTOwnerInfo) Packed() bool { 10087 return false 10088 } 10089 10090 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10091 func (i *IPTOwnerInfo) MarshalUnsafe(dst []byte) []byte { 10092 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 10093 return i.MarshalBytes(dst) 10094 } 10095 10096 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10097 func (i *IPTOwnerInfo) UnmarshalUnsafe(src []byte) []byte { 10098 // Type IPTOwnerInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10099 return i.UnmarshalBytes(src) 10100 } 10101 10102 // CopyOutN implements marshal.Marshallable.CopyOutN. 10103 func (i *IPTOwnerInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10104 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 10105 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10106 i.MarshalBytes(buf) // escapes: fallback. 10107 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10108 } 10109 10110 // CopyOut implements marshal.Marshallable.CopyOut. 10111 func (i *IPTOwnerInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10112 return i.CopyOutN(cc, addr, i.SizeBytes()) 10113 } 10114 10115 // CopyInN implements marshal.Marshallable.CopyInN. 10116 func (i *IPTOwnerInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10117 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10118 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10119 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10120 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10121 // partially unmarshalled struct. 10122 i.UnmarshalBytes(buf) // escapes: fallback. 10123 return length, err 10124 } 10125 10126 // CopyIn implements marshal.Marshallable.CopyIn. 10127 func (i *IPTOwnerInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10128 return i.CopyInN(cc, addr, i.SizeBytes()) 10129 } 10130 10131 // WriteTo implements io.WriterTo.WriteTo. 10132 func (i *IPTOwnerInfo) WriteTo(writer io.Writer) (int64, error) { 10133 // Type IPTOwnerInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 10134 buf := make([]byte, i.SizeBytes()) 10135 i.MarshalBytes(buf) 10136 length, err := writer.Write(buf) 10137 return int64(length), err 10138 } 10139 10140 // SizeBytes implements marshal.Marshallable.SizeBytes. 10141 func (i *IPTReplace) SizeBytes() int { 10142 return 24 + 10143 (*TableName)(nil).SizeBytes() + 10144 4*NF_INET_NUMHOOKS + 10145 4*NF_INET_NUMHOOKS 10146 } 10147 10148 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10149 func (i *IPTReplace) MarshalBytes(dst []byte) []byte { 10150 dst = i.Name.MarshalUnsafe(dst) 10151 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 10152 dst = dst[4:] 10153 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 10154 dst = dst[4:] 10155 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 10156 dst = dst[4:] 10157 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10158 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 10159 dst = dst[4:] 10160 } 10161 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10162 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 10163 dst = dst[4:] 10164 } 10165 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 10166 dst = dst[4:] 10167 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 10168 dst = dst[8:] 10169 return dst 10170 } 10171 10172 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10173 func (i *IPTReplace) UnmarshalBytes(src []byte) []byte { 10174 src = i.Name.UnmarshalUnsafe(src) 10175 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10176 src = src[4:] 10177 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10178 src = src[4:] 10179 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10180 src = src[4:] 10181 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10182 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10183 src = src[4:] 10184 } 10185 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 10186 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10187 src = src[4:] 10188 } 10189 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10190 src = src[4:] 10191 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10192 src = src[8:] 10193 return src 10194 } 10195 10196 // Packed implements marshal.Marshallable.Packed. 10197 //go:nosplit 10198 func (i *IPTReplace) Packed() bool { 10199 return i.Name.Packed() 10200 } 10201 10202 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10203 func (i *IPTReplace) MarshalUnsafe(dst []byte) []byte { 10204 if i.Name.Packed() { 10205 size := i.SizeBytes() 10206 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 10207 return dst[size:] 10208 } 10209 // Type IPTReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 10210 return i.MarshalBytes(dst) 10211 } 10212 10213 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10214 func (i *IPTReplace) UnmarshalUnsafe(src []byte) []byte { 10215 if i.Name.Packed() { 10216 size := i.SizeBytes() 10217 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 10218 return src[size:] 10219 } 10220 // Type IPTReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10221 return i.UnmarshalBytes(src) 10222 } 10223 10224 // CopyOutN implements marshal.Marshallable.CopyOutN. 10225 func (i *IPTReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10226 if !i.Name.Packed() { 10227 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 10228 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10229 i.MarshalBytes(buf) // escapes: fallback. 10230 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10231 } 10232 10233 // Construct a slice backed by dst's underlying memory. 10234 var buf []byte 10235 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10236 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10237 hdr.Len = i.SizeBytes() 10238 hdr.Cap = i.SizeBytes() 10239 10240 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10241 // Since we bypassed the compiler's escape analysis, indicate that i 10242 // must live until the use above. 10243 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10244 return length, err 10245 } 10246 10247 // CopyOut implements marshal.Marshallable.CopyOut. 10248 func (i *IPTReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10249 return i.CopyOutN(cc, addr, i.SizeBytes()) 10250 } 10251 10252 // CopyInN implements marshal.Marshallable.CopyInN. 10253 func (i *IPTReplace) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10254 if !i.Name.Packed() { 10255 // Type IPTReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10256 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 10257 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10258 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10259 // partially unmarshalled struct. 10260 i.UnmarshalBytes(buf) // escapes: fallback. 10261 return length, err 10262 } 10263 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(i))) 10268 hdr.Len = i.SizeBytes() 10269 hdr.Cap = i.SizeBytes() 10270 10271 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10272 // Since we bypassed the compiler's escape analysis, indicate that i 10273 // must live until the use above. 10274 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10275 return length, err 10276 } 10277 10278 // CopyIn implements marshal.Marshallable.CopyIn. 10279 func (i *IPTReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10280 return i.CopyInN(cc, addr, i.SizeBytes()) 10281 } 10282 10283 // WriteTo implements io.WriterTo.WriteTo. 10284 func (i *IPTReplace) WriteTo(writer io.Writer) (int64, error) { 10285 if !i.Name.Packed() { 10286 // Type IPTReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 10287 buf := make([]byte, i.SizeBytes()) 10288 i.MarshalBytes(buf) 10289 length, err := writer.Write(buf) 10290 return int64(length), err 10291 } 10292 10293 // Construct a slice backed by dst's underlying memory. 10294 var buf []byte 10295 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10296 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 10297 hdr.Len = i.SizeBytes() 10298 hdr.Cap = i.SizeBytes() 10299 10300 length, err := writer.Write(buf) 10301 // Since we bypassed the compiler's escape analysis, indicate that i 10302 // must live until the use above. 10303 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 10304 return int64(length), err 10305 } 10306 10307 // Packed implements marshal.Marshallable.Packed. 10308 //go:nosplit 10309 func (ke *KernelIPTEntry) Packed() bool { 10310 // Type KernelIPTEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 10311 return false 10312 } 10313 10314 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10315 func (ke *KernelIPTEntry) MarshalUnsafe(dst []byte) []byte { 10316 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 10317 return ke.MarshalBytes(dst) 10318 } 10319 10320 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10321 func (ke *KernelIPTEntry) UnmarshalUnsafe(src []byte) []byte { 10322 // Type KernelIPTEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10323 return ke.UnmarshalBytes(src) 10324 } 10325 10326 // CopyOutN implements marshal.Marshallable.CopyOutN. 10327 //go:nosplit 10328 func (ke *KernelIPTEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10329 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 10330 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10331 ke.MarshalBytes(buf) // escapes: fallback. 10332 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10333 } 10334 10335 // CopyOut implements marshal.Marshallable.CopyOut. 10336 func (ke *KernelIPTEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10337 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 10338 } 10339 10340 // CopyInN implements marshal.Marshallable.CopyInN. 10341 //go:nosplit 10342 func (ke *KernelIPTEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10343 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10344 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10345 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10346 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10347 // partially unmarshalled struct. 10348 ke.UnmarshalBytes(buf) // escapes: fallback. 10349 return length, err 10350 } 10351 10352 // CopyIn implements marshal.Marshallable.CopyIn. 10353 func (ke *KernelIPTEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10354 return ke.CopyInN(cc, addr, ke.SizeBytes()) 10355 } 10356 10357 // WriteTo implements io.WriterTo.WriteTo. 10358 func (ke *KernelIPTEntry) WriteTo(writer io.Writer) (int64, error) { 10359 // Type KernelIPTEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 10360 buf := make([]byte, ke.SizeBytes()) 10361 ke.MarshalBytes(buf) 10362 length, err := writer.Write(buf) 10363 return int64(length), err 10364 } 10365 10366 // Packed implements marshal.Marshallable.Packed. 10367 //go:nosplit 10368 func (ke *KernelIPTGetEntries) Packed() bool { 10369 // Type KernelIPTGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 10370 return false 10371 } 10372 10373 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10374 func (ke *KernelIPTGetEntries) MarshalUnsafe(dst []byte) []byte { 10375 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 10376 return ke.MarshalBytes(dst) 10377 } 10378 10379 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10380 func (ke *KernelIPTGetEntries) UnmarshalUnsafe(src []byte) []byte { 10381 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10382 return ke.UnmarshalBytes(src) 10383 } 10384 10385 // CopyOutN implements marshal.Marshallable.CopyOutN. 10386 //go:nosplit 10387 func (ke *KernelIPTGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10388 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 10389 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10390 ke.MarshalBytes(buf) // escapes: fallback. 10391 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10392 } 10393 10394 // CopyOut implements marshal.Marshallable.CopyOut. 10395 func (ke *KernelIPTGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10396 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 10397 } 10398 10399 // CopyInN implements marshal.Marshallable.CopyInN. 10400 //go:nosplit 10401 func (ke *KernelIPTGetEntries) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10402 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10403 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 10404 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 10405 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10406 // partially unmarshalled struct. 10407 ke.UnmarshalBytes(buf) // escapes: fallback. 10408 return length, err 10409 } 10410 10411 // CopyIn implements marshal.Marshallable.CopyIn. 10412 func (ke *KernelIPTGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10413 return ke.CopyInN(cc, addr, ke.SizeBytes()) 10414 } 10415 10416 // WriteTo implements io.WriterTo.WriteTo. 10417 func (ke *KernelIPTGetEntries) WriteTo(writer io.Writer) (int64, error) { 10418 // Type KernelIPTGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 10419 buf := make([]byte, ke.SizeBytes()) 10420 ke.MarshalBytes(buf) 10421 length, err := writer.Write(buf) 10422 return int64(length), err 10423 } 10424 10425 // SizeBytes implements marshal.Marshallable.SizeBytes. 10426 func (n *NfNATIPV4MultiRangeCompat) SizeBytes() int { 10427 return 4 + 10428 (*NfNATIPV4Range)(nil).SizeBytes() 10429 } 10430 10431 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10432 func (n *NfNATIPV4MultiRangeCompat) MarshalBytes(dst []byte) []byte { 10433 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.RangeSize)) 10434 dst = dst[4:] 10435 dst = n.RangeIPV4.MarshalUnsafe(dst) 10436 return dst 10437 } 10438 10439 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10440 func (n *NfNATIPV4MultiRangeCompat) UnmarshalBytes(src []byte) []byte { 10441 n.RangeSize = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10442 src = src[4:] 10443 src = n.RangeIPV4.UnmarshalUnsafe(src) 10444 return src 10445 } 10446 10447 // Packed implements marshal.Marshallable.Packed. 10448 //go:nosplit 10449 func (n *NfNATIPV4MultiRangeCompat) Packed() bool { 10450 return n.RangeIPV4.Packed() 10451 } 10452 10453 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10454 func (n *NfNATIPV4MultiRangeCompat) MarshalUnsafe(dst []byte) []byte { 10455 if n.RangeIPV4.Packed() { 10456 size := n.SizeBytes() 10457 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10458 return dst[size:] 10459 } 10460 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to MarshalBytes. 10461 return n.MarshalBytes(dst) 10462 } 10463 10464 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10465 func (n *NfNATIPV4MultiRangeCompat) UnmarshalUnsafe(src []byte) []byte { 10466 if n.RangeIPV4.Packed() { 10467 size := n.SizeBytes() 10468 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10469 return src[size:] 10470 } 10471 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10472 return n.UnmarshalBytes(src) 10473 } 10474 10475 // CopyOutN implements marshal.Marshallable.CopyOutN. 10476 func (n *NfNATIPV4MultiRangeCompat) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10477 if !n.RangeIPV4.Packed() { 10478 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 10479 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10480 n.MarshalBytes(buf) // escapes: fallback. 10481 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10482 } 10483 10484 // Construct a slice backed by dst's underlying memory. 10485 var buf []byte 10486 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10487 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10488 hdr.Len = n.SizeBytes() 10489 hdr.Cap = n.SizeBytes() 10490 10491 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10492 // Since we bypassed the compiler's escape analysis, indicate that n 10493 // must live until the use above. 10494 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10495 return length, err 10496 } 10497 10498 // CopyOut implements marshal.Marshallable.CopyOut. 10499 func (n *NfNATIPV4MultiRangeCompat) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10500 return n.CopyOutN(cc, addr, n.SizeBytes()) 10501 } 10502 10503 // CopyInN implements marshal.Marshallable.CopyInN. 10504 func (n *NfNATIPV4MultiRangeCompat) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10505 if !n.RangeIPV4.Packed() { 10506 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10507 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 10508 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10509 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10510 // partially unmarshalled struct. 10511 n.UnmarshalBytes(buf) // escapes: fallback. 10512 return length, err 10513 } 10514 10515 // Construct a slice backed by dst's underlying memory. 10516 var buf []byte 10517 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10518 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10519 hdr.Len = n.SizeBytes() 10520 hdr.Cap = n.SizeBytes() 10521 10522 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10523 // Since we bypassed the compiler's escape analysis, indicate that n 10524 // must live until the use above. 10525 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10526 return length, err 10527 } 10528 10529 // CopyIn implements marshal.Marshallable.CopyIn. 10530 func (n *NfNATIPV4MultiRangeCompat) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10531 return n.CopyInN(cc, addr, n.SizeBytes()) 10532 } 10533 10534 // WriteTo implements io.WriterTo.WriteTo. 10535 func (n *NfNATIPV4MultiRangeCompat) WriteTo(writer io.Writer) (int64, error) { 10536 if !n.RangeIPV4.Packed() { 10537 // Type NfNATIPV4MultiRangeCompat doesn't have a packed layout in memory, fall back to MarshalBytes. 10538 buf := make([]byte, n.SizeBytes()) 10539 n.MarshalBytes(buf) 10540 length, err := writer.Write(buf) 10541 return int64(length), err 10542 } 10543 10544 // Construct a slice backed by dst's underlying memory. 10545 var buf []byte 10546 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10547 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10548 hdr.Len = n.SizeBytes() 10549 hdr.Cap = n.SizeBytes() 10550 10551 length, err := writer.Write(buf) 10552 // Since we bypassed the compiler's escape analysis, indicate that n 10553 // must live until the use above. 10554 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10555 return int64(length), err 10556 } 10557 10558 // SizeBytes implements marshal.Marshallable.SizeBytes. 10559 func (n *NfNATIPV4Range) SizeBytes() int { 10560 return 8 + 10561 1*4 + 10562 1*4 10563 } 10564 10565 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10566 func (n *NfNATIPV4Range) MarshalBytes(dst []byte) []byte { 10567 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 10568 dst = dst[4:] 10569 for idx := 0; idx < 4; idx++ { 10570 dst[0] = byte(n.MinIP[idx]) 10571 dst = dst[1:] 10572 } 10573 for idx := 0; idx < 4; idx++ { 10574 dst[0] = byte(n.MaxIP[idx]) 10575 dst = dst[1:] 10576 } 10577 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinPort)) 10578 dst = dst[2:] 10579 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxPort)) 10580 dst = dst[2:] 10581 return dst 10582 } 10583 10584 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10585 func (n *NfNATIPV4Range) UnmarshalBytes(src []byte) []byte { 10586 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 10587 src = src[4:] 10588 for idx := 0; idx < 4; idx++ { 10589 n.MinIP[idx] = src[0] 10590 src = src[1:] 10591 } 10592 for idx := 0; idx < 4; idx++ { 10593 n.MaxIP[idx] = src[0] 10594 src = src[1:] 10595 } 10596 n.MinPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10597 src = src[2:] 10598 n.MaxPort = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10599 src = src[2:] 10600 return src 10601 } 10602 10603 // Packed implements marshal.Marshallable.Packed. 10604 //go:nosplit 10605 func (n *NfNATIPV4Range) Packed() bool { 10606 return true 10607 } 10608 10609 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10610 func (n *NfNATIPV4Range) MarshalUnsafe(dst []byte) []byte { 10611 size := n.SizeBytes() 10612 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 10613 return dst[size:] 10614 } 10615 10616 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10617 func (n *NfNATIPV4Range) UnmarshalUnsafe(src []byte) []byte { 10618 size := n.SizeBytes() 10619 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 10620 return src[size:] 10621 } 10622 10623 // CopyOutN implements marshal.Marshallable.CopyOutN. 10624 func (n *NfNATIPV4Range) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10625 // Construct a slice backed by dst's underlying memory. 10626 var buf []byte 10627 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10628 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10629 hdr.Len = n.SizeBytes() 10630 hdr.Cap = n.SizeBytes() 10631 10632 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10633 // Since we bypassed the compiler's escape analysis, indicate that n 10634 // must live until the use above. 10635 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10636 return length, err 10637 } 10638 10639 // CopyOut implements marshal.Marshallable.CopyOut. 10640 func (n *NfNATIPV4Range) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10641 return n.CopyOutN(cc, addr, n.SizeBytes()) 10642 } 10643 10644 // CopyInN implements marshal.Marshallable.CopyInN. 10645 func (n *NfNATIPV4Range) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10646 // Construct a slice backed by dst's underlying memory. 10647 var buf []byte 10648 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10649 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10650 hdr.Len = n.SizeBytes() 10651 hdr.Cap = n.SizeBytes() 10652 10653 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10654 // Since we bypassed the compiler's escape analysis, indicate that n 10655 // must live until the use above. 10656 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10657 return length, err 10658 } 10659 10660 // CopyIn implements marshal.Marshallable.CopyIn. 10661 func (n *NfNATIPV4Range) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10662 return n.CopyInN(cc, addr, n.SizeBytes()) 10663 } 10664 10665 // WriteTo implements io.WriterTo.WriteTo. 10666 func (n *NfNATIPV4Range) WriteTo(writer io.Writer) (int64, error) { 10667 // Construct a slice backed by dst's underlying memory. 10668 var buf []byte 10669 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10670 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 10671 hdr.Len = n.SizeBytes() 10672 hdr.Cap = n.SizeBytes() 10673 10674 length, err := writer.Write(buf) 10675 // Since we bypassed the compiler's escape analysis, indicate that n 10676 // must live until the use above. 10677 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 10678 return int64(length), err 10679 } 10680 10681 // SizeBytes implements marshal.Marshallable.SizeBytes. 10682 //go:nosplit 10683 func (tn *TableName) SizeBytes() int { 10684 return 1 * XT_TABLE_MAXNAMELEN 10685 } 10686 10687 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10688 func (tn *TableName) MarshalBytes(dst []byte) []byte { 10689 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 10690 dst[0] = byte(tn[idx]) 10691 dst = dst[1:] 10692 } 10693 return dst 10694 } 10695 10696 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10697 func (tn *TableName) UnmarshalBytes(src []byte) []byte { 10698 for idx := 0; idx < XT_TABLE_MAXNAMELEN; idx++ { 10699 tn[idx] = src[0] 10700 src = src[1:] 10701 } 10702 return src 10703 } 10704 10705 // Packed implements marshal.Marshallable.Packed. 10706 //go:nosplit 10707 func (tn *TableName) Packed() bool { 10708 // Array newtypes are always packed. 10709 return true 10710 } 10711 10712 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10713 func (tn *TableName) MarshalUnsafe(dst []byte) []byte { 10714 size := tn.SizeBytes() 10715 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&tn[0]), uintptr(size)) 10716 return dst[size:] 10717 } 10718 10719 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10720 func (tn *TableName) UnmarshalUnsafe(src []byte) []byte { 10721 size := tn.SizeBytes() 10722 gohacks.Memmove(unsafe.Pointer(tn), unsafe.Pointer(&src[0]), uintptr(size)) 10723 return src[size:] 10724 } 10725 10726 // CopyOutN implements marshal.Marshallable.CopyOutN. 10727 func (tn *TableName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10728 // Construct a slice backed by dst's underlying memory. 10729 var buf []byte 10730 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10731 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10732 hdr.Len = tn.SizeBytes() 10733 hdr.Cap = tn.SizeBytes() 10734 10735 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10736 // Since we bypassed the compiler's escape analysis, indicate that tn 10737 // must live until the use above. 10738 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10739 return length, err 10740 } 10741 10742 // CopyOut implements marshal.Marshallable.CopyOut. 10743 func (tn *TableName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10744 return tn.CopyOutN(cc, addr, tn.SizeBytes()) 10745 } 10746 10747 // CopyInN implements marshal.Marshallable.CopyInN. 10748 func (tn *TableName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10749 // Construct a slice backed by dst's underlying memory. 10750 var buf []byte 10751 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10752 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10753 hdr.Len = tn.SizeBytes() 10754 hdr.Cap = tn.SizeBytes() 10755 10756 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10757 // Since we bypassed the compiler's escape analysis, indicate that tn 10758 // must live until the use above. 10759 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10760 return length, err 10761 } 10762 10763 // CopyIn implements marshal.Marshallable.CopyIn. 10764 func (tn *TableName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10765 return tn.CopyInN(cc, addr, tn.SizeBytes()) 10766 } 10767 10768 // WriteTo implements io.WriterTo.WriteTo. 10769 func (tn *TableName) WriteTo(writer io.Writer) (int64, error) { 10770 // Construct a slice backed by dst's underlying memory. 10771 var buf []byte 10772 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10773 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tn))) 10774 hdr.Len = tn.SizeBytes() 10775 hdr.Cap = tn.SizeBytes() 10776 10777 length, err := writer.Write(buf) 10778 // Since we bypassed the compiler's escape analysis, indicate that tn 10779 // must live until the use above. 10780 runtime.KeepAlive(tn) // escapes: replaced by intrinsic. 10781 return int64(length), err 10782 } 10783 10784 // SizeBytes implements marshal.Marshallable.SizeBytes. 10785 func (x *XTCounters) SizeBytes() int { 10786 return 16 10787 } 10788 10789 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10790 func (x *XTCounters) MarshalBytes(dst []byte) []byte { 10791 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Pcnt)) 10792 dst = dst[8:] 10793 hostarch.ByteOrder.PutUint64(dst[:8], uint64(x.Bcnt)) 10794 dst = dst[8:] 10795 return dst 10796 } 10797 10798 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10799 func (x *XTCounters) UnmarshalBytes(src []byte) []byte { 10800 x.Pcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10801 src = src[8:] 10802 x.Bcnt = uint64(hostarch.ByteOrder.Uint64(src[:8])) 10803 src = src[8:] 10804 return src 10805 } 10806 10807 // Packed implements marshal.Marshallable.Packed. 10808 //go:nosplit 10809 func (x *XTCounters) Packed() bool { 10810 return true 10811 } 10812 10813 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10814 func (x *XTCounters) MarshalUnsafe(dst []byte) []byte { 10815 size := x.SizeBytes() 10816 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10817 return dst[size:] 10818 } 10819 10820 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10821 func (x *XTCounters) UnmarshalUnsafe(src []byte) []byte { 10822 size := x.SizeBytes() 10823 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10824 return src[size:] 10825 } 10826 10827 // CopyOutN implements marshal.Marshallable.CopyOutN. 10828 func (x *XTCounters) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10829 // Construct a slice backed by dst's underlying memory. 10830 var buf []byte 10831 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10832 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10833 hdr.Len = x.SizeBytes() 10834 hdr.Cap = x.SizeBytes() 10835 10836 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10837 // Since we bypassed the compiler's escape analysis, indicate that x 10838 // must live until the use above. 10839 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10840 return length, err 10841 } 10842 10843 // CopyOut implements marshal.Marshallable.CopyOut. 10844 func (x *XTCounters) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10845 return x.CopyOutN(cc, addr, x.SizeBytes()) 10846 } 10847 10848 // CopyInN implements marshal.Marshallable.CopyInN. 10849 func (x *XTCounters) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10850 // Construct a slice backed by dst's underlying memory. 10851 var buf []byte 10852 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10853 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10854 hdr.Len = x.SizeBytes() 10855 hdr.Cap = x.SizeBytes() 10856 10857 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10858 // Since we bypassed the compiler's escape analysis, indicate that x 10859 // must live until the use above. 10860 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10861 return length, err 10862 } 10863 10864 // CopyIn implements marshal.Marshallable.CopyIn. 10865 func (x *XTCounters) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10866 return x.CopyInN(cc, addr, x.SizeBytes()) 10867 } 10868 10869 // WriteTo implements io.WriterTo.WriteTo. 10870 func (x *XTCounters) WriteTo(writer io.Writer) (int64, error) { 10871 // Construct a slice backed by dst's underlying memory. 10872 var buf []byte 10873 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10874 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10875 hdr.Len = x.SizeBytes() 10876 hdr.Cap = x.SizeBytes() 10877 10878 length, err := writer.Write(buf) 10879 // Since we bypassed the compiler's escape analysis, indicate that x 10880 // must live until the use above. 10881 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10882 return int64(length), err 10883 } 10884 10885 // SizeBytes implements marshal.Marshallable.SizeBytes. 10886 func (x *XTEntryMatch) SizeBytes() int { 10887 return 3 + 10888 (*ExtensionName)(nil).SizeBytes() 10889 } 10890 10891 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 10892 func (x *XTEntryMatch) MarshalBytes(dst []byte) []byte { 10893 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.MatchSize)) 10894 dst = dst[2:] 10895 dst = x.Name.MarshalUnsafe(dst) 10896 dst[0] = byte(x.Revision) 10897 dst = dst[1:] 10898 return dst 10899 } 10900 10901 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 10902 func (x *XTEntryMatch) UnmarshalBytes(src []byte) []byte { 10903 x.MatchSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 10904 src = src[2:] 10905 src = x.Name.UnmarshalUnsafe(src) 10906 x.Revision = uint8(src[0]) 10907 src = src[1:] 10908 return src 10909 } 10910 10911 // Packed implements marshal.Marshallable.Packed. 10912 //go:nosplit 10913 func (x *XTEntryMatch) Packed() bool { 10914 return x.Name.Packed() 10915 } 10916 10917 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 10918 func (x *XTEntryMatch) MarshalUnsafe(dst []byte) []byte { 10919 if x.Name.Packed() { 10920 size := x.SizeBytes() 10921 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 10922 return dst[size:] 10923 } 10924 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to MarshalBytes. 10925 return x.MarshalBytes(dst) 10926 } 10927 10928 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 10929 func (x *XTEntryMatch) UnmarshalUnsafe(src []byte) []byte { 10930 if x.Name.Packed() { 10931 size := x.SizeBytes() 10932 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 10933 return src[size:] 10934 } 10935 // Type XTEntryMatch doesn't have a packed layout in memory, fallback to UnmarshalBytes. 10936 return x.UnmarshalBytes(src) 10937 } 10938 10939 // CopyOutN implements marshal.Marshallable.CopyOutN. 10940 func (x *XTEntryMatch) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10941 if !x.Name.Packed() { 10942 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 10943 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10944 x.MarshalBytes(buf) // escapes: fallback. 10945 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10946 } 10947 10948 // Construct a slice backed by dst's underlying memory. 10949 var buf []byte 10950 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10951 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10952 hdr.Len = x.SizeBytes() 10953 hdr.Cap = x.SizeBytes() 10954 10955 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 10956 // Since we bypassed the compiler's escape analysis, indicate that x 10957 // must live until the use above. 10958 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10959 return length, err 10960 } 10961 10962 // CopyOut implements marshal.Marshallable.CopyOut. 10963 func (x *XTEntryMatch) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10964 return x.CopyOutN(cc, addr, x.SizeBytes()) 10965 } 10966 10967 // CopyInN implements marshal.Marshallable.CopyInN. 10968 func (x *XTEntryMatch) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 10969 if !x.Name.Packed() { 10970 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to UnmarshalBytes. 10971 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 10972 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10973 // Unmarshal unconditionally. If we had a short copy-in, this results in a 10974 // partially unmarshalled struct. 10975 x.UnmarshalBytes(buf) // escapes: fallback. 10976 return length, err 10977 } 10978 10979 // Construct a slice backed by dst's underlying memory. 10980 var buf []byte 10981 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 10982 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 10983 hdr.Len = x.SizeBytes() 10984 hdr.Cap = x.SizeBytes() 10985 10986 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 10987 // Since we bypassed the compiler's escape analysis, indicate that x 10988 // must live until the use above. 10989 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 10990 return length, err 10991 } 10992 10993 // CopyIn implements marshal.Marshallable.CopyIn. 10994 func (x *XTEntryMatch) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 10995 return x.CopyInN(cc, addr, x.SizeBytes()) 10996 } 10997 10998 // WriteTo implements io.WriterTo.WriteTo. 10999 func (x *XTEntryMatch) WriteTo(writer io.Writer) (int64, error) { 11000 if !x.Name.Packed() { 11001 // Type XTEntryMatch doesn't have a packed layout in memory, fall back to MarshalBytes. 11002 buf := make([]byte, x.SizeBytes()) 11003 x.MarshalBytes(buf) 11004 length, err := writer.Write(buf) 11005 return int64(length), err 11006 } 11007 11008 // Construct a slice backed by dst's underlying memory. 11009 var buf []byte 11010 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11011 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11012 hdr.Len = x.SizeBytes() 11013 hdr.Cap = x.SizeBytes() 11014 11015 length, err := writer.Write(buf) 11016 // Since we bypassed the compiler's escape analysis, indicate that x 11017 // must live until the use above. 11018 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11019 return int64(length), err 11020 } 11021 11022 // SizeBytes implements marshal.Marshallable.SizeBytes. 11023 func (x *XTEntryTarget) SizeBytes() int { 11024 return 3 + 11025 (*ExtensionName)(nil).SizeBytes() 11026 } 11027 11028 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11029 func (x *XTEntryTarget) MarshalBytes(dst []byte) []byte { 11030 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.TargetSize)) 11031 dst = dst[2:] 11032 dst = x.Name.MarshalUnsafe(dst) 11033 dst[0] = byte(x.Revision) 11034 dst = dst[1:] 11035 return dst 11036 } 11037 11038 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11039 func (x *XTEntryTarget) UnmarshalBytes(src []byte) []byte { 11040 x.TargetSize = uint16(hostarch.ByteOrder.Uint16(src[:2])) 11041 src = src[2:] 11042 src = x.Name.UnmarshalUnsafe(src) 11043 x.Revision = uint8(src[0]) 11044 src = src[1:] 11045 return src 11046 } 11047 11048 // Packed implements marshal.Marshallable.Packed. 11049 //go:nosplit 11050 func (x *XTEntryTarget) Packed() bool { 11051 return x.Name.Packed() 11052 } 11053 11054 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11055 func (x *XTEntryTarget) MarshalUnsafe(dst []byte) []byte { 11056 if x.Name.Packed() { 11057 size := x.SizeBytes() 11058 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11059 return dst[size:] 11060 } 11061 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11062 return x.MarshalBytes(dst) 11063 } 11064 11065 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11066 func (x *XTEntryTarget) UnmarshalUnsafe(src []byte) []byte { 11067 if x.Name.Packed() { 11068 size := x.SizeBytes() 11069 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11070 return src[size:] 11071 } 11072 // Type XTEntryTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11073 return x.UnmarshalBytes(src) 11074 } 11075 11076 // CopyOutN implements marshal.Marshallable.CopyOutN. 11077 func (x *XTEntryTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11078 if !x.Name.Packed() { 11079 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11080 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11081 x.MarshalBytes(buf) // escapes: fallback. 11082 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11083 } 11084 11085 // Construct a slice backed by dst's underlying memory. 11086 var buf []byte 11087 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11088 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11089 hdr.Len = x.SizeBytes() 11090 hdr.Cap = x.SizeBytes() 11091 11092 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11093 // Since we bypassed the compiler's escape analysis, indicate that x 11094 // must live until the use above. 11095 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11096 return length, err 11097 } 11098 11099 // CopyOut implements marshal.Marshallable.CopyOut. 11100 func (x *XTEntryTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11101 return x.CopyOutN(cc, addr, x.SizeBytes()) 11102 } 11103 11104 // CopyInN implements marshal.Marshallable.CopyInN. 11105 func (x *XTEntryTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11106 if !x.Name.Packed() { 11107 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11108 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11109 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11110 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11111 // partially unmarshalled struct. 11112 x.UnmarshalBytes(buf) // escapes: fallback. 11113 return length, err 11114 } 11115 11116 // Construct a slice backed by dst's underlying memory. 11117 var buf []byte 11118 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11119 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11120 hdr.Len = x.SizeBytes() 11121 hdr.Cap = x.SizeBytes() 11122 11123 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11124 // Since we bypassed the compiler's escape analysis, indicate that x 11125 // must live until the use above. 11126 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11127 return length, err 11128 } 11129 11130 // CopyIn implements marshal.Marshallable.CopyIn. 11131 func (x *XTEntryTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11132 return x.CopyInN(cc, addr, x.SizeBytes()) 11133 } 11134 11135 // WriteTo implements io.WriterTo.WriteTo. 11136 func (x *XTEntryTarget) WriteTo(writer io.Writer) (int64, error) { 11137 if !x.Name.Packed() { 11138 // Type XTEntryTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11139 buf := make([]byte, x.SizeBytes()) 11140 x.MarshalBytes(buf) 11141 length, err := writer.Write(buf) 11142 return int64(length), err 11143 } 11144 11145 // Construct a slice backed by dst's underlying memory. 11146 var buf []byte 11147 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11148 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11149 hdr.Len = x.SizeBytes() 11150 hdr.Cap = x.SizeBytes() 11151 11152 length, err := writer.Write(buf) 11153 // Since we bypassed the compiler's escape analysis, indicate that x 11154 // must live until the use above. 11155 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11156 return int64(length), err 11157 } 11158 11159 // SizeBytes implements marshal.Marshallable.SizeBytes. 11160 func (x *XTErrorTarget) SizeBytes() int { 11161 return 0 + 11162 (*XTEntryTarget)(nil).SizeBytes() + 11163 (*ErrorName)(nil).SizeBytes() + 11164 1*2 11165 } 11166 11167 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11168 func (x *XTErrorTarget) MarshalBytes(dst []byte) []byte { 11169 dst = x.Target.MarshalUnsafe(dst) 11170 dst = x.Name.MarshalUnsafe(dst) 11171 // Padding: dst[:sizeof(byte)*2] ~= [2]byte{0} 11172 dst = dst[1*(2):] 11173 return dst 11174 } 11175 11176 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11177 func (x *XTErrorTarget) UnmarshalBytes(src []byte) []byte { 11178 src = x.Target.UnmarshalUnsafe(src) 11179 src = x.Name.UnmarshalUnsafe(src) 11180 // Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2]) 11181 src = src[1*(2):] 11182 return src 11183 } 11184 11185 // Packed implements marshal.Marshallable.Packed. 11186 //go:nosplit 11187 func (x *XTErrorTarget) Packed() bool { 11188 return x.Name.Packed() && x.Target.Packed() 11189 } 11190 11191 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11192 func (x *XTErrorTarget) MarshalUnsafe(dst []byte) []byte { 11193 if x.Name.Packed() && x.Target.Packed() { 11194 size := x.SizeBytes() 11195 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11196 return dst[size:] 11197 } 11198 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11199 return x.MarshalBytes(dst) 11200 } 11201 11202 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11203 func (x *XTErrorTarget) UnmarshalUnsafe(src []byte) []byte { 11204 if x.Name.Packed() && x.Target.Packed() { 11205 size := x.SizeBytes() 11206 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11207 return src[size:] 11208 } 11209 // Type XTErrorTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11210 return x.UnmarshalBytes(src) 11211 } 11212 11213 // CopyOutN implements marshal.Marshallable.CopyOutN. 11214 func (x *XTErrorTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11215 if !x.Name.Packed() && x.Target.Packed() { 11216 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11217 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11218 x.MarshalBytes(buf) // escapes: fallback. 11219 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11220 } 11221 11222 // Construct a slice backed by dst's underlying memory. 11223 var buf []byte 11224 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11225 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11226 hdr.Len = x.SizeBytes() 11227 hdr.Cap = x.SizeBytes() 11228 11229 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11230 // Since we bypassed the compiler's escape analysis, indicate that x 11231 // must live until the use above. 11232 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11233 return length, err 11234 } 11235 11236 // CopyOut implements marshal.Marshallable.CopyOut. 11237 func (x *XTErrorTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11238 return x.CopyOutN(cc, addr, x.SizeBytes()) 11239 } 11240 11241 // CopyInN implements marshal.Marshallable.CopyInN. 11242 func (x *XTErrorTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11243 if !x.Name.Packed() && x.Target.Packed() { 11244 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11245 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11246 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11247 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11248 // partially unmarshalled struct. 11249 x.UnmarshalBytes(buf) // escapes: fallback. 11250 return length, err 11251 } 11252 11253 // Construct a slice backed by dst's underlying memory. 11254 var buf []byte 11255 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11256 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11257 hdr.Len = x.SizeBytes() 11258 hdr.Cap = x.SizeBytes() 11259 11260 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11261 // Since we bypassed the compiler's escape analysis, indicate that x 11262 // must live until the use above. 11263 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11264 return length, err 11265 } 11266 11267 // CopyIn implements marshal.Marshallable.CopyIn. 11268 func (x *XTErrorTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11269 return x.CopyInN(cc, addr, x.SizeBytes()) 11270 } 11271 11272 // WriteTo implements io.WriterTo.WriteTo. 11273 func (x *XTErrorTarget) WriteTo(writer io.Writer) (int64, error) { 11274 if !x.Name.Packed() && x.Target.Packed() { 11275 // Type XTErrorTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 11276 buf := make([]byte, x.SizeBytes()) 11277 x.MarshalBytes(buf) 11278 length, err := writer.Write(buf) 11279 return int64(length), err 11280 } 11281 11282 // Construct a slice backed by dst's underlying memory. 11283 var buf []byte 11284 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11285 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11286 hdr.Len = x.SizeBytes() 11287 hdr.Cap = x.SizeBytes() 11288 11289 length, err := writer.Write(buf) 11290 // Since we bypassed the compiler's escape analysis, indicate that x 11291 // must live until the use above. 11292 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11293 return int64(length), err 11294 } 11295 11296 // SizeBytes implements marshal.Marshallable.SizeBytes. 11297 func (x *XTGetRevision) SizeBytes() int { 11298 return 1 + 11299 (*ExtensionName)(nil).SizeBytes() 11300 } 11301 11302 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11303 func (x *XTGetRevision) MarshalBytes(dst []byte) []byte { 11304 dst = x.Name.MarshalUnsafe(dst) 11305 dst[0] = byte(x.Revision) 11306 dst = dst[1:] 11307 return dst 11308 } 11309 11310 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11311 func (x *XTGetRevision) UnmarshalBytes(src []byte) []byte { 11312 src = x.Name.UnmarshalUnsafe(src) 11313 x.Revision = uint8(src[0]) 11314 src = src[1:] 11315 return src 11316 } 11317 11318 // Packed implements marshal.Marshallable.Packed. 11319 //go:nosplit 11320 func (x *XTGetRevision) Packed() bool { 11321 return x.Name.Packed() 11322 } 11323 11324 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11325 func (x *XTGetRevision) MarshalUnsafe(dst []byte) []byte { 11326 if x.Name.Packed() { 11327 size := x.SizeBytes() 11328 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11329 return dst[size:] 11330 } 11331 // Type XTGetRevision doesn't have a packed layout in memory, fallback to MarshalBytes. 11332 return x.MarshalBytes(dst) 11333 } 11334 11335 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11336 func (x *XTGetRevision) UnmarshalUnsafe(src []byte) []byte { 11337 if x.Name.Packed() { 11338 size := x.SizeBytes() 11339 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11340 return src[size:] 11341 } 11342 // Type XTGetRevision doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11343 return x.UnmarshalBytes(src) 11344 } 11345 11346 // CopyOutN implements marshal.Marshallable.CopyOutN. 11347 func (x *XTGetRevision) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11348 if !x.Name.Packed() { 11349 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 11350 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11351 x.MarshalBytes(buf) // escapes: fallback. 11352 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11353 } 11354 11355 // Construct a slice backed by dst's underlying memory. 11356 var buf []byte 11357 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11358 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11359 hdr.Len = x.SizeBytes() 11360 hdr.Cap = x.SizeBytes() 11361 11362 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11363 // Since we bypassed the compiler's escape analysis, indicate that x 11364 // must live until the use above. 11365 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11366 return length, err 11367 } 11368 11369 // CopyOut implements marshal.Marshallable.CopyOut. 11370 func (x *XTGetRevision) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11371 return x.CopyOutN(cc, addr, x.SizeBytes()) 11372 } 11373 11374 // CopyInN implements marshal.Marshallable.CopyInN. 11375 func (x *XTGetRevision) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11376 if !x.Name.Packed() { 11377 // Type XTGetRevision doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11378 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11379 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11380 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11381 // partially unmarshalled struct. 11382 x.UnmarshalBytes(buf) // escapes: fallback. 11383 return length, err 11384 } 11385 11386 // Construct a slice backed by dst's underlying memory. 11387 var buf []byte 11388 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11389 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11390 hdr.Len = x.SizeBytes() 11391 hdr.Cap = x.SizeBytes() 11392 11393 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11394 // Since we bypassed the compiler's escape analysis, indicate that x 11395 // must live until the use above. 11396 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11397 return length, err 11398 } 11399 11400 // CopyIn implements marshal.Marshallable.CopyIn. 11401 func (x *XTGetRevision) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11402 return x.CopyInN(cc, addr, x.SizeBytes()) 11403 } 11404 11405 // WriteTo implements io.WriterTo.WriteTo. 11406 func (x *XTGetRevision) WriteTo(writer io.Writer) (int64, error) { 11407 if !x.Name.Packed() { 11408 // Type XTGetRevision doesn't have a packed layout in memory, fall back to MarshalBytes. 11409 buf := make([]byte, x.SizeBytes()) 11410 x.MarshalBytes(buf) 11411 length, err := writer.Write(buf) 11412 return int64(length), err 11413 } 11414 11415 // Construct a slice backed by dst's underlying memory. 11416 var buf []byte 11417 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11418 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11419 hdr.Len = x.SizeBytes() 11420 hdr.Cap = x.SizeBytes() 11421 11422 length, err := writer.Write(buf) 11423 // Since we bypassed the compiler's escape analysis, indicate that x 11424 // must live until the use above. 11425 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11426 return int64(length), err 11427 } 11428 11429 // SizeBytes implements marshal.Marshallable.SizeBytes. 11430 func (x *XTNATTargetV0) SizeBytes() int { 11431 return 0 + 11432 (*XTEntryTarget)(nil).SizeBytes() + 11433 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 11434 1*4 11435 } 11436 11437 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11438 func (x *XTNATTargetV0) MarshalBytes(dst []byte) []byte { 11439 dst = x.Target.MarshalUnsafe(dst) 11440 dst = x.NfRange.MarshalUnsafe(dst) 11441 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11442 dst = dst[1*(4):] 11443 return dst 11444 } 11445 11446 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11447 func (x *XTNATTargetV0) UnmarshalBytes(src []byte) []byte { 11448 src = x.Target.UnmarshalUnsafe(src) 11449 src = x.NfRange.UnmarshalUnsafe(src) 11450 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 11451 src = src[1*(4):] 11452 return src 11453 } 11454 11455 // Packed implements marshal.Marshallable.Packed. 11456 //go:nosplit 11457 func (x *XTNATTargetV0) Packed() bool { 11458 return x.NfRange.Packed() && x.Target.Packed() 11459 } 11460 11461 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11462 func (x *XTNATTargetV0) MarshalUnsafe(dst []byte) []byte { 11463 if x.NfRange.Packed() && x.Target.Packed() { 11464 size := x.SizeBytes() 11465 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11466 return dst[size:] 11467 } 11468 // Type XTNATTargetV0 doesn't have a packed layout in memory, fallback to MarshalBytes. 11469 return x.MarshalBytes(dst) 11470 } 11471 11472 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11473 func (x *XTNATTargetV0) UnmarshalUnsafe(src []byte) []byte { 11474 if x.NfRange.Packed() && x.Target.Packed() { 11475 size := x.SizeBytes() 11476 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11477 return src[size:] 11478 } 11479 // Type XTNATTargetV0 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11480 return x.UnmarshalBytes(src) 11481 } 11482 11483 // CopyOutN implements marshal.Marshallable.CopyOutN. 11484 func (x *XTNATTargetV0) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11485 if !x.NfRange.Packed() && x.Target.Packed() { 11486 // Type XTNATTargetV0 doesn't have a packed layout in memory, fall back to MarshalBytes. 11487 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11488 x.MarshalBytes(buf) // escapes: fallback. 11489 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11490 } 11491 11492 // Construct a slice backed by dst's underlying memory. 11493 var buf []byte 11494 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11495 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11496 hdr.Len = x.SizeBytes() 11497 hdr.Cap = x.SizeBytes() 11498 11499 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11500 // Since we bypassed the compiler's escape analysis, indicate that x 11501 // must live until the use above. 11502 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11503 return length, err 11504 } 11505 11506 // CopyOut implements marshal.Marshallable.CopyOut. 11507 func (x *XTNATTargetV0) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11508 return x.CopyOutN(cc, addr, x.SizeBytes()) 11509 } 11510 11511 // CopyInN implements marshal.Marshallable.CopyInN. 11512 func (x *XTNATTargetV0) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11513 if !x.NfRange.Packed() && x.Target.Packed() { 11514 // Type XTNATTargetV0 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11515 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11516 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11517 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11518 // partially unmarshalled struct. 11519 x.UnmarshalBytes(buf) // escapes: fallback. 11520 return length, err 11521 } 11522 11523 // Construct a slice backed by dst's underlying memory. 11524 var buf []byte 11525 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11526 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11527 hdr.Len = x.SizeBytes() 11528 hdr.Cap = x.SizeBytes() 11529 11530 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11531 // Since we bypassed the compiler's escape analysis, indicate that x 11532 // must live until the use above. 11533 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11534 return length, err 11535 } 11536 11537 // CopyIn implements marshal.Marshallable.CopyIn. 11538 func (x *XTNATTargetV0) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11539 return x.CopyInN(cc, addr, x.SizeBytes()) 11540 } 11541 11542 // WriteTo implements io.WriterTo.WriteTo. 11543 func (x *XTNATTargetV0) WriteTo(writer io.Writer) (int64, error) { 11544 if !x.NfRange.Packed() && x.Target.Packed() { 11545 // Type XTNATTargetV0 doesn't have a packed layout in memory, fall back to MarshalBytes. 11546 buf := make([]byte, x.SizeBytes()) 11547 x.MarshalBytes(buf) 11548 length, err := writer.Write(buf) 11549 return int64(length), err 11550 } 11551 11552 // Construct a slice backed by dst's underlying memory. 11553 var buf []byte 11554 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11555 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11556 hdr.Len = x.SizeBytes() 11557 hdr.Cap = x.SizeBytes() 11558 11559 length, err := writer.Write(buf) 11560 // Since we bypassed the compiler's escape analysis, indicate that x 11561 // must live until the use above. 11562 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11563 return int64(length), err 11564 } 11565 11566 // SizeBytes implements marshal.Marshallable.SizeBytes. 11567 func (x *XTNATTargetV1) SizeBytes() int { 11568 return 0 + 11569 (*XTEntryTarget)(nil).SizeBytes() + 11570 (*NFNATRange)(nil).SizeBytes() 11571 } 11572 11573 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11574 func (x *XTNATTargetV1) MarshalBytes(dst []byte) []byte { 11575 dst = x.Target.MarshalUnsafe(dst) 11576 dst = x.Range.MarshalUnsafe(dst) 11577 return dst 11578 } 11579 11580 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11581 func (x *XTNATTargetV1) UnmarshalBytes(src []byte) []byte { 11582 src = x.Target.UnmarshalUnsafe(src) 11583 src = x.Range.UnmarshalUnsafe(src) 11584 return src 11585 } 11586 11587 // Packed implements marshal.Marshallable.Packed. 11588 //go:nosplit 11589 func (x *XTNATTargetV1) Packed() bool { 11590 return x.Range.Packed() && x.Target.Packed() 11591 } 11592 11593 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11594 func (x *XTNATTargetV1) MarshalUnsafe(dst []byte) []byte { 11595 if x.Range.Packed() && x.Target.Packed() { 11596 size := x.SizeBytes() 11597 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11598 return dst[size:] 11599 } 11600 // Type XTNATTargetV1 doesn't have a packed layout in memory, fallback to MarshalBytes. 11601 return x.MarshalBytes(dst) 11602 } 11603 11604 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11605 func (x *XTNATTargetV1) UnmarshalUnsafe(src []byte) []byte { 11606 if x.Range.Packed() && x.Target.Packed() { 11607 size := x.SizeBytes() 11608 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11609 return src[size:] 11610 } 11611 // Type XTNATTargetV1 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11612 return x.UnmarshalBytes(src) 11613 } 11614 11615 // CopyOutN implements marshal.Marshallable.CopyOutN. 11616 func (x *XTNATTargetV1) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11617 if !x.Range.Packed() && x.Target.Packed() { 11618 // Type XTNATTargetV1 doesn't have a packed layout in memory, fall back to MarshalBytes. 11619 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11620 x.MarshalBytes(buf) // escapes: fallback. 11621 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11622 } 11623 11624 // Construct a slice backed by dst's underlying memory. 11625 var buf []byte 11626 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11627 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11628 hdr.Len = x.SizeBytes() 11629 hdr.Cap = x.SizeBytes() 11630 11631 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11632 // Since we bypassed the compiler's escape analysis, indicate that x 11633 // must live until the use above. 11634 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11635 return length, err 11636 } 11637 11638 // CopyOut implements marshal.Marshallable.CopyOut. 11639 func (x *XTNATTargetV1) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11640 return x.CopyOutN(cc, addr, x.SizeBytes()) 11641 } 11642 11643 // CopyInN implements marshal.Marshallable.CopyInN. 11644 func (x *XTNATTargetV1) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11645 if !x.Range.Packed() && x.Target.Packed() { 11646 // Type XTNATTargetV1 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11647 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11648 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11649 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11650 // partially unmarshalled struct. 11651 x.UnmarshalBytes(buf) // escapes: fallback. 11652 return length, err 11653 } 11654 11655 // Construct a slice backed by dst's underlying memory. 11656 var buf []byte 11657 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11658 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11659 hdr.Len = x.SizeBytes() 11660 hdr.Cap = x.SizeBytes() 11661 11662 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11663 // Since we bypassed the compiler's escape analysis, indicate that x 11664 // must live until the use above. 11665 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11666 return length, err 11667 } 11668 11669 // CopyIn implements marshal.Marshallable.CopyIn. 11670 func (x *XTNATTargetV1) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11671 return x.CopyInN(cc, addr, x.SizeBytes()) 11672 } 11673 11674 // WriteTo implements io.WriterTo.WriteTo. 11675 func (x *XTNATTargetV1) WriteTo(writer io.Writer) (int64, error) { 11676 if !x.Range.Packed() && x.Target.Packed() { 11677 // Type XTNATTargetV1 doesn't have a packed layout in memory, fall back to MarshalBytes. 11678 buf := make([]byte, x.SizeBytes()) 11679 x.MarshalBytes(buf) 11680 length, err := writer.Write(buf) 11681 return int64(length), err 11682 } 11683 11684 // Construct a slice backed by dst's underlying memory. 11685 var buf []byte 11686 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11687 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11688 hdr.Len = x.SizeBytes() 11689 hdr.Cap = x.SizeBytes() 11690 11691 length, err := writer.Write(buf) 11692 // Since we bypassed the compiler's escape analysis, indicate that x 11693 // must live until the use above. 11694 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11695 return int64(length), err 11696 } 11697 11698 // SizeBytes implements marshal.Marshallable.SizeBytes. 11699 func (x *XTNATTargetV2) SizeBytes() int { 11700 return 0 + 11701 (*XTEntryTarget)(nil).SizeBytes() + 11702 (*NFNATRange2)(nil).SizeBytes() 11703 } 11704 11705 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11706 func (x *XTNATTargetV2) MarshalBytes(dst []byte) []byte { 11707 dst = x.Target.MarshalUnsafe(dst) 11708 dst = x.Range.MarshalUnsafe(dst) 11709 return dst 11710 } 11711 11712 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11713 func (x *XTNATTargetV2) UnmarshalBytes(src []byte) []byte { 11714 src = x.Target.UnmarshalUnsafe(src) 11715 src = x.Range.UnmarshalUnsafe(src) 11716 return src 11717 } 11718 11719 // Packed implements marshal.Marshallable.Packed. 11720 //go:nosplit 11721 func (x *XTNATTargetV2) Packed() bool { 11722 return x.Range.Packed() && x.Target.Packed() 11723 } 11724 11725 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11726 func (x *XTNATTargetV2) MarshalUnsafe(dst []byte) []byte { 11727 if x.Range.Packed() && x.Target.Packed() { 11728 size := x.SizeBytes() 11729 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11730 return dst[size:] 11731 } 11732 // Type XTNATTargetV2 doesn't have a packed layout in memory, fallback to MarshalBytes. 11733 return x.MarshalBytes(dst) 11734 } 11735 11736 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11737 func (x *XTNATTargetV2) UnmarshalUnsafe(src []byte) []byte { 11738 if x.Range.Packed() && x.Target.Packed() { 11739 size := x.SizeBytes() 11740 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11741 return src[size:] 11742 } 11743 // Type XTNATTargetV2 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 11744 return x.UnmarshalBytes(src) 11745 } 11746 11747 // CopyOutN implements marshal.Marshallable.CopyOutN. 11748 func (x *XTNATTargetV2) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11749 if !x.Range.Packed() && x.Target.Packed() { 11750 // Type XTNATTargetV2 doesn't have a packed layout in memory, fall back to MarshalBytes. 11751 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11752 x.MarshalBytes(buf) // escapes: fallback. 11753 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11754 } 11755 11756 // Construct a slice backed by dst's underlying memory. 11757 var buf []byte 11758 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11759 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11760 hdr.Len = x.SizeBytes() 11761 hdr.Cap = x.SizeBytes() 11762 11763 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11764 // Since we bypassed the compiler's escape analysis, indicate that x 11765 // must live until the use above. 11766 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11767 return length, err 11768 } 11769 11770 // CopyOut implements marshal.Marshallable.CopyOut. 11771 func (x *XTNATTargetV2) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11772 return x.CopyOutN(cc, addr, x.SizeBytes()) 11773 } 11774 11775 // CopyInN implements marshal.Marshallable.CopyInN. 11776 func (x *XTNATTargetV2) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11777 if !x.Range.Packed() && x.Target.Packed() { 11778 // Type XTNATTargetV2 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 11779 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 11780 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11781 // Unmarshal unconditionally. If we had a short copy-in, this results in a 11782 // partially unmarshalled struct. 11783 x.UnmarshalBytes(buf) // escapes: fallback. 11784 return length, err 11785 } 11786 11787 // Construct a slice backed by dst's underlying memory. 11788 var buf []byte 11789 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11790 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11791 hdr.Len = x.SizeBytes() 11792 hdr.Cap = x.SizeBytes() 11793 11794 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11795 // Since we bypassed the compiler's escape analysis, indicate that x 11796 // must live until the use above. 11797 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11798 return length, err 11799 } 11800 11801 // CopyIn implements marshal.Marshallable.CopyIn. 11802 func (x *XTNATTargetV2) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11803 return x.CopyInN(cc, addr, x.SizeBytes()) 11804 } 11805 11806 // WriteTo implements io.WriterTo.WriteTo. 11807 func (x *XTNATTargetV2) WriteTo(writer io.Writer) (int64, error) { 11808 if !x.Range.Packed() && x.Target.Packed() { 11809 // Type XTNATTargetV2 doesn't have a packed layout in memory, fall back to MarshalBytes. 11810 buf := make([]byte, x.SizeBytes()) 11811 x.MarshalBytes(buf) 11812 length, err := writer.Write(buf) 11813 return int64(length), err 11814 } 11815 11816 // Construct a slice backed by dst's underlying memory. 11817 var buf []byte 11818 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11819 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11820 hdr.Len = x.SizeBytes() 11821 hdr.Cap = x.SizeBytes() 11822 11823 length, err := writer.Write(buf) 11824 // Since we bypassed the compiler's escape analysis, indicate that x 11825 // must live until the use above. 11826 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11827 return int64(length), err 11828 } 11829 11830 // SizeBytes implements marshal.Marshallable.SizeBytes. 11831 func (x *XTOwnerMatchInfo) SizeBytes() int { 11832 return 18 + 11833 1*2 11834 } 11835 11836 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11837 func (x *XTOwnerMatchInfo) MarshalBytes(dst []byte) []byte { 11838 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.UIDMin)) 11839 dst = dst[4:] 11840 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.UIDMax)) 11841 dst = dst[4:] 11842 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.GIDMin)) 11843 dst = dst[4:] 11844 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.GIDMax)) 11845 dst = dst[4:] 11846 dst[0] = byte(x.Match) 11847 dst = dst[1:] 11848 dst[0] = byte(x.Invert) 11849 dst = dst[1:] 11850 // Padding: dst[:sizeof(byte)*2] ~= [2]byte{0} 11851 dst = dst[1*(2):] 11852 return dst 11853 } 11854 11855 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11856 func (x *XTOwnerMatchInfo) UnmarshalBytes(src []byte) []byte { 11857 x.UIDMin = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11858 src = src[4:] 11859 x.UIDMax = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11860 src = src[4:] 11861 x.GIDMin = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11862 src = src[4:] 11863 x.GIDMax = uint32(hostarch.ByteOrder.Uint32(src[:4])) 11864 src = src[4:] 11865 x.Match = uint8(src[0]) 11866 src = src[1:] 11867 x.Invert = uint8(src[0]) 11868 src = src[1:] 11869 // Padding: ~ copy([2]byte(x._), src[:sizeof(byte)*2]) 11870 src = src[1*(2):] 11871 return src 11872 } 11873 11874 // Packed implements marshal.Marshallable.Packed. 11875 //go:nosplit 11876 func (x *XTOwnerMatchInfo) Packed() bool { 11877 return true 11878 } 11879 11880 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11881 func (x *XTOwnerMatchInfo) MarshalUnsafe(dst []byte) []byte { 11882 size := x.SizeBytes() 11883 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11884 return dst[size:] 11885 } 11886 11887 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11888 func (x *XTOwnerMatchInfo) UnmarshalUnsafe(src []byte) []byte { 11889 size := x.SizeBytes() 11890 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 11891 return src[size:] 11892 } 11893 11894 // CopyOutN implements marshal.Marshallable.CopyOutN. 11895 func (x *XTOwnerMatchInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11896 // Construct a slice backed by dst's underlying memory. 11897 var buf []byte 11898 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11899 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11900 hdr.Len = x.SizeBytes() 11901 hdr.Cap = x.SizeBytes() 11902 11903 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 11904 // Since we bypassed the compiler's escape analysis, indicate that x 11905 // must live until the use above. 11906 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11907 return length, err 11908 } 11909 11910 // CopyOut implements marshal.Marshallable.CopyOut. 11911 func (x *XTOwnerMatchInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11912 return x.CopyOutN(cc, addr, x.SizeBytes()) 11913 } 11914 11915 // CopyInN implements marshal.Marshallable.CopyInN. 11916 func (x *XTOwnerMatchInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 11917 // Construct a slice backed by dst's underlying memory. 11918 var buf []byte 11919 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11920 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11921 hdr.Len = x.SizeBytes() 11922 hdr.Cap = x.SizeBytes() 11923 11924 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 11925 // Since we bypassed the compiler's escape analysis, indicate that x 11926 // must live until the use above. 11927 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11928 return length, err 11929 } 11930 11931 // CopyIn implements marshal.Marshallable.CopyIn. 11932 func (x *XTOwnerMatchInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 11933 return x.CopyInN(cc, addr, x.SizeBytes()) 11934 } 11935 11936 // WriteTo implements io.WriterTo.WriteTo. 11937 func (x *XTOwnerMatchInfo) WriteTo(writer io.Writer) (int64, error) { 11938 // Construct a slice backed by dst's underlying memory. 11939 var buf []byte 11940 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 11941 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 11942 hdr.Len = x.SizeBytes() 11943 hdr.Cap = x.SizeBytes() 11944 11945 length, err := writer.Write(buf) 11946 // Since we bypassed the compiler's escape analysis, indicate that x 11947 // must live until the use above. 11948 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 11949 return int64(length), err 11950 } 11951 11952 // SizeBytes implements marshal.Marshallable.SizeBytes. 11953 func (x *XTRedirectTarget) SizeBytes() int { 11954 return 0 + 11955 (*XTEntryTarget)(nil).SizeBytes() + 11956 (*NfNATIPV4MultiRangeCompat)(nil).SizeBytes() + 11957 1*4 11958 } 11959 11960 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 11961 func (x *XTRedirectTarget) MarshalBytes(dst []byte) []byte { 11962 dst = x.Target.MarshalUnsafe(dst) 11963 dst = x.NfRange.MarshalUnsafe(dst) 11964 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 11965 dst = dst[1*(4):] 11966 return dst 11967 } 11968 11969 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 11970 func (x *XTRedirectTarget) UnmarshalBytes(src []byte) []byte { 11971 src = x.Target.UnmarshalUnsafe(src) 11972 src = x.NfRange.UnmarshalUnsafe(src) 11973 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 11974 src = src[1*(4):] 11975 return src 11976 } 11977 11978 // Packed implements marshal.Marshallable.Packed. 11979 //go:nosplit 11980 func (x *XTRedirectTarget) Packed() bool { 11981 return x.NfRange.Packed() && x.Target.Packed() 11982 } 11983 11984 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 11985 func (x *XTRedirectTarget) MarshalUnsafe(dst []byte) []byte { 11986 if x.NfRange.Packed() && x.Target.Packed() { 11987 size := x.SizeBytes() 11988 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 11989 return dst[size:] 11990 } 11991 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 11992 return x.MarshalBytes(dst) 11993 } 11994 11995 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 11996 func (x *XTRedirectTarget) UnmarshalUnsafe(src []byte) []byte { 11997 if x.NfRange.Packed() && x.Target.Packed() { 11998 size := x.SizeBytes() 11999 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 12000 return src[size:] 12001 } 12002 // Type XTRedirectTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12003 return x.UnmarshalBytes(src) 12004 } 12005 12006 // CopyOutN implements marshal.Marshallable.CopyOutN. 12007 func (x *XTRedirectTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12008 if !x.NfRange.Packed() && x.Target.Packed() { 12009 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 12010 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 12011 x.MarshalBytes(buf) // escapes: fallback. 12012 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12013 } 12014 12015 // Construct a slice backed by dst's underlying memory. 12016 var buf []byte 12017 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12018 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12019 hdr.Len = x.SizeBytes() 12020 hdr.Cap = x.SizeBytes() 12021 12022 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12023 // Since we bypassed the compiler's escape analysis, indicate that x 12024 // must live until the use above. 12025 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12026 return length, err 12027 } 12028 12029 // CopyOut implements marshal.Marshallable.CopyOut. 12030 func (x *XTRedirectTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12031 return x.CopyOutN(cc, addr, x.SizeBytes()) 12032 } 12033 12034 // CopyInN implements marshal.Marshallable.CopyInN. 12035 func (x *XTRedirectTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12036 if !x.NfRange.Packed() && x.Target.Packed() { 12037 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12038 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 12039 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12040 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12041 // partially unmarshalled struct. 12042 x.UnmarshalBytes(buf) // escapes: fallback. 12043 return length, err 12044 } 12045 12046 // Construct a slice backed by dst's underlying memory. 12047 var buf []byte 12048 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12049 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12050 hdr.Len = x.SizeBytes() 12051 hdr.Cap = x.SizeBytes() 12052 12053 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12054 // Since we bypassed the compiler's escape analysis, indicate that x 12055 // must live until the use above. 12056 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12057 return length, err 12058 } 12059 12060 // CopyIn implements marshal.Marshallable.CopyIn. 12061 func (x *XTRedirectTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12062 return x.CopyInN(cc, addr, x.SizeBytes()) 12063 } 12064 12065 // WriteTo implements io.WriterTo.WriteTo. 12066 func (x *XTRedirectTarget) WriteTo(writer io.Writer) (int64, error) { 12067 if !x.NfRange.Packed() && x.Target.Packed() { 12068 // Type XTRedirectTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 12069 buf := make([]byte, x.SizeBytes()) 12070 x.MarshalBytes(buf) 12071 length, err := writer.Write(buf) 12072 return int64(length), err 12073 } 12074 12075 // Construct a slice backed by dst's underlying memory. 12076 var buf []byte 12077 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12078 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12079 hdr.Len = x.SizeBytes() 12080 hdr.Cap = x.SizeBytes() 12081 12082 length, err := writer.Write(buf) 12083 // Since we bypassed the compiler's escape analysis, indicate that x 12084 // must live until the use above. 12085 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12086 return int64(length), err 12087 } 12088 12089 // SizeBytes implements marshal.Marshallable.SizeBytes. 12090 func (x *XTStandardTarget) SizeBytes() int { 12091 return 4 + 12092 (*XTEntryTarget)(nil).SizeBytes() + 12093 1*4 12094 } 12095 12096 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12097 func (x *XTStandardTarget) MarshalBytes(dst []byte) []byte { 12098 dst = x.Target.MarshalUnsafe(dst) 12099 hostarch.ByteOrder.PutUint32(dst[:4], uint32(x.Verdict)) 12100 dst = dst[4:] 12101 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 12102 dst = dst[1*(4):] 12103 return dst 12104 } 12105 12106 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12107 func (x *XTStandardTarget) UnmarshalBytes(src []byte) []byte { 12108 src = x.Target.UnmarshalUnsafe(src) 12109 x.Verdict = int32(hostarch.ByteOrder.Uint32(src[:4])) 12110 src = src[4:] 12111 // Padding: ~ copy([4]byte(x._), src[:sizeof(byte)*4]) 12112 src = src[1*(4):] 12113 return src 12114 } 12115 12116 // Packed implements marshal.Marshallable.Packed. 12117 //go:nosplit 12118 func (x *XTStandardTarget) Packed() bool { 12119 return x.Target.Packed() 12120 } 12121 12122 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12123 func (x *XTStandardTarget) MarshalUnsafe(dst []byte) []byte { 12124 if x.Target.Packed() { 12125 size := x.SizeBytes() 12126 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 12127 return dst[size:] 12128 } 12129 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to MarshalBytes. 12130 return x.MarshalBytes(dst) 12131 } 12132 12133 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12134 func (x *XTStandardTarget) UnmarshalUnsafe(src []byte) []byte { 12135 if x.Target.Packed() { 12136 size := x.SizeBytes() 12137 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 12138 return src[size:] 12139 } 12140 // Type XTStandardTarget doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12141 return x.UnmarshalBytes(src) 12142 } 12143 12144 // CopyOutN implements marshal.Marshallable.CopyOutN. 12145 func (x *XTStandardTarget) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12146 if !x.Target.Packed() { 12147 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 12148 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 12149 x.MarshalBytes(buf) // escapes: fallback. 12150 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12151 } 12152 12153 // Construct a slice backed by dst's underlying memory. 12154 var buf []byte 12155 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12156 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12157 hdr.Len = x.SizeBytes() 12158 hdr.Cap = x.SizeBytes() 12159 12160 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12161 // Since we bypassed the compiler's escape analysis, indicate that x 12162 // must live until the use above. 12163 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12164 return length, err 12165 } 12166 12167 // CopyOut implements marshal.Marshallable.CopyOut. 12168 func (x *XTStandardTarget) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12169 return x.CopyOutN(cc, addr, x.SizeBytes()) 12170 } 12171 12172 // CopyInN implements marshal.Marshallable.CopyInN. 12173 func (x *XTStandardTarget) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12174 if !x.Target.Packed() { 12175 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12176 buf := cc.CopyScratchBuffer(x.SizeBytes()) // escapes: okay. 12177 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12178 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12179 // partially unmarshalled struct. 12180 x.UnmarshalBytes(buf) // escapes: fallback. 12181 return length, err 12182 } 12183 12184 // Construct a slice backed by dst's underlying memory. 12185 var buf []byte 12186 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12187 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12188 hdr.Len = x.SizeBytes() 12189 hdr.Cap = x.SizeBytes() 12190 12191 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12192 // Since we bypassed the compiler's escape analysis, indicate that x 12193 // must live until the use above. 12194 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12195 return length, err 12196 } 12197 12198 // CopyIn implements marshal.Marshallable.CopyIn. 12199 func (x *XTStandardTarget) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12200 return x.CopyInN(cc, addr, x.SizeBytes()) 12201 } 12202 12203 // WriteTo implements io.WriterTo.WriteTo. 12204 func (x *XTStandardTarget) WriteTo(writer io.Writer) (int64, error) { 12205 if !x.Target.Packed() { 12206 // Type XTStandardTarget doesn't have a packed layout in memory, fall back to MarshalBytes. 12207 buf := make([]byte, x.SizeBytes()) 12208 x.MarshalBytes(buf) 12209 length, err := writer.Write(buf) 12210 return int64(length), err 12211 } 12212 12213 // Construct a slice backed by dst's underlying memory. 12214 var buf []byte 12215 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12216 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12217 hdr.Len = x.SizeBytes() 12218 hdr.Cap = x.SizeBytes() 12219 12220 length, err := writer.Write(buf) 12221 // Since we bypassed the compiler's escape analysis, indicate that x 12222 // must live until the use above. 12223 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12224 return int64(length), err 12225 } 12226 12227 // SizeBytes implements marshal.Marshallable.SizeBytes. 12228 func (x *XTTCP) SizeBytes() int { 12229 return 12 12230 } 12231 12232 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12233 func (x *XTTCP) MarshalBytes(dst []byte) []byte { 12234 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 12235 dst = dst[2:] 12236 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 12237 dst = dst[2:] 12238 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 12239 dst = dst[2:] 12240 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 12241 dst = dst[2:] 12242 dst[0] = byte(x.Option) 12243 dst = dst[1:] 12244 dst[0] = byte(x.FlagMask) 12245 dst = dst[1:] 12246 dst[0] = byte(x.FlagCompare) 12247 dst = dst[1:] 12248 dst[0] = byte(x.InverseFlags) 12249 dst = dst[1:] 12250 return dst 12251 } 12252 12253 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12254 func (x *XTTCP) UnmarshalBytes(src []byte) []byte { 12255 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12256 src = src[2:] 12257 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12258 src = src[2:] 12259 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12260 src = src[2:] 12261 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12262 src = src[2:] 12263 x.Option = uint8(src[0]) 12264 src = src[1:] 12265 x.FlagMask = uint8(src[0]) 12266 src = src[1:] 12267 x.FlagCompare = uint8(src[0]) 12268 src = src[1:] 12269 x.InverseFlags = uint8(src[0]) 12270 src = src[1:] 12271 return src 12272 } 12273 12274 // Packed implements marshal.Marshallable.Packed. 12275 //go:nosplit 12276 func (x *XTTCP) Packed() bool { 12277 return true 12278 } 12279 12280 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12281 func (x *XTTCP) MarshalUnsafe(dst []byte) []byte { 12282 size := x.SizeBytes() 12283 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 12284 return dst[size:] 12285 } 12286 12287 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12288 func (x *XTTCP) UnmarshalUnsafe(src []byte) []byte { 12289 size := x.SizeBytes() 12290 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 12291 return src[size:] 12292 } 12293 12294 // CopyOutN implements marshal.Marshallable.CopyOutN. 12295 func (x *XTTCP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12296 // Construct a slice backed by dst's underlying memory. 12297 var buf []byte 12298 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12299 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12300 hdr.Len = x.SizeBytes() 12301 hdr.Cap = x.SizeBytes() 12302 12303 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12304 // Since we bypassed the compiler's escape analysis, indicate that x 12305 // must live until the use above. 12306 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12307 return length, err 12308 } 12309 12310 // CopyOut implements marshal.Marshallable.CopyOut. 12311 func (x *XTTCP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12312 return x.CopyOutN(cc, addr, x.SizeBytes()) 12313 } 12314 12315 // CopyInN implements marshal.Marshallable.CopyInN. 12316 func (x *XTTCP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12317 // Construct a slice backed by dst's underlying memory. 12318 var buf []byte 12319 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12320 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12321 hdr.Len = x.SizeBytes() 12322 hdr.Cap = x.SizeBytes() 12323 12324 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12325 // Since we bypassed the compiler's escape analysis, indicate that x 12326 // must live until the use above. 12327 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12328 return length, err 12329 } 12330 12331 // CopyIn implements marshal.Marshallable.CopyIn. 12332 func (x *XTTCP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12333 return x.CopyInN(cc, addr, x.SizeBytes()) 12334 } 12335 12336 // WriteTo implements io.WriterTo.WriteTo. 12337 func (x *XTTCP) WriteTo(writer io.Writer) (int64, error) { 12338 // Construct a slice backed by dst's underlying memory. 12339 var buf []byte 12340 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12341 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12342 hdr.Len = x.SizeBytes() 12343 hdr.Cap = x.SizeBytes() 12344 12345 length, err := writer.Write(buf) 12346 // Since we bypassed the compiler's escape analysis, indicate that x 12347 // must live until the use above. 12348 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12349 return int64(length), err 12350 } 12351 12352 // SizeBytes implements marshal.Marshallable.SizeBytes. 12353 func (x *XTUDP) SizeBytes() int { 12354 return 10 12355 } 12356 12357 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12358 func (x *XTUDP) MarshalBytes(dst []byte) []byte { 12359 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortStart)) 12360 dst = dst[2:] 12361 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.SourcePortEnd)) 12362 dst = dst[2:] 12363 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortStart)) 12364 dst = dst[2:] 12365 hostarch.ByteOrder.PutUint16(dst[:2], uint16(x.DestinationPortEnd)) 12366 dst = dst[2:] 12367 dst[0] = byte(x.InverseFlags) 12368 dst = dst[1:] 12369 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 12370 dst = dst[1:] 12371 return dst 12372 } 12373 12374 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12375 func (x *XTUDP) UnmarshalBytes(src []byte) []byte { 12376 x.SourcePortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12377 src = src[2:] 12378 x.SourcePortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12379 src = src[2:] 12380 x.DestinationPortStart = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12381 src = src[2:] 12382 x.DestinationPortEnd = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12383 src = src[2:] 12384 x.InverseFlags = uint8(src[0]) 12385 src = src[1:] 12386 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 12387 src = src[1:] 12388 return src 12389 } 12390 12391 // Packed implements marshal.Marshallable.Packed. 12392 //go:nosplit 12393 func (x *XTUDP) Packed() bool { 12394 return true 12395 } 12396 12397 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12398 func (x *XTUDP) MarshalUnsafe(dst []byte) []byte { 12399 size := x.SizeBytes() 12400 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(x), uintptr(size)) 12401 return dst[size:] 12402 } 12403 12404 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12405 func (x *XTUDP) UnmarshalUnsafe(src []byte) []byte { 12406 size := x.SizeBytes() 12407 gohacks.Memmove(unsafe.Pointer(x), unsafe.Pointer(&src[0]), uintptr(size)) 12408 return src[size:] 12409 } 12410 12411 // CopyOutN implements marshal.Marshallable.CopyOutN. 12412 func (x *XTUDP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12413 // Construct a slice backed by dst's underlying memory. 12414 var buf []byte 12415 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12416 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12417 hdr.Len = x.SizeBytes() 12418 hdr.Cap = x.SizeBytes() 12419 12420 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12421 // Since we bypassed the compiler's escape analysis, indicate that x 12422 // must live until the use above. 12423 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12424 return length, err 12425 } 12426 12427 // CopyOut implements marshal.Marshallable.CopyOut. 12428 func (x *XTUDP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12429 return x.CopyOutN(cc, addr, x.SizeBytes()) 12430 } 12431 12432 // CopyInN implements marshal.Marshallable.CopyInN. 12433 func (x *XTUDP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12434 // Construct a slice backed by dst's underlying memory. 12435 var buf []byte 12436 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12437 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12438 hdr.Len = x.SizeBytes() 12439 hdr.Cap = x.SizeBytes() 12440 12441 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12442 // Since we bypassed the compiler's escape analysis, indicate that x 12443 // must live until the use above. 12444 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12445 return length, err 12446 } 12447 12448 // CopyIn implements marshal.Marshallable.CopyIn. 12449 func (x *XTUDP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12450 return x.CopyInN(cc, addr, x.SizeBytes()) 12451 } 12452 12453 // WriteTo implements io.WriterTo.WriteTo. 12454 func (x *XTUDP) WriteTo(writer io.Writer) (int64, error) { 12455 // Construct a slice backed by dst's underlying memory. 12456 var buf []byte 12457 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12458 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(x))) 12459 hdr.Len = x.SizeBytes() 12460 hdr.Cap = x.SizeBytes() 12461 12462 length, err := writer.Write(buf) 12463 // Since we bypassed the compiler's escape analysis, indicate that x 12464 // must live until the use above. 12465 runtime.KeepAlive(x) // escapes: replaced by intrinsic. 12466 return int64(length), err 12467 } 12468 12469 // SizeBytes implements marshal.Marshallable.SizeBytes. 12470 func (i *IP6TEntry) SizeBytes() int { 12471 return 12 + 12472 (*IP6TIP)(nil).SizeBytes() + 12473 1*4 + 12474 (*XTCounters)(nil).SizeBytes() 12475 } 12476 12477 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12478 func (i *IP6TEntry) MarshalBytes(dst []byte) []byte { 12479 dst = i.IPv6.MarshalUnsafe(dst) 12480 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NFCache)) 12481 dst = dst[4:] 12482 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.TargetOffset)) 12483 dst = dst[2:] 12484 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.NextOffset)) 12485 dst = dst[2:] 12486 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Comeback)) 12487 dst = dst[4:] 12488 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 12489 dst = dst[1*(4):] 12490 dst = i.Counters.MarshalUnsafe(dst) 12491 return dst 12492 } 12493 12494 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12495 func (i *IP6TEntry) UnmarshalBytes(src []byte) []byte { 12496 src = i.IPv6.UnmarshalUnsafe(src) 12497 i.NFCache = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12498 src = src[4:] 12499 i.TargetOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12500 src = src[2:] 12501 i.NextOffset = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12502 src = src[2:] 12503 i.Comeback = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12504 src = src[4:] 12505 // Padding: ~ copy([4]byte(i._), src[:sizeof(byte)*4]) 12506 src = src[1*(4):] 12507 src = i.Counters.UnmarshalUnsafe(src) 12508 return src 12509 } 12510 12511 // Packed implements marshal.Marshallable.Packed. 12512 //go:nosplit 12513 func (i *IP6TEntry) Packed() bool { 12514 return i.Counters.Packed() && i.IPv6.Packed() 12515 } 12516 12517 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12518 func (i *IP6TEntry) MarshalUnsafe(dst []byte) []byte { 12519 if i.Counters.Packed() && i.IPv6.Packed() { 12520 size := i.SizeBytes() 12521 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12522 return dst[size:] 12523 } 12524 // Type IP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 12525 return i.MarshalBytes(dst) 12526 } 12527 12528 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12529 func (i *IP6TEntry) UnmarshalUnsafe(src []byte) []byte { 12530 if i.Counters.Packed() && i.IPv6.Packed() { 12531 size := i.SizeBytes() 12532 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12533 return src[size:] 12534 } 12535 // Type IP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12536 return i.UnmarshalBytes(src) 12537 } 12538 12539 // CopyOutN implements marshal.Marshallable.CopyOutN. 12540 func (i *IP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12541 if !i.Counters.Packed() && i.IPv6.Packed() { 12542 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 12543 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12544 i.MarshalBytes(buf) // escapes: fallback. 12545 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12546 } 12547 12548 // Construct a slice backed by dst's underlying memory. 12549 var buf []byte 12550 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12551 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12552 hdr.Len = i.SizeBytes() 12553 hdr.Cap = i.SizeBytes() 12554 12555 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12556 // Since we bypassed the compiler's escape analysis, indicate that i 12557 // must live until the use above. 12558 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12559 return length, err 12560 } 12561 12562 // CopyOut implements marshal.Marshallable.CopyOut. 12563 func (i *IP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12564 return i.CopyOutN(cc, addr, i.SizeBytes()) 12565 } 12566 12567 // CopyInN implements marshal.Marshallable.CopyInN. 12568 func (i *IP6TEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12569 if !i.Counters.Packed() && i.IPv6.Packed() { 12570 // Type IP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12571 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12572 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12573 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12574 // partially unmarshalled struct. 12575 i.UnmarshalBytes(buf) // escapes: fallback. 12576 return length, err 12577 } 12578 12579 // Construct a slice backed by dst's underlying memory. 12580 var buf []byte 12581 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12582 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12583 hdr.Len = i.SizeBytes() 12584 hdr.Cap = i.SizeBytes() 12585 12586 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12587 // Since we bypassed the compiler's escape analysis, indicate that i 12588 // must live until the use above. 12589 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12590 return length, err 12591 } 12592 12593 // CopyIn implements marshal.Marshallable.CopyIn. 12594 func (i *IP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12595 return i.CopyInN(cc, addr, i.SizeBytes()) 12596 } 12597 12598 // WriteTo implements io.WriterTo.WriteTo. 12599 func (i *IP6TEntry) WriteTo(writer io.Writer) (int64, error) { 12600 if !i.Counters.Packed() && i.IPv6.Packed() { 12601 // Type IP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 12602 buf := make([]byte, i.SizeBytes()) 12603 i.MarshalBytes(buf) 12604 length, err := writer.Write(buf) 12605 return int64(length), err 12606 } 12607 12608 // Construct a slice backed by dst's underlying memory. 12609 var buf []byte 12610 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12611 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12612 hdr.Len = i.SizeBytes() 12613 hdr.Cap = i.SizeBytes() 12614 12615 length, err := writer.Write(buf) 12616 // Since we bypassed the compiler's escape analysis, indicate that i 12617 // must live until the use above. 12618 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12619 return int64(length), err 12620 } 12621 12622 // SizeBytes implements marshal.Marshallable.SizeBytes. 12623 func (i *IP6TIP) SizeBytes() int { 12624 return 5 + 12625 (*Inet6Addr)(nil).SizeBytes() + 12626 (*Inet6Addr)(nil).SizeBytes() + 12627 (*Inet6Addr)(nil).SizeBytes() + 12628 (*Inet6Addr)(nil).SizeBytes() + 12629 1*IFNAMSIZ + 12630 1*IFNAMSIZ + 12631 1*IFNAMSIZ + 12632 1*IFNAMSIZ + 12633 1*3 12634 } 12635 12636 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12637 func (i *IP6TIP) MarshalBytes(dst []byte) []byte { 12638 dst = i.Src.MarshalUnsafe(dst) 12639 dst = i.Dst.MarshalUnsafe(dst) 12640 dst = i.SrcMask.MarshalUnsafe(dst) 12641 dst = i.DstMask.MarshalUnsafe(dst) 12642 for idx := 0; idx < IFNAMSIZ; idx++ { 12643 dst[0] = byte(i.InputInterface[idx]) 12644 dst = dst[1:] 12645 } 12646 for idx := 0; idx < IFNAMSIZ; idx++ { 12647 dst[0] = byte(i.OutputInterface[idx]) 12648 dst = dst[1:] 12649 } 12650 for idx := 0; idx < IFNAMSIZ; idx++ { 12651 dst[0] = byte(i.InputInterfaceMask[idx]) 12652 dst = dst[1:] 12653 } 12654 for idx := 0; idx < IFNAMSIZ; idx++ { 12655 dst[0] = byte(i.OutputInterfaceMask[idx]) 12656 dst = dst[1:] 12657 } 12658 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Protocol)) 12659 dst = dst[2:] 12660 dst[0] = byte(i.TOS) 12661 dst = dst[1:] 12662 dst[0] = byte(i.Flags) 12663 dst = dst[1:] 12664 dst[0] = byte(i.InverseFlags) 12665 dst = dst[1:] 12666 // Padding: dst[:sizeof(byte)*3] ~= [3]byte{0} 12667 dst = dst[1*(3):] 12668 return dst 12669 } 12670 12671 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12672 func (i *IP6TIP) UnmarshalBytes(src []byte) []byte { 12673 src = i.Src.UnmarshalUnsafe(src) 12674 src = i.Dst.UnmarshalUnsafe(src) 12675 src = i.SrcMask.UnmarshalUnsafe(src) 12676 src = i.DstMask.UnmarshalUnsafe(src) 12677 for idx := 0; idx < IFNAMSIZ; idx++ { 12678 i.InputInterface[idx] = src[0] 12679 src = src[1:] 12680 } 12681 for idx := 0; idx < IFNAMSIZ; idx++ { 12682 i.OutputInterface[idx] = src[0] 12683 src = src[1:] 12684 } 12685 for idx := 0; idx < IFNAMSIZ; idx++ { 12686 i.InputInterfaceMask[idx] = src[0] 12687 src = src[1:] 12688 } 12689 for idx := 0; idx < IFNAMSIZ; idx++ { 12690 i.OutputInterfaceMask[idx] = src[0] 12691 src = src[1:] 12692 } 12693 i.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 12694 src = src[2:] 12695 i.TOS = uint8(src[0]) 12696 src = src[1:] 12697 i.Flags = uint8(src[0]) 12698 src = src[1:] 12699 i.InverseFlags = uint8(src[0]) 12700 src = src[1:] 12701 // Padding: ~ copy([3]byte(i._), src[:sizeof(byte)*3]) 12702 src = src[1*(3):] 12703 return src 12704 } 12705 12706 // Packed implements marshal.Marshallable.Packed. 12707 //go:nosplit 12708 func (i *IP6TIP) Packed() bool { 12709 return i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() 12710 } 12711 12712 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12713 func (i *IP6TIP) MarshalUnsafe(dst []byte) []byte { 12714 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12715 size := i.SizeBytes() 12716 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12717 return dst[size:] 12718 } 12719 // Type IP6TIP doesn't have a packed layout in memory, fallback to MarshalBytes. 12720 return i.MarshalBytes(dst) 12721 } 12722 12723 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12724 func (i *IP6TIP) UnmarshalUnsafe(src []byte) []byte { 12725 if i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12726 size := i.SizeBytes() 12727 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12728 return src[size:] 12729 } 12730 // Type IP6TIP doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12731 return i.UnmarshalBytes(src) 12732 } 12733 12734 // CopyOutN implements marshal.Marshallable.CopyOutN. 12735 func (i *IP6TIP) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12736 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12737 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 12738 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12739 i.MarshalBytes(buf) // escapes: fallback. 12740 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12741 } 12742 12743 // Construct a slice backed by dst's underlying memory. 12744 var buf []byte 12745 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12746 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12747 hdr.Len = i.SizeBytes() 12748 hdr.Cap = i.SizeBytes() 12749 12750 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12751 // Since we bypassed the compiler's escape analysis, indicate that i 12752 // must live until the use above. 12753 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12754 return length, err 12755 } 12756 12757 // CopyOut implements marshal.Marshallable.CopyOut. 12758 func (i *IP6TIP) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12759 return i.CopyOutN(cc, addr, i.SizeBytes()) 12760 } 12761 12762 // CopyInN implements marshal.Marshallable.CopyInN. 12763 func (i *IP6TIP) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12764 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12765 // Type IP6TIP doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12766 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12767 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12768 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12769 // partially unmarshalled struct. 12770 i.UnmarshalBytes(buf) // escapes: fallback. 12771 return length, err 12772 } 12773 12774 // Construct a slice backed by dst's underlying memory. 12775 var buf []byte 12776 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12777 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12778 hdr.Len = i.SizeBytes() 12779 hdr.Cap = i.SizeBytes() 12780 12781 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12782 // Since we bypassed the compiler's escape analysis, indicate that i 12783 // must live until the use above. 12784 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12785 return length, err 12786 } 12787 12788 // CopyIn implements marshal.Marshallable.CopyIn. 12789 func (i *IP6TIP) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12790 return i.CopyInN(cc, addr, i.SizeBytes()) 12791 } 12792 12793 // WriteTo implements io.WriterTo.WriteTo. 12794 func (i *IP6TIP) WriteTo(writer io.Writer) (int64, error) { 12795 if !i.Dst.Packed() && i.DstMask.Packed() && i.Src.Packed() && i.SrcMask.Packed() { 12796 // Type IP6TIP doesn't have a packed layout in memory, fall back to MarshalBytes. 12797 buf := make([]byte, i.SizeBytes()) 12798 i.MarshalBytes(buf) 12799 length, err := writer.Write(buf) 12800 return int64(length), err 12801 } 12802 12803 // Construct a slice backed by dst's underlying memory. 12804 var buf []byte 12805 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12806 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12807 hdr.Len = i.SizeBytes() 12808 hdr.Cap = i.SizeBytes() 12809 12810 length, err := writer.Write(buf) 12811 // Since we bypassed the compiler's escape analysis, indicate that i 12812 // must live until the use above. 12813 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12814 return int64(length), err 12815 } 12816 12817 // SizeBytes implements marshal.Marshallable.SizeBytes. 12818 func (i *IP6TReplace) SizeBytes() int { 12819 return 24 + 12820 (*TableName)(nil).SizeBytes() + 12821 4*NF_INET_NUMHOOKS + 12822 4*NF_INET_NUMHOOKS 12823 } 12824 12825 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 12826 func (i *IP6TReplace) MarshalBytes(dst []byte) []byte { 12827 dst = i.Name.MarshalUnsafe(dst) 12828 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.ValidHooks)) 12829 dst = dst[4:] 12830 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumEntries)) 12831 dst = dst[4:] 12832 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Size)) 12833 dst = dst[4:] 12834 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12835 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.HookEntry[idx])) 12836 dst = dst[4:] 12837 } 12838 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12839 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Underflow[idx])) 12840 dst = dst[4:] 12841 } 12842 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.NumCounters)) 12843 dst = dst[4:] 12844 hostarch.ByteOrder.PutUint64(dst[:8], uint64(i.Counters)) 12845 dst = dst[8:] 12846 return dst 12847 } 12848 12849 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 12850 func (i *IP6TReplace) UnmarshalBytes(src []byte) []byte { 12851 src = i.Name.UnmarshalUnsafe(src) 12852 i.ValidHooks = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12853 src = src[4:] 12854 i.NumEntries = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12855 src = src[4:] 12856 i.Size = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12857 src = src[4:] 12858 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12859 i.HookEntry[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12860 src = src[4:] 12861 } 12862 for idx := 0; idx < NF_INET_NUMHOOKS; idx++ { 12863 i.Underflow[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12864 src = src[4:] 12865 } 12866 i.NumCounters = uint32(hostarch.ByteOrder.Uint32(src[:4])) 12867 src = src[4:] 12868 i.Counters = uint64(hostarch.ByteOrder.Uint64(src[:8])) 12869 src = src[8:] 12870 return src 12871 } 12872 12873 // Packed implements marshal.Marshallable.Packed. 12874 //go:nosplit 12875 func (i *IP6TReplace) Packed() bool { 12876 return i.Name.Packed() 12877 } 12878 12879 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12880 func (i *IP6TReplace) MarshalUnsafe(dst []byte) []byte { 12881 if i.Name.Packed() { 12882 size := i.SizeBytes() 12883 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 12884 return dst[size:] 12885 } 12886 // Type IP6TReplace doesn't have a packed layout in memory, fallback to MarshalBytes. 12887 return i.MarshalBytes(dst) 12888 } 12889 12890 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12891 func (i *IP6TReplace) UnmarshalUnsafe(src []byte) []byte { 12892 if i.Name.Packed() { 12893 size := i.SizeBytes() 12894 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 12895 return src[size:] 12896 } 12897 // Type IP6TReplace doesn't have a packed layout in memory, fallback to UnmarshalBytes. 12898 return i.UnmarshalBytes(src) 12899 } 12900 12901 // CopyOutN implements marshal.Marshallable.CopyOutN. 12902 func (i *IP6TReplace) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12903 if !i.Name.Packed() { 12904 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 12905 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12906 i.MarshalBytes(buf) // escapes: fallback. 12907 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12908 } 12909 12910 // Construct a slice backed by dst's underlying memory. 12911 var buf []byte 12912 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12913 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12914 hdr.Len = i.SizeBytes() 12915 hdr.Cap = i.SizeBytes() 12916 12917 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 12918 // Since we bypassed the compiler's escape analysis, indicate that i 12919 // must live until the use above. 12920 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12921 return length, err 12922 } 12923 12924 // CopyOut implements marshal.Marshallable.CopyOut. 12925 func (i *IP6TReplace) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12926 return i.CopyOutN(cc, addr, i.SizeBytes()) 12927 } 12928 12929 // CopyInN implements marshal.Marshallable.CopyInN. 12930 func (i *IP6TReplace) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 12931 if !i.Name.Packed() { 12932 // Type IP6TReplace doesn't have a packed layout in memory, fall back to UnmarshalBytes. 12933 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 12934 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12935 // Unmarshal unconditionally. If we had a short copy-in, this results in a 12936 // partially unmarshalled struct. 12937 i.UnmarshalBytes(buf) // escapes: fallback. 12938 return length, err 12939 } 12940 12941 // Construct a slice backed by dst's underlying memory. 12942 var buf []byte 12943 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12944 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12945 hdr.Len = i.SizeBytes() 12946 hdr.Cap = i.SizeBytes() 12947 12948 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 12949 // Since we bypassed the compiler's escape analysis, indicate that i 12950 // must live until the use above. 12951 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12952 return length, err 12953 } 12954 12955 // CopyIn implements marshal.Marshallable.CopyIn. 12956 func (i *IP6TReplace) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 12957 return i.CopyInN(cc, addr, i.SizeBytes()) 12958 } 12959 12960 // WriteTo implements io.WriterTo.WriteTo. 12961 func (i *IP6TReplace) WriteTo(writer io.Writer) (int64, error) { 12962 if !i.Name.Packed() { 12963 // Type IP6TReplace doesn't have a packed layout in memory, fall back to MarshalBytes. 12964 buf := make([]byte, i.SizeBytes()) 12965 i.MarshalBytes(buf) 12966 length, err := writer.Write(buf) 12967 return int64(length), err 12968 } 12969 12970 // Construct a slice backed by dst's underlying memory. 12971 var buf []byte 12972 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 12973 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 12974 hdr.Len = i.SizeBytes() 12975 hdr.Cap = i.SizeBytes() 12976 12977 length, err := writer.Write(buf) 12978 // Since we bypassed the compiler's escape analysis, indicate that i 12979 // must live until the use above. 12980 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 12981 return int64(length), err 12982 } 12983 12984 // Packed implements marshal.Marshallable.Packed. 12985 //go:nosplit 12986 func (ke *KernelIP6TEntry) Packed() bool { 12987 // Type KernelIP6TEntry is dynamic so it might have slice/string headers. Hence, it is not packed. 12988 return false 12989 } 12990 12991 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 12992 func (ke *KernelIP6TEntry) MarshalUnsafe(dst []byte) []byte { 12993 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to MarshalBytes. 12994 return ke.MarshalBytes(dst) 12995 } 12996 12997 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 12998 func (ke *KernelIP6TEntry) UnmarshalUnsafe(src []byte) []byte { 12999 // Type KernelIP6TEntry doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13000 return ke.UnmarshalBytes(src) 13001 } 13002 13003 // CopyOutN implements marshal.Marshallable.CopyOutN. 13004 //go:nosplit 13005 func (ke *KernelIP6TEntry) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13006 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 13007 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 13008 ke.MarshalBytes(buf) // escapes: fallback. 13009 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13010 } 13011 13012 // CopyOut implements marshal.Marshallable.CopyOut. 13013 func (ke *KernelIP6TEntry) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13014 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 13015 } 13016 13017 // CopyInN implements marshal.Marshallable.CopyInN. 13018 //go:nosplit 13019 func (ke *KernelIP6TEntry) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13020 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13021 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 13022 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13023 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13024 // partially unmarshalled struct. 13025 ke.UnmarshalBytes(buf) // escapes: fallback. 13026 return length, err 13027 } 13028 13029 // CopyIn implements marshal.Marshallable.CopyIn. 13030 func (ke *KernelIP6TEntry) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13031 return ke.CopyInN(cc, addr, ke.SizeBytes()) 13032 } 13033 13034 // WriteTo implements io.WriterTo.WriteTo. 13035 func (ke *KernelIP6TEntry) WriteTo(writer io.Writer) (int64, error) { 13036 // Type KernelIP6TEntry doesn't have a packed layout in memory, fall back to MarshalBytes. 13037 buf := make([]byte, ke.SizeBytes()) 13038 ke.MarshalBytes(buf) 13039 length, err := writer.Write(buf) 13040 return int64(length), err 13041 } 13042 13043 // Packed implements marshal.Marshallable.Packed. 13044 //go:nosplit 13045 func (ke *KernelIP6TGetEntries) Packed() bool { 13046 // Type KernelIP6TGetEntries is dynamic so it might have slice/string headers. Hence, it is not packed. 13047 return false 13048 } 13049 13050 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13051 func (ke *KernelIP6TGetEntries) MarshalUnsafe(dst []byte) []byte { 13052 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to MarshalBytes. 13053 return ke.MarshalBytes(dst) 13054 } 13055 13056 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13057 func (ke *KernelIP6TGetEntries) UnmarshalUnsafe(src []byte) []byte { 13058 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13059 return ke.UnmarshalBytes(src) 13060 } 13061 13062 // CopyOutN implements marshal.Marshallable.CopyOutN. 13063 //go:nosplit 13064 func (ke *KernelIP6TGetEntries) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13065 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 13066 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 13067 ke.MarshalBytes(buf) // escapes: fallback. 13068 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13069 } 13070 13071 // CopyOut implements marshal.Marshallable.CopyOut. 13072 func (ke *KernelIP6TGetEntries) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13073 return ke.CopyOutN(cc, addr, ke.SizeBytes()) 13074 } 13075 13076 // CopyInN implements marshal.Marshallable.CopyInN. 13077 //go:nosplit 13078 func (ke *KernelIP6TGetEntries) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13079 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13080 buf := cc.CopyScratchBuffer(ke.SizeBytes()) // escapes: okay. 13081 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 13082 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13083 // partially unmarshalled struct. 13084 ke.UnmarshalBytes(buf) // escapes: fallback. 13085 return length, err 13086 } 13087 13088 // CopyIn implements marshal.Marshallable.CopyIn. 13089 func (ke *KernelIP6TGetEntries) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13090 return ke.CopyInN(cc, addr, ke.SizeBytes()) 13091 } 13092 13093 // WriteTo implements io.WriterTo.WriteTo. 13094 func (ke *KernelIP6TGetEntries) WriteTo(writer io.Writer) (int64, error) { 13095 // Type KernelIP6TGetEntries doesn't have a packed layout in memory, fall back to MarshalBytes. 13096 buf := make([]byte, ke.SizeBytes()) 13097 ke.MarshalBytes(buf) 13098 length, err := writer.Write(buf) 13099 return int64(length), err 13100 } 13101 13102 // SizeBytes implements marshal.Marshallable.SizeBytes. 13103 func (n *NFNATRange) SizeBytes() int { 13104 return 8 + 13105 (*Inet6Addr)(nil).SizeBytes() + 13106 (*Inet6Addr)(nil).SizeBytes() 13107 } 13108 13109 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13110 func (n *NFNATRange) MarshalBytes(dst []byte) []byte { 13111 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 13112 dst = dst[4:] 13113 dst = n.MinAddr.MarshalUnsafe(dst) 13114 dst = n.MaxAddr.MarshalUnsafe(dst) 13115 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto)) 13116 dst = dst[2:] 13117 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto)) 13118 dst = dst[2:] 13119 return dst 13120 } 13121 13122 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13123 func (n *NFNATRange) UnmarshalBytes(src []byte) []byte { 13124 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13125 src = src[4:] 13126 src = n.MinAddr.UnmarshalUnsafe(src) 13127 src = n.MaxAddr.UnmarshalUnsafe(src) 13128 n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13129 src = src[2:] 13130 n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13131 src = src[2:] 13132 return src 13133 } 13134 13135 // Packed implements marshal.Marshallable.Packed. 13136 //go:nosplit 13137 func (n *NFNATRange) Packed() bool { 13138 return n.MaxAddr.Packed() && n.MinAddr.Packed() 13139 } 13140 13141 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13142 func (n *NFNATRange) MarshalUnsafe(dst []byte) []byte { 13143 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 13144 size := n.SizeBytes() 13145 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 13146 return dst[size:] 13147 } 13148 // Type NFNATRange doesn't have a packed layout in memory, fallback to MarshalBytes. 13149 return n.MarshalBytes(dst) 13150 } 13151 13152 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13153 func (n *NFNATRange) UnmarshalUnsafe(src []byte) []byte { 13154 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 13155 size := n.SizeBytes() 13156 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 13157 return src[size:] 13158 } 13159 // Type NFNATRange doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13160 return n.UnmarshalBytes(src) 13161 } 13162 13163 // CopyOutN implements marshal.Marshallable.CopyOutN. 13164 func (n *NFNATRange) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13165 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 13166 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 13167 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 13168 n.MarshalBytes(buf) // escapes: fallback. 13169 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13170 } 13171 13172 // Construct a slice backed by dst's underlying memory. 13173 var buf []byte 13174 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13175 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13176 hdr.Len = n.SizeBytes() 13177 hdr.Cap = n.SizeBytes() 13178 13179 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13180 // Since we bypassed the compiler's escape analysis, indicate that n 13181 // must live until the use above. 13182 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13183 return length, err 13184 } 13185 13186 // CopyOut implements marshal.Marshallable.CopyOut. 13187 func (n *NFNATRange) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13188 return n.CopyOutN(cc, addr, n.SizeBytes()) 13189 } 13190 13191 // CopyInN implements marshal.Marshallable.CopyInN. 13192 func (n *NFNATRange) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13193 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 13194 // Type NFNATRange doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13195 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 13196 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13197 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13198 // partially unmarshalled struct. 13199 n.UnmarshalBytes(buf) // escapes: fallback. 13200 return length, err 13201 } 13202 13203 // Construct a slice backed by dst's underlying memory. 13204 var buf []byte 13205 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13206 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13207 hdr.Len = n.SizeBytes() 13208 hdr.Cap = n.SizeBytes() 13209 13210 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13211 // Since we bypassed the compiler's escape analysis, indicate that n 13212 // must live until the use above. 13213 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13214 return length, err 13215 } 13216 13217 // CopyIn implements marshal.Marshallable.CopyIn. 13218 func (n *NFNATRange) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13219 return n.CopyInN(cc, addr, n.SizeBytes()) 13220 } 13221 13222 // WriteTo implements io.WriterTo.WriteTo. 13223 func (n *NFNATRange) WriteTo(writer io.Writer) (int64, error) { 13224 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 13225 // Type NFNATRange doesn't have a packed layout in memory, fall back to MarshalBytes. 13226 buf := make([]byte, n.SizeBytes()) 13227 n.MarshalBytes(buf) 13228 length, err := writer.Write(buf) 13229 return int64(length), err 13230 } 13231 13232 // Construct a slice backed by dst's underlying memory. 13233 var buf []byte 13234 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13235 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13236 hdr.Len = n.SizeBytes() 13237 hdr.Cap = n.SizeBytes() 13238 13239 length, err := writer.Write(buf) 13240 // Since we bypassed the compiler's escape analysis, indicate that n 13241 // must live until the use above. 13242 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13243 return int64(length), err 13244 } 13245 13246 // SizeBytes implements marshal.Marshallable.SizeBytes. 13247 func (n *NFNATRange2) SizeBytes() int { 13248 return 10 + 13249 (*Inet6Addr)(nil).SizeBytes() + 13250 (*Inet6Addr)(nil).SizeBytes() + 13251 1*6 13252 } 13253 13254 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13255 func (n *NFNATRange2) MarshalBytes(dst []byte) []byte { 13256 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Flags)) 13257 dst = dst[4:] 13258 dst = n.MinAddr.MarshalUnsafe(dst) 13259 dst = n.MaxAddr.MarshalUnsafe(dst) 13260 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MinProto)) 13261 dst = dst[2:] 13262 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.MaxProto)) 13263 dst = dst[2:] 13264 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.BaseProto)) 13265 dst = dst[2:] 13266 // Padding: dst[:sizeof(byte)*6] ~= [6]byte{0} 13267 dst = dst[1*(6):] 13268 return dst 13269 } 13270 13271 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13272 func (n *NFNATRange2) UnmarshalBytes(src []byte) []byte { 13273 n.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13274 src = src[4:] 13275 src = n.MinAddr.UnmarshalUnsafe(src) 13276 src = n.MaxAddr.UnmarshalUnsafe(src) 13277 n.MinProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13278 src = src[2:] 13279 n.MaxProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13280 src = src[2:] 13281 n.BaseProto = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13282 src = src[2:] 13283 // Padding: ~ copy([6]byte(n._), src[:sizeof(byte)*6]) 13284 src = src[1*(6):] 13285 return src 13286 } 13287 13288 // Packed implements marshal.Marshallable.Packed. 13289 //go:nosplit 13290 func (n *NFNATRange2) Packed() bool { 13291 return n.MaxAddr.Packed() && n.MinAddr.Packed() 13292 } 13293 13294 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13295 func (n *NFNATRange2) MarshalUnsafe(dst []byte) []byte { 13296 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 13297 size := n.SizeBytes() 13298 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 13299 return dst[size:] 13300 } 13301 // Type NFNATRange2 doesn't have a packed layout in memory, fallback to MarshalBytes. 13302 return n.MarshalBytes(dst) 13303 } 13304 13305 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13306 func (n *NFNATRange2) UnmarshalUnsafe(src []byte) []byte { 13307 if n.MaxAddr.Packed() && n.MinAddr.Packed() { 13308 size := n.SizeBytes() 13309 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 13310 return src[size:] 13311 } 13312 // Type NFNATRange2 doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13313 return n.UnmarshalBytes(src) 13314 } 13315 13316 // CopyOutN implements marshal.Marshallable.CopyOutN. 13317 func (n *NFNATRange2) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13318 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 13319 // Type NFNATRange2 doesn't have a packed layout in memory, fall back to MarshalBytes. 13320 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 13321 n.MarshalBytes(buf) // escapes: fallback. 13322 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13323 } 13324 13325 // Construct a slice backed by dst's underlying memory. 13326 var buf []byte 13327 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13328 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13329 hdr.Len = n.SizeBytes() 13330 hdr.Cap = n.SizeBytes() 13331 13332 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13333 // Since we bypassed the compiler's escape analysis, indicate that n 13334 // must live until the use above. 13335 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13336 return length, err 13337 } 13338 13339 // CopyOut implements marshal.Marshallable.CopyOut. 13340 func (n *NFNATRange2) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13341 return n.CopyOutN(cc, addr, n.SizeBytes()) 13342 } 13343 13344 // CopyInN implements marshal.Marshallable.CopyInN. 13345 func (n *NFNATRange2) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13346 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 13347 // Type NFNATRange2 doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13348 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 13349 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13350 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13351 // partially unmarshalled struct. 13352 n.UnmarshalBytes(buf) // escapes: fallback. 13353 return length, err 13354 } 13355 13356 // Construct a slice backed by dst's underlying memory. 13357 var buf []byte 13358 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13359 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13360 hdr.Len = n.SizeBytes() 13361 hdr.Cap = n.SizeBytes() 13362 13363 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13364 // Since we bypassed the compiler's escape analysis, indicate that n 13365 // must live until the use above. 13366 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13367 return length, err 13368 } 13369 13370 // CopyIn implements marshal.Marshallable.CopyIn. 13371 func (n *NFNATRange2) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13372 return n.CopyInN(cc, addr, n.SizeBytes()) 13373 } 13374 13375 // WriteTo implements io.WriterTo.WriteTo. 13376 func (n *NFNATRange2) WriteTo(writer io.Writer) (int64, error) { 13377 if !n.MaxAddr.Packed() && n.MinAddr.Packed() { 13378 // Type NFNATRange2 doesn't have a packed layout in memory, fall back to MarshalBytes. 13379 buf := make([]byte, n.SizeBytes()) 13380 n.MarshalBytes(buf) 13381 length, err := writer.Write(buf) 13382 return int64(length), err 13383 } 13384 13385 // Construct a slice backed by dst's underlying memory. 13386 var buf []byte 13387 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13388 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13389 hdr.Len = n.SizeBytes() 13390 hdr.Cap = n.SizeBytes() 13391 13392 length, err := writer.Write(buf) 13393 // Since we bypassed the compiler's escape analysis, indicate that n 13394 // must live until the use above. 13395 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13396 return int64(length), err 13397 } 13398 13399 // SizeBytes implements marshal.Marshallable.SizeBytes. 13400 func (n *NetlinkAttrHeader) SizeBytes() int { 13401 return 4 13402 } 13403 13404 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13405 func (n *NetlinkAttrHeader) MarshalBytes(dst []byte) []byte { 13406 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Length)) 13407 dst = dst[2:] 13408 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 13409 dst = dst[2:] 13410 return dst 13411 } 13412 13413 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13414 func (n *NetlinkAttrHeader) UnmarshalBytes(src []byte) []byte { 13415 n.Length = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13416 src = src[2:] 13417 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13418 src = src[2:] 13419 return src 13420 } 13421 13422 // Packed implements marshal.Marshallable.Packed. 13423 //go:nosplit 13424 func (n *NetlinkAttrHeader) Packed() bool { 13425 return true 13426 } 13427 13428 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13429 func (n *NetlinkAttrHeader) MarshalUnsafe(dst []byte) []byte { 13430 size := n.SizeBytes() 13431 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 13432 return dst[size:] 13433 } 13434 13435 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13436 func (n *NetlinkAttrHeader) UnmarshalUnsafe(src []byte) []byte { 13437 size := n.SizeBytes() 13438 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 13439 return src[size:] 13440 } 13441 13442 // CopyOutN implements marshal.Marshallable.CopyOutN. 13443 func (n *NetlinkAttrHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13444 // Construct a slice backed by dst's underlying memory. 13445 var buf []byte 13446 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13447 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13448 hdr.Len = n.SizeBytes() 13449 hdr.Cap = n.SizeBytes() 13450 13451 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13452 // Since we bypassed the compiler's escape analysis, indicate that n 13453 // must live until the use above. 13454 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13455 return length, err 13456 } 13457 13458 // CopyOut implements marshal.Marshallable.CopyOut. 13459 func (n *NetlinkAttrHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13460 return n.CopyOutN(cc, addr, n.SizeBytes()) 13461 } 13462 13463 // CopyInN implements marshal.Marshallable.CopyInN. 13464 func (n *NetlinkAttrHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13465 // Construct a slice backed by dst's underlying memory. 13466 var buf []byte 13467 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13468 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13469 hdr.Len = n.SizeBytes() 13470 hdr.Cap = n.SizeBytes() 13471 13472 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13473 // Since we bypassed the compiler's escape analysis, indicate that n 13474 // must live until the use above. 13475 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13476 return length, err 13477 } 13478 13479 // CopyIn implements marshal.Marshallable.CopyIn. 13480 func (n *NetlinkAttrHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13481 return n.CopyInN(cc, addr, n.SizeBytes()) 13482 } 13483 13484 // WriteTo implements io.WriterTo.WriteTo. 13485 func (n *NetlinkAttrHeader) WriteTo(writer io.Writer) (int64, error) { 13486 // Construct a slice backed by dst's underlying memory. 13487 var buf []byte 13488 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13489 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13490 hdr.Len = n.SizeBytes() 13491 hdr.Cap = n.SizeBytes() 13492 13493 length, err := writer.Write(buf) 13494 // Since we bypassed the compiler's escape analysis, indicate that n 13495 // must live until the use above. 13496 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13497 return int64(length), err 13498 } 13499 13500 // SizeBytes implements marshal.Marshallable.SizeBytes. 13501 func (n *NetlinkErrorMessage) SizeBytes() int { 13502 return 4 + 13503 (*NetlinkMessageHeader)(nil).SizeBytes() 13504 } 13505 13506 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13507 func (n *NetlinkErrorMessage) MarshalBytes(dst []byte) []byte { 13508 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Error)) 13509 dst = dst[4:] 13510 dst = n.Header.MarshalUnsafe(dst) 13511 return dst 13512 } 13513 13514 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13515 func (n *NetlinkErrorMessage) UnmarshalBytes(src []byte) []byte { 13516 n.Error = int32(hostarch.ByteOrder.Uint32(src[:4])) 13517 src = src[4:] 13518 src = n.Header.UnmarshalUnsafe(src) 13519 return src 13520 } 13521 13522 // Packed implements marshal.Marshallable.Packed. 13523 //go:nosplit 13524 func (n *NetlinkErrorMessage) Packed() bool { 13525 return n.Header.Packed() 13526 } 13527 13528 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13529 func (n *NetlinkErrorMessage) MarshalUnsafe(dst []byte) []byte { 13530 if n.Header.Packed() { 13531 size := n.SizeBytes() 13532 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 13533 return dst[size:] 13534 } 13535 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to MarshalBytes. 13536 return n.MarshalBytes(dst) 13537 } 13538 13539 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13540 func (n *NetlinkErrorMessage) UnmarshalUnsafe(src []byte) []byte { 13541 if n.Header.Packed() { 13542 size := n.SizeBytes() 13543 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 13544 return src[size:] 13545 } 13546 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 13547 return n.UnmarshalBytes(src) 13548 } 13549 13550 // CopyOutN implements marshal.Marshallable.CopyOutN. 13551 func (n *NetlinkErrorMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13552 if !n.Header.Packed() { 13553 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 13554 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 13555 n.MarshalBytes(buf) // escapes: fallback. 13556 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13557 } 13558 13559 // Construct a slice backed by dst's underlying memory. 13560 var buf []byte 13561 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13562 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13563 hdr.Len = n.SizeBytes() 13564 hdr.Cap = n.SizeBytes() 13565 13566 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13567 // Since we bypassed the compiler's escape analysis, indicate that n 13568 // must live until the use above. 13569 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13570 return length, err 13571 } 13572 13573 // CopyOut implements marshal.Marshallable.CopyOut. 13574 func (n *NetlinkErrorMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13575 return n.CopyOutN(cc, addr, n.SizeBytes()) 13576 } 13577 13578 // CopyInN implements marshal.Marshallable.CopyInN. 13579 func (n *NetlinkErrorMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13580 if !n.Header.Packed() { 13581 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 13582 buf := cc.CopyScratchBuffer(n.SizeBytes()) // escapes: okay. 13583 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13584 // Unmarshal unconditionally. If we had a short copy-in, this results in a 13585 // partially unmarshalled struct. 13586 n.UnmarshalBytes(buf) // escapes: fallback. 13587 return length, err 13588 } 13589 13590 // Construct a slice backed by dst's underlying memory. 13591 var buf []byte 13592 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13593 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13594 hdr.Len = n.SizeBytes() 13595 hdr.Cap = n.SizeBytes() 13596 13597 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13598 // Since we bypassed the compiler's escape analysis, indicate that n 13599 // must live until the use above. 13600 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13601 return length, err 13602 } 13603 13604 // CopyIn implements marshal.Marshallable.CopyIn. 13605 func (n *NetlinkErrorMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13606 return n.CopyInN(cc, addr, n.SizeBytes()) 13607 } 13608 13609 // WriteTo implements io.WriterTo.WriteTo. 13610 func (n *NetlinkErrorMessage) WriteTo(writer io.Writer) (int64, error) { 13611 if !n.Header.Packed() { 13612 // Type NetlinkErrorMessage doesn't have a packed layout in memory, fall back to MarshalBytes. 13613 buf := make([]byte, n.SizeBytes()) 13614 n.MarshalBytes(buf) 13615 length, err := writer.Write(buf) 13616 return int64(length), err 13617 } 13618 13619 // Construct a slice backed by dst's underlying memory. 13620 var buf []byte 13621 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13622 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13623 hdr.Len = n.SizeBytes() 13624 hdr.Cap = n.SizeBytes() 13625 13626 length, err := writer.Write(buf) 13627 // Since we bypassed the compiler's escape analysis, indicate that n 13628 // must live until the use above. 13629 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13630 return int64(length), err 13631 } 13632 13633 // SizeBytes implements marshal.Marshallable.SizeBytes. 13634 func (n *NetlinkMessageHeader) SizeBytes() int { 13635 return 16 13636 } 13637 13638 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13639 func (n *NetlinkMessageHeader) MarshalBytes(dst []byte) []byte { 13640 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Length)) 13641 dst = dst[4:] 13642 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Type)) 13643 dst = dst[2:] 13644 hostarch.ByteOrder.PutUint16(dst[:2], uint16(n.Flags)) 13645 dst = dst[2:] 13646 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.Seq)) 13647 dst = dst[4:] 13648 hostarch.ByteOrder.PutUint32(dst[:4], uint32(n.PortID)) 13649 dst = dst[4:] 13650 return dst 13651 } 13652 13653 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13654 func (n *NetlinkMessageHeader) UnmarshalBytes(src []byte) []byte { 13655 n.Length = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13656 src = src[4:] 13657 n.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13658 src = src[2:] 13659 n.Flags = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13660 src = src[2:] 13661 n.Seq = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13662 src = src[4:] 13663 n.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13664 src = src[4:] 13665 return src 13666 } 13667 13668 // Packed implements marshal.Marshallable.Packed. 13669 //go:nosplit 13670 func (n *NetlinkMessageHeader) Packed() bool { 13671 return true 13672 } 13673 13674 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13675 func (n *NetlinkMessageHeader) MarshalUnsafe(dst []byte) []byte { 13676 size := n.SizeBytes() 13677 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(n), uintptr(size)) 13678 return dst[size:] 13679 } 13680 13681 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13682 func (n *NetlinkMessageHeader) UnmarshalUnsafe(src []byte) []byte { 13683 size := n.SizeBytes() 13684 gohacks.Memmove(unsafe.Pointer(n), unsafe.Pointer(&src[0]), uintptr(size)) 13685 return src[size:] 13686 } 13687 13688 // CopyOutN implements marshal.Marshallable.CopyOutN. 13689 func (n *NetlinkMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13690 // Construct a slice backed by dst's underlying memory. 13691 var buf []byte 13692 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13693 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13694 hdr.Len = n.SizeBytes() 13695 hdr.Cap = n.SizeBytes() 13696 13697 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13698 // Since we bypassed the compiler's escape analysis, indicate that n 13699 // must live until the use above. 13700 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13701 return length, err 13702 } 13703 13704 // CopyOut implements marshal.Marshallable.CopyOut. 13705 func (n *NetlinkMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13706 return n.CopyOutN(cc, addr, n.SizeBytes()) 13707 } 13708 13709 // CopyInN implements marshal.Marshallable.CopyInN. 13710 func (n *NetlinkMessageHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13711 // Construct a slice backed by dst's underlying memory. 13712 var buf []byte 13713 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13714 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13715 hdr.Len = n.SizeBytes() 13716 hdr.Cap = n.SizeBytes() 13717 13718 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13719 // Since we bypassed the compiler's escape analysis, indicate that n 13720 // must live until the use above. 13721 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13722 return length, err 13723 } 13724 13725 // CopyIn implements marshal.Marshallable.CopyIn. 13726 func (n *NetlinkMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13727 return n.CopyInN(cc, addr, n.SizeBytes()) 13728 } 13729 13730 // WriteTo implements io.WriterTo.WriteTo. 13731 func (n *NetlinkMessageHeader) WriteTo(writer io.Writer) (int64, error) { 13732 // Construct a slice backed by dst's underlying memory. 13733 var buf []byte 13734 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13735 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(n))) 13736 hdr.Len = n.SizeBytes() 13737 hdr.Cap = n.SizeBytes() 13738 13739 length, err := writer.Write(buf) 13740 // Since we bypassed the compiler's escape analysis, indicate that n 13741 // must live until the use above. 13742 runtime.KeepAlive(n) // escapes: replaced by intrinsic. 13743 return int64(length), err 13744 } 13745 13746 // SizeBytes implements marshal.Marshallable.SizeBytes. 13747 func (s *SockAddrNetlink) SizeBytes() int { 13748 return 12 13749 } 13750 13751 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13752 func (s *SockAddrNetlink) MarshalBytes(dst []byte) []byte { 13753 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 13754 dst = dst[2:] 13755 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 13756 dst = dst[2:] 13757 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PortID)) 13758 dst = dst[4:] 13759 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Groups)) 13760 dst = dst[4:] 13761 return dst 13762 } 13763 13764 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13765 func (s *SockAddrNetlink) UnmarshalBytes(src []byte) []byte { 13766 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13767 src = src[2:] 13768 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 13769 src = src[2:] 13770 s.PortID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13771 src = src[4:] 13772 s.Groups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13773 src = src[4:] 13774 return src 13775 } 13776 13777 // Packed implements marshal.Marshallable.Packed. 13778 //go:nosplit 13779 func (s *SockAddrNetlink) Packed() bool { 13780 return true 13781 } 13782 13783 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13784 func (s *SockAddrNetlink) MarshalUnsafe(dst []byte) []byte { 13785 size := s.SizeBytes() 13786 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 13787 return dst[size:] 13788 } 13789 13790 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13791 func (s *SockAddrNetlink) UnmarshalUnsafe(src []byte) []byte { 13792 size := s.SizeBytes() 13793 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 13794 return src[size:] 13795 } 13796 13797 // CopyOutN implements marshal.Marshallable.CopyOutN. 13798 func (s *SockAddrNetlink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13799 // Construct a slice backed by dst's underlying memory. 13800 var buf []byte 13801 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13802 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13803 hdr.Len = s.SizeBytes() 13804 hdr.Cap = s.SizeBytes() 13805 13806 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13807 // Since we bypassed the compiler's escape analysis, indicate that s 13808 // must live until the use above. 13809 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13810 return length, err 13811 } 13812 13813 // CopyOut implements marshal.Marshallable.CopyOut. 13814 func (s *SockAddrNetlink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13815 return s.CopyOutN(cc, addr, s.SizeBytes()) 13816 } 13817 13818 // CopyInN implements marshal.Marshallable.CopyInN. 13819 func (s *SockAddrNetlink) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13820 // Construct a slice backed by dst's underlying memory. 13821 var buf []byte 13822 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13823 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13824 hdr.Len = s.SizeBytes() 13825 hdr.Cap = s.SizeBytes() 13826 13827 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13828 // Since we bypassed the compiler's escape analysis, indicate that s 13829 // must live until the use above. 13830 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13831 return length, err 13832 } 13833 13834 // CopyIn implements marshal.Marshallable.CopyIn. 13835 func (s *SockAddrNetlink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13836 return s.CopyInN(cc, addr, s.SizeBytes()) 13837 } 13838 13839 // WriteTo implements io.WriterTo.WriteTo. 13840 func (s *SockAddrNetlink) WriteTo(writer io.Writer) (int64, error) { 13841 // Construct a slice backed by dst's underlying memory. 13842 var buf []byte 13843 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13844 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 13845 hdr.Len = s.SizeBytes() 13846 hdr.Cap = s.SizeBytes() 13847 13848 length, err := writer.Write(buf) 13849 // Since we bypassed the compiler's escape analysis, indicate that s 13850 // must live until the use above. 13851 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 13852 return int64(length), err 13853 } 13854 13855 // SizeBytes implements marshal.Marshallable.SizeBytes. 13856 func (i *InterfaceAddrMessage) SizeBytes() int { 13857 return 8 13858 } 13859 13860 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13861 func (i *InterfaceAddrMessage) MarshalBytes(dst []byte) []byte { 13862 dst[0] = byte(i.Family) 13863 dst = dst[1:] 13864 dst[0] = byte(i.PrefixLen) 13865 dst = dst[1:] 13866 dst[0] = byte(i.Flags) 13867 dst = dst[1:] 13868 dst[0] = byte(i.Scope) 13869 dst = dst[1:] 13870 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 13871 dst = dst[4:] 13872 return dst 13873 } 13874 13875 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13876 func (i *InterfaceAddrMessage) UnmarshalBytes(src []byte) []byte { 13877 i.Family = uint8(src[0]) 13878 src = src[1:] 13879 i.PrefixLen = uint8(src[0]) 13880 src = src[1:] 13881 i.Flags = uint8(src[0]) 13882 src = src[1:] 13883 i.Scope = uint8(src[0]) 13884 src = src[1:] 13885 i.Index = uint32(hostarch.ByteOrder.Uint32(src[:4])) 13886 src = src[4:] 13887 return src 13888 } 13889 13890 // Packed implements marshal.Marshallable.Packed. 13891 //go:nosplit 13892 func (i *InterfaceAddrMessage) Packed() bool { 13893 return true 13894 } 13895 13896 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 13897 func (i *InterfaceAddrMessage) MarshalUnsafe(dst []byte) []byte { 13898 size := i.SizeBytes() 13899 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 13900 return dst[size:] 13901 } 13902 13903 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 13904 func (i *InterfaceAddrMessage) UnmarshalUnsafe(src []byte) []byte { 13905 size := i.SizeBytes() 13906 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 13907 return src[size:] 13908 } 13909 13910 // CopyOutN implements marshal.Marshallable.CopyOutN. 13911 func (i *InterfaceAddrMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13912 // Construct a slice backed by dst's underlying memory. 13913 var buf []byte 13914 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13915 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13916 hdr.Len = i.SizeBytes() 13917 hdr.Cap = i.SizeBytes() 13918 13919 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 13920 // Since we bypassed the compiler's escape analysis, indicate that i 13921 // must live until the use above. 13922 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13923 return length, err 13924 } 13925 13926 // CopyOut implements marshal.Marshallable.CopyOut. 13927 func (i *InterfaceAddrMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13928 return i.CopyOutN(cc, addr, i.SizeBytes()) 13929 } 13930 13931 // CopyInN implements marshal.Marshallable.CopyInN. 13932 func (i *InterfaceAddrMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 13933 // Construct a slice backed by dst's underlying memory. 13934 var buf []byte 13935 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13936 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13937 hdr.Len = i.SizeBytes() 13938 hdr.Cap = i.SizeBytes() 13939 13940 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 13941 // Since we bypassed the compiler's escape analysis, indicate that i 13942 // must live until the use above. 13943 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13944 return length, err 13945 } 13946 13947 // CopyIn implements marshal.Marshallable.CopyIn. 13948 func (i *InterfaceAddrMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 13949 return i.CopyInN(cc, addr, i.SizeBytes()) 13950 } 13951 13952 // WriteTo implements io.WriterTo.WriteTo. 13953 func (i *InterfaceAddrMessage) WriteTo(writer io.Writer) (int64, error) { 13954 // Construct a slice backed by dst's underlying memory. 13955 var buf []byte 13956 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 13957 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 13958 hdr.Len = i.SizeBytes() 13959 hdr.Cap = i.SizeBytes() 13960 13961 length, err := writer.Write(buf) 13962 // Since we bypassed the compiler's escape analysis, indicate that i 13963 // must live until the use above. 13964 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 13965 return int64(length), err 13966 } 13967 13968 // SizeBytes implements marshal.Marshallable.SizeBytes. 13969 func (i *InterfaceInfoMessage) SizeBytes() int { 13970 return 16 13971 } 13972 13973 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 13974 func (i *InterfaceInfoMessage) MarshalBytes(dst []byte) []byte { 13975 dst[0] = byte(i.Family) 13976 dst = dst[1:] 13977 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 13978 dst = dst[1:] 13979 hostarch.ByteOrder.PutUint16(dst[:2], uint16(i.Type)) 13980 dst = dst[2:] 13981 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Index)) 13982 dst = dst[4:] 13983 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Flags)) 13984 dst = dst[4:] 13985 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Change)) 13986 dst = dst[4:] 13987 return dst 13988 } 13989 13990 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 13991 func (i *InterfaceInfoMessage) UnmarshalBytes(src []byte) []byte { 13992 i.Family = uint8(src[0]) 13993 src = src[1:] 13994 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 13995 src = src[1:] 13996 i.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 13997 src = src[2:] 13998 i.Index = int32(hostarch.ByteOrder.Uint32(src[:4])) 13999 src = src[4:] 14000 i.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14001 src = src[4:] 14002 i.Change = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14003 src = src[4:] 14004 return src 14005 } 14006 14007 // Packed implements marshal.Marshallable.Packed. 14008 //go:nosplit 14009 func (i *InterfaceInfoMessage) Packed() bool { 14010 return true 14011 } 14012 14013 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14014 func (i *InterfaceInfoMessage) MarshalUnsafe(dst []byte) []byte { 14015 size := i.SizeBytes() 14016 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 14017 return dst[size:] 14018 } 14019 14020 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14021 func (i *InterfaceInfoMessage) UnmarshalUnsafe(src []byte) []byte { 14022 size := i.SizeBytes() 14023 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 14024 return src[size:] 14025 } 14026 14027 // CopyOutN implements marshal.Marshallable.CopyOutN. 14028 func (i *InterfaceInfoMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14029 // Construct a slice backed by dst's underlying memory. 14030 var buf []byte 14031 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14032 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14033 hdr.Len = i.SizeBytes() 14034 hdr.Cap = i.SizeBytes() 14035 14036 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14037 // Since we bypassed the compiler's escape analysis, indicate that i 14038 // must live until the use above. 14039 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14040 return length, err 14041 } 14042 14043 // CopyOut implements marshal.Marshallable.CopyOut. 14044 func (i *InterfaceInfoMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14045 return i.CopyOutN(cc, addr, i.SizeBytes()) 14046 } 14047 14048 // CopyInN implements marshal.Marshallable.CopyInN. 14049 func (i *InterfaceInfoMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14050 // Construct a slice backed by dst's underlying memory. 14051 var buf []byte 14052 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14053 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14054 hdr.Len = i.SizeBytes() 14055 hdr.Cap = i.SizeBytes() 14056 14057 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14058 // Since we bypassed the compiler's escape analysis, indicate that i 14059 // must live until the use above. 14060 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14061 return length, err 14062 } 14063 14064 // CopyIn implements marshal.Marshallable.CopyIn. 14065 func (i *InterfaceInfoMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14066 return i.CopyInN(cc, addr, i.SizeBytes()) 14067 } 14068 14069 // WriteTo implements io.WriterTo.WriteTo. 14070 func (i *InterfaceInfoMessage) WriteTo(writer io.Writer) (int64, error) { 14071 // Construct a slice backed by dst's underlying memory. 14072 var buf []byte 14073 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14074 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 14075 hdr.Len = i.SizeBytes() 14076 hdr.Cap = i.SizeBytes() 14077 14078 length, err := writer.Write(buf) 14079 // Since we bypassed the compiler's escape analysis, indicate that i 14080 // must live until the use above. 14081 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 14082 return int64(length), err 14083 } 14084 14085 // SizeBytes implements marshal.Marshallable.SizeBytes. 14086 func (r *RouteMessage) SizeBytes() int { 14087 return 12 14088 } 14089 14090 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14091 func (r *RouteMessage) MarshalBytes(dst []byte) []byte { 14092 dst[0] = byte(r.Family) 14093 dst = dst[1:] 14094 dst[0] = byte(r.DstLen) 14095 dst = dst[1:] 14096 dst[0] = byte(r.SrcLen) 14097 dst = dst[1:] 14098 dst[0] = byte(r.TOS) 14099 dst = dst[1:] 14100 dst[0] = byte(r.Table) 14101 dst = dst[1:] 14102 dst[0] = byte(r.Protocol) 14103 dst = dst[1:] 14104 dst[0] = byte(r.Scope) 14105 dst = dst[1:] 14106 dst[0] = byte(r.Type) 14107 dst = dst[1:] 14108 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 14109 dst = dst[4:] 14110 return dst 14111 } 14112 14113 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14114 func (r *RouteMessage) UnmarshalBytes(src []byte) []byte { 14115 r.Family = uint8(src[0]) 14116 src = src[1:] 14117 r.DstLen = uint8(src[0]) 14118 src = src[1:] 14119 r.SrcLen = uint8(src[0]) 14120 src = src[1:] 14121 r.TOS = uint8(src[0]) 14122 src = src[1:] 14123 r.Table = uint8(src[0]) 14124 src = src[1:] 14125 r.Protocol = uint8(src[0]) 14126 src = src[1:] 14127 r.Scope = uint8(src[0]) 14128 src = src[1:] 14129 r.Type = uint8(src[0]) 14130 src = src[1:] 14131 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14132 src = src[4:] 14133 return src 14134 } 14135 14136 // Packed implements marshal.Marshallable.Packed. 14137 //go:nosplit 14138 func (r *RouteMessage) Packed() bool { 14139 return true 14140 } 14141 14142 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14143 func (r *RouteMessage) MarshalUnsafe(dst []byte) []byte { 14144 size := r.SizeBytes() 14145 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 14146 return dst[size:] 14147 } 14148 14149 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14150 func (r *RouteMessage) UnmarshalUnsafe(src []byte) []byte { 14151 size := r.SizeBytes() 14152 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 14153 return src[size:] 14154 } 14155 14156 // CopyOutN implements marshal.Marshallable.CopyOutN. 14157 func (r *RouteMessage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14158 // Construct a slice backed by dst's underlying memory. 14159 var buf []byte 14160 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14161 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14162 hdr.Len = r.SizeBytes() 14163 hdr.Cap = r.SizeBytes() 14164 14165 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14166 // Since we bypassed the compiler's escape analysis, indicate that r 14167 // must live until the use above. 14168 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14169 return length, err 14170 } 14171 14172 // CopyOut implements marshal.Marshallable.CopyOut. 14173 func (r *RouteMessage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14174 return r.CopyOutN(cc, addr, r.SizeBytes()) 14175 } 14176 14177 // CopyInN implements marshal.Marshallable.CopyInN. 14178 func (r *RouteMessage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14179 // Construct a slice backed by dst's underlying memory. 14180 var buf []byte 14181 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14182 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14183 hdr.Len = r.SizeBytes() 14184 hdr.Cap = r.SizeBytes() 14185 14186 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14187 // Since we bypassed the compiler's escape analysis, indicate that r 14188 // must live until the use above. 14189 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14190 return length, err 14191 } 14192 14193 // CopyIn implements marshal.Marshallable.CopyIn. 14194 func (r *RouteMessage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14195 return r.CopyInN(cc, addr, r.SizeBytes()) 14196 } 14197 14198 // WriteTo implements io.WriterTo.WriteTo. 14199 func (r *RouteMessage) WriteTo(writer io.Writer) (int64, error) { 14200 // Construct a slice backed by dst's underlying memory. 14201 var buf []byte 14202 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14203 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14204 hdr.Len = r.SizeBytes() 14205 hdr.Cap = r.SizeBytes() 14206 14207 length, err := writer.Write(buf) 14208 // Since we bypassed the compiler's escape analysis, indicate that r 14209 // must live until the use above. 14210 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14211 return int64(length), err 14212 } 14213 14214 // SizeBytes implements marshal.Marshallable.SizeBytes. 14215 func (r *RtAttr) SizeBytes() int { 14216 return 4 14217 } 14218 14219 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14220 func (r *RtAttr) MarshalBytes(dst []byte) []byte { 14221 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Len)) 14222 dst = dst[2:] 14223 hostarch.ByteOrder.PutUint16(dst[:2], uint16(r.Type)) 14224 dst = dst[2:] 14225 return dst 14226 } 14227 14228 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14229 func (r *RtAttr) UnmarshalBytes(src []byte) []byte { 14230 r.Len = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14231 src = src[2:] 14232 r.Type = uint16(hostarch.ByteOrder.Uint16(src[:2])) 14233 src = src[2:] 14234 return src 14235 } 14236 14237 // Packed implements marshal.Marshallable.Packed. 14238 //go:nosplit 14239 func (r *RtAttr) Packed() bool { 14240 return true 14241 } 14242 14243 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14244 func (r *RtAttr) MarshalUnsafe(dst []byte) []byte { 14245 size := r.SizeBytes() 14246 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 14247 return dst[size:] 14248 } 14249 14250 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14251 func (r *RtAttr) UnmarshalUnsafe(src []byte) []byte { 14252 size := r.SizeBytes() 14253 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 14254 return src[size:] 14255 } 14256 14257 // CopyOutN implements marshal.Marshallable.CopyOutN. 14258 func (r *RtAttr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14259 // Construct a slice backed by dst's underlying memory. 14260 var buf []byte 14261 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14262 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14263 hdr.Len = r.SizeBytes() 14264 hdr.Cap = r.SizeBytes() 14265 14266 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14267 // Since we bypassed the compiler's escape analysis, indicate that r 14268 // must live until the use above. 14269 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14270 return length, err 14271 } 14272 14273 // CopyOut implements marshal.Marshallable.CopyOut. 14274 func (r *RtAttr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14275 return r.CopyOutN(cc, addr, r.SizeBytes()) 14276 } 14277 14278 // CopyInN implements marshal.Marshallable.CopyInN. 14279 func (r *RtAttr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14280 // Construct a slice backed by dst's underlying memory. 14281 var buf []byte 14282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14284 hdr.Len = r.SizeBytes() 14285 hdr.Cap = r.SizeBytes() 14286 14287 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14288 // Since we bypassed the compiler's escape analysis, indicate that r 14289 // must live until the use above. 14290 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14291 return length, err 14292 } 14293 14294 // CopyIn implements marshal.Marshallable.CopyIn. 14295 func (r *RtAttr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14296 return r.CopyInN(cc, addr, r.SizeBytes()) 14297 } 14298 14299 // WriteTo implements io.WriterTo.WriteTo. 14300 func (r *RtAttr) WriteTo(writer io.Writer) (int64, error) { 14301 // Construct a slice backed by dst's underlying memory. 14302 var buf []byte 14303 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14304 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14305 hdr.Len = r.SizeBytes() 14306 hdr.Cap = r.SizeBytes() 14307 14308 length, err := writer.Write(buf) 14309 // Since we bypassed the compiler's escape analysis, indicate that r 14310 // must live until the use above. 14311 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14312 return int64(length), err 14313 } 14314 14315 // SizeBytes implements marshal.Marshallable.SizeBytes. 14316 func (p *PollFD) SizeBytes() int { 14317 return 8 14318 } 14319 14320 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14321 func (p *PollFD) MarshalBytes(dst []byte) []byte { 14322 hostarch.ByteOrder.PutUint32(dst[:4], uint32(p.FD)) 14323 dst = dst[4:] 14324 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.Events)) 14325 dst = dst[2:] 14326 hostarch.ByteOrder.PutUint16(dst[:2], uint16(p.REvents)) 14327 dst = dst[2:] 14328 return dst 14329 } 14330 14331 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14332 func (p *PollFD) UnmarshalBytes(src []byte) []byte { 14333 p.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 14334 src = src[4:] 14335 p.Events = int16(hostarch.ByteOrder.Uint16(src[:2])) 14336 src = src[2:] 14337 p.REvents = int16(hostarch.ByteOrder.Uint16(src[:2])) 14338 src = src[2:] 14339 return src 14340 } 14341 14342 // Packed implements marshal.Marshallable.Packed. 14343 //go:nosplit 14344 func (p *PollFD) Packed() bool { 14345 return true 14346 } 14347 14348 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14349 func (p *PollFD) MarshalUnsafe(dst []byte) []byte { 14350 size := p.SizeBytes() 14351 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(p), uintptr(size)) 14352 return dst[size:] 14353 } 14354 14355 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14356 func (p *PollFD) UnmarshalUnsafe(src []byte) []byte { 14357 size := p.SizeBytes() 14358 gohacks.Memmove(unsafe.Pointer(p), unsafe.Pointer(&src[0]), uintptr(size)) 14359 return src[size:] 14360 } 14361 14362 // CopyOutN implements marshal.Marshallable.CopyOutN. 14363 func (p *PollFD) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14364 // Construct a slice backed by dst's underlying memory. 14365 var buf []byte 14366 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14367 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 14368 hdr.Len = p.SizeBytes() 14369 hdr.Cap = p.SizeBytes() 14370 14371 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14372 // Since we bypassed the compiler's escape analysis, indicate that p 14373 // must live until the use above. 14374 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 14375 return length, err 14376 } 14377 14378 // CopyOut implements marshal.Marshallable.CopyOut. 14379 func (p *PollFD) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14380 return p.CopyOutN(cc, addr, p.SizeBytes()) 14381 } 14382 14383 // CopyInN implements marshal.Marshallable.CopyInN. 14384 func (p *PollFD) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14385 // Construct a slice backed by dst's underlying memory. 14386 var buf []byte 14387 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14388 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 14389 hdr.Len = p.SizeBytes() 14390 hdr.Cap = p.SizeBytes() 14391 14392 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14393 // Since we bypassed the compiler's escape analysis, indicate that p 14394 // must live until the use above. 14395 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 14396 return length, err 14397 } 14398 14399 // CopyIn implements marshal.Marshallable.CopyIn. 14400 func (p *PollFD) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14401 return p.CopyInN(cc, addr, p.SizeBytes()) 14402 } 14403 14404 // WriteTo implements io.WriterTo.WriteTo. 14405 func (p *PollFD) WriteTo(writer io.Writer) (int64, error) { 14406 // Construct a slice backed by dst's underlying memory. 14407 var buf []byte 14408 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14409 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(p))) 14410 hdr.Len = p.SizeBytes() 14411 hdr.Cap = p.SizeBytes() 14412 14413 length, err := writer.Write(buf) 14414 // Since we bypassed the compiler's escape analysis, indicate that p 14415 // must live until the use above. 14416 runtime.KeepAlive(p) // escapes: replaced by intrinsic. 14417 return int64(length), err 14418 } 14419 14420 // CopyPollFDSliceIn copies in a slice of PollFD objects from the task's memory. 14421 func CopyPollFDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []PollFD) (int, error) { 14422 count := len(dst) 14423 if count == 0 { 14424 return 0, nil 14425 } 14426 size := (*PollFD)(nil).SizeBytes() 14427 14428 ptr := unsafe.Pointer(&dst) 14429 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 14430 14431 // Construct a slice backed by dst's underlying memory. 14432 var buf []byte 14433 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14434 hdr.Data = uintptr(val) 14435 hdr.Len = size * count 14436 hdr.Cap = size * count 14437 14438 length, err := cc.CopyInBytes(addr, buf) 14439 // Since we bypassed the compiler's escape analysis, indicate that dst 14440 // must live until the use above. 14441 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 14442 return length, err 14443 } 14444 14445 // CopyPollFDSliceOut copies a slice of PollFD objects to the task's memory. 14446 func CopyPollFDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []PollFD) (int, error) { 14447 count := len(src) 14448 if count == 0 { 14449 return 0, nil 14450 } 14451 size := (*PollFD)(nil).SizeBytes() 14452 14453 ptr := unsafe.Pointer(&src) 14454 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 14455 14456 // Construct a slice backed by dst's underlying memory. 14457 var buf []byte 14458 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14459 hdr.Data = uintptr(val) 14460 hdr.Len = size * count 14461 hdr.Cap = size * count 14462 14463 length, err := cc.CopyOutBytes(addr, buf) 14464 // Since we bypassed the compiler's escape analysis, indicate that src 14465 // must live until the use above. 14466 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 14467 return length, err 14468 } 14469 14470 // MarshalUnsafePollFDSlice is like PollFD.MarshalUnsafe, but for a []PollFD. 14471 func MarshalUnsafePollFDSlice(src []PollFD, dst []byte) []byte { 14472 count := len(src) 14473 if count == 0 { 14474 return dst 14475 } 14476 14477 size := (*PollFD)(nil).SizeBytes() 14478 buf := dst[:size*count] 14479 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 14480 return dst[size*count:] 14481 } 14482 14483 // UnmarshalUnsafePollFDSlice is like PollFD.UnmarshalUnsafe, but for a []PollFD. 14484 func UnmarshalUnsafePollFDSlice(dst []PollFD, src []byte) []byte { 14485 count := len(dst) 14486 if count == 0 { 14487 return src 14488 } 14489 14490 size := (*PollFD)(nil).SizeBytes() 14491 buf := src[:size*count] 14492 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 14493 return src[size*count:] 14494 } 14495 14496 // SizeBytes implements marshal.Marshallable.SizeBytes. 14497 func (r *RSeqCriticalSection) SizeBytes() int { 14498 return 32 14499 } 14500 14501 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14502 func (r *RSeqCriticalSection) MarshalBytes(dst []byte) []byte { 14503 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Version)) 14504 dst = dst[4:] 14505 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Flags)) 14506 dst = dst[4:] 14507 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Start)) 14508 dst = dst[8:] 14509 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.PostCommitOffset)) 14510 dst = dst[8:] 14511 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Abort)) 14512 dst = dst[8:] 14513 return dst 14514 } 14515 14516 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14517 func (r *RSeqCriticalSection) UnmarshalBytes(src []byte) []byte { 14518 r.Version = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14519 src = src[4:] 14520 r.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14521 src = src[4:] 14522 r.Start = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14523 src = src[8:] 14524 r.PostCommitOffset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14525 src = src[8:] 14526 r.Abort = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14527 src = src[8:] 14528 return src 14529 } 14530 14531 // Packed implements marshal.Marshallable.Packed. 14532 //go:nosplit 14533 func (r *RSeqCriticalSection) Packed() bool { 14534 return true 14535 } 14536 14537 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14538 func (r *RSeqCriticalSection) MarshalUnsafe(dst []byte) []byte { 14539 size := r.SizeBytes() 14540 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 14541 return dst[size:] 14542 } 14543 14544 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14545 func (r *RSeqCriticalSection) UnmarshalUnsafe(src []byte) []byte { 14546 size := r.SizeBytes() 14547 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 14548 return src[size:] 14549 } 14550 14551 // CopyOutN implements marshal.Marshallable.CopyOutN. 14552 func (r *RSeqCriticalSection) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14553 // Construct a slice backed by dst's underlying memory. 14554 var buf []byte 14555 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14556 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14557 hdr.Len = r.SizeBytes() 14558 hdr.Cap = r.SizeBytes() 14559 14560 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14561 // Since we bypassed the compiler's escape analysis, indicate that r 14562 // must live until the use above. 14563 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14564 return length, err 14565 } 14566 14567 // CopyOut implements marshal.Marshallable.CopyOut. 14568 func (r *RSeqCriticalSection) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14569 return r.CopyOutN(cc, addr, r.SizeBytes()) 14570 } 14571 14572 // CopyInN implements marshal.Marshallable.CopyInN. 14573 func (r *RSeqCriticalSection) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14574 // Construct a slice backed by dst's underlying memory. 14575 var buf []byte 14576 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14577 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14578 hdr.Len = r.SizeBytes() 14579 hdr.Cap = r.SizeBytes() 14580 14581 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14582 // Since we bypassed the compiler's escape analysis, indicate that r 14583 // must live until the use above. 14584 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14585 return length, err 14586 } 14587 14588 // CopyIn implements marshal.Marshallable.CopyIn. 14589 func (r *RSeqCriticalSection) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14590 return r.CopyInN(cc, addr, r.SizeBytes()) 14591 } 14592 14593 // WriteTo implements io.WriterTo.WriteTo. 14594 func (r *RSeqCriticalSection) WriteTo(writer io.Writer) (int64, error) { 14595 // Construct a slice backed by dst's underlying memory. 14596 var buf []byte 14597 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14598 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14599 hdr.Len = r.SizeBytes() 14600 hdr.Cap = r.SizeBytes() 14601 14602 length, err := writer.Write(buf) 14603 // Since we bypassed the compiler's escape analysis, indicate that r 14604 // must live until the use above. 14605 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14606 return int64(length), err 14607 } 14608 14609 // SizeBytes implements marshal.Marshallable.SizeBytes. 14610 func (r *Rusage) SizeBytes() int { 14611 return 112 + 14612 (*Timeval)(nil).SizeBytes() + 14613 (*Timeval)(nil).SizeBytes() 14614 } 14615 14616 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14617 func (r *Rusage) MarshalBytes(dst []byte) []byte { 14618 dst = r.UTime.MarshalUnsafe(dst) 14619 dst = r.STime.MarshalUnsafe(dst) 14620 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MaxRSS)) 14621 dst = dst[8:] 14622 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IXRSS)) 14623 dst = dst[8:] 14624 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.IDRSS)) 14625 dst = dst[8:] 14626 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.ISRSS)) 14627 dst = dst[8:] 14628 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MinFlt)) 14629 dst = dst[8:] 14630 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MajFlt)) 14631 dst = dst[8:] 14632 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSwap)) 14633 dst = dst[8:] 14634 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.InBlock)) 14635 dst = dst[8:] 14636 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.OuBlock)) 14637 dst = dst[8:] 14638 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgSnd)) 14639 dst = dst[8:] 14640 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.MsgRcv)) 14641 dst = dst[8:] 14642 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NSignals)) 14643 dst = dst[8:] 14644 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NVCSw)) 14645 dst = dst[8:] 14646 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.NIvCSw)) 14647 dst = dst[8:] 14648 return dst 14649 } 14650 14651 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14652 func (r *Rusage) UnmarshalBytes(src []byte) []byte { 14653 src = r.UTime.UnmarshalUnsafe(src) 14654 src = r.STime.UnmarshalUnsafe(src) 14655 r.MaxRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14656 src = src[8:] 14657 r.IXRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14658 src = src[8:] 14659 r.IDRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14660 src = src[8:] 14661 r.ISRSS = int64(hostarch.ByteOrder.Uint64(src[:8])) 14662 src = src[8:] 14663 r.MinFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 14664 src = src[8:] 14665 r.MajFlt = int64(hostarch.ByteOrder.Uint64(src[:8])) 14666 src = src[8:] 14667 r.NSwap = int64(hostarch.ByteOrder.Uint64(src[:8])) 14668 src = src[8:] 14669 r.InBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 14670 src = src[8:] 14671 r.OuBlock = int64(hostarch.ByteOrder.Uint64(src[:8])) 14672 src = src[8:] 14673 r.MsgSnd = int64(hostarch.ByteOrder.Uint64(src[:8])) 14674 src = src[8:] 14675 r.MsgRcv = int64(hostarch.ByteOrder.Uint64(src[:8])) 14676 src = src[8:] 14677 r.NSignals = int64(hostarch.ByteOrder.Uint64(src[:8])) 14678 src = src[8:] 14679 r.NVCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 14680 src = src[8:] 14681 r.NIvCSw = int64(hostarch.ByteOrder.Uint64(src[:8])) 14682 src = src[8:] 14683 return src 14684 } 14685 14686 // Packed implements marshal.Marshallable.Packed. 14687 //go:nosplit 14688 func (r *Rusage) Packed() bool { 14689 return r.STime.Packed() && r.UTime.Packed() 14690 } 14691 14692 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14693 func (r *Rusage) MarshalUnsafe(dst []byte) []byte { 14694 if r.STime.Packed() && r.UTime.Packed() { 14695 size := r.SizeBytes() 14696 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 14697 return dst[size:] 14698 } 14699 // Type Rusage doesn't have a packed layout in memory, fallback to MarshalBytes. 14700 return r.MarshalBytes(dst) 14701 } 14702 14703 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14704 func (r *Rusage) UnmarshalUnsafe(src []byte) []byte { 14705 if r.STime.Packed() && r.UTime.Packed() { 14706 size := r.SizeBytes() 14707 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 14708 return src[size:] 14709 } 14710 // Type Rusage doesn't have a packed layout in memory, fallback to UnmarshalBytes. 14711 return r.UnmarshalBytes(src) 14712 } 14713 14714 // CopyOutN implements marshal.Marshallable.CopyOutN. 14715 func (r *Rusage) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14716 if !r.STime.Packed() && r.UTime.Packed() { 14717 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 14718 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 14719 r.MarshalBytes(buf) // escapes: fallback. 14720 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14721 } 14722 14723 // Construct a slice backed by dst's underlying memory. 14724 var buf []byte 14725 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14726 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14727 hdr.Len = r.SizeBytes() 14728 hdr.Cap = r.SizeBytes() 14729 14730 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14731 // Since we bypassed the compiler's escape analysis, indicate that r 14732 // must live until the use above. 14733 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14734 return length, err 14735 } 14736 14737 // CopyOut implements marshal.Marshallable.CopyOut. 14738 func (r *Rusage) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14739 return r.CopyOutN(cc, addr, r.SizeBytes()) 14740 } 14741 14742 // CopyInN implements marshal.Marshallable.CopyInN. 14743 func (r *Rusage) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14744 if !r.STime.Packed() && r.UTime.Packed() { 14745 // Type Rusage doesn't have a packed layout in memory, fall back to UnmarshalBytes. 14746 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 14747 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14748 // Unmarshal unconditionally. If we had a short copy-in, this results in a 14749 // partially unmarshalled struct. 14750 r.UnmarshalBytes(buf) // escapes: fallback. 14751 return length, err 14752 } 14753 14754 // Construct a slice backed by dst's underlying memory. 14755 var buf []byte 14756 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14757 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14758 hdr.Len = r.SizeBytes() 14759 hdr.Cap = r.SizeBytes() 14760 14761 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14762 // Since we bypassed the compiler's escape analysis, indicate that r 14763 // must live until the use above. 14764 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14765 return length, err 14766 } 14767 14768 // CopyIn implements marshal.Marshallable.CopyIn. 14769 func (r *Rusage) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14770 return r.CopyInN(cc, addr, r.SizeBytes()) 14771 } 14772 14773 // WriteTo implements io.WriterTo.WriteTo. 14774 func (r *Rusage) WriteTo(writer io.Writer) (int64, error) { 14775 if !r.STime.Packed() && r.UTime.Packed() { 14776 // Type Rusage doesn't have a packed layout in memory, fall back to MarshalBytes. 14777 buf := make([]byte, r.SizeBytes()) 14778 r.MarshalBytes(buf) 14779 length, err := writer.Write(buf) 14780 return int64(length), err 14781 } 14782 14783 // Construct a slice backed by dst's underlying memory. 14784 var buf []byte 14785 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14786 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 14787 hdr.Len = r.SizeBytes() 14788 hdr.Cap = r.SizeBytes() 14789 14790 length, err := writer.Write(buf) 14791 // Since we bypassed the compiler's escape analysis, indicate that r 14792 // must live until the use above. 14793 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 14794 return int64(length), err 14795 } 14796 14797 // SizeBytes implements marshal.Marshallable.SizeBytes. 14798 func (sd *SeccompData) SizeBytes() int { 14799 return 16 + 14800 8*6 14801 } 14802 14803 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14804 func (sd *SeccompData) MarshalBytes(dst []byte) []byte { 14805 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sd.Nr)) 14806 dst = dst[4:] 14807 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sd.Arch)) 14808 dst = dst[4:] 14809 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sd.InstructionPointer)) 14810 dst = dst[8:] 14811 for idx := 0; idx < 6; idx++ { 14812 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sd.Args[idx])) 14813 dst = dst[8:] 14814 } 14815 return dst 14816 } 14817 14818 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14819 func (sd *SeccompData) UnmarshalBytes(src []byte) []byte { 14820 sd.Nr = int32(hostarch.ByteOrder.Uint32(src[:4])) 14821 src = src[4:] 14822 sd.Arch = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14823 src = src[4:] 14824 sd.InstructionPointer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14825 src = src[8:] 14826 for idx := 0; idx < 6; idx++ { 14827 sd.Args[idx] = uint64(hostarch.ByteOrder.Uint64(src[:8])) 14828 src = src[8:] 14829 } 14830 return src 14831 } 14832 14833 // Packed implements marshal.Marshallable.Packed. 14834 //go:nosplit 14835 func (sd *SeccompData) Packed() bool { 14836 return true 14837 } 14838 14839 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14840 func (sd *SeccompData) MarshalUnsafe(dst []byte) []byte { 14841 size := sd.SizeBytes() 14842 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sd), uintptr(size)) 14843 return dst[size:] 14844 } 14845 14846 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14847 func (sd *SeccompData) UnmarshalUnsafe(src []byte) []byte { 14848 size := sd.SizeBytes() 14849 gohacks.Memmove(unsafe.Pointer(sd), unsafe.Pointer(&src[0]), uintptr(size)) 14850 return src[size:] 14851 } 14852 14853 // CopyOutN implements marshal.Marshallable.CopyOutN. 14854 func (sd *SeccompData) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14855 // Construct a slice backed by dst's underlying memory. 14856 var buf []byte 14857 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14858 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sd))) 14859 hdr.Len = sd.SizeBytes() 14860 hdr.Cap = sd.SizeBytes() 14861 14862 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14863 // Since we bypassed the compiler's escape analysis, indicate that sd 14864 // must live until the use above. 14865 runtime.KeepAlive(sd) // escapes: replaced by intrinsic. 14866 return length, err 14867 } 14868 14869 // CopyOut implements marshal.Marshallable.CopyOut. 14870 func (sd *SeccompData) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14871 return sd.CopyOutN(cc, addr, sd.SizeBytes()) 14872 } 14873 14874 // CopyInN implements marshal.Marshallable.CopyInN. 14875 func (sd *SeccompData) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14876 // Construct a slice backed by dst's underlying memory. 14877 var buf []byte 14878 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14879 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sd))) 14880 hdr.Len = sd.SizeBytes() 14881 hdr.Cap = sd.SizeBytes() 14882 14883 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 14884 // Since we bypassed the compiler's escape analysis, indicate that sd 14885 // must live until the use above. 14886 runtime.KeepAlive(sd) // escapes: replaced by intrinsic. 14887 return length, err 14888 } 14889 14890 // CopyIn implements marshal.Marshallable.CopyIn. 14891 func (sd *SeccompData) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 14892 return sd.CopyInN(cc, addr, sd.SizeBytes()) 14893 } 14894 14895 // WriteTo implements io.WriterTo.WriteTo. 14896 func (sd *SeccompData) WriteTo(writer io.Writer) (int64, error) { 14897 // Construct a slice backed by dst's underlying memory. 14898 var buf []byte 14899 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14900 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sd))) 14901 hdr.Len = sd.SizeBytes() 14902 hdr.Cap = sd.SizeBytes() 14903 14904 length, err := writer.Write(buf) 14905 // Since we bypassed the compiler's escape analysis, indicate that sd 14906 // must live until the use above. 14907 runtime.KeepAlive(sd) // escapes: replaced by intrinsic. 14908 return int64(length), err 14909 } 14910 14911 // SizeBytes implements marshal.Marshallable.SizeBytes. 14912 func (s *SemInfo) SizeBytes() int { 14913 return 40 14914 } 14915 14916 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 14917 func (s *SemInfo) MarshalBytes(dst []byte) []byte { 14918 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMap)) 14919 dst = dst[4:] 14920 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMni)) 14921 dst = dst[4:] 14922 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMns)) 14923 dst = dst[4:] 14924 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMnu)) 14925 dst = dst[4:] 14926 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemMsl)) 14927 dst = dst[4:] 14928 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemOpm)) 14929 dst = dst[4:] 14930 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUme)) 14931 dst = dst[4:] 14932 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemUsz)) 14933 dst = dst[4:] 14934 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemVmx)) 14935 dst = dst[4:] 14936 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.SemAem)) 14937 dst = dst[4:] 14938 return dst 14939 } 14940 14941 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 14942 func (s *SemInfo) UnmarshalBytes(src []byte) []byte { 14943 s.SemMap = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14944 src = src[4:] 14945 s.SemMni = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14946 src = src[4:] 14947 s.SemMns = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14948 src = src[4:] 14949 s.SemMnu = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14950 src = src[4:] 14951 s.SemMsl = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14952 src = src[4:] 14953 s.SemOpm = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14954 src = src[4:] 14955 s.SemUme = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14956 src = src[4:] 14957 s.SemUsz = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14958 src = src[4:] 14959 s.SemVmx = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14960 src = src[4:] 14961 s.SemAem = uint32(hostarch.ByteOrder.Uint32(src[:4])) 14962 src = src[4:] 14963 return src 14964 } 14965 14966 // Packed implements marshal.Marshallable.Packed. 14967 //go:nosplit 14968 func (s *SemInfo) Packed() bool { 14969 return true 14970 } 14971 14972 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 14973 func (s *SemInfo) MarshalUnsafe(dst []byte) []byte { 14974 size := s.SizeBytes() 14975 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 14976 return dst[size:] 14977 } 14978 14979 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 14980 func (s *SemInfo) UnmarshalUnsafe(src []byte) []byte { 14981 size := s.SizeBytes() 14982 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 14983 return src[size:] 14984 } 14985 14986 // CopyOutN implements marshal.Marshallable.CopyOutN. 14987 func (s *SemInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 14988 // Construct a slice backed by dst's underlying memory. 14989 var buf []byte 14990 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 14991 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 14992 hdr.Len = s.SizeBytes() 14993 hdr.Cap = s.SizeBytes() 14994 14995 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 14996 // Since we bypassed the compiler's escape analysis, indicate that s 14997 // must live until the use above. 14998 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 14999 return length, err 15000 } 15001 15002 // CopyOut implements marshal.Marshallable.CopyOut. 15003 func (s *SemInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15004 return s.CopyOutN(cc, addr, s.SizeBytes()) 15005 } 15006 15007 // CopyInN implements marshal.Marshallable.CopyInN. 15008 func (s *SemInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15009 // Construct a slice backed by dst's underlying memory. 15010 var buf []byte 15011 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15012 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15013 hdr.Len = s.SizeBytes() 15014 hdr.Cap = s.SizeBytes() 15015 15016 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15017 // Since we bypassed the compiler's escape analysis, indicate that s 15018 // must live until the use above. 15019 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15020 return length, err 15021 } 15022 15023 // CopyIn implements marshal.Marshallable.CopyIn. 15024 func (s *SemInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15025 return s.CopyInN(cc, addr, s.SizeBytes()) 15026 } 15027 15028 // WriteTo implements io.WriterTo.WriteTo. 15029 func (s *SemInfo) WriteTo(writer io.Writer) (int64, error) { 15030 // Construct a slice backed by dst's underlying memory. 15031 var buf []byte 15032 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15033 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15034 hdr.Len = s.SizeBytes() 15035 hdr.Cap = s.SizeBytes() 15036 15037 length, err := writer.Write(buf) 15038 // Since we bypassed the compiler's escape analysis, indicate that s 15039 // must live until the use above. 15040 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15041 return int64(length), err 15042 } 15043 15044 // SizeBytes implements marshal.Marshallable.SizeBytes. 15045 func (s *Sembuf) SizeBytes() int { 15046 return 6 15047 } 15048 15049 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15050 func (s *Sembuf) MarshalBytes(dst []byte) []byte { 15051 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemNum)) 15052 dst = dst[2:] 15053 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemOp)) 15054 dst = dst[2:] 15055 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.SemFlg)) 15056 dst = dst[2:] 15057 return dst 15058 } 15059 15060 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15061 func (s *Sembuf) UnmarshalBytes(src []byte) []byte { 15062 s.SemNum = uint16(hostarch.ByteOrder.Uint16(src[:2])) 15063 src = src[2:] 15064 s.SemOp = int16(hostarch.ByteOrder.Uint16(src[:2])) 15065 src = src[2:] 15066 s.SemFlg = int16(hostarch.ByteOrder.Uint16(src[:2])) 15067 src = src[2:] 15068 return src 15069 } 15070 15071 // Packed implements marshal.Marshallable.Packed. 15072 //go:nosplit 15073 func (s *Sembuf) Packed() bool { 15074 return true 15075 } 15076 15077 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15078 func (s *Sembuf) MarshalUnsafe(dst []byte) []byte { 15079 size := s.SizeBytes() 15080 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15081 return dst[size:] 15082 } 15083 15084 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15085 func (s *Sembuf) UnmarshalUnsafe(src []byte) []byte { 15086 size := s.SizeBytes() 15087 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15088 return src[size:] 15089 } 15090 15091 // CopyOutN implements marshal.Marshallable.CopyOutN. 15092 func (s *Sembuf) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15093 // Construct a slice backed by dst's underlying memory. 15094 var buf []byte 15095 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15096 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15097 hdr.Len = s.SizeBytes() 15098 hdr.Cap = s.SizeBytes() 15099 15100 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15101 // Since we bypassed the compiler's escape analysis, indicate that s 15102 // must live until the use above. 15103 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15104 return length, err 15105 } 15106 15107 // CopyOut implements marshal.Marshallable.CopyOut. 15108 func (s *Sembuf) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15109 return s.CopyOutN(cc, addr, s.SizeBytes()) 15110 } 15111 15112 // CopyInN implements marshal.Marshallable.CopyInN. 15113 func (s *Sembuf) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15114 // Construct a slice backed by dst's underlying memory. 15115 var buf []byte 15116 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15117 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15118 hdr.Len = s.SizeBytes() 15119 hdr.Cap = s.SizeBytes() 15120 15121 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15122 // Since we bypassed the compiler's escape analysis, indicate that s 15123 // must live until the use above. 15124 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15125 return length, err 15126 } 15127 15128 // CopyIn implements marshal.Marshallable.CopyIn. 15129 func (s *Sembuf) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15130 return s.CopyInN(cc, addr, s.SizeBytes()) 15131 } 15132 15133 // WriteTo implements io.WriterTo.WriteTo. 15134 func (s *Sembuf) WriteTo(writer io.Writer) (int64, error) { 15135 // Construct a slice backed by dst's underlying memory. 15136 var buf []byte 15137 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15138 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15139 hdr.Len = s.SizeBytes() 15140 hdr.Cap = s.SizeBytes() 15141 15142 length, err := writer.Write(buf) 15143 // Since we bypassed the compiler's escape analysis, indicate that s 15144 // must live until the use above. 15145 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15146 return int64(length), err 15147 } 15148 15149 // CopySembufSliceIn copies in a slice of Sembuf objects from the task's memory. 15150 func CopySembufSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Sembuf) (int, error) { 15151 count := len(dst) 15152 if count == 0 { 15153 return 0, nil 15154 } 15155 size := (*Sembuf)(nil).SizeBytes() 15156 15157 ptr := unsafe.Pointer(&dst) 15158 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 15159 15160 // Construct a slice backed by dst's underlying memory. 15161 var buf []byte 15162 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15163 hdr.Data = uintptr(val) 15164 hdr.Len = size * count 15165 hdr.Cap = size * count 15166 15167 length, err := cc.CopyInBytes(addr, buf) 15168 // Since we bypassed the compiler's escape analysis, indicate that dst 15169 // must live until the use above. 15170 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 15171 return length, err 15172 } 15173 15174 // CopySembufSliceOut copies a slice of Sembuf objects to the task's memory. 15175 func CopySembufSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Sembuf) (int, error) { 15176 count := len(src) 15177 if count == 0 { 15178 return 0, nil 15179 } 15180 size := (*Sembuf)(nil).SizeBytes() 15181 15182 ptr := unsafe.Pointer(&src) 15183 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 15184 15185 // Construct a slice backed by dst's underlying memory. 15186 var buf []byte 15187 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15188 hdr.Data = uintptr(val) 15189 hdr.Len = size * count 15190 hdr.Cap = size * count 15191 15192 length, err := cc.CopyOutBytes(addr, buf) 15193 // Since we bypassed the compiler's escape analysis, indicate that src 15194 // must live until the use above. 15195 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 15196 return length, err 15197 } 15198 15199 // MarshalUnsafeSembufSlice is like Sembuf.MarshalUnsafe, but for a []Sembuf. 15200 func MarshalUnsafeSembufSlice(src []Sembuf, dst []byte) []byte { 15201 count := len(src) 15202 if count == 0 { 15203 return dst 15204 } 15205 15206 size := (*Sembuf)(nil).SizeBytes() 15207 buf := dst[:size*count] 15208 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 15209 return dst[size*count:] 15210 } 15211 15212 // UnmarshalUnsafeSembufSlice is like Sembuf.UnmarshalUnsafe, but for a []Sembuf. 15213 func UnmarshalUnsafeSembufSlice(dst []Sembuf, src []byte) []byte { 15214 count := len(dst) 15215 if count == 0 { 15216 return src 15217 } 15218 15219 size := (*Sembuf)(nil).SizeBytes() 15220 buf := src[:size*count] 15221 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 15222 return src[size*count:] 15223 } 15224 15225 // SizeBytes implements marshal.Marshallable.SizeBytes. 15226 func (s *ShmInfo) SizeBytes() int { 15227 return 44 + 15228 1*4 15229 } 15230 15231 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15232 func (s *ShmInfo) MarshalBytes(dst []byte) []byte { 15233 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UsedIDs)) 15234 dst = dst[4:] 15235 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 15236 dst = dst[1*(4):] 15237 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmTot)) 15238 dst = dst[8:] 15239 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmRss)) 15240 dst = dst[8:] 15241 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSwp)) 15242 dst = dst[8:] 15243 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapAttempts)) 15244 dst = dst[8:] 15245 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.SwapSuccesses)) 15246 dst = dst[8:] 15247 return dst 15248 } 15249 15250 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15251 func (s *ShmInfo) UnmarshalBytes(src []byte) []byte { 15252 s.UsedIDs = int32(hostarch.ByteOrder.Uint32(src[:4])) 15253 src = src[4:] 15254 // Padding: ~ copy([4]byte(s._), src[:sizeof(byte)*4]) 15255 src = src[1*(4):] 15256 s.ShmTot = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15257 src = src[8:] 15258 s.ShmRss = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15259 src = src[8:] 15260 s.ShmSwp = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15261 src = src[8:] 15262 s.SwapAttempts = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15263 src = src[8:] 15264 s.SwapSuccesses = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15265 src = src[8:] 15266 return src 15267 } 15268 15269 // Packed implements marshal.Marshallable.Packed. 15270 //go:nosplit 15271 func (s *ShmInfo) Packed() bool { 15272 return true 15273 } 15274 15275 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15276 func (s *ShmInfo) MarshalUnsafe(dst []byte) []byte { 15277 size := s.SizeBytes() 15278 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15279 return dst[size:] 15280 } 15281 15282 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15283 func (s *ShmInfo) UnmarshalUnsafe(src []byte) []byte { 15284 size := s.SizeBytes() 15285 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15286 return src[size:] 15287 } 15288 15289 // CopyOutN implements marshal.Marshallable.CopyOutN. 15290 func (s *ShmInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15291 // Construct a slice backed by dst's underlying memory. 15292 var buf []byte 15293 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15294 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15295 hdr.Len = s.SizeBytes() 15296 hdr.Cap = s.SizeBytes() 15297 15298 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15299 // Since we bypassed the compiler's escape analysis, indicate that s 15300 // must live until the use above. 15301 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15302 return length, err 15303 } 15304 15305 // CopyOut implements marshal.Marshallable.CopyOut. 15306 func (s *ShmInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15307 return s.CopyOutN(cc, addr, s.SizeBytes()) 15308 } 15309 15310 // CopyInN implements marshal.Marshallable.CopyInN. 15311 func (s *ShmInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15312 // Construct a slice backed by dst's underlying memory. 15313 var buf []byte 15314 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15315 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15316 hdr.Len = s.SizeBytes() 15317 hdr.Cap = s.SizeBytes() 15318 15319 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15320 // Since we bypassed the compiler's escape analysis, indicate that s 15321 // must live until the use above. 15322 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15323 return length, err 15324 } 15325 15326 // CopyIn implements marshal.Marshallable.CopyIn. 15327 func (s *ShmInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15328 return s.CopyInN(cc, addr, s.SizeBytes()) 15329 } 15330 15331 // WriteTo implements io.WriterTo.WriteTo. 15332 func (s *ShmInfo) WriteTo(writer io.Writer) (int64, error) { 15333 // Construct a slice backed by dst's underlying memory. 15334 var buf []byte 15335 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15336 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15337 hdr.Len = s.SizeBytes() 15338 hdr.Cap = s.SizeBytes() 15339 15340 length, err := writer.Write(buf) 15341 // Since we bypassed the compiler's escape analysis, indicate that s 15342 // must live until the use above. 15343 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15344 return int64(length), err 15345 } 15346 15347 // SizeBytes implements marshal.Marshallable.SizeBytes. 15348 func (s *ShmParams) SizeBytes() int { 15349 return 40 15350 } 15351 15352 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15353 func (s *ShmParams) MarshalBytes(dst []byte) []byte { 15354 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMax)) 15355 dst = dst[8:] 15356 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMin)) 15357 dst = dst[8:] 15358 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmMni)) 15359 dst = dst[8:] 15360 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSeg)) 15361 dst = dst[8:] 15362 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmAll)) 15363 dst = dst[8:] 15364 return dst 15365 } 15366 15367 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15368 func (s *ShmParams) UnmarshalBytes(src []byte) []byte { 15369 s.ShmMax = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15370 src = src[8:] 15371 s.ShmMin = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15372 src = src[8:] 15373 s.ShmMni = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15374 src = src[8:] 15375 s.ShmSeg = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15376 src = src[8:] 15377 s.ShmAll = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15378 src = src[8:] 15379 return src 15380 } 15381 15382 // Packed implements marshal.Marshallable.Packed. 15383 //go:nosplit 15384 func (s *ShmParams) Packed() bool { 15385 return true 15386 } 15387 15388 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15389 func (s *ShmParams) MarshalUnsafe(dst []byte) []byte { 15390 size := s.SizeBytes() 15391 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15392 return dst[size:] 15393 } 15394 15395 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15396 func (s *ShmParams) UnmarshalUnsafe(src []byte) []byte { 15397 size := s.SizeBytes() 15398 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15399 return src[size:] 15400 } 15401 15402 // CopyOutN implements marshal.Marshallable.CopyOutN. 15403 func (s *ShmParams) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15404 // Construct a slice backed by dst's underlying memory. 15405 var buf []byte 15406 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15407 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15408 hdr.Len = s.SizeBytes() 15409 hdr.Cap = s.SizeBytes() 15410 15411 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15412 // Since we bypassed the compiler's escape analysis, indicate that s 15413 // must live until the use above. 15414 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15415 return length, err 15416 } 15417 15418 // CopyOut implements marshal.Marshallable.CopyOut. 15419 func (s *ShmParams) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15420 return s.CopyOutN(cc, addr, s.SizeBytes()) 15421 } 15422 15423 // CopyInN implements marshal.Marshallable.CopyInN. 15424 func (s *ShmParams) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15425 // Construct a slice backed by dst's underlying memory. 15426 var buf []byte 15427 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15428 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15429 hdr.Len = s.SizeBytes() 15430 hdr.Cap = s.SizeBytes() 15431 15432 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15433 // Since we bypassed the compiler's escape analysis, indicate that s 15434 // must live until the use above. 15435 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15436 return length, err 15437 } 15438 15439 // CopyIn implements marshal.Marshallable.CopyIn. 15440 func (s *ShmParams) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15441 return s.CopyInN(cc, addr, s.SizeBytes()) 15442 } 15443 15444 // WriteTo implements io.WriterTo.WriteTo. 15445 func (s *ShmParams) WriteTo(writer io.Writer) (int64, error) { 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(s))) 15450 hdr.Len = s.SizeBytes() 15451 hdr.Cap = s.SizeBytes() 15452 15453 length, err := writer.Write(buf) 15454 // Since we bypassed the compiler's escape analysis, indicate that s 15455 // must live until the use above. 15456 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15457 return int64(length), err 15458 } 15459 15460 // SizeBytes implements marshal.Marshallable.SizeBytes. 15461 func (s *ShmidDS) SizeBytes() int { 15462 return 40 + 15463 (*IPCPerm)(nil).SizeBytes() + 15464 (*TimeT)(nil).SizeBytes() + 15465 (*TimeT)(nil).SizeBytes() + 15466 (*TimeT)(nil).SizeBytes() 15467 } 15468 15469 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15470 func (s *ShmidDS) MarshalBytes(dst []byte) []byte { 15471 dst = s.ShmPerm.MarshalUnsafe(dst) 15472 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmSegsz)) 15473 dst = dst[8:] 15474 dst = s.ShmAtime.MarshalUnsafe(dst) 15475 dst = s.ShmDtime.MarshalUnsafe(dst) 15476 dst = s.ShmCtime.MarshalUnsafe(dst) 15477 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmCpid)) 15478 dst = dst[4:] 15479 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.ShmLpid)) 15480 dst = dst[4:] 15481 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.ShmNattach)) 15482 dst = dst[8:] 15483 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused4)) 15484 dst = dst[8:] 15485 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Unused5)) 15486 dst = dst[8:] 15487 return dst 15488 } 15489 15490 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15491 func (s *ShmidDS) UnmarshalBytes(src []byte) []byte { 15492 src = s.ShmPerm.UnmarshalUnsafe(src) 15493 s.ShmSegsz = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15494 src = src[8:] 15495 src = s.ShmAtime.UnmarshalUnsafe(src) 15496 src = s.ShmDtime.UnmarshalUnsafe(src) 15497 src = s.ShmCtime.UnmarshalUnsafe(src) 15498 s.ShmCpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 15499 src = src[4:] 15500 s.ShmLpid = int32(hostarch.ByteOrder.Uint32(src[:4])) 15501 src = src[4:] 15502 s.ShmNattach = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15503 src = src[8:] 15504 s.Unused4 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15505 src = src[8:] 15506 s.Unused5 = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15507 src = src[8:] 15508 return src 15509 } 15510 15511 // Packed implements marshal.Marshallable.Packed. 15512 //go:nosplit 15513 func (s *ShmidDS) Packed() bool { 15514 return s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() 15515 } 15516 15517 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15518 func (s *ShmidDS) MarshalUnsafe(dst []byte) []byte { 15519 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 15520 size := s.SizeBytes() 15521 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15522 return dst[size:] 15523 } 15524 // Type ShmidDS doesn't have a packed layout in memory, fallback to MarshalBytes. 15525 return s.MarshalBytes(dst) 15526 } 15527 15528 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15529 func (s *ShmidDS) UnmarshalUnsafe(src []byte) []byte { 15530 if s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 15531 size := s.SizeBytes() 15532 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15533 return src[size:] 15534 } 15535 // Type ShmidDS doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15536 return s.UnmarshalBytes(src) 15537 } 15538 15539 // CopyOutN implements marshal.Marshallable.CopyOutN. 15540 func (s *ShmidDS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15541 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 15542 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 15543 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15544 s.MarshalBytes(buf) // escapes: fallback. 15545 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15546 } 15547 15548 // Construct a slice backed by dst's underlying memory. 15549 var buf []byte 15550 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15551 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15552 hdr.Len = s.SizeBytes() 15553 hdr.Cap = s.SizeBytes() 15554 15555 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15556 // Since we bypassed the compiler's escape analysis, indicate that s 15557 // must live until the use above. 15558 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15559 return length, err 15560 } 15561 15562 // CopyOut implements marshal.Marshallable.CopyOut. 15563 func (s *ShmidDS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15564 return s.CopyOutN(cc, addr, s.SizeBytes()) 15565 } 15566 15567 // CopyInN implements marshal.Marshallable.CopyInN. 15568 func (s *ShmidDS) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15569 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 15570 // Type ShmidDS doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15571 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15572 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15573 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15574 // partially unmarshalled struct. 15575 s.UnmarshalBytes(buf) // escapes: fallback. 15576 return length, err 15577 } 15578 15579 // Construct a slice backed by dst's underlying memory. 15580 var buf []byte 15581 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15582 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15583 hdr.Len = s.SizeBytes() 15584 hdr.Cap = s.SizeBytes() 15585 15586 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15587 // Since we bypassed the compiler's escape analysis, indicate that s 15588 // must live until the use above. 15589 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15590 return length, err 15591 } 15592 15593 // CopyIn implements marshal.Marshallable.CopyIn. 15594 func (s *ShmidDS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15595 return s.CopyInN(cc, addr, s.SizeBytes()) 15596 } 15597 15598 // WriteTo implements io.WriterTo.WriteTo. 15599 func (s *ShmidDS) WriteTo(writer io.Writer) (int64, error) { 15600 if !s.ShmAtime.Packed() && s.ShmCtime.Packed() && s.ShmDtime.Packed() && s.ShmPerm.Packed() { 15601 // Type ShmidDS doesn't have a packed layout in memory, fall back to MarshalBytes. 15602 buf := make([]byte, s.SizeBytes()) 15603 s.MarshalBytes(buf) 15604 length, err := writer.Write(buf) 15605 return int64(length), err 15606 } 15607 15608 // Construct a slice backed by dst's underlying memory. 15609 var buf []byte 15610 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15611 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15612 hdr.Len = s.SizeBytes() 15613 hdr.Cap = s.SizeBytes() 15614 15615 length, err := writer.Write(buf) 15616 // Since we bypassed the compiler's escape analysis, indicate that s 15617 // must live until the use above. 15618 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15619 return int64(length), err 15620 } 15621 15622 // SizeBytes implements marshal.Marshallable.SizeBytes. 15623 func (s *SigAction) SizeBytes() int { 15624 return 24 + 15625 (*SignalSet)(nil).SizeBytes() 15626 } 15627 15628 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15629 func (s *SigAction) MarshalBytes(dst []byte) []byte { 15630 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Handler)) 15631 dst = dst[8:] 15632 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Flags)) 15633 dst = dst[8:] 15634 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Restorer)) 15635 dst = dst[8:] 15636 dst = s.Mask.MarshalUnsafe(dst) 15637 return dst 15638 } 15639 15640 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15641 func (s *SigAction) UnmarshalBytes(src []byte) []byte { 15642 s.Handler = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15643 src = src[8:] 15644 s.Flags = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15645 src = src[8:] 15646 s.Restorer = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15647 src = src[8:] 15648 src = s.Mask.UnmarshalUnsafe(src) 15649 return src 15650 } 15651 15652 // Packed implements marshal.Marshallable.Packed. 15653 //go:nosplit 15654 func (s *SigAction) Packed() bool { 15655 return s.Mask.Packed() 15656 } 15657 15658 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15659 func (s *SigAction) MarshalUnsafe(dst []byte) []byte { 15660 if s.Mask.Packed() { 15661 size := s.SizeBytes() 15662 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15663 return dst[size:] 15664 } 15665 // Type SigAction doesn't have a packed layout in memory, fallback to MarshalBytes. 15666 return s.MarshalBytes(dst) 15667 } 15668 15669 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15670 func (s *SigAction) UnmarshalUnsafe(src []byte) []byte { 15671 if s.Mask.Packed() { 15672 size := s.SizeBytes() 15673 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15674 return src[size:] 15675 } 15676 // Type SigAction doesn't have a packed layout in memory, fallback to UnmarshalBytes. 15677 return s.UnmarshalBytes(src) 15678 } 15679 15680 // CopyOutN implements marshal.Marshallable.CopyOutN. 15681 func (s *SigAction) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15682 if !s.Mask.Packed() { 15683 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 15684 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15685 s.MarshalBytes(buf) // escapes: fallback. 15686 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15687 } 15688 15689 // Construct a slice backed by dst's underlying memory. 15690 var buf []byte 15691 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15692 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15693 hdr.Len = s.SizeBytes() 15694 hdr.Cap = s.SizeBytes() 15695 15696 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15697 // Since we bypassed the compiler's escape analysis, indicate that s 15698 // must live until the use above. 15699 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15700 return length, err 15701 } 15702 15703 // CopyOut implements marshal.Marshallable.CopyOut. 15704 func (s *SigAction) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15705 return s.CopyOutN(cc, addr, s.SizeBytes()) 15706 } 15707 15708 // CopyInN implements marshal.Marshallable.CopyInN. 15709 func (s *SigAction) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15710 if !s.Mask.Packed() { 15711 // Type SigAction doesn't have a packed layout in memory, fall back to UnmarshalBytes. 15712 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 15713 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15714 // Unmarshal unconditionally. If we had a short copy-in, this results in a 15715 // partially unmarshalled struct. 15716 s.UnmarshalBytes(buf) // escapes: fallback. 15717 return length, err 15718 } 15719 15720 // Construct a slice backed by dst's underlying memory. 15721 var buf []byte 15722 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15723 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15724 hdr.Len = s.SizeBytes() 15725 hdr.Cap = s.SizeBytes() 15726 15727 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15728 // Since we bypassed the compiler's escape analysis, indicate that s 15729 // must live until the use above. 15730 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15731 return length, err 15732 } 15733 15734 // CopyIn implements marshal.Marshallable.CopyIn. 15735 func (s *SigAction) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15736 return s.CopyInN(cc, addr, s.SizeBytes()) 15737 } 15738 15739 // WriteTo implements io.WriterTo.WriteTo. 15740 func (s *SigAction) WriteTo(writer io.Writer) (int64, error) { 15741 if !s.Mask.Packed() { 15742 // Type SigAction doesn't have a packed layout in memory, fall back to MarshalBytes. 15743 buf := make([]byte, s.SizeBytes()) 15744 s.MarshalBytes(buf) 15745 length, err := writer.Write(buf) 15746 return int64(length), err 15747 } 15748 15749 // Construct a slice backed by dst's underlying memory. 15750 var buf []byte 15751 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15752 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15753 hdr.Len = s.SizeBytes() 15754 hdr.Cap = s.SizeBytes() 15755 15756 length, err := writer.Write(buf) 15757 // Since we bypassed the compiler's escape analysis, indicate that s 15758 // must live until the use above. 15759 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15760 return int64(length), err 15761 } 15762 15763 // SizeBytes implements marshal.Marshallable.SizeBytes. 15764 func (s *Sigevent) SizeBytes() int { 15765 return 20 + 15766 1*44 15767 } 15768 15769 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15770 func (s *Sigevent) MarshalBytes(dst []byte) []byte { 15771 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Value)) 15772 dst = dst[8:] 15773 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 15774 dst = dst[4:] 15775 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Notify)) 15776 dst = dst[4:] 15777 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Tid)) 15778 dst = dst[4:] 15779 for idx := 0; idx < 44; idx++ { 15780 dst[0] = byte(s.UnRemainder[idx]) 15781 dst = dst[1:] 15782 } 15783 return dst 15784 } 15785 15786 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15787 func (s *Sigevent) UnmarshalBytes(src []byte) []byte { 15788 s.Value = uint64(hostarch.ByteOrder.Uint64(src[:8])) 15789 src = src[8:] 15790 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 15791 src = src[4:] 15792 s.Notify = int32(hostarch.ByteOrder.Uint32(src[:4])) 15793 src = src[4:] 15794 s.Tid = int32(hostarch.ByteOrder.Uint32(src[:4])) 15795 src = src[4:] 15796 for idx := 0; idx < 44; idx++ { 15797 s.UnRemainder[idx] = src[0] 15798 src = src[1:] 15799 } 15800 return src 15801 } 15802 15803 // Packed implements marshal.Marshallable.Packed. 15804 //go:nosplit 15805 func (s *Sigevent) Packed() bool { 15806 return true 15807 } 15808 15809 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15810 func (s *Sigevent) MarshalUnsafe(dst []byte) []byte { 15811 size := s.SizeBytes() 15812 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15813 return dst[size:] 15814 } 15815 15816 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15817 func (s *Sigevent) UnmarshalUnsafe(src []byte) []byte { 15818 size := s.SizeBytes() 15819 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15820 return src[size:] 15821 } 15822 15823 // CopyOutN implements marshal.Marshallable.CopyOutN. 15824 func (s *Sigevent) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15825 // Construct a slice backed by dst's underlying memory. 15826 var buf []byte 15827 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15828 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15829 hdr.Len = s.SizeBytes() 15830 hdr.Cap = s.SizeBytes() 15831 15832 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15833 // Since we bypassed the compiler's escape analysis, indicate that s 15834 // must live until the use above. 15835 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15836 return length, err 15837 } 15838 15839 // CopyOut implements marshal.Marshallable.CopyOut. 15840 func (s *Sigevent) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15841 return s.CopyOutN(cc, addr, s.SizeBytes()) 15842 } 15843 15844 // CopyInN implements marshal.Marshallable.CopyInN. 15845 func (s *Sigevent) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15846 // Construct a slice backed by dst's underlying memory. 15847 var buf []byte 15848 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15849 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15850 hdr.Len = s.SizeBytes() 15851 hdr.Cap = s.SizeBytes() 15852 15853 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15854 // Since we bypassed the compiler's escape analysis, indicate that s 15855 // must live until the use above. 15856 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15857 return length, err 15858 } 15859 15860 // CopyIn implements marshal.Marshallable.CopyIn. 15861 func (s *Sigevent) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15862 return s.CopyInN(cc, addr, s.SizeBytes()) 15863 } 15864 15865 // WriteTo implements io.WriterTo.WriteTo. 15866 func (s *Sigevent) WriteTo(writer io.Writer) (int64, error) { 15867 // Construct a slice backed by dst's underlying memory. 15868 var buf []byte 15869 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15870 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15871 hdr.Len = s.SizeBytes() 15872 hdr.Cap = s.SizeBytes() 15873 15874 length, err := writer.Write(buf) 15875 // Since we bypassed the compiler's escape analysis, indicate that s 15876 // must live until the use above. 15877 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15878 return int64(length), err 15879 } 15880 15881 // SizeBytes implements marshal.Marshallable.SizeBytes. 15882 func (s *SignalInfo) SizeBytes() int { 15883 return 16 + 15884 1*(128-16) 15885 } 15886 15887 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 15888 func (s *SignalInfo) MarshalBytes(dst []byte) []byte { 15889 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 15890 dst = dst[4:] 15891 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 15892 dst = dst[4:] 15893 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 15894 dst = dst[4:] 15895 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 15896 dst = dst[4:] 15897 for idx := 0; idx < (128-16); idx++ { 15898 dst[0] = byte(s.Fields[idx]) 15899 dst = dst[1:] 15900 } 15901 return dst 15902 } 15903 15904 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 15905 func (s *SignalInfo) UnmarshalBytes(src []byte) []byte { 15906 s.Signo = int32(hostarch.ByteOrder.Uint32(src[:4])) 15907 src = src[4:] 15908 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 15909 src = src[4:] 15910 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 15911 src = src[4:] 15912 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 15913 src = src[4:] 15914 for idx := 0; idx < (128-16); idx++ { 15915 s.Fields[idx] = src[0] 15916 src = src[1:] 15917 } 15918 return src 15919 } 15920 15921 // Packed implements marshal.Marshallable.Packed. 15922 //go:nosplit 15923 func (s *SignalInfo) Packed() bool { 15924 return true 15925 } 15926 15927 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 15928 func (s *SignalInfo) MarshalUnsafe(dst []byte) []byte { 15929 size := s.SizeBytes() 15930 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 15931 return dst[size:] 15932 } 15933 15934 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 15935 func (s *SignalInfo) UnmarshalUnsafe(src []byte) []byte { 15936 size := s.SizeBytes() 15937 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 15938 return src[size:] 15939 } 15940 15941 // CopyOutN implements marshal.Marshallable.CopyOutN. 15942 func (s *SignalInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15943 // Construct a slice backed by dst's underlying memory. 15944 var buf []byte 15945 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15946 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15947 hdr.Len = s.SizeBytes() 15948 hdr.Cap = s.SizeBytes() 15949 15950 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 15951 // Since we bypassed the compiler's escape analysis, indicate that s 15952 // must live until the use above. 15953 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15954 return length, err 15955 } 15956 15957 // CopyOut implements marshal.Marshallable.CopyOut. 15958 func (s *SignalInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15959 return s.CopyOutN(cc, addr, s.SizeBytes()) 15960 } 15961 15962 // CopyInN implements marshal.Marshallable.CopyInN. 15963 func (s *SignalInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 15964 // Construct a slice backed by dst's underlying memory. 15965 var buf []byte 15966 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15967 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15968 hdr.Len = s.SizeBytes() 15969 hdr.Cap = s.SizeBytes() 15970 15971 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 15972 // Since we bypassed the compiler's escape analysis, indicate that s 15973 // must live until the use above. 15974 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15975 return length, err 15976 } 15977 15978 // CopyIn implements marshal.Marshallable.CopyIn. 15979 func (s *SignalInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 15980 return s.CopyInN(cc, addr, s.SizeBytes()) 15981 } 15982 15983 // WriteTo implements io.WriterTo.WriteTo. 15984 func (s *SignalInfo) WriteTo(writer io.Writer) (int64, error) { 15985 // Construct a slice backed by dst's underlying memory. 15986 var buf []byte 15987 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 15988 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 15989 hdr.Len = s.SizeBytes() 15990 hdr.Cap = s.SizeBytes() 15991 15992 length, err := writer.Write(buf) 15993 // Since we bypassed the compiler's escape analysis, indicate that s 15994 // must live until the use above. 15995 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 15996 return int64(length), err 15997 } 15998 15999 // SizeBytes implements marshal.Marshallable.SizeBytes. 16000 //go:nosplit 16001 func (s *SignalSet) SizeBytes() int { 16002 return 8 16003 } 16004 16005 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16006 func (s *SignalSet) MarshalBytes(dst []byte) []byte { 16007 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*s)) 16008 return dst[8:] 16009 } 16010 16011 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16012 func (s *SignalSet) UnmarshalBytes(src []byte) []byte { 16013 *s = SignalSet(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 16014 return src[8:] 16015 } 16016 16017 // Packed implements marshal.Marshallable.Packed. 16018 //go:nosplit 16019 func (s *SignalSet) Packed() bool { 16020 // Scalar newtypes are always packed. 16021 return true 16022 } 16023 16024 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16025 func (s *SignalSet) MarshalUnsafe(dst []byte) []byte { 16026 size := s.SizeBytes() 16027 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16028 return dst[size:] 16029 } 16030 16031 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16032 func (s *SignalSet) UnmarshalUnsafe(src []byte) []byte { 16033 size := s.SizeBytes() 16034 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16035 return src[size:] 16036 } 16037 16038 // CopyOutN implements marshal.Marshallable.CopyOutN. 16039 func (s *SignalSet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16040 // Construct a slice backed by dst's underlying memory. 16041 var buf []byte 16042 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16043 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16044 hdr.Len = s.SizeBytes() 16045 hdr.Cap = s.SizeBytes() 16046 16047 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16048 // Since we bypassed the compiler's escape analysis, indicate that s 16049 // must live until the use above. 16050 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16051 return length, err 16052 } 16053 16054 // CopyOut implements marshal.Marshallable.CopyOut. 16055 func (s *SignalSet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16056 return s.CopyOutN(cc, addr, s.SizeBytes()) 16057 } 16058 16059 // CopyInN implements marshal.Marshallable.CopyInN. 16060 func (s *SignalSet) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16061 // Construct a slice backed by dst's underlying memory. 16062 var buf []byte 16063 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16064 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16065 hdr.Len = s.SizeBytes() 16066 hdr.Cap = s.SizeBytes() 16067 16068 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16069 // Since we bypassed the compiler's escape analysis, indicate that s 16070 // must live until the use above. 16071 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16072 return length, err 16073 } 16074 16075 // CopyIn implements marshal.Marshallable.CopyIn. 16076 func (s *SignalSet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16077 return s.CopyInN(cc, addr, s.SizeBytes()) 16078 } 16079 16080 // WriteTo implements io.WriterTo.WriteTo. 16081 func (s *SignalSet) WriteTo(writer io.Writer) (int64, error) { 16082 // Construct a slice backed by dst's underlying memory. 16083 var buf []byte 16084 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16085 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16086 hdr.Len = s.SizeBytes() 16087 hdr.Cap = s.SizeBytes() 16088 16089 length, err := writer.Write(buf) 16090 // Since we bypassed the compiler's escape analysis, indicate that s 16091 // must live until the use above. 16092 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16093 return int64(length), err 16094 } 16095 16096 // SizeBytes implements marshal.Marshallable.SizeBytes. 16097 func (s *SignalStack) SizeBytes() int { 16098 return 24 16099 } 16100 16101 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16102 func (s *SignalStack) MarshalBytes(dst []byte) []byte { 16103 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 16104 dst = dst[8:] 16105 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flags)) 16106 dst = dst[4:] 16107 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 16108 dst = dst[4:] 16109 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 16110 dst = dst[8:] 16111 return dst 16112 } 16113 16114 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16115 func (s *SignalStack) UnmarshalBytes(src []byte) []byte { 16116 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16117 src = src[8:] 16118 s.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16119 src = src[4:] 16120 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 16121 src = src[4:] 16122 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16123 src = src[8:] 16124 return src 16125 } 16126 16127 // Packed implements marshal.Marshallable.Packed. 16128 //go:nosplit 16129 func (s *SignalStack) Packed() bool { 16130 return true 16131 } 16132 16133 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16134 func (s *SignalStack) MarshalUnsafe(dst []byte) []byte { 16135 size := s.SizeBytes() 16136 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 16137 return dst[size:] 16138 } 16139 16140 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16141 func (s *SignalStack) UnmarshalUnsafe(src []byte) []byte { 16142 size := s.SizeBytes() 16143 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 16144 return src[size:] 16145 } 16146 16147 // CopyOutN implements marshal.Marshallable.CopyOutN. 16148 func (s *SignalStack) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16149 // Construct a slice backed by dst's underlying memory. 16150 var buf []byte 16151 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16152 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16153 hdr.Len = s.SizeBytes() 16154 hdr.Cap = s.SizeBytes() 16155 16156 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16157 // Since we bypassed the compiler's escape analysis, indicate that s 16158 // must live until the use above. 16159 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16160 return length, err 16161 } 16162 16163 // CopyOut implements marshal.Marshallable.CopyOut. 16164 func (s *SignalStack) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16165 return s.CopyOutN(cc, addr, s.SizeBytes()) 16166 } 16167 16168 // CopyInN implements marshal.Marshallable.CopyInN. 16169 func (s *SignalStack) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16170 // Construct a slice backed by dst's underlying memory. 16171 var buf []byte 16172 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16173 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16174 hdr.Len = s.SizeBytes() 16175 hdr.Cap = s.SizeBytes() 16176 16177 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16178 // Since we bypassed the compiler's escape analysis, indicate that s 16179 // must live until the use above. 16180 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16181 return length, err 16182 } 16183 16184 // CopyIn implements marshal.Marshallable.CopyIn. 16185 func (s *SignalStack) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16186 return s.CopyInN(cc, addr, s.SizeBytes()) 16187 } 16188 16189 // WriteTo implements io.WriterTo.WriteTo. 16190 func (s *SignalStack) WriteTo(writer io.Writer) (int64, error) { 16191 // Construct a slice backed by dst's underlying memory. 16192 var buf []byte 16193 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16194 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 16195 hdr.Len = s.SizeBytes() 16196 hdr.Cap = s.SizeBytes() 16197 16198 length, err := writer.Write(buf) 16199 // Since we bypassed the compiler's escape analysis, indicate that s 16200 // must live until the use above. 16201 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 16202 return int64(length), err 16203 } 16204 16205 // SizeBytes implements marshal.Marshallable.SizeBytes. 16206 func (s *SignalfdSiginfo) SizeBytes() int { 16207 return 82 + 16208 1*48 16209 } 16210 16211 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16212 func (s *SignalfdSiginfo) MarshalBytes(dst []byte) []byte { 16213 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Signo)) 16214 dst = dst[4:] 16215 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Errno)) 16216 dst = dst[4:] 16217 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Code)) 16218 dst = dst[4:] 16219 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.PID)) 16220 dst = dst[4:] 16221 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.UID)) 16222 dst = dst[4:] 16223 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FD)) 16224 dst = dst[4:] 16225 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TID)) 16226 dst = dst[4:] 16227 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Band)) 16228 dst = dst[4:] 16229 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Overrun)) 16230 dst = dst[4:] 16231 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.TrapNo)) 16232 dst = dst[4:] 16233 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Status)) 16234 dst = dst[4:] 16235 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Int)) 16236 dst = dst[4:] 16237 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Ptr)) 16238 dst = dst[8:] 16239 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.UTime)) 16240 dst = dst[8:] 16241 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.STime)) 16242 dst = dst[8:] 16243 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Addr)) 16244 dst = dst[8:] 16245 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.AddrLSB)) 16246 dst = dst[2:] 16247 // Padding: dst[:sizeof(uint8)*48] ~= [48]uint8{0} 16248 dst = dst[1*(48):] 16249 return dst 16250 } 16251 16252 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16253 func (s *SignalfdSiginfo) UnmarshalBytes(src []byte) []byte { 16254 s.Signo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16255 src = src[4:] 16256 s.Errno = int32(hostarch.ByteOrder.Uint32(src[:4])) 16257 src = src[4:] 16258 s.Code = int32(hostarch.ByteOrder.Uint32(src[:4])) 16259 src = src[4:] 16260 s.PID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16261 src = src[4:] 16262 s.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16263 src = src[4:] 16264 s.FD = int32(hostarch.ByteOrder.Uint32(src[:4])) 16265 src = src[4:] 16266 s.TID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16267 src = src[4:] 16268 s.Band = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16269 src = src[4:] 16270 s.Overrun = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16271 src = src[4:] 16272 s.TrapNo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16273 src = src[4:] 16274 s.Status = int32(hostarch.ByteOrder.Uint32(src[:4])) 16275 src = src[4:] 16276 s.Int = int32(hostarch.ByteOrder.Uint32(src[:4])) 16277 src = src[4:] 16278 s.Ptr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16279 src = src[8:] 16280 s.UTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16281 src = src[8:] 16282 s.STime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16283 src = src[8:] 16284 s.Addr = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16285 src = src[8:] 16286 s.AddrLSB = uint16(hostarch.ByteOrder.Uint16(src[:2])) 16287 src = src[2:] 16288 // Padding: ~ copy([48]uint8(s._), src[:sizeof(uint8)*48]) 16289 src = src[1*(48):] 16290 return src 16291 } 16292 16293 // Packed implements marshal.Marshallable.Packed. 16294 //go:nosplit 16295 func (s *SignalfdSiginfo) Packed() bool { 16296 return false 16297 } 16298 16299 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16300 func (s *SignalfdSiginfo) MarshalUnsafe(dst []byte) []byte { 16301 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to MarshalBytes. 16302 return s.MarshalBytes(dst) 16303 } 16304 16305 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16306 func (s *SignalfdSiginfo) UnmarshalUnsafe(src []byte) []byte { 16307 // Type SignalfdSiginfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16308 return s.UnmarshalBytes(src) 16309 } 16310 16311 // CopyOutN implements marshal.Marshallable.CopyOutN. 16312 func (s *SignalfdSiginfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16313 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16314 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 16315 s.MarshalBytes(buf) // escapes: fallback. 16316 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16317 } 16318 16319 // CopyOut implements marshal.Marshallable.CopyOut. 16320 func (s *SignalfdSiginfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16321 return s.CopyOutN(cc, addr, s.SizeBytes()) 16322 } 16323 16324 // CopyInN implements marshal.Marshallable.CopyInN. 16325 func (s *SignalfdSiginfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16326 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16327 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 16328 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16329 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16330 // partially unmarshalled struct. 16331 s.UnmarshalBytes(buf) // escapes: fallback. 16332 return length, err 16333 } 16334 16335 // CopyIn implements marshal.Marshallable.CopyIn. 16336 func (s *SignalfdSiginfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16337 return s.CopyInN(cc, addr, s.SizeBytes()) 16338 } 16339 16340 // WriteTo implements io.WriterTo.WriteTo. 16341 func (s *SignalfdSiginfo) WriteTo(writer io.Writer) (int64, error) { 16342 // Type SignalfdSiginfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16343 buf := make([]byte, s.SizeBytes()) 16344 s.MarshalBytes(buf) 16345 length, err := writer.Write(buf) 16346 return int64(length), err 16347 } 16348 16349 // SizeBytes implements marshal.Marshallable.SizeBytes. 16350 func (c *ControlMessageCredentials) SizeBytes() int { 16351 return 12 16352 } 16353 16354 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16355 func (c *ControlMessageCredentials) MarshalBytes(dst []byte) []byte { 16356 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.PID)) 16357 dst = dst[4:] 16358 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.UID)) 16359 dst = dst[4:] 16360 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.GID)) 16361 dst = dst[4:] 16362 return dst 16363 } 16364 16365 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16366 func (c *ControlMessageCredentials) UnmarshalBytes(src []byte) []byte { 16367 c.PID = int32(hostarch.ByteOrder.Uint32(src[:4])) 16368 src = src[4:] 16369 c.UID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16370 src = src[4:] 16371 c.GID = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16372 src = src[4:] 16373 return src 16374 } 16375 16376 // Packed implements marshal.Marshallable.Packed. 16377 //go:nosplit 16378 func (c *ControlMessageCredentials) Packed() bool { 16379 return true 16380 } 16381 16382 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16383 func (c *ControlMessageCredentials) MarshalUnsafe(dst []byte) []byte { 16384 size := c.SizeBytes() 16385 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 16386 return dst[size:] 16387 } 16388 16389 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16390 func (c *ControlMessageCredentials) UnmarshalUnsafe(src []byte) []byte { 16391 size := c.SizeBytes() 16392 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 16393 return src[size:] 16394 } 16395 16396 // CopyOutN implements marshal.Marshallable.CopyOutN. 16397 func (c *ControlMessageCredentials) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16398 // Construct a slice backed by dst's underlying memory. 16399 var buf []byte 16400 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16401 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16402 hdr.Len = c.SizeBytes() 16403 hdr.Cap = c.SizeBytes() 16404 16405 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16406 // Since we bypassed the compiler's escape analysis, indicate that c 16407 // must live until the use above. 16408 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16409 return length, err 16410 } 16411 16412 // CopyOut implements marshal.Marshallable.CopyOut. 16413 func (c *ControlMessageCredentials) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16414 return c.CopyOutN(cc, addr, c.SizeBytes()) 16415 } 16416 16417 // CopyInN implements marshal.Marshallable.CopyInN. 16418 func (c *ControlMessageCredentials) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16419 // Construct a slice backed by dst's underlying memory. 16420 var buf []byte 16421 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16422 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16423 hdr.Len = c.SizeBytes() 16424 hdr.Cap = c.SizeBytes() 16425 16426 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16427 // Since we bypassed the compiler's escape analysis, indicate that c 16428 // must live until the use above. 16429 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16430 return length, err 16431 } 16432 16433 // CopyIn implements marshal.Marshallable.CopyIn. 16434 func (c *ControlMessageCredentials) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16435 return c.CopyInN(cc, addr, c.SizeBytes()) 16436 } 16437 16438 // WriteTo implements io.WriterTo.WriteTo. 16439 func (c *ControlMessageCredentials) WriteTo(writer io.Writer) (int64, error) { 16440 // Construct a slice backed by dst's underlying memory. 16441 var buf []byte 16442 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16443 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16444 hdr.Len = c.SizeBytes() 16445 hdr.Cap = c.SizeBytes() 16446 16447 length, err := writer.Write(buf) 16448 // Since we bypassed the compiler's escape analysis, indicate that c 16449 // must live until the use above. 16450 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16451 return int64(length), err 16452 } 16453 16454 // SizeBytes implements marshal.Marshallable.SizeBytes. 16455 func (c *ControlMessageHeader) SizeBytes() int { 16456 return 16 16457 } 16458 16459 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16460 func (c *ControlMessageHeader) MarshalBytes(dst []byte) []byte { 16461 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.Length)) 16462 dst = dst[8:] 16463 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Level)) 16464 dst = dst[4:] 16465 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.Type)) 16466 dst = dst[4:] 16467 return dst 16468 } 16469 16470 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16471 func (c *ControlMessageHeader) UnmarshalBytes(src []byte) []byte { 16472 c.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 16473 src = src[8:] 16474 c.Level = int32(hostarch.ByteOrder.Uint32(src[:4])) 16475 src = src[4:] 16476 c.Type = int32(hostarch.ByteOrder.Uint32(src[:4])) 16477 src = src[4:] 16478 return src 16479 } 16480 16481 // Packed implements marshal.Marshallable.Packed. 16482 //go:nosplit 16483 func (c *ControlMessageHeader) Packed() bool { 16484 return true 16485 } 16486 16487 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16488 func (c *ControlMessageHeader) MarshalUnsafe(dst []byte) []byte { 16489 size := c.SizeBytes() 16490 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 16491 return dst[size:] 16492 } 16493 16494 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16495 func (c *ControlMessageHeader) UnmarshalUnsafe(src []byte) []byte { 16496 size := c.SizeBytes() 16497 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 16498 return src[size:] 16499 } 16500 16501 // CopyOutN implements marshal.Marshallable.CopyOutN. 16502 func (c *ControlMessageHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16503 // Construct a slice backed by dst's underlying memory. 16504 var buf []byte 16505 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16506 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16507 hdr.Len = c.SizeBytes() 16508 hdr.Cap = c.SizeBytes() 16509 16510 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16511 // Since we bypassed the compiler's escape analysis, indicate that c 16512 // must live until the use above. 16513 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16514 return length, err 16515 } 16516 16517 // CopyOut implements marshal.Marshallable.CopyOut. 16518 func (c *ControlMessageHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16519 return c.CopyOutN(cc, addr, c.SizeBytes()) 16520 } 16521 16522 // CopyInN implements marshal.Marshallable.CopyInN. 16523 func (c *ControlMessageHeader) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16524 // Construct a slice backed by dst's underlying memory. 16525 var buf []byte 16526 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16527 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16528 hdr.Len = c.SizeBytes() 16529 hdr.Cap = c.SizeBytes() 16530 16531 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16532 // Since we bypassed the compiler's escape analysis, indicate that c 16533 // must live until the use above. 16534 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16535 return length, err 16536 } 16537 16538 // CopyIn implements marshal.Marshallable.CopyIn. 16539 func (c *ControlMessageHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16540 return c.CopyInN(cc, addr, c.SizeBytes()) 16541 } 16542 16543 // WriteTo implements io.WriterTo.WriteTo. 16544 func (c *ControlMessageHeader) WriteTo(writer io.Writer) (int64, error) { 16545 // Construct a slice backed by dst's underlying memory. 16546 var buf []byte 16547 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16548 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16549 hdr.Len = c.SizeBytes() 16550 hdr.Cap = c.SizeBytes() 16551 16552 length, err := writer.Write(buf) 16553 // Since we bypassed the compiler's escape analysis, indicate that c 16554 // must live until the use above. 16555 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16556 return int64(length), err 16557 } 16558 16559 // SizeBytes implements marshal.Marshallable.SizeBytes. 16560 func (c *ControlMessageIPPacketInfo) SizeBytes() int { 16561 return 4 + 16562 (*InetAddr)(nil).SizeBytes() + 16563 (*InetAddr)(nil).SizeBytes() 16564 } 16565 16566 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16567 func (c *ControlMessageIPPacketInfo) MarshalBytes(dst []byte) []byte { 16568 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 16569 dst = dst[4:] 16570 dst = c.LocalAddr.MarshalUnsafe(dst) 16571 dst = c.DestinationAddr.MarshalUnsafe(dst) 16572 return dst 16573 } 16574 16575 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16576 func (c *ControlMessageIPPacketInfo) UnmarshalBytes(src []byte) []byte { 16577 c.NIC = int32(hostarch.ByteOrder.Uint32(src[:4])) 16578 src = src[4:] 16579 src = c.LocalAddr.UnmarshalUnsafe(src) 16580 src = c.DestinationAddr.UnmarshalUnsafe(src) 16581 return src 16582 } 16583 16584 // Packed implements marshal.Marshallable.Packed. 16585 //go:nosplit 16586 func (c *ControlMessageIPPacketInfo) Packed() bool { 16587 return c.DestinationAddr.Packed() && c.LocalAddr.Packed() 16588 } 16589 16590 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16591 func (c *ControlMessageIPPacketInfo) MarshalUnsafe(dst []byte) []byte { 16592 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 16593 size := c.SizeBytes() 16594 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 16595 return dst[size:] 16596 } 16597 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 16598 return c.MarshalBytes(dst) 16599 } 16600 16601 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16602 func (c *ControlMessageIPPacketInfo) UnmarshalUnsafe(src []byte) []byte { 16603 if c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 16604 size := c.SizeBytes() 16605 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 16606 return src[size:] 16607 } 16608 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16609 return c.UnmarshalBytes(src) 16610 } 16611 16612 // CopyOutN implements marshal.Marshallable.CopyOutN. 16613 func (c *ControlMessageIPPacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16614 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 16615 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16616 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 16617 c.MarshalBytes(buf) // escapes: fallback. 16618 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16619 } 16620 16621 // Construct a slice backed by dst's underlying memory. 16622 var buf []byte 16623 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16624 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16625 hdr.Len = c.SizeBytes() 16626 hdr.Cap = c.SizeBytes() 16627 16628 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16629 // Since we bypassed the compiler's escape analysis, indicate that c 16630 // must live until the use above. 16631 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16632 return length, err 16633 } 16634 16635 // CopyOut implements marshal.Marshallable.CopyOut. 16636 func (c *ControlMessageIPPacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16637 return c.CopyOutN(cc, addr, c.SizeBytes()) 16638 } 16639 16640 // CopyInN implements marshal.Marshallable.CopyInN. 16641 func (c *ControlMessageIPPacketInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16642 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 16643 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16644 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 16645 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16646 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16647 // partially unmarshalled struct. 16648 c.UnmarshalBytes(buf) // escapes: fallback. 16649 return length, err 16650 } 16651 16652 // Construct a slice backed by dst's underlying memory. 16653 var buf []byte 16654 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16655 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16656 hdr.Len = c.SizeBytes() 16657 hdr.Cap = c.SizeBytes() 16658 16659 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16660 // Since we bypassed the compiler's escape analysis, indicate that c 16661 // must live until the use above. 16662 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16663 return length, err 16664 } 16665 16666 // CopyIn implements marshal.Marshallable.CopyIn. 16667 func (c *ControlMessageIPPacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16668 return c.CopyInN(cc, addr, c.SizeBytes()) 16669 } 16670 16671 // WriteTo implements io.WriterTo.WriteTo. 16672 func (c *ControlMessageIPPacketInfo) WriteTo(writer io.Writer) (int64, error) { 16673 if !c.DestinationAddr.Packed() && c.LocalAddr.Packed() { 16674 // Type ControlMessageIPPacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16675 buf := make([]byte, c.SizeBytes()) 16676 c.MarshalBytes(buf) 16677 length, err := writer.Write(buf) 16678 return int64(length), err 16679 } 16680 16681 // Construct a slice backed by dst's underlying memory. 16682 var buf []byte 16683 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16684 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16685 hdr.Len = c.SizeBytes() 16686 hdr.Cap = c.SizeBytes() 16687 16688 length, err := writer.Write(buf) 16689 // Since we bypassed the compiler's escape analysis, indicate that c 16690 // must live until the use above. 16691 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16692 return int64(length), err 16693 } 16694 16695 // SizeBytes implements marshal.Marshallable.SizeBytes. 16696 func (c *ControlMessageIPv6PacketInfo) SizeBytes() int { 16697 return 4 + 16698 (*Inet6Addr)(nil).SizeBytes() 16699 } 16700 16701 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16702 func (c *ControlMessageIPv6PacketInfo) MarshalBytes(dst []byte) []byte { 16703 dst = c.Addr.MarshalUnsafe(dst) 16704 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.NIC)) 16705 dst = dst[4:] 16706 return dst 16707 } 16708 16709 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16710 func (c *ControlMessageIPv6PacketInfo) UnmarshalBytes(src []byte) []byte { 16711 src = c.Addr.UnmarshalUnsafe(src) 16712 c.NIC = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16713 src = src[4:] 16714 return src 16715 } 16716 16717 // Packed implements marshal.Marshallable.Packed. 16718 //go:nosplit 16719 func (c *ControlMessageIPv6PacketInfo) Packed() bool { 16720 return c.Addr.Packed() 16721 } 16722 16723 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16724 func (c *ControlMessageIPv6PacketInfo) MarshalUnsafe(dst []byte) []byte { 16725 if c.Addr.Packed() { 16726 size := c.SizeBytes() 16727 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 16728 return dst[size:] 16729 } 16730 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to MarshalBytes. 16731 return c.MarshalBytes(dst) 16732 } 16733 16734 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16735 func (c *ControlMessageIPv6PacketInfo) UnmarshalUnsafe(src []byte) []byte { 16736 if c.Addr.Packed() { 16737 size := c.SizeBytes() 16738 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 16739 return src[size:] 16740 } 16741 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fallback to UnmarshalBytes. 16742 return c.UnmarshalBytes(src) 16743 } 16744 16745 // CopyOutN implements marshal.Marshallable.CopyOutN. 16746 func (c *ControlMessageIPv6PacketInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16747 if !c.Addr.Packed() { 16748 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16749 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 16750 c.MarshalBytes(buf) // escapes: fallback. 16751 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16752 } 16753 16754 // Construct a slice backed by dst's underlying memory. 16755 var buf []byte 16756 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16757 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16758 hdr.Len = c.SizeBytes() 16759 hdr.Cap = c.SizeBytes() 16760 16761 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16762 // Since we bypassed the compiler's escape analysis, indicate that c 16763 // must live until the use above. 16764 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16765 return length, err 16766 } 16767 16768 // CopyOut implements marshal.Marshallable.CopyOut. 16769 func (c *ControlMessageIPv6PacketInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16770 return c.CopyOutN(cc, addr, c.SizeBytes()) 16771 } 16772 16773 // CopyInN implements marshal.Marshallable.CopyInN. 16774 func (c *ControlMessageIPv6PacketInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16775 if !c.Addr.Packed() { 16776 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to UnmarshalBytes. 16777 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 16778 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16779 // Unmarshal unconditionally. If we had a short copy-in, this results in a 16780 // partially unmarshalled struct. 16781 c.UnmarshalBytes(buf) // escapes: fallback. 16782 return length, err 16783 } 16784 16785 // Construct a slice backed by dst's underlying memory. 16786 var buf []byte 16787 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16788 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16789 hdr.Len = c.SizeBytes() 16790 hdr.Cap = c.SizeBytes() 16791 16792 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16793 // Since we bypassed the compiler's escape analysis, indicate that c 16794 // must live until the use above. 16795 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16796 return length, err 16797 } 16798 16799 // CopyIn implements marshal.Marshallable.CopyIn. 16800 func (c *ControlMessageIPv6PacketInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16801 return c.CopyInN(cc, addr, c.SizeBytes()) 16802 } 16803 16804 // WriteTo implements io.WriterTo.WriteTo. 16805 func (c *ControlMessageIPv6PacketInfo) WriteTo(writer io.Writer) (int64, error) { 16806 if !c.Addr.Packed() { 16807 // Type ControlMessageIPv6PacketInfo doesn't have a packed layout in memory, fall back to MarshalBytes. 16808 buf := make([]byte, c.SizeBytes()) 16809 c.MarshalBytes(buf) 16810 length, err := writer.Write(buf) 16811 return int64(length), err 16812 } 16813 16814 // Construct a slice backed by dst's underlying memory. 16815 var buf []byte 16816 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16817 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 16818 hdr.Len = c.SizeBytes() 16819 hdr.Cap = c.SizeBytes() 16820 16821 length, err := writer.Write(buf) 16822 // Since we bypassed the compiler's escape analysis, indicate that c 16823 // must live until the use above. 16824 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 16825 return int64(length), err 16826 } 16827 16828 // SizeBytes implements marshal.Marshallable.SizeBytes. 16829 func (i *ICMP6Filter) SizeBytes() int { 16830 return 0 + 16831 4*8 16832 } 16833 16834 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16835 func (i *ICMP6Filter) MarshalBytes(dst []byte) []byte { 16836 for idx := 0; idx < 8; idx++ { 16837 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.Filter[idx])) 16838 dst = dst[4:] 16839 } 16840 return dst 16841 } 16842 16843 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16844 func (i *ICMP6Filter) UnmarshalBytes(src []byte) []byte { 16845 for idx := 0; idx < 8; idx++ { 16846 i.Filter[idx] = uint32(hostarch.ByteOrder.Uint32(src[:4])) 16847 src = src[4:] 16848 } 16849 return src 16850 } 16851 16852 // Packed implements marshal.Marshallable.Packed. 16853 //go:nosplit 16854 func (i *ICMP6Filter) Packed() bool { 16855 return true 16856 } 16857 16858 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16859 func (i *ICMP6Filter) MarshalUnsafe(dst []byte) []byte { 16860 size := i.SizeBytes() 16861 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 16862 return dst[size:] 16863 } 16864 16865 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16866 func (i *ICMP6Filter) UnmarshalUnsafe(src []byte) []byte { 16867 size := i.SizeBytes() 16868 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16869 return src[size:] 16870 } 16871 16872 // CopyOutN implements marshal.Marshallable.CopyOutN. 16873 func (i *ICMP6Filter) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16874 // Construct a slice backed by dst's underlying memory. 16875 var buf []byte 16876 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16877 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16878 hdr.Len = i.SizeBytes() 16879 hdr.Cap = i.SizeBytes() 16880 16881 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16882 // Since we bypassed the compiler's escape analysis, indicate that i 16883 // must live until the use above. 16884 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16885 return length, err 16886 } 16887 16888 // CopyOut implements marshal.Marshallable.CopyOut. 16889 func (i *ICMP6Filter) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16890 return i.CopyOutN(cc, addr, i.SizeBytes()) 16891 } 16892 16893 // CopyInN implements marshal.Marshallable.CopyInN. 16894 func (i *ICMP6Filter) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16895 // Construct a slice backed by dst's underlying memory. 16896 var buf []byte 16897 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16898 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16899 hdr.Len = i.SizeBytes() 16900 hdr.Cap = i.SizeBytes() 16901 16902 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 16903 // Since we bypassed the compiler's escape analysis, indicate that i 16904 // must live until the use above. 16905 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16906 return length, err 16907 } 16908 16909 // CopyIn implements marshal.Marshallable.CopyIn. 16910 func (i *ICMP6Filter) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16911 return i.CopyInN(cc, addr, i.SizeBytes()) 16912 } 16913 16914 // WriteTo implements io.WriterTo.WriteTo. 16915 func (i *ICMP6Filter) WriteTo(writer io.Writer) (int64, error) { 16916 // Construct a slice backed by dst's underlying memory. 16917 var buf []byte 16918 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16919 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16920 hdr.Len = i.SizeBytes() 16921 hdr.Cap = i.SizeBytes() 16922 16923 length, err := writer.Write(buf) 16924 // Since we bypassed the compiler's escape analysis, indicate that i 16925 // must live until the use above. 16926 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16927 return int64(length), err 16928 } 16929 16930 // SizeBytes implements marshal.Marshallable.SizeBytes. 16931 //go:nosplit 16932 func (i *Inet6Addr) SizeBytes() int { 16933 return 1 * 16 16934 } 16935 16936 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 16937 func (i *Inet6Addr) MarshalBytes(dst []byte) []byte { 16938 for idx := 0; idx < 16; idx++ { 16939 dst[0] = byte(i[idx]) 16940 dst = dst[1:] 16941 } 16942 return dst 16943 } 16944 16945 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 16946 func (i *Inet6Addr) UnmarshalBytes(src []byte) []byte { 16947 for idx := 0; idx < 16; idx++ { 16948 i[idx] = src[0] 16949 src = src[1:] 16950 } 16951 return src 16952 } 16953 16954 // Packed implements marshal.Marshallable.Packed. 16955 //go:nosplit 16956 func (i *Inet6Addr) Packed() bool { 16957 // Array newtypes are always packed. 16958 return true 16959 } 16960 16961 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 16962 func (i *Inet6Addr) MarshalUnsafe(dst []byte) []byte { 16963 size := i.SizeBytes() 16964 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 16965 return dst[size:] 16966 } 16967 16968 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 16969 func (i *Inet6Addr) UnmarshalUnsafe(src []byte) []byte { 16970 size := i.SizeBytes() 16971 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 16972 return src[size:] 16973 } 16974 16975 // CopyOutN implements marshal.Marshallable.CopyOutN. 16976 func (i *Inet6Addr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16977 // Construct a slice backed by dst's underlying memory. 16978 var buf []byte 16979 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 16980 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 16981 hdr.Len = i.SizeBytes() 16982 hdr.Cap = i.SizeBytes() 16983 16984 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 16985 // Since we bypassed the compiler's escape analysis, indicate that i 16986 // must live until the use above. 16987 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 16988 return length, err 16989 } 16990 16991 // CopyOut implements marshal.Marshallable.CopyOut. 16992 func (i *Inet6Addr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 16993 return i.CopyOutN(cc, addr, i.SizeBytes()) 16994 } 16995 16996 // CopyInN implements marshal.Marshallable.CopyInN. 16997 func (i *Inet6Addr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 16998 // Construct a slice backed by dst's underlying memory. 16999 var buf []byte 17000 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17001 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17002 hdr.Len = i.SizeBytes() 17003 hdr.Cap = i.SizeBytes() 17004 17005 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17006 // Since we bypassed the compiler's escape analysis, indicate that i 17007 // must live until the use above. 17008 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17009 return length, err 17010 } 17011 17012 // CopyIn implements marshal.Marshallable.CopyIn. 17013 func (i *Inet6Addr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17014 return i.CopyInN(cc, addr, i.SizeBytes()) 17015 } 17016 17017 // WriteTo implements io.WriterTo.WriteTo. 17018 func (i *Inet6Addr) WriteTo(writer io.Writer) (int64, error) { 17019 // Construct a slice backed by dst's underlying memory. 17020 var buf []byte 17021 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17022 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17023 hdr.Len = i.SizeBytes() 17024 hdr.Cap = i.SizeBytes() 17025 17026 length, err := writer.Write(buf) 17027 // Since we bypassed the compiler's escape analysis, indicate that i 17028 // must live until the use above. 17029 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17030 return int64(length), err 17031 } 17032 17033 // SizeBytes implements marshal.Marshallable.SizeBytes. 17034 func (i *Inet6MulticastRequest) SizeBytes() int { 17035 return 4 + 17036 (*Inet6Addr)(nil).SizeBytes() 17037 } 17038 17039 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17040 func (i *Inet6MulticastRequest) MarshalBytes(dst []byte) []byte { 17041 dst = i.MulticastAddr.MarshalUnsafe(dst) 17042 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 17043 dst = dst[4:] 17044 return dst 17045 } 17046 17047 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17048 func (i *Inet6MulticastRequest) UnmarshalBytes(src []byte) []byte { 17049 src = i.MulticastAddr.UnmarshalUnsafe(src) 17050 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 17051 src = src[4:] 17052 return src 17053 } 17054 17055 // Packed implements marshal.Marshallable.Packed. 17056 //go:nosplit 17057 func (i *Inet6MulticastRequest) Packed() bool { 17058 return i.MulticastAddr.Packed() 17059 } 17060 17061 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17062 func (i *Inet6MulticastRequest) MarshalUnsafe(dst []byte) []byte { 17063 if i.MulticastAddr.Packed() { 17064 size := i.SizeBytes() 17065 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17066 return dst[size:] 17067 } 17068 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 17069 return i.MarshalBytes(dst) 17070 } 17071 17072 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17073 func (i *Inet6MulticastRequest) UnmarshalUnsafe(src []byte) []byte { 17074 if i.MulticastAddr.Packed() { 17075 size := i.SizeBytes() 17076 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17077 return src[size:] 17078 } 17079 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17080 return i.UnmarshalBytes(src) 17081 } 17082 17083 // CopyOutN implements marshal.Marshallable.CopyOutN. 17084 func (i *Inet6MulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17085 if !i.MulticastAddr.Packed() { 17086 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 17087 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17088 i.MarshalBytes(buf) // escapes: fallback. 17089 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17090 } 17091 17092 // Construct a slice backed by dst's underlying memory. 17093 var buf []byte 17094 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17095 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17096 hdr.Len = i.SizeBytes() 17097 hdr.Cap = i.SizeBytes() 17098 17099 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17100 // Since we bypassed the compiler's escape analysis, indicate that i 17101 // must live until the use above. 17102 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17103 return length, err 17104 } 17105 17106 // CopyOut implements marshal.Marshallable.CopyOut. 17107 func (i *Inet6MulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17108 return i.CopyOutN(cc, addr, i.SizeBytes()) 17109 } 17110 17111 // CopyInN implements marshal.Marshallable.CopyInN. 17112 func (i *Inet6MulticastRequest) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17113 if !i.MulticastAddr.Packed() { 17114 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17115 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17116 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17117 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17118 // partially unmarshalled struct. 17119 i.UnmarshalBytes(buf) // escapes: fallback. 17120 return length, err 17121 } 17122 17123 // Construct a slice backed by dst's underlying memory. 17124 var buf []byte 17125 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17126 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17127 hdr.Len = i.SizeBytes() 17128 hdr.Cap = i.SizeBytes() 17129 17130 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17131 // Since we bypassed the compiler's escape analysis, indicate that i 17132 // must live until the use above. 17133 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17134 return length, err 17135 } 17136 17137 // CopyIn implements marshal.Marshallable.CopyIn. 17138 func (i *Inet6MulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17139 return i.CopyInN(cc, addr, i.SizeBytes()) 17140 } 17141 17142 // WriteTo implements io.WriterTo.WriteTo. 17143 func (i *Inet6MulticastRequest) WriteTo(writer io.Writer) (int64, error) { 17144 if !i.MulticastAddr.Packed() { 17145 // Type Inet6MulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 17146 buf := make([]byte, i.SizeBytes()) 17147 i.MarshalBytes(buf) 17148 length, err := writer.Write(buf) 17149 return int64(length), err 17150 } 17151 17152 // Construct a slice backed by dst's underlying memory. 17153 var buf []byte 17154 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17155 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17156 hdr.Len = i.SizeBytes() 17157 hdr.Cap = i.SizeBytes() 17158 17159 length, err := writer.Write(buf) 17160 // Since we bypassed the compiler's escape analysis, indicate that i 17161 // must live until the use above. 17162 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17163 return int64(length), err 17164 } 17165 17166 // SizeBytes implements marshal.Marshallable.SizeBytes. 17167 //go:nosplit 17168 func (i *InetAddr) SizeBytes() int { 17169 return 1 * 4 17170 } 17171 17172 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17173 func (i *InetAddr) MarshalBytes(dst []byte) []byte { 17174 for idx := 0; idx < 4; idx++ { 17175 dst[0] = byte(i[idx]) 17176 dst = dst[1:] 17177 } 17178 return dst 17179 } 17180 17181 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17182 func (i *InetAddr) UnmarshalBytes(src []byte) []byte { 17183 for idx := 0; idx < 4; idx++ { 17184 i[idx] = src[0] 17185 src = src[1:] 17186 } 17187 return src 17188 } 17189 17190 // Packed implements marshal.Marshallable.Packed. 17191 //go:nosplit 17192 func (i *InetAddr) Packed() bool { 17193 // Array newtypes are always packed. 17194 return true 17195 } 17196 17197 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17198 func (i *InetAddr) MarshalUnsafe(dst []byte) []byte { 17199 size := i.SizeBytes() 17200 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&i[0]), uintptr(size)) 17201 return dst[size:] 17202 } 17203 17204 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17205 func (i *InetAddr) UnmarshalUnsafe(src []byte) []byte { 17206 size := i.SizeBytes() 17207 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17208 return src[size:] 17209 } 17210 17211 // CopyOutN implements marshal.Marshallable.CopyOutN. 17212 func (i *InetAddr) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17213 // Construct a slice backed by dst's underlying memory. 17214 var buf []byte 17215 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17216 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17217 hdr.Len = i.SizeBytes() 17218 hdr.Cap = i.SizeBytes() 17219 17220 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17221 // Since we bypassed the compiler's escape analysis, indicate that i 17222 // must live until the use above. 17223 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17224 return length, err 17225 } 17226 17227 // CopyOut implements marshal.Marshallable.CopyOut. 17228 func (i *InetAddr) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17229 return i.CopyOutN(cc, addr, i.SizeBytes()) 17230 } 17231 17232 // CopyInN implements marshal.Marshallable.CopyInN. 17233 func (i *InetAddr) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17234 // Construct a slice backed by dst's underlying memory. 17235 var buf []byte 17236 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17237 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17238 hdr.Len = i.SizeBytes() 17239 hdr.Cap = i.SizeBytes() 17240 17241 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17242 // Since we bypassed the compiler's escape analysis, indicate that i 17243 // must live until the use above. 17244 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17245 return length, err 17246 } 17247 17248 // CopyIn implements marshal.Marshallable.CopyIn. 17249 func (i *InetAddr) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17250 return i.CopyInN(cc, addr, i.SizeBytes()) 17251 } 17252 17253 // WriteTo implements io.WriterTo.WriteTo. 17254 func (i *InetAddr) WriteTo(writer io.Writer) (int64, error) { 17255 // Construct a slice backed by dst's underlying memory. 17256 var buf []byte 17257 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17258 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17259 hdr.Len = i.SizeBytes() 17260 hdr.Cap = i.SizeBytes() 17261 17262 length, err := writer.Write(buf) 17263 // Since we bypassed the compiler's escape analysis, indicate that i 17264 // must live until the use above. 17265 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17266 return int64(length), err 17267 } 17268 17269 // SizeBytes implements marshal.Marshallable.SizeBytes. 17270 func (i *InetMulticastRequest) SizeBytes() int { 17271 return 0 + 17272 (*InetAddr)(nil).SizeBytes() + 17273 (*InetAddr)(nil).SizeBytes() 17274 } 17275 17276 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17277 func (i *InetMulticastRequest) MarshalBytes(dst []byte) []byte { 17278 dst = i.MulticastAddr.MarshalUnsafe(dst) 17279 dst = i.InterfaceAddr.MarshalUnsafe(dst) 17280 return dst 17281 } 17282 17283 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17284 func (i *InetMulticastRequest) UnmarshalBytes(src []byte) []byte { 17285 src = i.MulticastAddr.UnmarshalUnsafe(src) 17286 src = i.InterfaceAddr.UnmarshalUnsafe(src) 17287 return src 17288 } 17289 17290 // Packed implements marshal.Marshallable.Packed. 17291 //go:nosplit 17292 func (i *InetMulticastRequest) Packed() bool { 17293 return i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() 17294 } 17295 17296 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17297 func (i *InetMulticastRequest) MarshalUnsafe(dst []byte) []byte { 17298 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 17299 size := i.SizeBytes() 17300 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17301 return dst[size:] 17302 } 17303 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to MarshalBytes. 17304 return i.MarshalBytes(dst) 17305 } 17306 17307 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17308 func (i *InetMulticastRequest) UnmarshalUnsafe(src []byte) []byte { 17309 if i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 17310 size := i.SizeBytes() 17311 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17312 return src[size:] 17313 } 17314 // Type InetMulticastRequest doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17315 return i.UnmarshalBytes(src) 17316 } 17317 17318 // CopyOutN implements marshal.Marshallable.CopyOutN. 17319 func (i *InetMulticastRequest) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17320 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 17321 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 17322 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17323 i.MarshalBytes(buf) // escapes: fallback. 17324 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17325 } 17326 17327 // Construct a slice backed by dst's underlying memory. 17328 var buf []byte 17329 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17330 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17331 hdr.Len = i.SizeBytes() 17332 hdr.Cap = i.SizeBytes() 17333 17334 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17335 // Since we bypassed the compiler's escape analysis, indicate that i 17336 // must live until the use above. 17337 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17338 return length, err 17339 } 17340 17341 // CopyOut implements marshal.Marshallable.CopyOut. 17342 func (i *InetMulticastRequest) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17343 return i.CopyOutN(cc, addr, i.SizeBytes()) 17344 } 17345 17346 // CopyInN implements marshal.Marshallable.CopyInN. 17347 func (i *InetMulticastRequest) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17348 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 17349 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17350 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17351 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17352 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17353 // partially unmarshalled struct. 17354 i.UnmarshalBytes(buf) // escapes: fallback. 17355 return length, err 17356 } 17357 17358 // Construct a slice backed by dst's underlying memory. 17359 var buf []byte 17360 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17361 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17362 hdr.Len = i.SizeBytes() 17363 hdr.Cap = i.SizeBytes() 17364 17365 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17366 // Since we bypassed the compiler's escape analysis, indicate that i 17367 // must live until the use above. 17368 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17369 return length, err 17370 } 17371 17372 // CopyIn implements marshal.Marshallable.CopyIn. 17373 func (i *InetMulticastRequest) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17374 return i.CopyInN(cc, addr, i.SizeBytes()) 17375 } 17376 17377 // WriteTo implements io.WriterTo.WriteTo. 17378 func (i *InetMulticastRequest) WriteTo(writer io.Writer) (int64, error) { 17379 if !i.InterfaceAddr.Packed() && i.MulticastAddr.Packed() { 17380 // Type InetMulticastRequest doesn't have a packed layout in memory, fall back to MarshalBytes. 17381 buf := make([]byte, i.SizeBytes()) 17382 i.MarshalBytes(buf) 17383 length, err := writer.Write(buf) 17384 return int64(length), err 17385 } 17386 17387 // Construct a slice backed by dst's underlying memory. 17388 var buf []byte 17389 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17390 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17391 hdr.Len = i.SizeBytes() 17392 hdr.Cap = i.SizeBytes() 17393 17394 length, err := writer.Write(buf) 17395 // Since we bypassed the compiler's escape analysis, indicate that i 17396 // must live until the use above. 17397 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17398 return int64(length), err 17399 } 17400 17401 // SizeBytes implements marshal.Marshallable.SizeBytes. 17402 func (i *InetMulticastRequestWithNIC) SizeBytes() int { 17403 return 4 + 17404 (*InetMulticastRequest)(nil).SizeBytes() 17405 } 17406 17407 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17408 func (i *InetMulticastRequestWithNIC) MarshalBytes(dst []byte) []byte { 17409 dst = i.InetMulticastRequest.MarshalUnsafe(dst) 17410 hostarch.ByteOrder.PutUint32(dst[:4], uint32(i.InterfaceIndex)) 17411 dst = dst[4:] 17412 return dst 17413 } 17414 17415 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17416 func (i *InetMulticastRequestWithNIC) UnmarshalBytes(src []byte) []byte { 17417 src = i.InetMulticastRequest.UnmarshalUnsafe(src) 17418 i.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 17419 src = src[4:] 17420 return src 17421 } 17422 17423 // Packed implements marshal.Marshallable.Packed. 17424 //go:nosplit 17425 func (i *InetMulticastRequestWithNIC) Packed() bool { 17426 return i.InetMulticastRequest.Packed() 17427 } 17428 17429 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17430 func (i *InetMulticastRequestWithNIC) MarshalUnsafe(dst []byte) []byte { 17431 if i.InetMulticastRequest.Packed() { 17432 size := i.SizeBytes() 17433 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 17434 return dst[size:] 17435 } 17436 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to MarshalBytes. 17437 return i.MarshalBytes(dst) 17438 } 17439 17440 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17441 func (i *InetMulticastRequestWithNIC) UnmarshalUnsafe(src []byte) []byte { 17442 if i.InetMulticastRequest.Packed() { 17443 size := i.SizeBytes() 17444 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 17445 return src[size:] 17446 } 17447 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17448 return i.UnmarshalBytes(src) 17449 } 17450 17451 // CopyOutN implements marshal.Marshallable.CopyOutN. 17452 func (i *InetMulticastRequestWithNIC) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17453 if !i.InetMulticastRequest.Packed() { 17454 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 17455 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17456 i.MarshalBytes(buf) // escapes: fallback. 17457 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17458 } 17459 17460 // Construct a slice backed by dst's underlying memory. 17461 var buf []byte 17462 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17463 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17464 hdr.Len = i.SizeBytes() 17465 hdr.Cap = i.SizeBytes() 17466 17467 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17468 // Since we bypassed the compiler's escape analysis, indicate that i 17469 // must live until the use above. 17470 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17471 return length, err 17472 } 17473 17474 // CopyOut implements marshal.Marshallable.CopyOut. 17475 func (i *InetMulticastRequestWithNIC) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17476 return i.CopyOutN(cc, addr, i.SizeBytes()) 17477 } 17478 17479 // CopyInN implements marshal.Marshallable.CopyInN. 17480 func (i *InetMulticastRequestWithNIC) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17481 if !i.InetMulticastRequest.Packed() { 17482 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17483 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 17484 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17485 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17486 // partially unmarshalled struct. 17487 i.UnmarshalBytes(buf) // escapes: fallback. 17488 return length, err 17489 } 17490 17491 // Construct a slice backed by dst's underlying memory. 17492 var buf []byte 17493 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17494 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17495 hdr.Len = i.SizeBytes() 17496 hdr.Cap = i.SizeBytes() 17497 17498 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17499 // Since we bypassed the compiler's escape analysis, indicate that i 17500 // must live until the use above. 17501 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17502 return length, err 17503 } 17504 17505 // CopyIn implements marshal.Marshallable.CopyIn. 17506 func (i *InetMulticastRequestWithNIC) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17507 return i.CopyInN(cc, addr, i.SizeBytes()) 17508 } 17509 17510 // WriteTo implements io.WriterTo.WriteTo. 17511 func (i *InetMulticastRequestWithNIC) WriteTo(writer io.Writer) (int64, error) { 17512 if !i.InetMulticastRequest.Packed() { 17513 // Type InetMulticastRequestWithNIC doesn't have a packed layout in memory, fall back to MarshalBytes. 17514 buf := make([]byte, i.SizeBytes()) 17515 i.MarshalBytes(buf) 17516 length, err := writer.Write(buf) 17517 return int64(length), err 17518 } 17519 17520 // Construct a slice backed by dst's underlying memory. 17521 var buf []byte 17522 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17523 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 17524 hdr.Len = i.SizeBytes() 17525 hdr.Cap = i.SizeBytes() 17526 17527 length, err := writer.Write(buf) 17528 // Since we bypassed the compiler's escape analysis, indicate that i 17529 // must live until the use above. 17530 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 17531 return int64(length), err 17532 } 17533 17534 // SizeBytes implements marshal.Marshallable.SizeBytes. 17535 func (l *Linger) SizeBytes() int { 17536 return 8 17537 } 17538 17539 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17540 func (l *Linger) MarshalBytes(dst []byte) []byte { 17541 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.OnOff)) 17542 dst = dst[4:] 17543 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Linger)) 17544 dst = dst[4:] 17545 return dst 17546 } 17547 17548 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17549 func (l *Linger) UnmarshalBytes(src []byte) []byte { 17550 l.OnOff = int32(hostarch.ByteOrder.Uint32(src[:4])) 17551 src = src[4:] 17552 l.Linger = int32(hostarch.ByteOrder.Uint32(src[:4])) 17553 src = src[4:] 17554 return src 17555 } 17556 17557 // Packed implements marshal.Marshallable.Packed. 17558 //go:nosplit 17559 func (l *Linger) Packed() bool { 17560 return true 17561 } 17562 17563 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17564 func (l *Linger) MarshalUnsafe(dst []byte) []byte { 17565 size := l.SizeBytes() 17566 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 17567 return dst[size:] 17568 } 17569 17570 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17571 func (l *Linger) UnmarshalUnsafe(src []byte) []byte { 17572 size := l.SizeBytes() 17573 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 17574 return src[size:] 17575 } 17576 17577 // CopyOutN implements marshal.Marshallable.CopyOutN. 17578 func (l *Linger) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17579 // Construct a slice backed by dst's underlying memory. 17580 var buf []byte 17581 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17582 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 17583 hdr.Len = l.SizeBytes() 17584 hdr.Cap = l.SizeBytes() 17585 17586 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17587 // Since we bypassed the compiler's escape analysis, indicate that l 17588 // must live until the use above. 17589 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 17590 return length, err 17591 } 17592 17593 // CopyOut implements marshal.Marshallable.CopyOut. 17594 func (l *Linger) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17595 return l.CopyOutN(cc, addr, l.SizeBytes()) 17596 } 17597 17598 // CopyInN implements marshal.Marshallable.CopyInN. 17599 func (l *Linger) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, 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(l))) 17604 hdr.Len = l.SizeBytes() 17605 hdr.Cap = l.SizeBytes() 17606 17607 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17608 // Since we bypassed the compiler's escape analysis, indicate that l 17609 // must live until the use above. 17610 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 17611 return length, err 17612 } 17613 17614 // CopyIn implements marshal.Marshallable.CopyIn. 17615 func (l *Linger) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17616 return l.CopyInN(cc, addr, l.SizeBytes()) 17617 } 17618 17619 // WriteTo implements io.WriterTo.WriteTo. 17620 func (l *Linger) WriteTo(writer io.Writer) (int64, error) { 17621 // Construct a slice backed by dst's underlying memory. 17622 var buf []byte 17623 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17624 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 17625 hdr.Len = l.SizeBytes() 17626 hdr.Cap = l.SizeBytes() 17627 17628 length, err := writer.Write(buf) 17629 // Since we bypassed the compiler's escape analysis, indicate that l 17630 // must live until the use above. 17631 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 17632 return int64(length), err 17633 } 17634 17635 // SizeBytes implements marshal.Marshallable.SizeBytes. 17636 func (s *SockAddrInet) SizeBytes() int { 17637 return 4 + 17638 (*InetAddr)(nil).SizeBytes() + 17639 1*8 17640 } 17641 17642 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17643 func (s *SockAddrInet) MarshalBytes(dst []byte) []byte { 17644 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 17645 dst = dst[2:] 17646 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 17647 dst = dst[2:] 17648 dst = s.Addr.MarshalUnsafe(dst) 17649 // Padding: dst[:sizeof(uint8)*8] ~= [8]uint8{0} 17650 dst = dst[1*(8):] 17651 return dst 17652 } 17653 17654 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17655 func (s *SockAddrInet) UnmarshalBytes(src []byte) []byte { 17656 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17657 src = src[2:] 17658 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17659 src = src[2:] 17660 src = s.Addr.UnmarshalUnsafe(src) 17661 // Padding: ~ copy([8]uint8(s._), src[:sizeof(uint8)*8]) 17662 src = src[1*(8):] 17663 return src 17664 } 17665 17666 // Packed implements marshal.Marshallable.Packed. 17667 //go:nosplit 17668 func (s *SockAddrInet) Packed() bool { 17669 return s.Addr.Packed() 17670 } 17671 17672 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17673 func (s *SockAddrInet) MarshalUnsafe(dst []byte) []byte { 17674 if s.Addr.Packed() { 17675 size := s.SizeBytes() 17676 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17677 return dst[size:] 17678 } 17679 // Type SockAddrInet doesn't have a packed layout in memory, fallback to MarshalBytes. 17680 return s.MarshalBytes(dst) 17681 } 17682 17683 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17684 func (s *SockAddrInet) UnmarshalUnsafe(src []byte) []byte { 17685 if s.Addr.Packed() { 17686 size := s.SizeBytes() 17687 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17688 return src[size:] 17689 } 17690 // Type SockAddrInet doesn't have a packed layout in memory, fallback to UnmarshalBytes. 17691 return s.UnmarshalBytes(src) 17692 } 17693 17694 // CopyOutN implements marshal.Marshallable.CopyOutN. 17695 func (s *SockAddrInet) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17696 if !s.Addr.Packed() { 17697 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 17698 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 17699 s.MarshalBytes(buf) // escapes: fallback. 17700 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17701 } 17702 17703 // Construct a slice backed by dst's underlying memory. 17704 var buf []byte 17705 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17706 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17707 hdr.Len = s.SizeBytes() 17708 hdr.Cap = s.SizeBytes() 17709 17710 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17711 // Since we bypassed the compiler's escape analysis, indicate that s 17712 // must live until the use above. 17713 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17714 return length, err 17715 } 17716 17717 // CopyOut implements marshal.Marshallable.CopyOut. 17718 func (s *SockAddrInet) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17719 return s.CopyOutN(cc, addr, s.SizeBytes()) 17720 } 17721 17722 // CopyInN implements marshal.Marshallable.CopyInN. 17723 func (s *SockAddrInet) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17724 if !s.Addr.Packed() { 17725 // Type SockAddrInet doesn't have a packed layout in memory, fall back to UnmarshalBytes. 17726 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 17727 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17728 // Unmarshal unconditionally. If we had a short copy-in, this results in a 17729 // partially unmarshalled struct. 17730 s.UnmarshalBytes(buf) // escapes: fallback. 17731 return length, err 17732 } 17733 17734 // Construct a slice backed by dst's underlying memory. 17735 var buf []byte 17736 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17737 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17738 hdr.Len = s.SizeBytes() 17739 hdr.Cap = s.SizeBytes() 17740 17741 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17742 // Since we bypassed the compiler's escape analysis, indicate that s 17743 // must live until the use above. 17744 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17745 return length, err 17746 } 17747 17748 // CopyIn implements marshal.Marshallable.CopyIn. 17749 func (s *SockAddrInet) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17750 return s.CopyInN(cc, addr, s.SizeBytes()) 17751 } 17752 17753 // WriteTo implements io.WriterTo.WriteTo. 17754 func (s *SockAddrInet) WriteTo(writer io.Writer) (int64, error) { 17755 if !s.Addr.Packed() { 17756 // Type SockAddrInet doesn't have a packed layout in memory, fall back to MarshalBytes. 17757 buf := make([]byte, s.SizeBytes()) 17758 s.MarshalBytes(buf) 17759 length, err := writer.Write(buf) 17760 return int64(length), err 17761 } 17762 17763 // Construct a slice backed by dst's underlying memory. 17764 var buf []byte 17765 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17766 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17767 hdr.Len = s.SizeBytes() 17768 hdr.Cap = s.SizeBytes() 17769 17770 length, err := writer.Write(buf) 17771 // Since we bypassed the compiler's escape analysis, indicate that s 17772 // must live until the use above. 17773 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17774 return int64(length), err 17775 } 17776 17777 // SizeBytes implements marshal.Marshallable.SizeBytes. 17778 func (s *SockAddrInet6) SizeBytes() int { 17779 return 12 + 17780 1*16 17781 } 17782 17783 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17784 func (s *SockAddrInet6) MarshalBytes(dst []byte) []byte { 17785 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 17786 dst = dst[2:] 17787 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Port)) 17788 dst = dst[2:] 17789 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Flowinfo)) 17790 dst = dst[4:] 17791 for idx := 0; idx < 16; idx++ { 17792 dst[0] = byte(s.Addr[idx]) 17793 dst = dst[1:] 17794 } 17795 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Scope_id)) 17796 dst = dst[4:] 17797 return dst 17798 } 17799 17800 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17801 func (s *SockAddrInet6) UnmarshalBytes(src []byte) []byte { 17802 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17803 src = src[2:] 17804 s.Port = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17805 src = src[2:] 17806 s.Flowinfo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17807 src = src[4:] 17808 for idx := 0; idx < 16; idx++ { 17809 s.Addr[idx] = src[0] 17810 src = src[1:] 17811 } 17812 s.Scope_id = uint32(hostarch.ByteOrder.Uint32(src[:4])) 17813 src = src[4:] 17814 return src 17815 } 17816 17817 // Packed implements marshal.Marshallable.Packed. 17818 //go:nosplit 17819 func (s *SockAddrInet6) Packed() bool { 17820 return true 17821 } 17822 17823 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17824 func (s *SockAddrInet6) MarshalUnsafe(dst []byte) []byte { 17825 size := s.SizeBytes() 17826 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17827 return dst[size:] 17828 } 17829 17830 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17831 func (s *SockAddrInet6) UnmarshalUnsafe(src []byte) []byte { 17832 size := s.SizeBytes() 17833 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17834 return src[size:] 17835 } 17836 17837 // CopyOutN implements marshal.Marshallable.CopyOutN. 17838 func (s *SockAddrInet6) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17839 // Construct a slice backed by dst's underlying memory. 17840 var buf []byte 17841 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17842 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17843 hdr.Len = s.SizeBytes() 17844 hdr.Cap = s.SizeBytes() 17845 17846 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17847 // Since we bypassed the compiler's escape analysis, indicate that s 17848 // must live until the use above. 17849 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17850 return length, err 17851 } 17852 17853 // CopyOut implements marshal.Marshallable.CopyOut. 17854 func (s *SockAddrInet6) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17855 return s.CopyOutN(cc, addr, s.SizeBytes()) 17856 } 17857 17858 // CopyInN implements marshal.Marshallable.CopyInN. 17859 func (s *SockAddrInet6) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17860 // Construct a slice backed by dst's underlying memory. 17861 var buf []byte 17862 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17863 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17864 hdr.Len = s.SizeBytes() 17865 hdr.Cap = s.SizeBytes() 17866 17867 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17868 // Since we bypassed the compiler's escape analysis, indicate that s 17869 // must live until the use above. 17870 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17871 return length, err 17872 } 17873 17874 // CopyIn implements marshal.Marshallable.CopyIn. 17875 func (s *SockAddrInet6) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17876 return s.CopyInN(cc, addr, s.SizeBytes()) 17877 } 17878 17879 // WriteTo implements io.WriterTo.WriteTo. 17880 func (s *SockAddrInet6) WriteTo(writer io.Writer) (int64, error) { 17881 // Construct a slice backed by dst's underlying memory. 17882 var buf []byte 17883 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17884 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17885 hdr.Len = s.SizeBytes() 17886 hdr.Cap = s.SizeBytes() 17887 17888 length, err := writer.Write(buf) 17889 // Since we bypassed the compiler's escape analysis, indicate that s 17890 // must live until the use above. 17891 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17892 return int64(length), err 17893 } 17894 17895 // SizeBytes implements marshal.Marshallable.SizeBytes. 17896 func (s *SockAddrLink) SizeBytes() int { 17897 return 12 + 17898 1*8 17899 } 17900 17901 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 17902 func (s *SockAddrLink) MarshalBytes(dst []byte) []byte { 17903 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 17904 dst = dst[2:] 17905 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Protocol)) 17906 dst = dst[2:] 17907 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.InterfaceIndex)) 17908 dst = dst[4:] 17909 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.ARPHardwareType)) 17910 dst = dst[2:] 17911 dst[0] = byte(s.PacketType) 17912 dst = dst[1:] 17913 dst[0] = byte(s.HardwareAddrLen) 17914 dst = dst[1:] 17915 for idx := 0; idx < 8; idx++ { 17916 dst[0] = byte(s.HardwareAddr[idx]) 17917 dst = dst[1:] 17918 } 17919 return dst 17920 } 17921 17922 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 17923 func (s *SockAddrLink) UnmarshalBytes(src []byte) []byte { 17924 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17925 src = src[2:] 17926 s.Protocol = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17927 src = src[2:] 17928 s.InterfaceIndex = int32(hostarch.ByteOrder.Uint32(src[:4])) 17929 src = src[4:] 17930 s.ARPHardwareType = uint16(hostarch.ByteOrder.Uint16(src[:2])) 17931 src = src[2:] 17932 s.PacketType = src[0] 17933 src = src[1:] 17934 s.HardwareAddrLen = src[0] 17935 src = src[1:] 17936 for idx := 0; idx < 8; idx++ { 17937 s.HardwareAddr[idx] = src[0] 17938 src = src[1:] 17939 } 17940 return src 17941 } 17942 17943 // Packed implements marshal.Marshallable.Packed. 17944 //go:nosplit 17945 func (s *SockAddrLink) Packed() bool { 17946 return true 17947 } 17948 17949 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 17950 func (s *SockAddrLink) MarshalUnsafe(dst []byte) []byte { 17951 size := s.SizeBytes() 17952 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 17953 return dst[size:] 17954 } 17955 17956 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 17957 func (s *SockAddrLink) UnmarshalUnsafe(src []byte) []byte { 17958 size := s.SizeBytes() 17959 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 17960 return src[size:] 17961 } 17962 17963 // CopyOutN implements marshal.Marshallable.CopyOutN. 17964 func (s *SockAddrLink) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17965 // Construct a slice backed by dst's underlying memory. 17966 var buf []byte 17967 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17968 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17969 hdr.Len = s.SizeBytes() 17970 hdr.Cap = s.SizeBytes() 17971 17972 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 17973 // Since we bypassed the compiler's escape analysis, indicate that s 17974 // must live until the use above. 17975 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17976 return length, err 17977 } 17978 17979 // CopyOut implements marshal.Marshallable.CopyOut. 17980 func (s *SockAddrLink) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 17981 return s.CopyOutN(cc, addr, s.SizeBytes()) 17982 } 17983 17984 // CopyInN implements marshal.Marshallable.CopyInN. 17985 func (s *SockAddrLink) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 17986 // Construct a slice backed by dst's underlying memory. 17987 var buf []byte 17988 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 17989 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 17990 hdr.Len = s.SizeBytes() 17991 hdr.Cap = s.SizeBytes() 17992 17993 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 17994 // Since we bypassed the compiler's escape analysis, indicate that s 17995 // must live until the use above. 17996 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 17997 return length, err 17998 } 17999 18000 // CopyIn implements marshal.Marshallable.CopyIn. 18001 func (s *SockAddrLink) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18002 return s.CopyInN(cc, addr, s.SizeBytes()) 18003 } 18004 18005 // WriteTo implements io.WriterTo.WriteTo. 18006 func (s *SockAddrLink) WriteTo(writer io.Writer) (int64, error) { 18007 // Construct a slice backed by dst's underlying memory. 18008 var buf []byte 18009 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18010 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 18011 hdr.Len = s.SizeBytes() 18012 hdr.Cap = s.SizeBytes() 18013 18014 length, err := writer.Write(buf) 18015 // Since we bypassed the compiler's escape analysis, indicate that s 18016 // must live until the use above. 18017 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 18018 return int64(length), err 18019 } 18020 18021 // SizeBytes implements marshal.Marshallable.SizeBytes. 18022 func (s *SockAddrUnix) SizeBytes() int { 18023 return 2 + 18024 1*UnixPathMax 18025 } 18026 18027 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18028 func (s *SockAddrUnix) MarshalBytes(dst []byte) []byte { 18029 hostarch.ByteOrder.PutUint16(dst[:2], uint16(s.Family)) 18030 dst = dst[2:] 18031 for idx := 0; idx < UnixPathMax; idx++ { 18032 dst[0] = byte(s.Path[idx]) 18033 dst = dst[1:] 18034 } 18035 return dst 18036 } 18037 18038 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18039 func (s *SockAddrUnix) UnmarshalBytes(src []byte) []byte { 18040 s.Family = uint16(hostarch.ByteOrder.Uint16(src[:2])) 18041 src = src[2:] 18042 for idx := 0; idx < UnixPathMax; idx++ { 18043 s.Path[idx] = int8(src[0]) 18044 src = src[1:] 18045 } 18046 return src 18047 } 18048 18049 // Packed implements marshal.Marshallable.Packed. 18050 //go:nosplit 18051 func (s *SockAddrUnix) Packed() bool { 18052 return true 18053 } 18054 18055 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18056 func (s *SockAddrUnix) MarshalUnsafe(dst []byte) []byte { 18057 size := s.SizeBytes() 18058 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 18059 return dst[size:] 18060 } 18061 18062 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18063 func (s *SockAddrUnix) UnmarshalUnsafe(src []byte) []byte { 18064 size := s.SizeBytes() 18065 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 18066 return src[size:] 18067 } 18068 18069 // CopyOutN implements marshal.Marshallable.CopyOutN. 18070 func (s *SockAddrUnix) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18071 // Construct a slice backed by dst's underlying memory. 18072 var buf []byte 18073 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18074 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 18075 hdr.Len = s.SizeBytes() 18076 hdr.Cap = s.SizeBytes() 18077 18078 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18079 // Since we bypassed the compiler's escape analysis, indicate that s 18080 // must live until the use above. 18081 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 18082 return length, err 18083 } 18084 18085 // CopyOut implements marshal.Marshallable.CopyOut. 18086 func (s *SockAddrUnix) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18087 return s.CopyOutN(cc, addr, s.SizeBytes()) 18088 } 18089 18090 // CopyInN implements marshal.Marshallable.CopyInN. 18091 func (s *SockAddrUnix) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18092 // Construct a slice backed by dst's underlying memory. 18093 var buf []byte 18094 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18095 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 18096 hdr.Len = s.SizeBytes() 18097 hdr.Cap = s.SizeBytes() 18098 18099 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18100 // Since we bypassed the compiler's escape analysis, indicate that s 18101 // must live until the use above. 18102 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 18103 return length, err 18104 } 18105 18106 // CopyIn implements marshal.Marshallable.CopyIn. 18107 func (s *SockAddrUnix) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18108 return s.CopyInN(cc, addr, s.SizeBytes()) 18109 } 18110 18111 // WriteTo implements io.WriterTo.WriteTo. 18112 func (s *SockAddrUnix) WriteTo(writer io.Writer) (int64, error) { 18113 // Construct a slice backed by dst's underlying memory. 18114 var buf []byte 18115 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18116 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 18117 hdr.Len = s.SizeBytes() 18118 hdr.Cap = s.SizeBytes() 18119 18120 length, err := writer.Write(buf) 18121 // Since we bypassed the compiler's escape analysis, indicate that s 18122 // must live until the use above. 18123 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 18124 return int64(length), err 18125 } 18126 18127 // SizeBytes implements marshal.Marshallable.SizeBytes. 18128 func (t *TCPInfo) SizeBytes() int { 18129 return 224 18130 } 18131 18132 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18133 func (t *TCPInfo) MarshalBytes(dst []byte) []byte { 18134 dst[0] = byte(t.State) 18135 dst = dst[1:] 18136 dst[0] = byte(t.CaState) 18137 dst = dst[1:] 18138 dst[0] = byte(t.Retransmits) 18139 dst = dst[1:] 18140 dst[0] = byte(t.Probes) 18141 dst = dst[1:] 18142 dst[0] = byte(t.Backoff) 18143 dst = dst[1:] 18144 dst[0] = byte(t.Options) 18145 dst = dst[1:] 18146 dst[0] = byte(t.WindowScale) 18147 dst = dst[1:] 18148 dst[0] = byte(t.DeliveryRateAppLimited) 18149 dst = dst[1:] 18150 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTO)) 18151 dst = dst[4:] 18152 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ATO)) 18153 dst = dst[4:] 18154 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndMss)) 18155 dst = dst[4:] 18156 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvMss)) 18157 dst = dst[4:] 18158 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Unacked)) 18159 dst = dst[4:] 18160 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Sacked)) 18161 dst = dst[4:] 18162 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Lost)) 18163 dst = dst[4:] 18164 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Retrans)) 18165 dst = dst[4:] 18166 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Fackets)) 18167 dst = dst[4:] 18168 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataSent)) 18169 dst = dst[4:] 18170 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckSent)) 18171 dst = dst[4:] 18172 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastDataRecv)) 18173 dst = dst[4:] 18174 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LastAckRecv)) 18175 dst = dst[4:] 18176 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.PMTU)) 18177 dst = dst[4:] 18178 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSsthresh)) 18179 dst = dst[4:] 18180 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTT)) 18181 dst = dst[4:] 18182 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RTTVar)) 18183 dst = dst[4:] 18184 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndSsthresh)) 18185 dst = dst[4:] 18186 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SndCwnd)) 18187 dst = dst[4:] 18188 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Advmss)) 18189 dst = dst[4:] 18190 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Reordering)) 18191 dst = dst[4:] 18192 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvRTT)) 18193 dst = dst[4:] 18194 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.RcvSpace)) 18195 dst = dst[4:] 18196 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.TotalRetrans)) 18197 dst = dst[4:] 18198 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.PacingRate)) 18199 dst = dst[8:] 18200 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.MaxPacingRate)) 18201 dst = dst[8:] 18202 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesAcked)) 18203 dst = dst[8:] 18204 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesReceived)) 18205 dst = dst[8:] 18206 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsOut)) 18207 dst = dst[4:] 18208 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.SegsIn)) 18209 dst = dst[4:] 18210 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.NotSentBytes)) 18211 dst = dst[4:] 18212 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.MinRTT)) 18213 dst = dst[4:] 18214 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsIn)) 18215 dst = dst[4:] 18216 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DataSegsOut)) 18217 dst = dst[4:] 18218 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.DeliveryRate)) 18219 dst = dst[8:] 18220 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BusyTime)) 18221 dst = dst[8:] 18222 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.RwndLimited)) 18223 dst = dst[8:] 18224 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.SndBufLimited)) 18225 dst = dst[8:] 18226 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.Delivered)) 18227 dst = dst[4:] 18228 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DeliveredCE)) 18229 dst = dst[4:] 18230 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesSent)) 18231 dst = dst[8:] 18232 hostarch.ByteOrder.PutUint64(dst[:8], uint64(t.BytesRetrans)) 18233 dst = dst[8:] 18234 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.DSACKDups)) 18235 dst = dst[4:] 18236 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ReordSeen)) 18237 dst = dst[4:] 18238 return dst 18239 } 18240 18241 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18242 func (t *TCPInfo) UnmarshalBytes(src []byte) []byte { 18243 t.State = uint8(src[0]) 18244 src = src[1:] 18245 t.CaState = uint8(src[0]) 18246 src = src[1:] 18247 t.Retransmits = uint8(src[0]) 18248 src = src[1:] 18249 t.Probes = uint8(src[0]) 18250 src = src[1:] 18251 t.Backoff = uint8(src[0]) 18252 src = src[1:] 18253 t.Options = uint8(src[0]) 18254 src = src[1:] 18255 t.WindowScale = uint8(src[0]) 18256 src = src[1:] 18257 t.DeliveryRateAppLimited = uint8(src[0]) 18258 src = src[1:] 18259 t.RTO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18260 src = src[4:] 18261 t.ATO = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18262 src = src[4:] 18263 t.SndMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18264 src = src[4:] 18265 t.RcvMss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18266 src = src[4:] 18267 t.Unacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18268 src = src[4:] 18269 t.Sacked = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18270 src = src[4:] 18271 t.Lost = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18272 src = src[4:] 18273 t.Retrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18274 src = src[4:] 18275 t.Fackets = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18276 src = src[4:] 18277 t.LastDataSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18278 src = src[4:] 18279 t.LastAckSent = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18280 src = src[4:] 18281 t.LastDataRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18282 src = src[4:] 18283 t.LastAckRecv = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18284 src = src[4:] 18285 t.PMTU = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18286 src = src[4:] 18287 t.RcvSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18288 src = src[4:] 18289 t.RTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18290 src = src[4:] 18291 t.RTTVar = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18292 src = src[4:] 18293 t.SndSsthresh = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18294 src = src[4:] 18295 t.SndCwnd = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18296 src = src[4:] 18297 t.Advmss = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18298 src = src[4:] 18299 t.Reordering = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18300 src = src[4:] 18301 t.RcvRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18302 src = src[4:] 18303 t.RcvSpace = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18304 src = src[4:] 18305 t.TotalRetrans = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18306 src = src[4:] 18307 t.PacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18308 src = src[8:] 18309 t.MaxPacingRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18310 src = src[8:] 18311 t.BytesAcked = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18312 src = src[8:] 18313 t.BytesReceived = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18314 src = src[8:] 18315 t.SegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18316 src = src[4:] 18317 t.SegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18318 src = src[4:] 18319 t.NotSentBytes = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18320 src = src[4:] 18321 t.MinRTT = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18322 src = src[4:] 18323 t.DataSegsIn = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18324 src = src[4:] 18325 t.DataSegsOut = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18326 src = src[4:] 18327 t.DeliveryRate = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18328 src = src[8:] 18329 t.BusyTime = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18330 src = src[8:] 18331 t.RwndLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18332 src = src[8:] 18333 t.SndBufLimited = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18334 src = src[8:] 18335 t.Delivered = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18336 src = src[4:] 18337 t.DeliveredCE = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18338 src = src[4:] 18339 t.BytesSent = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18340 src = src[8:] 18341 t.BytesRetrans = uint64(hostarch.ByteOrder.Uint64(src[:8])) 18342 src = src[8:] 18343 t.DSACKDups = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18344 src = src[4:] 18345 t.ReordSeen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18346 src = src[4:] 18347 return src 18348 } 18349 18350 // Packed implements marshal.Marshallable.Packed. 18351 //go:nosplit 18352 func (t *TCPInfo) Packed() bool { 18353 return true 18354 } 18355 18356 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18357 func (t *TCPInfo) MarshalUnsafe(dst []byte) []byte { 18358 size := t.SizeBytes() 18359 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18360 return dst[size:] 18361 } 18362 18363 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18364 func (t *TCPInfo) UnmarshalUnsafe(src []byte) []byte { 18365 size := t.SizeBytes() 18366 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18367 return src[size:] 18368 } 18369 18370 // CopyOutN implements marshal.Marshallable.CopyOutN. 18371 func (t *TCPInfo) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18372 // Construct a slice backed by dst's underlying memory. 18373 var buf []byte 18374 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18375 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18376 hdr.Len = t.SizeBytes() 18377 hdr.Cap = t.SizeBytes() 18378 18379 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18380 // Since we bypassed the compiler's escape analysis, indicate that t 18381 // must live until the use above. 18382 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18383 return length, err 18384 } 18385 18386 // CopyOut implements marshal.Marshallable.CopyOut. 18387 func (t *TCPInfo) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18388 return t.CopyOutN(cc, addr, t.SizeBytes()) 18389 } 18390 18391 // CopyInN implements marshal.Marshallable.CopyInN. 18392 func (t *TCPInfo) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18393 // Construct a slice backed by dst's underlying memory. 18394 var buf []byte 18395 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18396 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18397 hdr.Len = t.SizeBytes() 18398 hdr.Cap = t.SizeBytes() 18399 18400 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18401 // Since we bypassed the compiler's escape analysis, indicate that t 18402 // must live until the use above. 18403 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18404 return length, err 18405 } 18406 18407 // CopyIn implements marshal.Marshallable.CopyIn. 18408 func (t *TCPInfo) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18409 return t.CopyInN(cc, addr, t.SizeBytes()) 18410 } 18411 18412 // WriteTo implements io.WriterTo.WriteTo. 18413 func (t *TCPInfo) WriteTo(writer io.Writer) (int64, error) { 18414 // Construct a slice backed by dst's underlying memory. 18415 var buf []byte 18416 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18417 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18418 hdr.Len = t.SizeBytes() 18419 hdr.Cap = t.SizeBytes() 18420 18421 length, err := writer.Write(buf) 18422 // Since we bypassed the compiler's escape analysis, indicate that t 18423 // must live until the use above. 18424 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18425 return int64(length), err 18426 } 18427 18428 // SizeBytes implements marshal.Marshallable.SizeBytes. 18429 //go:nosplit 18430 func (c *ClockT) SizeBytes() int { 18431 return 8 18432 } 18433 18434 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18435 func (c *ClockT) MarshalBytes(dst []byte) []byte { 18436 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*c)) 18437 return dst[8:] 18438 } 18439 18440 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18441 func (c *ClockT) UnmarshalBytes(src []byte) []byte { 18442 *c = ClockT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 18443 return src[8:] 18444 } 18445 18446 // Packed implements marshal.Marshallable.Packed. 18447 //go:nosplit 18448 func (c *ClockT) Packed() bool { 18449 // Scalar newtypes are always packed. 18450 return true 18451 } 18452 18453 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18454 func (c *ClockT) MarshalUnsafe(dst []byte) []byte { 18455 size := c.SizeBytes() 18456 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 18457 return dst[size:] 18458 } 18459 18460 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18461 func (c *ClockT) UnmarshalUnsafe(src []byte) []byte { 18462 size := c.SizeBytes() 18463 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 18464 return src[size:] 18465 } 18466 18467 // CopyOutN implements marshal.Marshallable.CopyOutN. 18468 func (c *ClockT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18469 // Construct a slice backed by dst's underlying memory. 18470 var buf []byte 18471 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18472 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 18473 hdr.Len = c.SizeBytes() 18474 hdr.Cap = c.SizeBytes() 18475 18476 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18477 // Since we bypassed the compiler's escape analysis, indicate that c 18478 // must live until the use above. 18479 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 18480 return length, err 18481 } 18482 18483 // CopyOut implements marshal.Marshallable.CopyOut. 18484 func (c *ClockT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18485 return c.CopyOutN(cc, addr, c.SizeBytes()) 18486 } 18487 18488 // CopyInN implements marshal.Marshallable.CopyInN. 18489 func (c *ClockT) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18490 // Construct a slice backed by dst's underlying memory. 18491 var buf []byte 18492 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18493 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 18494 hdr.Len = c.SizeBytes() 18495 hdr.Cap = c.SizeBytes() 18496 18497 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18498 // Since we bypassed the compiler's escape analysis, indicate that c 18499 // must live until the use above. 18500 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 18501 return length, err 18502 } 18503 18504 // CopyIn implements marshal.Marshallable.CopyIn. 18505 func (c *ClockT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18506 return c.CopyInN(cc, addr, c.SizeBytes()) 18507 } 18508 18509 // WriteTo implements io.WriterTo.WriteTo. 18510 func (c *ClockT) WriteTo(writer io.Writer) (int64, error) { 18511 // Construct a slice backed by dst's underlying memory. 18512 var buf []byte 18513 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18514 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 18515 hdr.Len = c.SizeBytes() 18516 hdr.Cap = c.SizeBytes() 18517 18518 length, err := writer.Write(buf) 18519 // Since we bypassed the compiler's escape analysis, indicate that c 18520 // must live until the use above. 18521 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 18522 return int64(length), err 18523 } 18524 18525 // SizeBytes implements marshal.Marshallable.SizeBytes. 18526 func (i *ItimerVal) SizeBytes() int { 18527 return 0 + 18528 (*Timeval)(nil).SizeBytes() + 18529 (*Timeval)(nil).SizeBytes() 18530 } 18531 18532 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18533 func (i *ItimerVal) MarshalBytes(dst []byte) []byte { 18534 dst = i.Interval.MarshalUnsafe(dst) 18535 dst = i.Value.MarshalUnsafe(dst) 18536 return dst 18537 } 18538 18539 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18540 func (i *ItimerVal) UnmarshalBytes(src []byte) []byte { 18541 src = i.Interval.UnmarshalUnsafe(src) 18542 src = i.Value.UnmarshalUnsafe(src) 18543 return src 18544 } 18545 18546 // Packed implements marshal.Marshallable.Packed. 18547 //go:nosplit 18548 func (i *ItimerVal) Packed() bool { 18549 return i.Interval.Packed() && i.Value.Packed() 18550 } 18551 18552 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18553 func (i *ItimerVal) MarshalUnsafe(dst []byte) []byte { 18554 if i.Interval.Packed() && i.Value.Packed() { 18555 size := i.SizeBytes() 18556 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 18557 return dst[size:] 18558 } 18559 // Type ItimerVal doesn't have a packed layout in memory, fallback to MarshalBytes. 18560 return i.MarshalBytes(dst) 18561 } 18562 18563 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18564 func (i *ItimerVal) UnmarshalUnsafe(src []byte) []byte { 18565 if i.Interval.Packed() && i.Value.Packed() { 18566 size := i.SizeBytes() 18567 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 18568 return src[size:] 18569 } 18570 // Type ItimerVal doesn't have a packed layout in memory, fallback to UnmarshalBytes. 18571 return i.UnmarshalBytes(src) 18572 } 18573 18574 // CopyOutN implements marshal.Marshallable.CopyOutN. 18575 func (i *ItimerVal) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18576 if !i.Interval.Packed() && i.Value.Packed() { 18577 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 18578 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 18579 i.MarshalBytes(buf) // escapes: fallback. 18580 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18581 } 18582 18583 // Construct a slice backed by dst's underlying memory. 18584 var buf []byte 18585 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18586 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18587 hdr.Len = i.SizeBytes() 18588 hdr.Cap = i.SizeBytes() 18589 18590 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18591 // Since we bypassed the compiler's escape analysis, indicate that i 18592 // must live until the use above. 18593 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18594 return length, err 18595 } 18596 18597 // CopyOut implements marshal.Marshallable.CopyOut. 18598 func (i *ItimerVal) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18599 return i.CopyOutN(cc, addr, i.SizeBytes()) 18600 } 18601 18602 // CopyInN implements marshal.Marshallable.CopyInN. 18603 func (i *ItimerVal) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18604 if !i.Interval.Packed() && i.Value.Packed() { 18605 // Type ItimerVal doesn't have a packed layout in memory, fall back to UnmarshalBytes. 18606 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 18607 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18608 // Unmarshal unconditionally. If we had a short copy-in, this results in a 18609 // partially unmarshalled struct. 18610 i.UnmarshalBytes(buf) // escapes: fallback. 18611 return length, err 18612 } 18613 18614 // Construct a slice backed by dst's underlying memory. 18615 var buf []byte 18616 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18617 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18618 hdr.Len = i.SizeBytes() 18619 hdr.Cap = i.SizeBytes() 18620 18621 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18622 // Since we bypassed the compiler's escape analysis, indicate that i 18623 // must live until the use above. 18624 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18625 return length, err 18626 } 18627 18628 // CopyIn implements marshal.Marshallable.CopyIn. 18629 func (i *ItimerVal) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18630 return i.CopyInN(cc, addr, i.SizeBytes()) 18631 } 18632 18633 // WriteTo implements io.WriterTo.WriteTo. 18634 func (i *ItimerVal) WriteTo(writer io.Writer) (int64, error) { 18635 if !i.Interval.Packed() && i.Value.Packed() { 18636 // Type ItimerVal doesn't have a packed layout in memory, fall back to MarshalBytes. 18637 buf := make([]byte, i.SizeBytes()) 18638 i.MarshalBytes(buf) 18639 length, err := writer.Write(buf) 18640 return int64(length), err 18641 } 18642 18643 // Construct a slice backed by dst's underlying memory. 18644 var buf []byte 18645 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18646 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18647 hdr.Len = i.SizeBytes() 18648 hdr.Cap = i.SizeBytes() 18649 18650 length, err := writer.Write(buf) 18651 // Since we bypassed the compiler's escape analysis, indicate that i 18652 // must live until the use above. 18653 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18654 return int64(length), err 18655 } 18656 18657 // SizeBytes implements marshal.Marshallable.SizeBytes. 18658 func (i *Itimerspec) SizeBytes() int { 18659 return 0 + 18660 (*Timespec)(nil).SizeBytes() + 18661 (*Timespec)(nil).SizeBytes() 18662 } 18663 18664 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18665 func (i *Itimerspec) MarshalBytes(dst []byte) []byte { 18666 dst = i.Interval.MarshalUnsafe(dst) 18667 dst = i.Value.MarshalUnsafe(dst) 18668 return dst 18669 } 18670 18671 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18672 func (i *Itimerspec) UnmarshalBytes(src []byte) []byte { 18673 src = i.Interval.UnmarshalUnsafe(src) 18674 src = i.Value.UnmarshalUnsafe(src) 18675 return src 18676 } 18677 18678 // Packed implements marshal.Marshallable.Packed. 18679 //go:nosplit 18680 func (i *Itimerspec) Packed() bool { 18681 return i.Interval.Packed() && i.Value.Packed() 18682 } 18683 18684 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18685 func (i *Itimerspec) MarshalUnsafe(dst []byte) []byte { 18686 if i.Interval.Packed() && i.Value.Packed() { 18687 size := i.SizeBytes() 18688 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 18689 return dst[size:] 18690 } 18691 // Type Itimerspec doesn't have a packed layout in memory, fallback to MarshalBytes. 18692 return i.MarshalBytes(dst) 18693 } 18694 18695 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18696 func (i *Itimerspec) UnmarshalUnsafe(src []byte) []byte { 18697 if i.Interval.Packed() && i.Value.Packed() { 18698 size := i.SizeBytes() 18699 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 18700 return src[size:] 18701 } 18702 // Type Itimerspec doesn't have a packed layout in memory, fallback to UnmarshalBytes. 18703 return i.UnmarshalBytes(src) 18704 } 18705 18706 // CopyOutN implements marshal.Marshallable.CopyOutN. 18707 func (i *Itimerspec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18708 if !i.Interval.Packed() && i.Value.Packed() { 18709 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 18710 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 18711 i.MarshalBytes(buf) // escapes: fallback. 18712 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18713 } 18714 18715 // Construct a slice backed by dst's underlying memory. 18716 var buf []byte 18717 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18718 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18719 hdr.Len = i.SizeBytes() 18720 hdr.Cap = i.SizeBytes() 18721 18722 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18723 // Since we bypassed the compiler's escape analysis, indicate that i 18724 // must live until the use above. 18725 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18726 return length, err 18727 } 18728 18729 // CopyOut implements marshal.Marshallable.CopyOut. 18730 func (i *Itimerspec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18731 return i.CopyOutN(cc, addr, i.SizeBytes()) 18732 } 18733 18734 // CopyInN implements marshal.Marshallable.CopyInN. 18735 func (i *Itimerspec) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18736 if !i.Interval.Packed() && i.Value.Packed() { 18737 // Type Itimerspec doesn't have a packed layout in memory, fall back to UnmarshalBytes. 18738 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 18739 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18740 // Unmarshal unconditionally. If we had a short copy-in, this results in a 18741 // partially unmarshalled struct. 18742 i.UnmarshalBytes(buf) // escapes: fallback. 18743 return length, err 18744 } 18745 18746 // Construct a slice backed by dst's underlying memory. 18747 var buf []byte 18748 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18749 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18750 hdr.Len = i.SizeBytes() 18751 hdr.Cap = i.SizeBytes() 18752 18753 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18754 // Since we bypassed the compiler's escape analysis, indicate that i 18755 // must live until the use above. 18756 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18757 return length, err 18758 } 18759 18760 // CopyIn implements marshal.Marshallable.CopyIn. 18761 func (i *Itimerspec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18762 return i.CopyInN(cc, addr, i.SizeBytes()) 18763 } 18764 18765 // WriteTo implements io.WriterTo.WriteTo. 18766 func (i *Itimerspec) WriteTo(writer io.Writer) (int64, error) { 18767 if !i.Interval.Packed() && i.Value.Packed() { 18768 // Type Itimerspec doesn't have a packed layout in memory, fall back to MarshalBytes. 18769 buf := make([]byte, i.SizeBytes()) 18770 i.MarshalBytes(buf) 18771 length, err := writer.Write(buf) 18772 return int64(length), err 18773 } 18774 18775 // Construct a slice backed by dst's underlying memory. 18776 var buf []byte 18777 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18778 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 18779 hdr.Len = i.SizeBytes() 18780 hdr.Cap = i.SizeBytes() 18781 18782 length, err := writer.Write(buf) 18783 // Since we bypassed the compiler's escape analysis, indicate that i 18784 // must live until the use above. 18785 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 18786 return int64(length), err 18787 } 18788 18789 // SizeBytes implements marshal.Marshallable.SizeBytes. 18790 func (sxts *StatxTimestamp) SizeBytes() int { 18791 return 16 18792 } 18793 18794 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18795 func (sxts *StatxTimestamp) MarshalBytes(dst []byte) []byte { 18796 hostarch.ByteOrder.PutUint64(dst[:8], uint64(sxts.Sec)) 18797 dst = dst[8:] 18798 hostarch.ByteOrder.PutUint32(dst[:4], uint32(sxts.Nsec)) 18799 dst = dst[4:] 18800 // Padding: dst[:sizeof(int32)] ~= int32(0) 18801 dst = dst[4:] 18802 return dst 18803 } 18804 18805 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18806 func (sxts *StatxTimestamp) UnmarshalBytes(src []byte) []byte { 18807 sxts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 18808 src = src[8:] 18809 sxts.Nsec = uint32(hostarch.ByteOrder.Uint32(src[:4])) 18810 src = src[4:] 18811 // Padding: var _ int32 ~= src[:sizeof(int32)] 18812 src = src[4:] 18813 return src 18814 } 18815 18816 // Packed implements marshal.Marshallable.Packed. 18817 //go:nosplit 18818 func (sxts *StatxTimestamp) Packed() bool { 18819 return true 18820 } 18821 18822 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18823 func (sxts *StatxTimestamp) MarshalUnsafe(dst []byte) []byte { 18824 size := sxts.SizeBytes() 18825 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(sxts), uintptr(size)) 18826 return dst[size:] 18827 } 18828 18829 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18830 func (sxts *StatxTimestamp) UnmarshalUnsafe(src []byte) []byte { 18831 size := sxts.SizeBytes() 18832 gohacks.Memmove(unsafe.Pointer(sxts), unsafe.Pointer(&src[0]), uintptr(size)) 18833 return src[size:] 18834 } 18835 18836 // CopyOutN implements marshal.Marshallable.CopyOutN. 18837 func (sxts *StatxTimestamp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18838 // Construct a slice backed by dst's underlying memory. 18839 var buf []byte 18840 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18841 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 18842 hdr.Len = sxts.SizeBytes() 18843 hdr.Cap = sxts.SizeBytes() 18844 18845 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18846 // Since we bypassed the compiler's escape analysis, indicate that sxts 18847 // must live until the use above. 18848 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 18849 return length, err 18850 } 18851 18852 // CopyOut implements marshal.Marshallable.CopyOut. 18853 func (sxts *StatxTimestamp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18854 return sxts.CopyOutN(cc, addr, sxts.SizeBytes()) 18855 } 18856 18857 // CopyInN implements marshal.Marshallable.CopyInN. 18858 func (sxts *StatxTimestamp) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18859 // Construct a slice backed by dst's underlying memory. 18860 var buf []byte 18861 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18862 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 18863 hdr.Len = sxts.SizeBytes() 18864 hdr.Cap = sxts.SizeBytes() 18865 18866 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18867 // Since we bypassed the compiler's escape analysis, indicate that sxts 18868 // must live until the use above. 18869 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 18870 return length, err 18871 } 18872 18873 // CopyIn implements marshal.Marshallable.CopyIn. 18874 func (sxts *StatxTimestamp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18875 return sxts.CopyInN(cc, addr, sxts.SizeBytes()) 18876 } 18877 18878 // WriteTo implements io.WriterTo.WriteTo. 18879 func (sxts *StatxTimestamp) WriteTo(writer io.Writer) (int64, error) { 18880 // Construct a slice backed by dst's underlying memory. 18881 var buf []byte 18882 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18883 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(sxts))) 18884 hdr.Len = sxts.SizeBytes() 18885 hdr.Cap = sxts.SizeBytes() 18886 18887 length, err := writer.Write(buf) 18888 // Since we bypassed the compiler's escape analysis, indicate that sxts 18889 // must live until the use above. 18890 runtime.KeepAlive(sxts) // escapes: replaced by intrinsic. 18891 return int64(length), err 18892 } 18893 18894 // SizeBytes implements marshal.Marshallable.SizeBytes. 18895 //go:nosplit 18896 func (t *TimeT) SizeBytes() int { 18897 return 8 18898 } 18899 18900 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18901 func (t *TimeT) MarshalBytes(dst []byte) []byte { 18902 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*t)) 18903 return dst[8:] 18904 } 18905 18906 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 18907 func (t *TimeT) UnmarshalBytes(src []byte) []byte { 18908 *t = TimeT(int64(hostarch.ByteOrder.Uint64(src[:8]))) 18909 return src[8:] 18910 } 18911 18912 // Packed implements marshal.Marshallable.Packed. 18913 //go:nosplit 18914 func (t *TimeT) Packed() bool { 18915 // Scalar newtypes are always packed. 18916 return true 18917 } 18918 18919 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 18920 func (t *TimeT) MarshalUnsafe(dst []byte) []byte { 18921 size := t.SizeBytes() 18922 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 18923 return dst[size:] 18924 } 18925 18926 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 18927 func (t *TimeT) UnmarshalUnsafe(src []byte) []byte { 18928 size := t.SizeBytes() 18929 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 18930 return src[size:] 18931 } 18932 18933 // CopyOutN implements marshal.Marshallable.CopyOutN. 18934 func (t *TimeT) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18935 // Construct a slice backed by dst's underlying memory. 18936 var buf []byte 18937 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18938 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18939 hdr.Len = t.SizeBytes() 18940 hdr.Cap = t.SizeBytes() 18941 18942 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 18943 // Since we bypassed the compiler's escape analysis, indicate that t 18944 // must live until the use above. 18945 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18946 return length, err 18947 } 18948 18949 // CopyOut implements marshal.Marshallable.CopyOut. 18950 func (t *TimeT) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18951 return t.CopyOutN(cc, addr, t.SizeBytes()) 18952 } 18953 18954 // CopyInN implements marshal.Marshallable.CopyInN. 18955 func (t *TimeT) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 18956 // Construct a slice backed by dst's underlying memory. 18957 var buf []byte 18958 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18959 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18960 hdr.Len = t.SizeBytes() 18961 hdr.Cap = t.SizeBytes() 18962 18963 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 18964 // Since we bypassed the compiler's escape analysis, indicate that t 18965 // must live until the use above. 18966 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18967 return length, err 18968 } 18969 18970 // CopyIn implements marshal.Marshallable.CopyIn. 18971 func (t *TimeT) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 18972 return t.CopyInN(cc, addr, t.SizeBytes()) 18973 } 18974 18975 // WriteTo implements io.WriterTo.WriteTo. 18976 func (t *TimeT) WriteTo(writer io.Writer) (int64, error) { 18977 // Construct a slice backed by dst's underlying memory. 18978 var buf []byte 18979 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 18980 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 18981 hdr.Len = t.SizeBytes() 18982 hdr.Cap = t.SizeBytes() 18983 18984 length, err := writer.Write(buf) 18985 // Since we bypassed the compiler's escape analysis, indicate that t 18986 // must live until the use above. 18987 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 18988 return int64(length), err 18989 } 18990 18991 // SizeBytes implements marshal.Marshallable.SizeBytes. 18992 //go:nosplit 18993 func (t *TimerID) SizeBytes() int { 18994 return 4 18995 } 18996 18997 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 18998 func (t *TimerID) MarshalBytes(dst []byte) []byte { 18999 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*t)) 19000 return dst[4:] 19001 } 19002 19003 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19004 func (t *TimerID) UnmarshalBytes(src []byte) []byte { 19005 *t = TimerID(int32(hostarch.ByteOrder.Uint32(src[:4]))) 19006 return src[4:] 19007 } 19008 19009 // Packed implements marshal.Marshallable.Packed. 19010 //go:nosplit 19011 func (t *TimerID) Packed() bool { 19012 // Scalar newtypes are always packed. 19013 return true 19014 } 19015 19016 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19017 func (t *TimerID) MarshalUnsafe(dst []byte) []byte { 19018 size := t.SizeBytes() 19019 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 19020 return dst[size:] 19021 } 19022 19023 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19024 func (t *TimerID) UnmarshalUnsafe(src []byte) []byte { 19025 size := t.SizeBytes() 19026 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 19027 return src[size:] 19028 } 19029 19030 // CopyOutN implements marshal.Marshallable.CopyOutN. 19031 func (t *TimerID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19032 // Construct a slice backed by dst's underlying memory. 19033 var buf []byte 19034 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19035 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19036 hdr.Len = t.SizeBytes() 19037 hdr.Cap = t.SizeBytes() 19038 19039 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19040 // Since we bypassed the compiler's escape analysis, indicate that t 19041 // must live until the use above. 19042 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19043 return length, err 19044 } 19045 19046 // CopyOut implements marshal.Marshallable.CopyOut. 19047 func (t *TimerID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19048 return t.CopyOutN(cc, addr, t.SizeBytes()) 19049 } 19050 19051 // CopyInN implements marshal.Marshallable.CopyInN. 19052 func (t *TimerID) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19053 // Construct a slice backed by dst's underlying memory. 19054 var buf []byte 19055 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19056 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19057 hdr.Len = t.SizeBytes() 19058 hdr.Cap = t.SizeBytes() 19059 19060 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19061 // Since we bypassed the compiler's escape analysis, indicate that t 19062 // must live until the use above. 19063 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19064 return length, err 19065 } 19066 19067 // CopyIn implements marshal.Marshallable.CopyIn. 19068 func (t *TimerID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19069 return t.CopyInN(cc, addr, t.SizeBytes()) 19070 } 19071 19072 // WriteTo implements io.WriterTo.WriteTo. 19073 func (t *TimerID) WriteTo(writer io.Writer) (int64, error) { 19074 // Construct a slice backed by dst's underlying memory. 19075 var buf []byte 19076 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19077 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19078 hdr.Len = t.SizeBytes() 19079 hdr.Cap = t.SizeBytes() 19080 19081 length, err := writer.Write(buf) 19082 // Since we bypassed the compiler's escape analysis, indicate that t 19083 // must live until the use above. 19084 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19085 return int64(length), err 19086 } 19087 19088 // SizeBytes implements marshal.Marshallable.SizeBytes. 19089 func (ts *Timespec) SizeBytes() int { 19090 return 16 19091 } 19092 19093 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19094 func (ts *Timespec) MarshalBytes(dst []byte) []byte { 19095 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Sec)) 19096 dst = dst[8:] 19097 hostarch.ByteOrder.PutUint64(dst[:8], uint64(ts.Nsec)) 19098 dst = dst[8:] 19099 return dst 19100 } 19101 19102 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19103 func (ts *Timespec) UnmarshalBytes(src []byte) []byte { 19104 ts.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 19105 src = src[8:] 19106 ts.Nsec = int64(hostarch.ByteOrder.Uint64(src[:8])) 19107 src = src[8:] 19108 return src 19109 } 19110 19111 // Packed implements marshal.Marshallable.Packed. 19112 //go:nosplit 19113 func (ts *Timespec) Packed() bool { 19114 return true 19115 } 19116 19117 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19118 func (ts *Timespec) MarshalUnsafe(dst []byte) []byte { 19119 size := ts.SizeBytes() 19120 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(ts), uintptr(size)) 19121 return dst[size:] 19122 } 19123 19124 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19125 func (ts *Timespec) UnmarshalUnsafe(src []byte) []byte { 19126 size := ts.SizeBytes() 19127 gohacks.Memmove(unsafe.Pointer(ts), unsafe.Pointer(&src[0]), uintptr(size)) 19128 return src[size:] 19129 } 19130 19131 // CopyOutN implements marshal.Marshallable.CopyOutN. 19132 func (ts *Timespec) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19133 // Construct a slice backed by dst's underlying memory. 19134 var buf []byte 19135 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19136 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 19137 hdr.Len = ts.SizeBytes() 19138 hdr.Cap = ts.SizeBytes() 19139 19140 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19141 // Since we bypassed the compiler's escape analysis, indicate that ts 19142 // must live until the use above. 19143 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 19144 return length, err 19145 } 19146 19147 // CopyOut implements marshal.Marshallable.CopyOut. 19148 func (ts *Timespec) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19149 return ts.CopyOutN(cc, addr, ts.SizeBytes()) 19150 } 19151 19152 // CopyInN implements marshal.Marshallable.CopyInN. 19153 func (ts *Timespec) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19154 // Construct a slice backed by dst's underlying memory. 19155 var buf []byte 19156 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19157 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 19158 hdr.Len = ts.SizeBytes() 19159 hdr.Cap = ts.SizeBytes() 19160 19161 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19162 // Since we bypassed the compiler's escape analysis, indicate that ts 19163 // must live until the use above. 19164 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 19165 return length, err 19166 } 19167 19168 // CopyIn implements marshal.Marshallable.CopyIn. 19169 func (ts *Timespec) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19170 return ts.CopyInN(cc, addr, ts.SizeBytes()) 19171 } 19172 19173 // WriteTo implements io.WriterTo.WriteTo. 19174 func (ts *Timespec) WriteTo(writer io.Writer) (int64, error) { 19175 // Construct a slice backed by dst's underlying memory. 19176 var buf []byte 19177 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19178 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(ts))) 19179 hdr.Len = ts.SizeBytes() 19180 hdr.Cap = ts.SizeBytes() 19181 19182 length, err := writer.Write(buf) 19183 // Since we bypassed the compiler's escape analysis, indicate that ts 19184 // must live until the use above. 19185 runtime.KeepAlive(ts) // escapes: replaced by intrinsic. 19186 return int64(length), err 19187 } 19188 19189 // CopyTimespecSliceIn copies in a slice of Timespec objects from the task's memory. 19190 func CopyTimespecSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timespec) (int, error) { 19191 count := len(dst) 19192 if count == 0 { 19193 return 0, nil 19194 } 19195 size := (*Timespec)(nil).SizeBytes() 19196 19197 ptr := unsafe.Pointer(&dst) 19198 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 19199 19200 // Construct a slice backed by dst's underlying memory. 19201 var buf []byte 19202 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19203 hdr.Data = uintptr(val) 19204 hdr.Len = size * count 19205 hdr.Cap = size * count 19206 19207 length, err := cc.CopyInBytes(addr, buf) 19208 // Since we bypassed the compiler's escape analysis, indicate that dst 19209 // must live until the use above. 19210 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 19211 return length, err 19212 } 19213 19214 // CopyTimespecSliceOut copies a slice of Timespec objects to the task's memory. 19215 func CopyTimespecSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timespec) (int, error) { 19216 count := len(src) 19217 if count == 0 { 19218 return 0, nil 19219 } 19220 size := (*Timespec)(nil).SizeBytes() 19221 19222 ptr := unsafe.Pointer(&src) 19223 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 19224 19225 // Construct a slice backed by dst's underlying memory. 19226 var buf []byte 19227 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19228 hdr.Data = uintptr(val) 19229 hdr.Len = size * count 19230 hdr.Cap = size * count 19231 19232 length, err := cc.CopyOutBytes(addr, buf) 19233 // Since we bypassed the compiler's escape analysis, indicate that src 19234 // must live until the use above. 19235 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 19236 return length, err 19237 } 19238 19239 // MarshalUnsafeTimespecSlice is like Timespec.MarshalUnsafe, but for a []Timespec. 19240 func MarshalUnsafeTimespecSlice(src []Timespec, dst []byte) []byte { 19241 count := len(src) 19242 if count == 0 { 19243 return dst 19244 } 19245 19246 size := (*Timespec)(nil).SizeBytes() 19247 buf := dst[:size*count] 19248 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 19249 return dst[size*count:] 19250 } 19251 19252 // UnmarshalUnsafeTimespecSlice is like Timespec.UnmarshalUnsafe, but for a []Timespec. 19253 func UnmarshalUnsafeTimespecSlice(dst []Timespec, src []byte) []byte { 19254 count := len(dst) 19255 if count == 0 { 19256 return src 19257 } 19258 19259 size := (*Timespec)(nil).SizeBytes() 19260 buf := src[:size*count] 19261 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 19262 return src[size*count:] 19263 } 19264 19265 // SizeBytes implements marshal.Marshallable.SizeBytes. 19266 func (tv *Timeval) SizeBytes() int { 19267 return 16 19268 } 19269 19270 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19271 func (tv *Timeval) MarshalBytes(dst []byte) []byte { 19272 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Sec)) 19273 dst = dst[8:] 19274 hostarch.ByteOrder.PutUint64(dst[:8], uint64(tv.Usec)) 19275 dst = dst[8:] 19276 return dst 19277 } 19278 19279 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19280 func (tv *Timeval) UnmarshalBytes(src []byte) []byte { 19281 tv.Sec = int64(hostarch.ByteOrder.Uint64(src[:8])) 19282 src = src[8:] 19283 tv.Usec = int64(hostarch.ByteOrder.Uint64(src[:8])) 19284 src = src[8:] 19285 return src 19286 } 19287 19288 // Packed implements marshal.Marshallable.Packed. 19289 //go:nosplit 19290 func (tv *Timeval) Packed() bool { 19291 return true 19292 } 19293 19294 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19295 func (tv *Timeval) MarshalUnsafe(dst []byte) []byte { 19296 size := tv.SizeBytes() 19297 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(tv), uintptr(size)) 19298 return dst[size:] 19299 } 19300 19301 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19302 func (tv *Timeval) UnmarshalUnsafe(src []byte) []byte { 19303 size := tv.SizeBytes() 19304 gohacks.Memmove(unsafe.Pointer(tv), unsafe.Pointer(&src[0]), uintptr(size)) 19305 return src[size:] 19306 } 19307 19308 // CopyOutN implements marshal.Marshallable.CopyOutN. 19309 func (tv *Timeval) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19310 // Construct a slice backed by dst's underlying memory. 19311 var buf []byte 19312 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19313 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 19314 hdr.Len = tv.SizeBytes() 19315 hdr.Cap = tv.SizeBytes() 19316 19317 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19318 // Since we bypassed the compiler's escape analysis, indicate that tv 19319 // must live until the use above. 19320 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 19321 return length, err 19322 } 19323 19324 // CopyOut implements marshal.Marshallable.CopyOut. 19325 func (tv *Timeval) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19326 return tv.CopyOutN(cc, addr, tv.SizeBytes()) 19327 } 19328 19329 // CopyInN implements marshal.Marshallable.CopyInN. 19330 func (tv *Timeval) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19331 // Construct a slice backed by dst's underlying memory. 19332 var buf []byte 19333 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19334 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 19335 hdr.Len = tv.SizeBytes() 19336 hdr.Cap = tv.SizeBytes() 19337 19338 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19339 // Since we bypassed the compiler's escape analysis, indicate that tv 19340 // must live until the use above. 19341 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 19342 return length, err 19343 } 19344 19345 // CopyIn implements marshal.Marshallable.CopyIn. 19346 func (tv *Timeval) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19347 return tv.CopyInN(cc, addr, tv.SizeBytes()) 19348 } 19349 19350 // WriteTo implements io.WriterTo.WriteTo. 19351 func (tv *Timeval) WriteTo(writer io.Writer) (int64, error) { 19352 // Construct a slice backed by dst's underlying memory. 19353 var buf []byte 19354 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19355 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(tv))) 19356 hdr.Len = tv.SizeBytes() 19357 hdr.Cap = tv.SizeBytes() 19358 19359 length, err := writer.Write(buf) 19360 // Since we bypassed the compiler's escape analysis, indicate that tv 19361 // must live until the use above. 19362 runtime.KeepAlive(tv) // escapes: replaced by intrinsic. 19363 return int64(length), err 19364 } 19365 19366 // CopyTimevalSliceIn copies in a slice of Timeval objects from the task's memory. 19367 func CopyTimevalSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Timeval) (int, error) { 19368 count := len(dst) 19369 if count == 0 { 19370 return 0, nil 19371 } 19372 size := (*Timeval)(nil).SizeBytes() 19373 19374 ptr := unsafe.Pointer(&dst) 19375 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 19376 19377 // Construct a slice backed by dst's underlying memory. 19378 var buf []byte 19379 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19380 hdr.Data = uintptr(val) 19381 hdr.Len = size * count 19382 hdr.Cap = size * count 19383 19384 length, err := cc.CopyInBytes(addr, buf) 19385 // Since we bypassed the compiler's escape analysis, indicate that dst 19386 // must live until the use above. 19387 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 19388 return length, err 19389 } 19390 19391 // CopyTimevalSliceOut copies a slice of Timeval objects to the task's memory. 19392 func CopyTimevalSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Timeval) (int, error) { 19393 count := len(src) 19394 if count == 0 { 19395 return 0, nil 19396 } 19397 size := (*Timeval)(nil).SizeBytes() 19398 19399 ptr := unsafe.Pointer(&src) 19400 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 19401 19402 // Construct a slice backed by dst's underlying memory. 19403 var buf []byte 19404 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19405 hdr.Data = uintptr(val) 19406 hdr.Len = size * count 19407 hdr.Cap = size * count 19408 19409 length, err := cc.CopyOutBytes(addr, buf) 19410 // Since we bypassed the compiler's escape analysis, indicate that src 19411 // must live until the use above. 19412 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 19413 return length, err 19414 } 19415 19416 // MarshalUnsafeTimevalSlice is like Timeval.MarshalUnsafe, but for a []Timeval. 19417 func MarshalUnsafeTimevalSlice(src []Timeval, dst []byte) []byte { 19418 count := len(src) 19419 if count == 0 { 19420 return dst 19421 } 19422 19423 size := (*Timeval)(nil).SizeBytes() 19424 buf := dst[:size*count] 19425 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 19426 return dst[size*count:] 19427 } 19428 19429 // UnmarshalUnsafeTimevalSlice is like Timeval.UnmarshalUnsafe, but for a []Timeval. 19430 func UnmarshalUnsafeTimevalSlice(dst []Timeval, src []byte) []byte { 19431 count := len(dst) 19432 if count == 0 { 19433 return src 19434 } 19435 19436 size := (*Timeval)(nil).SizeBytes() 19437 buf := src[:size*count] 19438 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 19439 return src[size*count:] 19440 } 19441 19442 // SizeBytes implements marshal.Marshallable.SizeBytes. 19443 func (t *Tms) SizeBytes() int { 19444 return 0 + 19445 (*ClockT)(nil).SizeBytes() + 19446 (*ClockT)(nil).SizeBytes() + 19447 (*ClockT)(nil).SizeBytes() + 19448 (*ClockT)(nil).SizeBytes() 19449 } 19450 19451 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19452 func (t *Tms) MarshalBytes(dst []byte) []byte { 19453 dst = t.UTime.MarshalUnsafe(dst) 19454 dst = t.STime.MarshalUnsafe(dst) 19455 dst = t.CUTime.MarshalUnsafe(dst) 19456 dst = t.CSTime.MarshalUnsafe(dst) 19457 return dst 19458 } 19459 19460 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19461 func (t *Tms) UnmarshalBytes(src []byte) []byte { 19462 src = t.UTime.UnmarshalUnsafe(src) 19463 src = t.STime.UnmarshalUnsafe(src) 19464 src = t.CUTime.UnmarshalUnsafe(src) 19465 src = t.CSTime.UnmarshalUnsafe(src) 19466 return src 19467 } 19468 19469 // Packed implements marshal.Marshallable.Packed. 19470 //go:nosplit 19471 func (t *Tms) Packed() bool { 19472 return t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() 19473 } 19474 19475 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19476 func (t *Tms) MarshalUnsafe(dst []byte) []byte { 19477 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 19478 size := t.SizeBytes() 19479 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 19480 return dst[size:] 19481 } 19482 // Type Tms doesn't have a packed layout in memory, fallback to MarshalBytes. 19483 return t.MarshalBytes(dst) 19484 } 19485 19486 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19487 func (t *Tms) UnmarshalUnsafe(src []byte) []byte { 19488 if t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 19489 size := t.SizeBytes() 19490 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 19491 return src[size:] 19492 } 19493 // Type Tms doesn't have a packed layout in memory, fallback to UnmarshalBytes. 19494 return t.UnmarshalBytes(src) 19495 } 19496 19497 // CopyOutN implements marshal.Marshallable.CopyOutN. 19498 func (t *Tms) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19499 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 19500 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 19501 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 19502 t.MarshalBytes(buf) // escapes: fallback. 19503 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19504 } 19505 19506 // Construct a slice backed by dst's underlying memory. 19507 var buf []byte 19508 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19509 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19510 hdr.Len = t.SizeBytes() 19511 hdr.Cap = t.SizeBytes() 19512 19513 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19514 // Since we bypassed the compiler's escape analysis, indicate that t 19515 // must live until the use above. 19516 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19517 return length, err 19518 } 19519 19520 // CopyOut implements marshal.Marshallable.CopyOut. 19521 func (t *Tms) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19522 return t.CopyOutN(cc, addr, t.SizeBytes()) 19523 } 19524 19525 // CopyInN implements marshal.Marshallable.CopyInN. 19526 func (t *Tms) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19527 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 19528 // Type Tms doesn't have a packed layout in memory, fall back to UnmarshalBytes. 19529 buf := cc.CopyScratchBuffer(t.SizeBytes()) // escapes: okay. 19530 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19531 // Unmarshal unconditionally. If we had a short copy-in, this results in a 19532 // partially unmarshalled struct. 19533 t.UnmarshalBytes(buf) // escapes: fallback. 19534 return length, err 19535 } 19536 19537 // Construct a slice backed by dst's underlying memory. 19538 var buf []byte 19539 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19540 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19541 hdr.Len = t.SizeBytes() 19542 hdr.Cap = t.SizeBytes() 19543 19544 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19545 // Since we bypassed the compiler's escape analysis, indicate that t 19546 // must live until the use above. 19547 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19548 return length, err 19549 } 19550 19551 // CopyIn implements marshal.Marshallable.CopyIn. 19552 func (t *Tms) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19553 return t.CopyInN(cc, addr, t.SizeBytes()) 19554 } 19555 19556 // WriteTo implements io.WriterTo.WriteTo. 19557 func (t *Tms) WriteTo(writer io.Writer) (int64, error) { 19558 if !t.CSTime.Packed() && t.CUTime.Packed() && t.STime.Packed() && t.UTime.Packed() { 19559 // Type Tms doesn't have a packed layout in memory, fall back to MarshalBytes. 19560 buf := make([]byte, t.SizeBytes()) 19561 t.MarshalBytes(buf) 19562 length, err := writer.Write(buf) 19563 return int64(length), err 19564 } 19565 19566 // Construct a slice backed by dst's underlying memory. 19567 var buf []byte 19568 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19569 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19570 hdr.Len = t.SizeBytes() 19571 hdr.Cap = t.SizeBytes() 19572 19573 length, err := writer.Write(buf) 19574 // Since we bypassed the compiler's escape analysis, indicate that t 19575 // must live until the use above. 19576 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19577 return int64(length), err 19578 } 19579 19580 // SizeBytes implements marshal.Marshallable.SizeBytes. 19581 func (u *Utime) SizeBytes() int { 19582 return 16 19583 } 19584 19585 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19586 func (u *Utime) MarshalBytes(dst []byte) []byte { 19587 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Actime)) 19588 dst = dst[8:] 19589 hostarch.ByteOrder.PutUint64(dst[:8], uint64(u.Modtime)) 19590 dst = dst[8:] 19591 return dst 19592 } 19593 19594 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19595 func (u *Utime) UnmarshalBytes(src []byte) []byte { 19596 u.Actime = int64(hostarch.ByteOrder.Uint64(src[:8])) 19597 src = src[8:] 19598 u.Modtime = int64(hostarch.ByteOrder.Uint64(src[:8])) 19599 src = src[8:] 19600 return src 19601 } 19602 19603 // Packed implements marshal.Marshallable.Packed. 19604 //go:nosplit 19605 func (u *Utime) Packed() bool { 19606 return true 19607 } 19608 19609 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19610 func (u *Utime) MarshalUnsafe(dst []byte) []byte { 19611 size := u.SizeBytes() 19612 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 19613 return dst[size:] 19614 } 19615 19616 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19617 func (u *Utime) UnmarshalUnsafe(src []byte) []byte { 19618 size := u.SizeBytes() 19619 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 19620 return src[size:] 19621 } 19622 19623 // CopyOutN implements marshal.Marshallable.CopyOutN. 19624 func (u *Utime) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19625 // Construct a slice backed by dst's underlying memory. 19626 var buf []byte 19627 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19628 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19629 hdr.Len = u.SizeBytes() 19630 hdr.Cap = u.SizeBytes() 19631 19632 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19633 // Since we bypassed the compiler's escape analysis, indicate that u 19634 // must live until the use above. 19635 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19636 return length, err 19637 } 19638 19639 // CopyOut implements marshal.Marshallable.CopyOut. 19640 func (u *Utime) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19641 return u.CopyOutN(cc, addr, u.SizeBytes()) 19642 } 19643 19644 // CopyInN implements marshal.Marshallable.CopyInN. 19645 func (u *Utime) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19646 // Construct a slice backed by dst's underlying memory. 19647 var buf []byte 19648 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19649 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19650 hdr.Len = u.SizeBytes() 19651 hdr.Cap = u.SizeBytes() 19652 19653 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19654 // Since we bypassed the compiler's escape analysis, indicate that u 19655 // must live until the use above. 19656 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19657 return length, err 19658 } 19659 19660 // CopyIn implements marshal.Marshallable.CopyIn. 19661 func (u *Utime) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19662 return u.CopyInN(cc, addr, u.SizeBytes()) 19663 } 19664 19665 // WriteTo implements io.WriterTo.WriteTo. 19666 func (u *Utime) WriteTo(writer io.Writer) (int64, error) { 19667 // Construct a slice backed by dst's underlying memory. 19668 var buf []byte 19669 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19670 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 19671 hdr.Len = u.SizeBytes() 19672 hdr.Cap = u.SizeBytes() 19673 19674 length, err := writer.Write(buf) 19675 // Since we bypassed the compiler's escape analysis, indicate that u 19676 // must live until the use above. 19677 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 19678 return int64(length), err 19679 } 19680 19681 // SizeBytes implements marshal.Marshallable.SizeBytes. 19682 func (t *Termios) SizeBytes() int { 19683 return 17 + 19684 1*NumControlCharacters 19685 } 19686 19687 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19688 func (t *Termios) MarshalBytes(dst []byte) []byte { 19689 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.InputFlags)) 19690 dst = dst[4:] 19691 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.OutputFlags)) 19692 dst = dst[4:] 19693 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.ControlFlags)) 19694 dst = dst[4:] 19695 hostarch.ByteOrder.PutUint32(dst[:4], uint32(t.LocalFlags)) 19696 dst = dst[4:] 19697 dst[0] = byte(t.LineDiscipline) 19698 dst = dst[1:] 19699 for idx := 0; idx < NumControlCharacters; idx++ { 19700 dst[0] = byte(t.ControlCharacters[idx]) 19701 dst = dst[1:] 19702 } 19703 return dst 19704 } 19705 19706 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19707 func (t *Termios) UnmarshalBytes(src []byte) []byte { 19708 t.InputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19709 src = src[4:] 19710 t.OutputFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19711 src = src[4:] 19712 t.ControlFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19713 src = src[4:] 19714 t.LocalFlags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 19715 src = src[4:] 19716 t.LineDiscipline = uint8(src[0]) 19717 src = src[1:] 19718 for idx := 0; idx < NumControlCharacters; idx++ { 19719 t.ControlCharacters[idx] = uint8(src[0]) 19720 src = src[1:] 19721 } 19722 return src 19723 } 19724 19725 // Packed implements marshal.Marshallable.Packed. 19726 //go:nosplit 19727 func (t *Termios) Packed() bool { 19728 return true 19729 } 19730 19731 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19732 func (t *Termios) MarshalUnsafe(dst []byte) []byte { 19733 size := t.SizeBytes() 19734 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(t), uintptr(size)) 19735 return dst[size:] 19736 } 19737 19738 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19739 func (t *Termios) UnmarshalUnsafe(src []byte) []byte { 19740 size := t.SizeBytes() 19741 gohacks.Memmove(unsafe.Pointer(t), unsafe.Pointer(&src[0]), uintptr(size)) 19742 return src[size:] 19743 } 19744 19745 // CopyOutN implements marshal.Marshallable.CopyOutN. 19746 func (t *Termios) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19747 // Construct a slice backed by dst's underlying memory. 19748 var buf []byte 19749 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19750 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19751 hdr.Len = t.SizeBytes() 19752 hdr.Cap = t.SizeBytes() 19753 19754 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19755 // Since we bypassed the compiler's escape analysis, indicate that t 19756 // must live until the use above. 19757 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19758 return length, err 19759 } 19760 19761 // CopyOut implements marshal.Marshallable.CopyOut. 19762 func (t *Termios) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19763 return t.CopyOutN(cc, addr, t.SizeBytes()) 19764 } 19765 19766 // CopyInN implements marshal.Marshallable.CopyInN. 19767 func (t *Termios) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19768 // Construct a slice backed by dst's underlying memory. 19769 var buf []byte 19770 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19771 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19772 hdr.Len = t.SizeBytes() 19773 hdr.Cap = t.SizeBytes() 19774 19775 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19776 // Since we bypassed the compiler's escape analysis, indicate that t 19777 // must live until the use above. 19778 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19779 return length, err 19780 } 19781 19782 // CopyIn implements marshal.Marshallable.CopyIn. 19783 func (t *Termios) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19784 return t.CopyInN(cc, addr, t.SizeBytes()) 19785 } 19786 19787 // WriteTo implements io.WriterTo.WriteTo. 19788 func (t *Termios) WriteTo(writer io.Writer) (int64, error) { 19789 // Construct a slice backed by dst's underlying memory. 19790 var buf []byte 19791 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19792 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(t))) 19793 hdr.Len = t.SizeBytes() 19794 hdr.Cap = t.SizeBytes() 19795 19796 length, err := writer.Write(buf) 19797 // Since we bypassed the compiler's escape analysis, indicate that t 19798 // must live until the use above. 19799 runtime.KeepAlive(t) // escapes: replaced by intrinsic. 19800 return int64(length), err 19801 } 19802 19803 // SizeBytes implements marshal.Marshallable.SizeBytes. 19804 func (w *WindowSize) SizeBytes() int { 19805 return 4 + 19806 1*4 19807 } 19808 19809 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19810 func (w *WindowSize) MarshalBytes(dst []byte) []byte { 19811 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Rows)) 19812 dst = dst[2:] 19813 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Cols)) 19814 dst = dst[2:] 19815 // Padding: dst[:sizeof(byte)*4] ~= [4]byte{0} 19816 dst = dst[1*(4):] 19817 return dst 19818 } 19819 19820 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19821 func (w *WindowSize) UnmarshalBytes(src []byte) []byte { 19822 w.Rows = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19823 src = src[2:] 19824 w.Cols = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19825 src = src[2:] 19826 // Padding: ~ copy([4]byte(w._), src[:sizeof(byte)*4]) 19827 src = src[1*(4):] 19828 return src 19829 } 19830 19831 // Packed implements marshal.Marshallable.Packed. 19832 //go:nosplit 19833 func (w *WindowSize) Packed() bool { 19834 return true 19835 } 19836 19837 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19838 func (w *WindowSize) MarshalUnsafe(dst []byte) []byte { 19839 size := w.SizeBytes() 19840 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 19841 return dst[size:] 19842 } 19843 19844 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19845 func (w *WindowSize) UnmarshalUnsafe(src []byte) []byte { 19846 size := w.SizeBytes() 19847 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 19848 return src[size:] 19849 } 19850 19851 // CopyOutN implements marshal.Marshallable.CopyOutN. 19852 func (w *WindowSize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19853 // Construct a slice backed by dst's underlying memory. 19854 var buf []byte 19855 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19856 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19857 hdr.Len = w.SizeBytes() 19858 hdr.Cap = w.SizeBytes() 19859 19860 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19861 // Since we bypassed the compiler's escape analysis, indicate that w 19862 // must live until the use above. 19863 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19864 return length, err 19865 } 19866 19867 // CopyOut implements marshal.Marshallable.CopyOut. 19868 func (w *WindowSize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19869 return w.CopyOutN(cc, addr, w.SizeBytes()) 19870 } 19871 19872 // CopyInN implements marshal.Marshallable.CopyInN. 19873 func (w *WindowSize) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19874 // Construct a slice backed by dst's underlying memory. 19875 var buf []byte 19876 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19877 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19878 hdr.Len = w.SizeBytes() 19879 hdr.Cap = w.SizeBytes() 19880 19881 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19882 // Since we bypassed the compiler's escape analysis, indicate that w 19883 // must live until the use above. 19884 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19885 return length, err 19886 } 19887 19888 // CopyIn implements marshal.Marshallable.CopyIn. 19889 func (w *WindowSize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19890 return w.CopyInN(cc, addr, w.SizeBytes()) 19891 } 19892 19893 // WriteTo implements io.WriterTo.WriteTo. 19894 func (w *WindowSize) WriteTo(writer io.Writer) (int64, error) { 19895 // Construct a slice backed by dst's underlying memory. 19896 var buf []byte 19897 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19898 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19899 hdr.Len = w.SizeBytes() 19900 hdr.Cap = w.SizeBytes() 19901 19902 length, err := writer.Write(buf) 19903 // Since we bypassed the compiler's escape analysis, indicate that w 19904 // must live until the use above. 19905 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19906 return int64(length), err 19907 } 19908 19909 // SizeBytes implements marshal.Marshallable.SizeBytes. 19910 func (w *Winsize) SizeBytes() int { 19911 return 8 19912 } 19913 19914 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 19915 func (w *Winsize) MarshalBytes(dst []byte) []byte { 19916 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Row)) 19917 dst = dst[2:] 19918 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Col)) 19919 dst = dst[2:] 19920 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Xpixel)) 19921 dst = dst[2:] 19922 hostarch.ByteOrder.PutUint16(dst[:2], uint16(w.Ypixel)) 19923 dst = dst[2:] 19924 return dst 19925 } 19926 19927 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 19928 func (w *Winsize) UnmarshalBytes(src []byte) []byte { 19929 w.Row = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19930 src = src[2:] 19931 w.Col = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19932 src = src[2:] 19933 w.Xpixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19934 src = src[2:] 19935 w.Ypixel = uint16(hostarch.ByteOrder.Uint16(src[:2])) 19936 src = src[2:] 19937 return src 19938 } 19939 19940 // Packed implements marshal.Marshallable.Packed. 19941 //go:nosplit 19942 func (w *Winsize) Packed() bool { 19943 return true 19944 } 19945 19946 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 19947 func (w *Winsize) MarshalUnsafe(dst []byte) []byte { 19948 size := w.SizeBytes() 19949 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 19950 return dst[size:] 19951 } 19952 19953 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 19954 func (w *Winsize) UnmarshalUnsafe(src []byte) []byte { 19955 size := w.SizeBytes() 19956 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 19957 return src[size:] 19958 } 19959 19960 // CopyOutN implements marshal.Marshallable.CopyOutN. 19961 func (w *Winsize) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19962 // Construct a slice backed by dst's underlying memory. 19963 var buf []byte 19964 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19965 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19966 hdr.Len = w.SizeBytes() 19967 hdr.Cap = w.SizeBytes() 19968 19969 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 19970 // Since we bypassed the compiler's escape analysis, indicate that w 19971 // must live until the use above. 19972 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19973 return length, err 19974 } 19975 19976 // CopyOut implements marshal.Marshallable.CopyOut. 19977 func (w *Winsize) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19978 return w.CopyOutN(cc, addr, w.SizeBytes()) 19979 } 19980 19981 // CopyInN implements marshal.Marshallable.CopyInN. 19982 func (w *Winsize) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 19983 // Construct a slice backed by dst's underlying memory. 19984 var buf []byte 19985 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 19986 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 19987 hdr.Len = w.SizeBytes() 19988 hdr.Cap = w.SizeBytes() 19989 19990 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 19991 // Since we bypassed the compiler's escape analysis, indicate that w 19992 // must live until the use above. 19993 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 19994 return length, err 19995 } 19996 19997 // CopyIn implements marshal.Marshallable.CopyIn. 19998 func (w *Winsize) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 19999 return w.CopyInN(cc, addr, w.SizeBytes()) 20000 } 20001 20002 // WriteTo implements io.WriterTo.WriteTo. 20003 func (w *Winsize) WriteTo(writer io.Writer) (int64, error) { 20004 // Construct a slice backed by dst's underlying memory. 20005 var buf []byte 20006 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 20007 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 20008 hdr.Len = w.SizeBytes() 20009 hdr.Cap = w.SizeBytes() 20010 20011 length, err := writer.Write(buf) 20012 // Since we bypassed the compiler's escape analysis, indicate that w 20013 // must live until the use above. 20014 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 20015 return int64(length), err 20016 } 20017 20018 // SizeBytes implements marshal.Marshallable.SizeBytes. 20019 func (u *UtsName) SizeBytes() int { 20020 return 0 + 20021 1*(UTSLen+1) + 20022 1*(UTSLen+1) + 20023 1*(UTSLen+1) + 20024 1*(UTSLen+1) + 20025 1*(UTSLen+1) + 20026 1*(UTSLen+1) 20027 } 20028 20029 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 20030 func (u *UtsName) MarshalBytes(dst []byte) []byte { 20031 for idx := 0; idx < (UTSLen+1); idx++ { 20032 dst[0] = byte(u.Sysname[idx]) 20033 dst = dst[1:] 20034 } 20035 for idx := 0; idx < (UTSLen+1); idx++ { 20036 dst[0] = byte(u.Nodename[idx]) 20037 dst = dst[1:] 20038 } 20039 for idx := 0; idx < (UTSLen+1); idx++ { 20040 dst[0] = byte(u.Release[idx]) 20041 dst = dst[1:] 20042 } 20043 for idx := 0; idx < (UTSLen+1); idx++ { 20044 dst[0] = byte(u.Version[idx]) 20045 dst = dst[1:] 20046 } 20047 for idx := 0; idx < (UTSLen+1); idx++ { 20048 dst[0] = byte(u.Machine[idx]) 20049 dst = dst[1:] 20050 } 20051 for idx := 0; idx < (UTSLen+1); idx++ { 20052 dst[0] = byte(u.Domainname[idx]) 20053 dst = dst[1:] 20054 } 20055 return dst 20056 } 20057 20058 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 20059 func (u *UtsName) UnmarshalBytes(src []byte) []byte { 20060 for idx := 0; idx < (UTSLen+1); idx++ { 20061 u.Sysname[idx] = src[0] 20062 src = src[1:] 20063 } 20064 for idx := 0; idx < (UTSLen+1); idx++ { 20065 u.Nodename[idx] = src[0] 20066 src = src[1:] 20067 } 20068 for idx := 0; idx < (UTSLen+1); idx++ { 20069 u.Release[idx] = src[0] 20070 src = src[1:] 20071 } 20072 for idx := 0; idx < (UTSLen+1); idx++ { 20073 u.Version[idx] = src[0] 20074 src = src[1:] 20075 } 20076 for idx := 0; idx < (UTSLen+1); idx++ { 20077 u.Machine[idx] = src[0] 20078 src = src[1:] 20079 } 20080 for idx := 0; idx < (UTSLen+1); idx++ { 20081 u.Domainname[idx] = src[0] 20082 src = src[1:] 20083 } 20084 return src 20085 } 20086 20087 // Packed implements marshal.Marshallable.Packed. 20088 //go:nosplit 20089 func (u *UtsName) Packed() bool { 20090 return true 20091 } 20092 20093 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 20094 func (u *UtsName) MarshalUnsafe(dst []byte) []byte { 20095 size := u.SizeBytes() 20096 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size)) 20097 return dst[size:] 20098 } 20099 20100 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 20101 func (u *UtsName) UnmarshalUnsafe(src []byte) []byte { 20102 size := u.SizeBytes() 20103 gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size)) 20104 return src[size:] 20105 } 20106 20107 // CopyOutN implements marshal.Marshallable.CopyOutN. 20108 func (u *UtsName) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 20109 // Construct a slice backed by dst's underlying memory. 20110 var buf []byte 20111 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 20112 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 20113 hdr.Len = u.SizeBytes() 20114 hdr.Cap = u.SizeBytes() 20115 20116 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 20117 // Since we bypassed the compiler's escape analysis, indicate that u 20118 // must live until the use above. 20119 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 20120 return length, err 20121 } 20122 20123 // CopyOut implements marshal.Marshallable.CopyOut. 20124 func (u *UtsName) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 20125 return u.CopyOutN(cc, addr, u.SizeBytes()) 20126 } 20127 20128 // CopyInN implements marshal.Marshallable.CopyInN. 20129 func (u *UtsName) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 20130 // Construct a slice backed by dst's underlying memory. 20131 var buf []byte 20132 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 20133 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 20134 hdr.Len = u.SizeBytes() 20135 hdr.Cap = u.SizeBytes() 20136 20137 length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay. 20138 // Since we bypassed the compiler's escape analysis, indicate that u 20139 // must live until the use above. 20140 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 20141 return length, err 20142 } 20143 20144 // CopyIn implements marshal.Marshallable.CopyIn. 20145 func (u *UtsName) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 20146 return u.CopyInN(cc, addr, u.SizeBytes()) 20147 } 20148 20149 // WriteTo implements io.WriterTo.WriteTo. 20150 func (u *UtsName) WriteTo(writer io.Writer) (int64, error) { 20151 // Construct a slice backed by dst's underlying memory. 20152 var buf []byte 20153 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 20154 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u))) 20155 hdr.Len = u.SizeBytes() 20156 hdr.Cap = u.SizeBytes() 20157 20158 length, err := writer.Write(buf) 20159 // Since we bypassed the compiler's escape analysis, indicate that u 20160 // must live until the use above. 20161 runtime.KeepAlive(u) // escapes: replaced by intrinsic. 20162 return int64(length), err 20163 } 20164