github.com/nicocha30/gvisor-ligolo@v0.0.0-20230726075806-989fa2c0a413/pkg/lisafs/lisafs_abi_autogen_unsafe.go (about) 1 // Automatically generated marshal implementation. See tools/go_marshal. 2 3 package lisafs 4 5 import ( 6 "github.com/nicocha30/gvisor-ligolo/pkg/abi/linux" 7 "github.com/nicocha30/gvisor-ligolo/pkg/gohacks" 8 "github.com/nicocha30/gvisor-ligolo/pkg/hostarch" 9 "github.com/nicocha30/gvisor-ligolo/pkg/marshal" 10 "io" 11 "reflect" 12 "runtime" 13 "unsafe" 14 ) 15 16 // Marshallable types used by this file. 17 var _ marshal.Marshallable = (*AcceptReq)(nil) 18 var _ marshal.Marshallable = (*BindAtResp)(nil) 19 var _ marshal.Marshallable = (*ChannelResp)(nil) 20 var _ marshal.Marshallable = (*ConnectReq)(nil) 21 var _ marshal.Marshallable = (*ErrorResp)(nil) 22 var _ marshal.Marshallable = (*FAllocateReq)(nil) 23 var _ marshal.Marshallable = (*FDID)(nil) 24 var _ marshal.Marshallable = (*FListXattrReq)(nil) 25 var _ marshal.Marshallable = (*FStatFSReq)(nil) 26 var _ marshal.Marshallable = (*FlushReq)(nil) 27 var _ marshal.Marshallable = (*GID)(nil) 28 var _ marshal.Marshallable = (*Getdents64Req)(nil) 29 var _ marshal.Marshallable = (*Inode)(nil) 30 var _ marshal.Marshallable = (*LinkAtResp)(nil) 31 var _ marshal.Marshallable = (*ListenReq)(nil) 32 var _ marshal.Marshallable = (*MID)(nil) 33 var _ marshal.Marshallable = (*MkdirAtResp)(nil) 34 var _ marshal.Marshallable = (*MknodAtResp)(nil) 35 var _ marshal.Marshallable = (*MsgDynamic)(nil) 36 var _ marshal.Marshallable = (*MsgSimple)(nil) 37 var _ marshal.Marshallable = (*OpenAtReq)(nil) 38 var _ marshal.Marshallable = (*OpenAtResp)(nil) 39 var _ marshal.Marshallable = (*OpenCreateAtResp)(nil) 40 var _ marshal.Marshallable = (*PReadReq)(nil) 41 var _ marshal.Marshallable = (*PWriteResp)(nil) 42 var _ marshal.Marshallable = (*ReadLinkAtReq)(nil) 43 var _ marshal.Marshallable = (*SetStatReq)(nil) 44 var _ marshal.Marshallable = (*SetStatResp)(nil) 45 var _ marshal.Marshallable = (*StatFS)(nil) 46 var _ marshal.Marshallable = (*StatReq)(nil) 47 var _ marshal.Marshallable = (*SymlinkAtResp)(nil) 48 var _ marshal.Marshallable = (*UID)(nil) 49 var _ marshal.Marshallable = (*channelHeader)(nil) 50 var _ marshal.Marshallable = (*createCommon)(nil) 51 var _ marshal.Marshallable = (*linux.FileMode)(nil) 52 var _ marshal.Marshallable = (*linux.Statx)(nil) 53 var _ marshal.Marshallable = (*linux.Timespec)(nil) 54 var _ marshal.Marshallable = (*sockHeader)(nil) 55 56 // SizeBytes implements marshal.Marshallable.SizeBytes. 57 func (c *channelHeader) SizeBytes() int { 58 return 2 + 59 (*MID)(nil).SizeBytes() 60 } 61 62 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 63 func (c *channelHeader) MarshalBytes(dst []byte) []byte { 64 dst = c.message.MarshalUnsafe(dst) 65 dst[0] = byte(c.numFDs) 66 dst = dst[1:] 67 // Padding: dst[:sizeof(uint8)] ~= uint8(0) 68 dst = dst[1:] 69 return dst 70 } 71 72 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 73 func (c *channelHeader) UnmarshalBytes(src []byte) []byte { 74 src = c.message.UnmarshalUnsafe(src) 75 c.numFDs = uint8(src[0]) 76 src = src[1:] 77 // Padding: var _ uint8 ~= src[:sizeof(uint8)] 78 src = src[1:] 79 return src 80 } 81 82 // Packed implements marshal.Marshallable.Packed. 83 //go:nosplit 84 func (c *channelHeader) Packed() bool { 85 return c.message.Packed() 86 } 87 88 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 89 func (c *channelHeader) MarshalUnsafe(dst []byte) []byte { 90 if c.message.Packed() { 91 size := c.SizeBytes() 92 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 93 return dst[size:] 94 } 95 // Type channelHeader doesn't have a packed layout in memory, fallback to MarshalBytes. 96 return c.MarshalBytes(dst) 97 } 98 99 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 100 func (c *channelHeader) UnmarshalUnsafe(src []byte) []byte { 101 if c.message.Packed() { 102 size := c.SizeBytes() 103 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 104 return src[size:] 105 } 106 // Type channelHeader doesn't have a packed layout in memory, fallback to UnmarshalBytes. 107 return c.UnmarshalBytes(src) 108 } 109 110 // CopyOutN implements marshal.Marshallable.CopyOutN. 111 func (c *channelHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 112 if !c.message.Packed() { 113 // Type channelHeader doesn't have a packed layout in memory, fall back to MarshalBytes. 114 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 115 c.MarshalBytes(buf) // escapes: fallback. 116 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 117 } 118 119 // Construct a slice backed by dst's underlying memory. 120 var buf []byte 121 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 122 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 123 hdr.Len = c.SizeBytes() 124 hdr.Cap = c.SizeBytes() 125 126 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 127 // Since we bypassed the compiler's escape analysis, indicate that c 128 // must live until the use above. 129 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 130 return length, err 131 } 132 133 // CopyOut implements marshal.Marshallable.CopyOut. 134 func (c *channelHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 135 return c.CopyOutN(cc, addr, c.SizeBytes()) 136 } 137 138 // CopyIn implements marshal.Marshallable.CopyIn. 139 func (c *channelHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 140 if !c.message.Packed() { 141 // Type channelHeader doesn't have a packed layout in memory, fall back to UnmarshalBytes. 142 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 143 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 144 // Unmarshal unconditionally. If we had a short copy-in, this results in a 145 // partially unmarshalled struct. 146 c.UnmarshalBytes(buf) // escapes: fallback. 147 return length, err 148 } 149 150 // Construct a slice backed by dst's underlying memory. 151 var buf []byte 152 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 153 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 154 hdr.Len = c.SizeBytes() 155 hdr.Cap = c.SizeBytes() 156 157 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 158 // Since we bypassed the compiler's escape analysis, indicate that c 159 // must live until the use above. 160 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 161 return length, err 162 } 163 164 // WriteTo implements io.WriterTo.WriteTo. 165 func (c *channelHeader) WriteTo(writer io.Writer) (int64, error) { 166 if !c.message.Packed() { 167 // Type channelHeader doesn't have a packed layout in memory, fall back to MarshalBytes. 168 buf := make([]byte, c.SizeBytes()) 169 c.MarshalBytes(buf) 170 length, err := writer.Write(buf) 171 return int64(length), err 172 } 173 174 // Construct a slice backed by dst's underlying memory. 175 var buf []byte 176 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 177 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 178 hdr.Len = c.SizeBytes() 179 hdr.Cap = c.SizeBytes() 180 181 length, err := writer.Write(buf) 182 // Since we bypassed the compiler's escape analysis, indicate that c 183 // must live until the use above. 184 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 185 return int64(length), err 186 } 187 188 // SizeBytes implements marshal.Marshallable.SizeBytes. 189 //go:nosplit 190 func (f *FDID) SizeBytes() int { 191 return 8 192 } 193 194 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 195 func (f *FDID) MarshalBytes(dst []byte) []byte { 196 hostarch.ByteOrder.PutUint64(dst[:8], uint64(*f)) 197 return dst[8:] 198 } 199 200 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 201 func (f *FDID) UnmarshalBytes(src []byte) []byte { 202 *f = FDID(uint64(hostarch.ByteOrder.Uint64(src[:8]))) 203 return src[8:] 204 } 205 206 // Packed implements marshal.Marshallable.Packed. 207 //go:nosplit 208 func (f *FDID) Packed() bool { 209 // Scalar newtypes are always packed. 210 return true 211 } 212 213 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 214 func (f *FDID) MarshalUnsafe(dst []byte) []byte { 215 size := f.SizeBytes() 216 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 217 return dst[size:] 218 } 219 220 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 221 func (f *FDID) UnmarshalUnsafe(src []byte) []byte { 222 size := f.SizeBytes() 223 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 224 return src[size:] 225 } 226 227 // CopyOutN implements marshal.Marshallable.CopyOutN. 228 func (f *FDID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 229 // Construct a slice backed by dst's underlying memory. 230 var buf []byte 231 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 232 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 233 hdr.Len = f.SizeBytes() 234 hdr.Cap = f.SizeBytes() 235 236 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 237 // Since we bypassed the compiler's escape analysis, indicate that f 238 // must live until the use above. 239 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 240 return length, err 241 } 242 243 // CopyOut implements marshal.Marshallable.CopyOut. 244 func (f *FDID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 245 return f.CopyOutN(cc, addr, f.SizeBytes()) 246 } 247 248 // CopyIn implements marshal.Marshallable.CopyIn. 249 func (f *FDID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 250 // Construct a slice backed by dst's underlying memory. 251 var buf []byte 252 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 253 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 254 hdr.Len = f.SizeBytes() 255 hdr.Cap = f.SizeBytes() 256 257 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 258 // Since we bypassed the compiler's escape analysis, indicate that f 259 // must live until the use above. 260 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 261 return length, err 262 } 263 264 // WriteTo implements io.WriterTo.WriteTo. 265 func (f *FDID) WriteTo(writer io.Writer) (int64, error) { 266 // Construct a slice backed by dst's underlying memory. 267 var buf []byte 268 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 269 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 270 hdr.Len = f.SizeBytes() 271 hdr.Cap = f.SizeBytes() 272 273 length, err := writer.Write(buf) 274 // Since we bypassed the compiler's escape analysis, indicate that f 275 // must live until the use above. 276 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 277 return int64(length), err 278 } 279 280 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 281 func (f *FDID) CheckedMarshal(dst []byte) ([]byte, bool) { 282 size := f.SizeBytes() 283 if size > len(dst) { 284 return dst, false 285 } 286 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 287 return dst[size:], true 288 } 289 290 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 291 func (f *FDID) CheckedUnmarshal(src []byte) ([]byte, bool) { 292 size := f.SizeBytes() 293 if size > len(src) { 294 return src, false 295 } 296 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 297 return src[size:], true 298 } 299 300 // CopyFDIDSliceIn copies in a slice of FDID objects from the task's memory. 301 func CopyFDIDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []FDID) (int, error) { 302 count := len(dst) 303 if count == 0 { 304 return 0, nil 305 } 306 size := (*FDID)(nil).SizeBytes() 307 308 ptr := unsafe.Pointer(&dst) 309 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 310 311 // Construct a slice backed by dst's underlying memory. 312 var buf []byte 313 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 314 hdr.Data = uintptr(val) 315 hdr.Len = size * count 316 hdr.Cap = size * count 317 318 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 319 // Since we bypassed the compiler's escape analysis, indicate that dst 320 // must live until the use above. 321 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 322 return length, err 323 } 324 325 // CopyFDIDSliceOut copies a slice of FDID objects to the task's memory. 326 func CopyFDIDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []FDID) (int, error) { 327 count := len(src) 328 if count == 0 { 329 return 0, nil 330 } 331 size := (*FDID)(nil).SizeBytes() 332 333 ptr := unsafe.Pointer(&src) 334 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 335 336 // Construct a slice backed by dst's underlying memory. 337 var buf []byte 338 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 339 hdr.Data = uintptr(val) 340 hdr.Len = size * count 341 hdr.Cap = size * count 342 343 length, err := cc.CopyOutBytes(addr, buf) // escapes: okay. 344 // Since we bypassed the compiler's escape analysis, indicate that src 345 // must live until the use above. 346 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 347 return length, err 348 } 349 350 // MarshalUnsafeFDIDSlice is like FDID.MarshalUnsafe, but for a []FDID. 351 func MarshalUnsafeFDIDSlice(src []FDID, dst []byte) []byte { 352 count := len(src) 353 if count == 0 { 354 return dst 355 } 356 size := (*FDID)(nil).SizeBytes() 357 358 buf := dst[:size*count] 359 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 360 return dst[size*count:] 361 } 362 363 // UnmarshalUnsafeFDIDSlice is like FDID.UnmarshalUnsafe, but for a []FDID. 364 func UnmarshalUnsafeFDIDSlice(dst []FDID, src []byte) []byte { 365 count := len(dst) 366 if count == 0 { 367 return src 368 } 369 size := (*FDID)(nil).SizeBytes() 370 371 buf := src[:size*count] 372 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 373 return src[size*count:] 374 } 375 376 // SizeBytes implements marshal.Marshallable.SizeBytes. 377 func (a *AcceptReq) SizeBytes() int { 378 return 0 + 379 (*FDID)(nil).SizeBytes() 380 } 381 382 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 383 func (a *AcceptReq) MarshalBytes(dst []byte) []byte { 384 dst = a.FD.MarshalUnsafe(dst) 385 return dst 386 } 387 388 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 389 func (a *AcceptReq) UnmarshalBytes(src []byte) []byte { 390 src = a.FD.UnmarshalUnsafe(src) 391 return src 392 } 393 394 // Packed implements marshal.Marshallable.Packed. 395 //go:nosplit 396 func (a *AcceptReq) Packed() bool { 397 return a.FD.Packed() 398 } 399 400 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 401 func (a *AcceptReq) MarshalUnsafe(dst []byte) []byte { 402 if a.FD.Packed() { 403 size := a.SizeBytes() 404 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size)) 405 return dst[size:] 406 } 407 // Type AcceptReq doesn't have a packed layout in memory, fallback to MarshalBytes. 408 return a.MarshalBytes(dst) 409 } 410 411 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 412 func (a *AcceptReq) UnmarshalUnsafe(src []byte) []byte { 413 if a.FD.Packed() { 414 size := a.SizeBytes() 415 gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size)) 416 return src[size:] 417 } 418 // Type AcceptReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 419 return a.UnmarshalBytes(src) 420 } 421 422 // CopyOutN implements marshal.Marshallable.CopyOutN. 423 func (a *AcceptReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 424 if !a.FD.Packed() { 425 // Type AcceptReq doesn't have a packed layout in memory, fall back to MarshalBytes. 426 buf := cc.CopyScratchBuffer(a.SizeBytes()) // escapes: okay. 427 a.MarshalBytes(buf) // escapes: fallback. 428 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 429 } 430 431 // Construct a slice backed by dst's underlying memory. 432 var buf []byte 433 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 434 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 435 hdr.Len = a.SizeBytes() 436 hdr.Cap = a.SizeBytes() 437 438 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 439 // Since we bypassed the compiler's escape analysis, indicate that a 440 // must live until the use above. 441 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 442 return length, err 443 } 444 445 // CopyOut implements marshal.Marshallable.CopyOut. 446 func (a *AcceptReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 447 return a.CopyOutN(cc, addr, a.SizeBytes()) 448 } 449 450 // CopyIn implements marshal.Marshallable.CopyIn. 451 func (a *AcceptReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 452 if !a.FD.Packed() { 453 // Type AcceptReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 454 buf := cc.CopyScratchBuffer(a.SizeBytes()) // escapes: okay. 455 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 456 // Unmarshal unconditionally. If we had a short copy-in, this results in a 457 // partially unmarshalled struct. 458 a.UnmarshalBytes(buf) // escapes: fallback. 459 return length, err 460 } 461 462 // Construct a slice backed by dst's underlying memory. 463 var buf []byte 464 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 465 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 466 hdr.Len = a.SizeBytes() 467 hdr.Cap = a.SizeBytes() 468 469 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 470 // Since we bypassed the compiler's escape analysis, indicate that a 471 // must live until the use above. 472 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 473 return length, err 474 } 475 476 // WriteTo implements io.WriterTo.WriteTo. 477 func (a *AcceptReq) WriteTo(writer io.Writer) (int64, error) { 478 if !a.FD.Packed() { 479 // Type AcceptReq doesn't have a packed layout in memory, fall back to MarshalBytes. 480 buf := make([]byte, a.SizeBytes()) 481 a.MarshalBytes(buf) 482 length, err := writer.Write(buf) 483 return int64(length), err 484 } 485 486 // Construct a slice backed by dst's underlying memory. 487 var buf []byte 488 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 489 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 490 hdr.Len = a.SizeBytes() 491 hdr.Cap = a.SizeBytes() 492 493 length, err := writer.Write(buf) 494 // Since we bypassed the compiler's escape analysis, indicate that a 495 // must live until the use above. 496 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 497 return int64(length), err 498 } 499 500 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 501 func (a *AcceptReq) CheckedMarshal(dst []byte) ([]byte, bool) { 502 if a.SizeBytes() > len(dst) { 503 return dst, false 504 } 505 return a.MarshalUnsafe(dst), true 506 } 507 508 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 509 func (a *AcceptReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 510 if a.SizeBytes() > len(src) { 511 return src, false 512 } 513 return a.UnmarshalUnsafe(src), true 514 } 515 516 // SizeBytes implements marshal.Marshallable.SizeBytes. 517 func (b *BindAtResp) SizeBytes() int { 518 return 0 + 519 (*Inode)(nil).SizeBytes() + 520 (*FDID)(nil).SizeBytes() 521 } 522 523 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 524 func (b *BindAtResp) MarshalBytes(dst []byte) []byte { 525 dst = b.Child.MarshalUnsafe(dst) 526 dst = b.BoundSocketFD.MarshalUnsafe(dst) 527 return dst 528 } 529 530 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 531 func (b *BindAtResp) UnmarshalBytes(src []byte) []byte { 532 src = b.Child.UnmarshalUnsafe(src) 533 src = b.BoundSocketFD.UnmarshalUnsafe(src) 534 return src 535 } 536 537 // Packed implements marshal.Marshallable.Packed. 538 //go:nosplit 539 func (b *BindAtResp) Packed() bool { 540 return b.BoundSocketFD.Packed() && b.Child.Packed() 541 } 542 543 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 544 func (b *BindAtResp) MarshalUnsafe(dst []byte) []byte { 545 if b.BoundSocketFD.Packed() && b.Child.Packed() { 546 size := b.SizeBytes() 547 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(b), uintptr(size)) 548 return dst[size:] 549 } 550 // Type BindAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 551 return b.MarshalBytes(dst) 552 } 553 554 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 555 func (b *BindAtResp) UnmarshalUnsafe(src []byte) []byte { 556 if b.BoundSocketFD.Packed() && b.Child.Packed() { 557 size := b.SizeBytes() 558 gohacks.Memmove(unsafe.Pointer(b), unsafe.Pointer(&src[0]), uintptr(size)) 559 return src[size:] 560 } 561 // Type BindAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 562 return b.UnmarshalBytes(src) 563 } 564 565 // CopyOutN implements marshal.Marshallable.CopyOutN. 566 func (b *BindAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 567 if !b.BoundSocketFD.Packed() && b.Child.Packed() { 568 // Type BindAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 569 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 570 b.MarshalBytes(buf) // escapes: fallback. 571 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 572 } 573 574 // Construct a slice backed by dst's underlying memory. 575 var buf []byte 576 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 577 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 578 hdr.Len = b.SizeBytes() 579 hdr.Cap = b.SizeBytes() 580 581 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 582 // Since we bypassed the compiler's escape analysis, indicate that b 583 // must live until the use above. 584 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 585 return length, err 586 } 587 588 // CopyOut implements marshal.Marshallable.CopyOut. 589 func (b *BindAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 590 return b.CopyOutN(cc, addr, b.SizeBytes()) 591 } 592 593 // CopyIn implements marshal.Marshallable.CopyIn. 594 func (b *BindAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 595 if !b.BoundSocketFD.Packed() && b.Child.Packed() { 596 // Type BindAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 597 buf := cc.CopyScratchBuffer(b.SizeBytes()) // escapes: okay. 598 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 599 // Unmarshal unconditionally. If we had a short copy-in, this results in a 600 // partially unmarshalled struct. 601 b.UnmarshalBytes(buf) // escapes: fallback. 602 return length, err 603 } 604 605 // Construct a slice backed by dst's underlying memory. 606 var buf []byte 607 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 608 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 609 hdr.Len = b.SizeBytes() 610 hdr.Cap = b.SizeBytes() 611 612 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 613 // Since we bypassed the compiler's escape analysis, indicate that b 614 // must live until the use above. 615 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 616 return length, err 617 } 618 619 // WriteTo implements io.WriterTo.WriteTo. 620 func (b *BindAtResp) WriteTo(writer io.Writer) (int64, error) { 621 if !b.BoundSocketFD.Packed() && b.Child.Packed() { 622 // Type BindAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 623 buf := make([]byte, b.SizeBytes()) 624 b.MarshalBytes(buf) 625 length, err := writer.Write(buf) 626 return int64(length), err 627 } 628 629 // Construct a slice backed by dst's underlying memory. 630 var buf []byte 631 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 632 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(b))) 633 hdr.Len = b.SizeBytes() 634 hdr.Cap = b.SizeBytes() 635 636 length, err := writer.Write(buf) 637 // Since we bypassed the compiler's escape analysis, indicate that b 638 // must live until the use above. 639 runtime.KeepAlive(b) // escapes: replaced by intrinsic. 640 return int64(length), err 641 } 642 643 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 644 func (b *BindAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 645 if b.SizeBytes() > len(dst) { 646 return dst, false 647 } 648 return b.MarshalUnsafe(dst), true 649 } 650 651 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 652 func (b *BindAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 653 if b.SizeBytes() > len(src) { 654 return src, false 655 } 656 return b.UnmarshalUnsafe(src), true 657 } 658 659 // SizeBytes implements marshal.Marshallable.SizeBytes. 660 func (c *ChannelResp) SizeBytes() int { 661 return 16 662 } 663 664 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 665 func (c *ChannelResp) MarshalBytes(dst []byte) []byte { 666 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.dataOffset)) 667 dst = dst[8:] 668 hostarch.ByteOrder.PutUint64(dst[:8], uint64(c.dataLength)) 669 dst = dst[8:] 670 return dst 671 } 672 673 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 674 func (c *ChannelResp) UnmarshalBytes(src []byte) []byte { 675 c.dataOffset = int64(hostarch.ByteOrder.Uint64(src[:8])) 676 src = src[8:] 677 c.dataLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 678 src = src[8:] 679 return src 680 } 681 682 // Packed implements marshal.Marshallable.Packed. 683 //go:nosplit 684 func (c *ChannelResp) Packed() bool { 685 return true 686 } 687 688 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 689 func (c *ChannelResp) MarshalUnsafe(dst []byte) []byte { 690 size := c.SizeBytes() 691 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 692 return dst[size:] 693 } 694 695 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 696 func (c *ChannelResp) UnmarshalUnsafe(src []byte) []byte { 697 size := c.SizeBytes() 698 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 699 return src[size:] 700 } 701 702 // CopyOutN implements marshal.Marshallable.CopyOutN. 703 func (c *ChannelResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 704 // Construct a slice backed by dst's underlying memory. 705 var buf []byte 706 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 707 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 708 hdr.Len = c.SizeBytes() 709 hdr.Cap = c.SizeBytes() 710 711 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 712 // Since we bypassed the compiler's escape analysis, indicate that c 713 // must live until the use above. 714 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 715 return length, err 716 } 717 718 // CopyOut implements marshal.Marshallable.CopyOut. 719 func (c *ChannelResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 720 return c.CopyOutN(cc, addr, c.SizeBytes()) 721 } 722 723 // CopyIn implements marshal.Marshallable.CopyIn. 724 func (c *ChannelResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 725 // Construct a slice backed by dst's underlying memory. 726 var buf []byte 727 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 728 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 729 hdr.Len = c.SizeBytes() 730 hdr.Cap = c.SizeBytes() 731 732 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 733 // Since we bypassed the compiler's escape analysis, indicate that c 734 // must live until the use above. 735 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 736 return length, err 737 } 738 739 // WriteTo implements io.WriterTo.WriteTo. 740 func (c *ChannelResp) WriteTo(writer io.Writer) (int64, error) { 741 // Construct a slice backed by dst's underlying memory. 742 var buf []byte 743 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 744 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 745 hdr.Len = c.SizeBytes() 746 hdr.Cap = c.SizeBytes() 747 748 length, err := writer.Write(buf) 749 // Since we bypassed the compiler's escape analysis, indicate that c 750 // must live until the use above. 751 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 752 return int64(length), err 753 } 754 755 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 756 func (c *ChannelResp) CheckedMarshal(dst []byte) ([]byte, bool) { 757 if c.SizeBytes() > len(dst) { 758 return dst, false 759 } 760 return c.MarshalUnsafe(dst), true 761 } 762 763 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 764 func (c *ChannelResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 765 if c.SizeBytes() > len(src) { 766 return src, false 767 } 768 return c.UnmarshalUnsafe(src), true 769 } 770 771 // SizeBytes implements marshal.Marshallable.SizeBytes. 772 func (c *ConnectReq) SizeBytes() int { 773 return 8 + 774 (*FDID)(nil).SizeBytes() 775 } 776 777 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 778 func (c *ConnectReq) MarshalBytes(dst []byte) []byte { 779 dst = c.FD.MarshalUnsafe(dst) 780 hostarch.ByteOrder.PutUint32(dst[:4], uint32(c.SockType)) 781 dst = dst[4:] 782 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 783 dst = dst[4:] 784 return dst 785 } 786 787 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 788 func (c *ConnectReq) UnmarshalBytes(src []byte) []byte { 789 src = c.FD.UnmarshalUnsafe(src) 790 c.SockType = uint32(hostarch.ByteOrder.Uint32(src[:4])) 791 src = src[4:] 792 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 793 src = src[4:] 794 return src 795 } 796 797 // Packed implements marshal.Marshallable.Packed. 798 //go:nosplit 799 func (c *ConnectReq) Packed() bool { 800 return c.FD.Packed() 801 } 802 803 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 804 func (c *ConnectReq) MarshalUnsafe(dst []byte) []byte { 805 if c.FD.Packed() { 806 size := c.SizeBytes() 807 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 808 return dst[size:] 809 } 810 // Type ConnectReq doesn't have a packed layout in memory, fallback to MarshalBytes. 811 return c.MarshalBytes(dst) 812 } 813 814 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 815 func (c *ConnectReq) UnmarshalUnsafe(src []byte) []byte { 816 if c.FD.Packed() { 817 size := c.SizeBytes() 818 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 819 return src[size:] 820 } 821 // Type ConnectReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 822 return c.UnmarshalBytes(src) 823 } 824 825 // CopyOutN implements marshal.Marshallable.CopyOutN. 826 func (c *ConnectReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 827 if !c.FD.Packed() { 828 // Type ConnectReq doesn't have a packed layout in memory, fall back to MarshalBytes. 829 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 830 c.MarshalBytes(buf) // escapes: fallback. 831 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 832 } 833 834 // Construct a slice backed by dst's underlying memory. 835 var buf []byte 836 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 837 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 838 hdr.Len = c.SizeBytes() 839 hdr.Cap = c.SizeBytes() 840 841 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 842 // Since we bypassed the compiler's escape analysis, indicate that c 843 // must live until the use above. 844 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 845 return length, err 846 } 847 848 // CopyOut implements marshal.Marshallable.CopyOut. 849 func (c *ConnectReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 850 return c.CopyOutN(cc, addr, c.SizeBytes()) 851 } 852 853 // CopyIn implements marshal.Marshallable.CopyIn. 854 func (c *ConnectReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 855 if !c.FD.Packed() { 856 // Type ConnectReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 857 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 858 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 859 // Unmarshal unconditionally. If we had a short copy-in, this results in a 860 // partially unmarshalled struct. 861 c.UnmarshalBytes(buf) // escapes: fallback. 862 return length, err 863 } 864 865 // Construct a slice backed by dst's underlying memory. 866 var buf []byte 867 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 868 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 869 hdr.Len = c.SizeBytes() 870 hdr.Cap = c.SizeBytes() 871 872 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 873 // Since we bypassed the compiler's escape analysis, indicate that c 874 // must live until the use above. 875 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 876 return length, err 877 } 878 879 // WriteTo implements io.WriterTo.WriteTo. 880 func (c *ConnectReq) WriteTo(writer io.Writer) (int64, error) { 881 if !c.FD.Packed() { 882 // Type ConnectReq doesn't have a packed layout in memory, fall back to MarshalBytes. 883 buf := make([]byte, c.SizeBytes()) 884 c.MarshalBytes(buf) 885 length, err := writer.Write(buf) 886 return int64(length), err 887 } 888 889 // Construct a slice backed by dst's underlying memory. 890 var buf []byte 891 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 892 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 893 hdr.Len = c.SizeBytes() 894 hdr.Cap = c.SizeBytes() 895 896 length, err := writer.Write(buf) 897 // Since we bypassed the compiler's escape analysis, indicate that c 898 // must live until the use above. 899 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 900 return int64(length), err 901 } 902 903 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 904 func (c *ConnectReq) CheckedMarshal(dst []byte) ([]byte, bool) { 905 if c.SizeBytes() > len(dst) { 906 return dst, false 907 } 908 return c.MarshalUnsafe(dst), true 909 } 910 911 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 912 func (c *ConnectReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 913 if c.SizeBytes() > len(src) { 914 return src, false 915 } 916 return c.UnmarshalUnsafe(src), true 917 } 918 919 // SizeBytes implements marshal.Marshallable.SizeBytes. 920 func (e *ErrorResp) SizeBytes() int { 921 return 4 922 } 923 924 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 925 func (e *ErrorResp) MarshalBytes(dst []byte) []byte { 926 hostarch.ByteOrder.PutUint32(dst[:4], uint32(e.errno)) 927 dst = dst[4:] 928 return dst 929 } 930 931 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 932 func (e *ErrorResp) UnmarshalBytes(src []byte) []byte { 933 e.errno = uint32(hostarch.ByteOrder.Uint32(src[:4])) 934 src = src[4:] 935 return src 936 } 937 938 // Packed implements marshal.Marshallable.Packed. 939 //go:nosplit 940 func (e *ErrorResp) Packed() bool { 941 return true 942 } 943 944 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 945 func (e *ErrorResp) MarshalUnsafe(dst []byte) []byte { 946 size := e.SizeBytes() 947 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(e), uintptr(size)) 948 return dst[size:] 949 } 950 951 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 952 func (e *ErrorResp) UnmarshalUnsafe(src []byte) []byte { 953 size := e.SizeBytes() 954 gohacks.Memmove(unsafe.Pointer(e), unsafe.Pointer(&src[0]), uintptr(size)) 955 return src[size:] 956 } 957 958 // CopyOutN implements marshal.Marshallable.CopyOutN. 959 func (e *ErrorResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 960 // Construct a slice backed by dst's underlying memory. 961 var buf []byte 962 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 963 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 964 hdr.Len = e.SizeBytes() 965 hdr.Cap = e.SizeBytes() 966 967 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 968 // Since we bypassed the compiler's escape analysis, indicate that e 969 // must live until the use above. 970 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 971 return length, err 972 } 973 974 // CopyOut implements marshal.Marshallable.CopyOut. 975 func (e *ErrorResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 976 return e.CopyOutN(cc, addr, e.SizeBytes()) 977 } 978 979 // CopyIn implements marshal.Marshallable.CopyIn. 980 func (e *ErrorResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 981 // Construct a slice backed by dst's underlying memory. 982 var buf []byte 983 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 984 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 985 hdr.Len = e.SizeBytes() 986 hdr.Cap = e.SizeBytes() 987 988 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 989 // Since we bypassed the compiler's escape analysis, indicate that e 990 // must live until the use above. 991 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 992 return length, err 993 } 994 995 // WriteTo implements io.WriterTo.WriteTo. 996 func (e *ErrorResp) WriteTo(writer io.Writer) (int64, error) { 997 // Construct a slice backed by dst's underlying memory. 998 var buf []byte 999 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1000 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(e))) 1001 hdr.Len = e.SizeBytes() 1002 hdr.Cap = e.SizeBytes() 1003 1004 length, err := writer.Write(buf) 1005 // Since we bypassed the compiler's escape analysis, indicate that e 1006 // must live until the use above. 1007 runtime.KeepAlive(e) // escapes: replaced by intrinsic. 1008 return int64(length), err 1009 } 1010 1011 // SizeBytes implements marshal.Marshallable.SizeBytes. 1012 func (a *FAllocateReq) SizeBytes() int { 1013 return 24 + 1014 (*FDID)(nil).SizeBytes() 1015 } 1016 1017 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1018 func (a *FAllocateReq) MarshalBytes(dst []byte) []byte { 1019 dst = a.FD.MarshalUnsafe(dst) 1020 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Mode)) 1021 dst = dst[8:] 1022 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Offset)) 1023 dst = dst[8:] 1024 hostarch.ByteOrder.PutUint64(dst[:8], uint64(a.Length)) 1025 dst = dst[8:] 1026 return dst 1027 } 1028 1029 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1030 func (a *FAllocateReq) UnmarshalBytes(src []byte) []byte { 1031 src = a.FD.UnmarshalUnsafe(src) 1032 a.Mode = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1033 src = src[8:] 1034 a.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1035 src = src[8:] 1036 a.Length = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1037 src = src[8:] 1038 return src 1039 } 1040 1041 // Packed implements marshal.Marshallable.Packed. 1042 //go:nosplit 1043 func (a *FAllocateReq) Packed() bool { 1044 return a.FD.Packed() 1045 } 1046 1047 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1048 func (a *FAllocateReq) MarshalUnsafe(dst []byte) []byte { 1049 if a.FD.Packed() { 1050 size := a.SizeBytes() 1051 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(a), uintptr(size)) 1052 return dst[size:] 1053 } 1054 // Type FAllocateReq doesn't have a packed layout in memory, fallback to MarshalBytes. 1055 return a.MarshalBytes(dst) 1056 } 1057 1058 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1059 func (a *FAllocateReq) UnmarshalUnsafe(src []byte) []byte { 1060 if a.FD.Packed() { 1061 size := a.SizeBytes() 1062 gohacks.Memmove(unsafe.Pointer(a), unsafe.Pointer(&src[0]), uintptr(size)) 1063 return src[size:] 1064 } 1065 // Type FAllocateReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1066 return a.UnmarshalBytes(src) 1067 } 1068 1069 // CopyOutN implements marshal.Marshallable.CopyOutN. 1070 func (a *FAllocateReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1071 if !a.FD.Packed() { 1072 // Type FAllocateReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1073 buf := cc.CopyScratchBuffer(a.SizeBytes()) // escapes: okay. 1074 a.MarshalBytes(buf) // escapes: fallback. 1075 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1076 } 1077 1078 // Construct a slice backed by dst's underlying memory. 1079 var buf []byte 1080 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1081 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 1082 hdr.Len = a.SizeBytes() 1083 hdr.Cap = a.SizeBytes() 1084 1085 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1086 // Since we bypassed the compiler's escape analysis, indicate that a 1087 // must live until the use above. 1088 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 1089 return length, err 1090 } 1091 1092 // CopyOut implements marshal.Marshallable.CopyOut. 1093 func (a *FAllocateReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1094 return a.CopyOutN(cc, addr, a.SizeBytes()) 1095 } 1096 1097 // CopyIn implements marshal.Marshallable.CopyIn. 1098 func (a *FAllocateReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1099 if !a.FD.Packed() { 1100 // Type FAllocateReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1101 buf := cc.CopyScratchBuffer(a.SizeBytes()) // escapes: okay. 1102 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1103 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1104 // partially unmarshalled struct. 1105 a.UnmarshalBytes(buf) // escapes: fallback. 1106 return length, err 1107 } 1108 1109 // Construct a slice backed by dst's underlying memory. 1110 var buf []byte 1111 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1112 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 1113 hdr.Len = a.SizeBytes() 1114 hdr.Cap = a.SizeBytes() 1115 1116 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1117 // Since we bypassed the compiler's escape analysis, indicate that a 1118 // must live until the use above. 1119 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 1120 return length, err 1121 } 1122 1123 // WriteTo implements io.WriterTo.WriteTo. 1124 func (a *FAllocateReq) WriteTo(writer io.Writer) (int64, error) { 1125 if !a.FD.Packed() { 1126 // Type FAllocateReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1127 buf := make([]byte, a.SizeBytes()) 1128 a.MarshalBytes(buf) 1129 length, err := writer.Write(buf) 1130 return int64(length), err 1131 } 1132 1133 // Construct a slice backed by dst's underlying memory. 1134 var buf []byte 1135 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1136 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(a))) 1137 hdr.Len = a.SizeBytes() 1138 hdr.Cap = a.SizeBytes() 1139 1140 length, err := writer.Write(buf) 1141 // Since we bypassed the compiler's escape analysis, indicate that a 1142 // must live until the use above. 1143 runtime.KeepAlive(a) // escapes: replaced by intrinsic. 1144 return int64(length), err 1145 } 1146 1147 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 1148 func (a *FAllocateReq) CheckedMarshal(dst []byte) ([]byte, bool) { 1149 if a.SizeBytes() > len(dst) { 1150 return dst, false 1151 } 1152 return a.MarshalUnsafe(dst), true 1153 } 1154 1155 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 1156 func (a *FAllocateReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 1157 if a.SizeBytes() > len(src) { 1158 return src, false 1159 } 1160 return a.UnmarshalUnsafe(src), true 1161 } 1162 1163 // SizeBytes implements marshal.Marshallable.SizeBytes. 1164 func (l *FListXattrReq) SizeBytes() int { 1165 return 8 + 1166 (*FDID)(nil).SizeBytes() 1167 } 1168 1169 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1170 func (l *FListXattrReq) MarshalBytes(dst []byte) []byte { 1171 dst = l.FD.MarshalUnsafe(dst) 1172 hostarch.ByteOrder.PutUint64(dst[:8], uint64(l.Size)) 1173 dst = dst[8:] 1174 return dst 1175 } 1176 1177 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1178 func (l *FListXattrReq) UnmarshalBytes(src []byte) []byte { 1179 src = l.FD.UnmarshalUnsafe(src) 1180 l.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 1181 src = src[8:] 1182 return src 1183 } 1184 1185 // Packed implements marshal.Marshallable.Packed. 1186 //go:nosplit 1187 func (l *FListXattrReq) Packed() bool { 1188 return l.FD.Packed() 1189 } 1190 1191 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1192 func (l *FListXattrReq) MarshalUnsafe(dst []byte) []byte { 1193 if l.FD.Packed() { 1194 size := l.SizeBytes() 1195 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 1196 return dst[size:] 1197 } 1198 // Type FListXattrReq doesn't have a packed layout in memory, fallback to MarshalBytes. 1199 return l.MarshalBytes(dst) 1200 } 1201 1202 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1203 func (l *FListXattrReq) UnmarshalUnsafe(src []byte) []byte { 1204 if l.FD.Packed() { 1205 size := l.SizeBytes() 1206 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 1207 return src[size:] 1208 } 1209 // Type FListXattrReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1210 return l.UnmarshalBytes(src) 1211 } 1212 1213 // CopyOutN implements marshal.Marshallable.CopyOutN. 1214 func (l *FListXattrReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1215 if !l.FD.Packed() { 1216 // Type FListXattrReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1217 buf := cc.CopyScratchBuffer(l.SizeBytes()) // escapes: okay. 1218 l.MarshalBytes(buf) // escapes: fallback. 1219 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1220 } 1221 1222 // Construct a slice backed by dst's underlying memory. 1223 var buf []byte 1224 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1225 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 1226 hdr.Len = l.SizeBytes() 1227 hdr.Cap = l.SizeBytes() 1228 1229 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1230 // Since we bypassed the compiler's escape analysis, indicate that l 1231 // must live until the use above. 1232 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 1233 return length, err 1234 } 1235 1236 // CopyOut implements marshal.Marshallable.CopyOut. 1237 func (l *FListXattrReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1238 return l.CopyOutN(cc, addr, l.SizeBytes()) 1239 } 1240 1241 // CopyIn implements marshal.Marshallable.CopyIn. 1242 func (l *FListXattrReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1243 if !l.FD.Packed() { 1244 // Type FListXattrReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1245 buf := cc.CopyScratchBuffer(l.SizeBytes()) // escapes: okay. 1246 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1247 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1248 // partially unmarshalled struct. 1249 l.UnmarshalBytes(buf) // escapes: fallback. 1250 return length, err 1251 } 1252 1253 // Construct a slice backed by dst's underlying memory. 1254 var buf []byte 1255 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1256 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 1257 hdr.Len = l.SizeBytes() 1258 hdr.Cap = l.SizeBytes() 1259 1260 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1261 // Since we bypassed the compiler's escape analysis, indicate that l 1262 // must live until the use above. 1263 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 1264 return length, err 1265 } 1266 1267 // WriteTo implements io.WriterTo.WriteTo. 1268 func (l *FListXattrReq) WriteTo(writer io.Writer) (int64, error) { 1269 if !l.FD.Packed() { 1270 // Type FListXattrReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1271 buf := make([]byte, l.SizeBytes()) 1272 l.MarshalBytes(buf) 1273 length, err := writer.Write(buf) 1274 return int64(length), err 1275 } 1276 1277 // Construct a slice backed by dst's underlying memory. 1278 var buf []byte 1279 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1280 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 1281 hdr.Len = l.SizeBytes() 1282 hdr.Cap = l.SizeBytes() 1283 1284 length, err := writer.Write(buf) 1285 // Since we bypassed the compiler's escape analysis, indicate that l 1286 // must live until the use above. 1287 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 1288 return int64(length), err 1289 } 1290 1291 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 1292 func (l *FListXattrReq) CheckedMarshal(dst []byte) ([]byte, bool) { 1293 if l.SizeBytes() > len(dst) { 1294 return dst, false 1295 } 1296 return l.MarshalUnsafe(dst), true 1297 } 1298 1299 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 1300 func (l *FListXattrReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 1301 if l.SizeBytes() > len(src) { 1302 return src, false 1303 } 1304 return l.UnmarshalUnsafe(src), true 1305 } 1306 1307 // SizeBytes implements marshal.Marshallable.SizeBytes. 1308 func (s *FStatFSReq) SizeBytes() int { 1309 return 0 + 1310 (*FDID)(nil).SizeBytes() 1311 } 1312 1313 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1314 func (s *FStatFSReq) MarshalBytes(dst []byte) []byte { 1315 dst = s.FD.MarshalUnsafe(dst) 1316 return dst 1317 } 1318 1319 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1320 func (s *FStatFSReq) UnmarshalBytes(src []byte) []byte { 1321 src = s.FD.UnmarshalUnsafe(src) 1322 return src 1323 } 1324 1325 // Packed implements marshal.Marshallable.Packed. 1326 //go:nosplit 1327 func (s *FStatFSReq) Packed() bool { 1328 return s.FD.Packed() 1329 } 1330 1331 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1332 func (s *FStatFSReq) MarshalUnsafe(dst []byte) []byte { 1333 if s.FD.Packed() { 1334 size := s.SizeBytes() 1335 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 1336 return dst[size:] 1337 } 1338 // Type FStatFSReq doesn't have a packed layout in memory, fallback to MarshalBytes. 1339 return s.MarshalBytes(dst) 1340 } 1341 1342 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1343 func (s *FStatFSReq) UnmarshalUnsafe(src []byte) []byte { 1344 if s.FD.Packed() { 1345 size := s.SizeBytes() 1346 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 1347 return src[size:] 1348 } 1349 // Type FStatFSReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1350 return s.UnmarshalBytes(src) 1351 } 1352 1353 // CopyOutN implements marshal.Marshallable.CopyOutN. 1354 func (s *FStatFSReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1355 if !s.FD.Packed() { 1356 // Type FStatFSReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1357 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1358 s.MarshalBytes(buf) // escapes: fallback. 1359 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1360 } 1361 1362 // Construct a slice backed by dst's underlying memory. 1363 var buf []byte 1364 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1365 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1366 hdr.Len = s.SizeBytes() 1367 hdr.Cap = s.SizeBytes() 1368 1369 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1370 // Since we bypassed the compiler's escape analysis, indicate that s 1371 // must live until the use above. 1372 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1373 return length, err 1374 } 1375 1376 // CopyOut implements marshal.Marshallable.CopyOut. 1377 func (s *FStatFSReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1378 return s.CopyOutN(cc, addr, s.SizeBytes()) 1379 } 1380 1381 // CopyIn implements marshal.Marshallable.CopyIn. 1382 func (s *FStatFSReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1383 if !s.FD.Packed() { 1384 // Type FStatFSReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1385 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 1386 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1387 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1388 // partially unmarshalled struct. 1389 s.UnmarshalBytes(buf) // escapes: fallback. 1390 return length, err 1391 } 1392 1393 // Construct a slice backed by dst's underlying memory. 1394 var buf []byte 1395 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1396 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1397 hdr.Len = s.SizeBytes() 1398 hdr.Cap = s.SizeBytes() 1399 1400 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1401 // Since we bypassed the compiler's escape analysis, indicate that s 1402 // must live until the use above. 1403 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1404 return length, err 1405 } 1406 1407 // WriteTo implements io.WriterTo.WriteTo. 1408 func (s *FStatFSReq) WriteTo(writer io.Writer) (int64, error) { 1409 if !s.FD.Packed() { 1410 // Type FStatFSReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1411 buf := make([]byte, s.SizeBytes()) 1412 s.MarshalBytes(buf) 1413 length, err := writer.Write(buf) 1414 return int64(length), err 1415 } 1416 1417 // Construct a slice backed by dst's underlying memory. 1418 var buf []byte 1419 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1420 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 1421 hdr.Len = s.SizeBytes() 1422 hdr.Cap = s.SizeBytes() 1423 1424 length, err := writer.Write(buf) 1425 // Since we bypassed the compiler's escape analysis, indicate that s 1426 // must live until the use above. 1427 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 1428 return int64(length), err 1429 } 1430 1431 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 1432 func (s *FStatFSReq) CheckedMarshal(dst []byte) ([]byte, bool) { 1433 if s.SizeBytes() > len(dst) { 1434 return dst, false 1435 } 1436 return s.MarshalUnsafe(dst), true 1437 } 1438 1439 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 1440 func (s *FStatFSReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 1441 if s.SizeBytes() > len(src) { 1442 return src, false 1443 } 1444 return s.UnmarshalUnsafe(src), true 1445 } 1446 1447 // SizeBytes implements marshal.Marshallable.SizeBytes. 1448 func (f *FlushReq) SizeBytes() int { 1449 return 0 + 1450 (*FDID)(nil).SizeBytes() 1451 } 1452 1453 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1454 func (f *FlushReq) MarshalBytes(dst []byte) []byte { 1455 dst = f.FD.MarshalUnsafe(dst) 1456 return dst 1457 } 1458 1459 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1460 func (f *FlushReq) UnmarshalBytes(src []byte) []byte { 1461 src = f.FD.UnmarshalUnsafe(src) 1462 return src 1463 } 1464 1465 // Packed implements marshal.Marshallable.Packed. 1466 //go:nosplit 1467 func (f *FlushReq) Packed() bool { 1468 return f.FD.Packed() 1469 } 1470 1471 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1472 func (f *FlushReq) MarshalUnsafe(dst []byte) []byte { 1473 if f.FD.Packed() { 1474 size := f.SizeBytes() 1475 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(f), uintptr(size)) 1476 return dst[size:] 1477 } 1478 // Type FlushReq doesn't have a packed layout in memory, fallback to MarshalBytes. 1479 return f.MarshalBytes(dst) 1480 } 1481 1482 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1483 func (f *FlushReq) UnmarshalUnsafe(src []byte) []byte { 1484 if f.FD.Packed() { 1485 size := f.SizeBytes() 1486 gohacks.Memmove(unsafe.Pointer(f), unsafe.Pointer(&src[0]), uintptr(size)) 1487 return src[size:] 1488 } 1489 // Type FlushReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1490 return f.UnmarshalBytes(src) 1491 } 1492 1493 // CopyOutN implements marshal.Marshallable.CopyOutN. 1494 func (f *FlushReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1495 if !f.FD.Packed() { 1496 // Type FlushReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1497 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 1498 f.MarshalBytes(buf) // escapes: fallback. 1499 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1500 } 1501 1502 // Construct a slice backed by dst's underlying memory. 1503 var buf []byte 1504 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1505 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1506 hdr.Len = f.SizeBytes() 1507 hdr.Cap = f.SizeBytes() 1508 1509 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1510 // Since we bypassed the compiler's escape analysis, indicate that f 1511 // must live until the use above. 1512 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1513 return length, err 1514 } 1515 1516 // CopyOut implements marshal.Marshallable.CopyOut. 1517 func (f *FlushReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1518 return f.CopyOutN(cc, addr, f.SizeBytes()) 1519 } 1520 1521 // CopyIn implements marshal.Marshallable.CopyIn. 1522 func (f *FlushReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1523 if !f.FD.Packed() { 1524 // Type FlushReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1525 buf := cc.CopyScratchBuffer(f.SizeBytes()) // escapes: okay. 1526 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1527 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1528 // partially unmarshalled struct. 1529 f.UnmarshalBytes(buf) // escapes: fallback. 1530 return length, err 1531 } 1532 1533 // Construct a slice backed by dst's underlying memory. 1534 var buf []byte 1535 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1536 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1537 hdr.Len = f.SizeBytes() 1538 hdr.Cap = f.SizeBytes() 1539 1540 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1541 // Since we bypassed the compiler's escape analysis, indicate that f 1542 // must live until the use above. 1543 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1544 return length, err 1545 } 1546 1547 // WriteTo implements io.WriterTo.WriteTo. 1548 func (f *FlushReq) WriteTo(writer io.Writer) (int64, error) { 1549 if !f.FD.Packed() { 1550 // Type FlushReq doesn't have a packed layout in memory, fall back to MarshalBytes. 1551 buf := make([]byte, f.SizeBytes()) 1552 f.MarshalBytes(buf) 1553 length, err := writer.Write(buf) 1554 return int64(length), err 1555 } 1556 1557 // Construct a slice backed by dst's underlying memory. 1558 var buf []byte 1559 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1560 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(f))) 1561 hdr.Len = f.SizeBytes() 1562 hdr.Cap = f.SizeBytes() 1563 1564 length, err := writer.Write(buf) 1565 // Since we bypassed the compiler's escape analysis, indicate that f 1566 // must live until the use above. 1567 runtime.KeepAlive(f) // escapes: replaced by intrinsic. 1568 return int64(length), err 1569 } 1570 1571 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 1572 func (f *FlushReq) CheckedMarshal(dst []byte) ([]byte, bool) { 1573 if f.SizeBytes() > len(dst) { 1574 return dst, false 1575 } 1576 return f.MarshalUnsafe(dst), true 1577 } 1578 1579 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 1580 func (f *FlushReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 1581 if f.SizeBytes() > len(src) { 1582 return src, false 1583 } 1584 return f.UnmarshalUnsafe(src), true 1585 } 1586 1587 // SizeBytes implements marshal.Marshallable.SizeBytes. 1588 //go:nosplit 1589 func (gid *GID) SizeBytes() int { 1590 return 4 1591 } 1592 1593 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1594 func (gid *GID) MarshalBytes(dst []byte) []byte { 1595 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*gid)) 1596 return dst[4:] 1597 } 1598 1599 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1600 func (gid *GID) UnmarshalBytes(src []byte) []byte { 1601 *gid = GID(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 1602 return src[4:] 1603 } 1604 1605 // Packed implements marshal.Marshallable.Packed. 1606 //go:nosplit 1607 func (gid *GID) Packed() bool { 1608 // Scalar newtypes are always packed. 1609 return true 1610 } 1611 1612 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1613 func (gid *GID) MarshalUnsafe(dst []byte) []byte { 1614 size := gid.SizeBytes() 1615 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(gid), uintptr(size)) 1616 return dst[size:] 1617 } 1618 1619 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1620 func (gid *GID) UnmarshalUnsafe(src []byte) []byte { 1621 size := gid.SizeBytes() 1622 gohacks.Memmove(unsafe.Pointer(gid), unsafe.Pointer(&src[0]), uintptr(size)) 1623 return src[size:] 1624 } 1625 1626 // CopyOutN implements marshal.Marshallable.CopyOutN. 1627 func (gid *GID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1628 // Construct a slice backed by dst's underlying memory. 1629 var buf []byte 1630 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1631 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(gid))) 1632 hdr.Len = gid.SizeBytes() 1633 hdr.Cap = gid.SizeBytes() 1634 1635 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1636 // Since we bypassed the compiler's escape analysis, indicate that gid 1637 // must live until the use above. 1638 runtime.KeepAlive(gid) // escapes: replaced by intrinsic. 1639 return length, err 1640 } 1641 1642 // CopyOut implements marshal.Marshallable.CopyOut. 1643 func (gid *GID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1644 return gid.CopyOutN(cc, addr, gid.SizeBytes()) 1645 } 1646 1647 // CopyIn implements marshal.Marshallable.CopyIn. 1648 func (gid *GID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1649 // Construct a slice backed by dst's underlying memory. 1650 var buf []byte 1651 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1652 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(gid))) 1653 hdr.Len = gid.SizeBytes() 1654 hdr.Cap = gid.SizeBytes() 1655 1656 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1657 // Since we bypassed the compiler's escape analysis, indicate that gid 1658 // must live until the use above. 1659 runtime.KeepAlive(gid) // escapes: replaced by intrinsic. 1660 return length, err 1661 } 1662 1663 // WriteTo implements io.WriterTo.WriteTo. 1664 func (gid *GID) WriteTo(writer io.Writer) (int64, error) { 1665 // Construct a slice backed by dst's underlying memory. 1666 var buf []byte 1667 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1668 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(gid))) 1669 hdr.Len = gid.SizeBytes() 1670 hdr.Cap = gid.SizeBytes() 1671 1672 length, err := writer.Write(buf) 1673 // Since we bypassed the compiler's escape analysis, indicate that gid 1674 // must live until the use above. 1675 runtime.KeepAlive(gid) // escapes: replaced by intrinsic. 1676 return int64(length), err 1677 } 1678 1679 // SizeBytes implements marshal.Marshallable.SizeBytes. 1680 func (g *Getdents64Req) SizeBytes() int { 1681 return 8 + 1682 (*FDID)(nil).SizeBytes() 1683 } 1684 1685 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1686 func (g *Getdents64Req) MarshalBytes(dst []byte) []byte { 1687 dst = g.DirFD.MarshalUnsafe(dst) 1688 hostarch.ByteOrder.PutUint32(dst[:4], uint32(g.Count)) 1689 dst = dst[4:] 1690 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 1691 dst = dst[4:] 1692 return dst 1693 } 1694 1695 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1696 func (g *Getdents64Req) UnmarshalBytes(src []byte) []byte { 1697 src = g.DirFD.UnmarshalUnsafe(src) 1698 g.Count = int32(hostarch.ByteOrder.Uint32(src[:4])) 1699 src = src[4:] 1700 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 1701 src = src[4:] 1702 return src 1703 } 1704 1705 // Packed implements marshal.Marshallable.Packed. 1706 //go:nosplit 1707 func (g *Getdents64Req) Packed() bool { 1708 return g.DirFD.Packed() 1709 } 1710 1711 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1712 func (g *Getdents64Req) MarshalUnsafe(dst []byte) []byte { 1713 if g.DirFD.Packed() { 1714 size := g.SizeBytes() 1715 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(g), uintptr(size)) 1716 return dst[size:] 1717 } 1718 // Type Getdents64Req doesn't have a packed layout in memory, fallback to MarshalBytes. 1719 return g.MarshalBytes(dst) 1720 } 1721 1722 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1723 func (g *Getdents64Req) UnmarshalUnsafe(src []byte) []byte { 1724 if g.DirFD.Packed() { 1725 size := g.SizeBytes() 1726 gohacks.Memmove(unsafe.Pointer(g), unsafe.Pointer(&src[0]), uintptr(size)) 1727 return src[size:] 1728 } 1729 // Type Getdents64Req doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1730 return g.UnmarshalBytes(src) 1731 } 1732 1733 // CopyOutN implements marshal.Marshallable.CopyOutN. 1734 func (g *Getdents64Req) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1735 if !g.DirFD.Packed() { 1736 // Type Getdents64Req doesn't have a packed layout in memory, fall back to MarshalBytes. 1737 buf := cc.CopyScratchBuffer(g.SizeBytes()) // escapes: okay. 1738 g.MarshalBytes(buf) // escapes: fallback. 1739 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1740 } 1741 1742 // Construct a slice backed by dst's underlying memory. 1743 var buf []byte 1744 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1745 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(g))) 1746 hdr.Len = g.SizeBytes() 1747 hdr.Cap = g.SizeBytes() 1748 1749 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1750 // Since we bypassed the compiler's escape analysis, indicate that g 1751 // must live until the use above. 1752 runtime.KeepAlive(g) // escapes: replaced by intrinsic. 1753 return length, err 1754 } 1755 1756 // CopyOut implements marshal.Marshallable.CopyOut. 1757 func (g *Getdents64Req) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1758 return g.CopyOutN(cc, addr, g.SizeBytes()) 1759 } 1760 1761 // CopyIn implements marshal.Marshallable.CopyIn. 1762 func (g *Getdents64Req) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1763 if !g.DirFD.Packed() { 1764 // Type Getdents64Req doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1765 buf := cc.CopyScratchBuffer(g.SizeBytes()) // escapes: okay. 1766 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1767 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1768 // partially unmarshalled struct. 1769 g.UnmarshalBytes(buf) // escapes: fallback. 1770 return length, err 1771 } 1772 1773 // Construct a slice backed by dst's underlying memory. 1774 var buf []byte 1775 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1776 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(g))) 1777 hdr.Len = g.SizeBytes() 1778 hdr.Cap = g.SizeBytes() 1779 1780 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1781 // Since we bypassed the compiler's escape analysis, indicate that g 1782 // must live until the use above. 1783 runtime.KeepAlive(g) // escapes: replaced by intrinsic. 1784 return length, err 1785 } 1786 1787 // WriteTo implements io.WriterTo.WriteTo. 1788 func (g *Getdents64Req) WriteTo(writer io.Writer) (int64, error) { 1789 if !g.DirFD.Packed() { 1790 // Type Getdents64Req doesn't have a packed layout in memory, fall back to MarshalBytes. 1791 buf := make([]byte, g.SizeBytes()) 1792 g.MarshalBytes(buf) 1793 length, err := writer.Write(buf) 1794 return int64(length), err 1795 } 1796 1797 // Construct a slice backed by dst's underlying memory. 1798 var buf []byte 1799 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1800 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(g))) 1801 hdr.Len = g.SizeBytes() 1802 hdr.Cap = g.SizeBytes() 1803 1804 length, err := writer.Write(buf) 1805 // Since we bypassed the compiler's escape analysis, indicate that g 1806 // must live until the use above. 1807 runtime.KeepAlive(g) // escapes: replaced by intrinsic. 1808 return int64(length), err 1809 } 1810 1811 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 1812 func (g *Getdents64Req) CheckedMarshal(dst []byte) ([]byte, bool) { 1813 if g.SizeBytes() > len(dst) { 1814 return dst, false 1815 } 1816 return g.MarshalUnsafe(dst), true 1817 } 1818 1819 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 1820 func (g *Getdents64Req) CheckedUnmarshal(src []byte) ([]byte, bool) { 1821 if g.SizeBytes() > len(src) { 1822 return src, false 1823 } 1824 return g.UnmarshalUnsafe(src), true 1825 } 1826 1827 // SizeBytes implements marshal.Marshallable.SizeBytes. 1828 func (i *Inode) SizeBytes() int { 1829 return 0 + 1830 (*FDID)(nil).SizeBytes() + 1831 (*linux.Statx)(nil).SizeBytes() 1832 } 1833 1834 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 1835 func (i *Inode) MarshalBytes(dst []byte) []byte { 1836 dst = i.ControlFD.MarshalUnsafe(dst) 1837 dst = i.Stat.MarshalUnsafe(dst) 1838 return dst 1839 } 1840 1841 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 1842 func (i *Inode) UnmarshalBytes(src []byte) []byte { 1843 src = i.ControlFD.UnmarshalUnsafe(src) 1844 src = i.Stat.UnmarshalUnsafe(src) 1845 return src 1846 } 1847 1848 // Packed implements marshal.Marshallable.Packed. 1849 //go:nosplit 1850 func (i *Inode) Packed() bool { 1851 return i.ControlFD.Packed() && i.Stat.Packed() 1852 } 1853 1854 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 1855 func (i *Inode) MarshalUnsafe(dst []byte) []byte { 1856 if i.ControlFD.Packed() && i.Stat.Packed() { 1857 size := i.SizeBytes() 1858 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size)) 1859 return dst[size:] 1860 } 1861 // Type Inode doesn't have a packed layout in memory, fallback to MarshalBytes. 1862 return i.MarshalBytes(dst) 1863 } 1864 1865 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 1866 func (i *Inode) UnmarshalUnsafe(src []byte) []byte { 1867 if i.ControlFD.Packed() && i.Stat.Packed() { 1868 size := i.SizeBytes() 1869 gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size)) 1870 return src[size:] 1871 } 1872 // Type Inode doesn't have a packed layout in memory, fallback to UnmarshalBytes. 1873 return i.UnmarshalBytes(src) 1874 } 1875 1876 // CopyOutN implements marshal.Marshallable.CopyOutN. 1877 func (i *Inode) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 1878 if !i.ControlFD.Packed() && i.Stat.Packed() { 1879 // Type Inode doesn't have a packed layout in memory, fall back to MarshalBytes. 1880 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 1881 i.MarshalBytes(buf) // escapes: fallback. 1882 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1883 } 1884 1885 // Construct a slice backed by dst's underlying memory. 1886 var buf []byte 1887 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1888 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 1889 hdr.Len = i.SizeBytes() 1890 hdr.Cap = i.SizeBytes() 1891 1892 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 1893 // Since we bypassed the compiler's escape analysis, indicate that i 1894 // must live until the use above. 1895 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 1896 return length, err 1897 } 1898 1899 // CopyOut implements marshal.Marshallable.CopyOut. 1900 func (i *Inode) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1901 return i.CopyOutN(cc, addr, i.SizeBytes()) 1902 } 1903 1904 // CopyIn implements marshal.Marshallable.CopyIn. 1905 func (i *Inode) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 1906 if !i.ControlFD.Packed() && i.Stat.Packed() { 1907 // Type Inode doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1908 buf := cc.CopyScratchBuffer(i.SizeBytes()) // escapes: okay. 1909 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1910 // Unmarshal unconditionally. If we had a short copy-in, this results in a 1911 // partially unmarshalled struct. 1912 i.UnmarshalBytes(buf) // escapes: fallback. 1913 return length, err 1914 } 1915 1916 // Construct a slice backed by dst's underlying memory. 1917 var buf []byte 1918 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1919 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 1920 hdr.Len = i.SizeBytes() 1921 hdr.Cap = i.SizeBytes() 1922 1923 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 1924 // Since we bypassed the compiler's escape analysis, indicate that i 1925 // must live until the use above. 1926 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 1927 return length, err 1928 } 1929 1930 // WriteTo implements io.WriterTo.WriteTo. 1931 func (i *Inode) WriteTo(writer io.Writer) (int64, error) { 1932 if !i.ControlFD.Packed() && i.Stat.Packed() { 1933 // Type Inode doesn't have a packed layout in memory, fall back to MarshalBytes. 1934 buf := make([]byte, i.SizeBytes()) 1935 i.MarshalBytes(buf) 1936 length, err := writer.Write(buf) 1937 return int64(length), err 1938 } 1939 1940 // Construct a slice backed by dst's underlying memory. 1941 var buf []byte 1942 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1943 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i))) 1944 hdr.Len = i.SizeBytes() 1945 hdr.Cap = i.SizeBytes() 1946 1947 length, err := writer.Write(buf) 1948 // Since we bypassed the compiler's escape analysis, indicate that i 1949 // must live until the use above. 1950 runtime.KeepAlive(i) // escapes: replaced by intrinsic. 1951 return int64(length), err 1952 } 1953 1954 // CopyInodeSliceIn copies in a slice of Inode objects from the task's memory. 1955 func CopyInodeSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []Inode) (int, error) { 1956 count := len(dst) 1957 if count == 0 { 1958 return 0, nil 1959 } 1960 size := (*Inode)(nil).SizeBytes() 1961 1962 if !dst[0].Packed() { 1963 // Type Inode doesn't have a packed layout in memory, fall back to UnmarshalBytes. 1964 buf := cc.CopyScratchBuffer(size * count) 1965 length, err := cc.CopyInBytes(addr, buf) 1966 1967 // Unmarshal as much as possible, even on error. First handle full objects. 1968 limit := length/size 1969 for idx := 0; idx < limit; idx++ { 1970 buf = dst[idx].UnmarshalBytes(buf) 1971 } 1972 1973 // Handle any final partial object. buf is guaranteed to be long enough for the 1974 // final element, but may not contain valid data for the entire range. This may 1975 // result in unmarshalling zero values for some parts of the object. 1976 if length%size != 0 { 1977 dst[limit].UnmarshalBytes(buf) 1978 } 1979 1980 return length, err 1981 } 1982 1983 ptr := unsafe.Pointer(&dst) 1984 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 1985 1986 // Construct a slice backed by dst's underlying memory. 1987 var buf []byte 1988 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 1989 hdr.Data = uintptr(val) 1990 hdr.Len = size * count 1991 hdr.Cap = size * count 1992 1993 length, err := cc.CopyInBytes(addr, buf) 1994 // Since we bypassed the compiler's escape analysis, indicate that dst 1995 // must live until the use above. 1996 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 1997 return length, err 1998 } 1999 2000 // CopyInodeSliceOut copies a slice of Inode objects to the task's memory. 2001 func CopyInodeSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []Inode) (int, error) { 2002 count := len(src) 2003 if count == 0 { 2004 return 0, nil 2005 } 2006 size := (*Inode)(nil).SizeBytes() 2007 2008 if !src[0].Packed() { 2009 // Type Inode doesn't have a packed layout in memory, fall back to MarshalBytes. 2010 buf := cc.CopyScratchBuffer(size * count) 2011 curBuf := buf 2012 for idx := 0; idx < count; idx++ { 2013 curBuf = src[idx].MarshalBytes(curBuf) 2014 } 2015 return cc.CopyOutBytes(addr, buf) 2016 } 2017 2018 ptr := unsafe.Pointer(&src) 2019 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2020 2021 // Construct a slice backed by dst's underlying memory. 2022 var buf []byte 2023 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2024 hdr.Data = uintptr(val) 2025 hdr.Len = size * count 2026 hdr.Cap = size * count 2027 2028 length, err := cc.CopyOutBytes(addr, buf) 2029 // Since we bypassed the compiler's escape analysis, indicate that src 2030 // must live until the use above. 2031 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2032 return length, err 2033 } 2034 2035 // MarshalUnsafeInodeSlice is like Inode.MarshalUnsafe, but for a []Inode. 2036 func MarshalUnsafeInodeSlice(src []Inode, dst []byte) []byte { 2037 count := len(src) 2038 if count == 0 { 2039 return dst 2040 } 2041 2042 if !src[0].Packed() { 2043 // Type Inode doesn't have a packed layout in memory, fall back to MarshalBytes. 2044 for idx := 0; idx < count; idx++ { 2045 dst = src[idx].MarshalBytes(dst) 2046 } 2047 return dst 2048 } 2049 2050 size := (*Inode)(nil).SizeBytes() 2051 buf := dst[:size*count] 2052 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2053 return dst[size*count:] 2054 } 2055 2056 // UnmarshalUnsafeInodeSlice is like Inode.UnmarshalUnsafe, but for a []Inode. 2057 func UnmarshalUnsafeInodeSlice(dst []Inode, src []byte) []byte { 2058 count := len(dst) 2059 if count == 0 { 2060 return src 2061 } 2062 2063 if !dst[0].Packed() { 2064 // Type Inode doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2065 for idx := 0; idx < count; idx++ { 2066 src = dst[idx].UnmarshalBytes(src) 2067 } 2068 return src 2069 } 2070 2071 size := (*Inode)(nil).SizeBytes() 2072 buf := src[:size*count] 2073 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2074 return src[size*count:] 2075 } 2076 2077 // SizeBytes implements marshal.Marshallable.SizeBytes. 2078 func (l *LinkAtResp) SizeBytes() int { 2079 return 0 + 2080 (*Inode)(nil).SizeBytes() 2081 } 2082 2083 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2084 func (l *LinkAtResp) MarshalBytes(dst []byte) []byte { 2085 dst = l.Link.MarshalUnsafe(dst) 2086 return dst 2087 } 2088 2089 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2090 func (l *LinkAtResp) UnmarshalBytes(src []byte) []byte { 2091 src = l.Link.UnmarshalUnsafe(src) 2092 return src 2093 } 2094 2095 // Packed implements marshal.Marshallable.Packed. 2096 //go:nosplit 2097 func (l *LinkAtResp) Packed() bool { 2098 return l.Link.Packed() 2099 } 2100 2101 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2102 func (l *LinkAtResp) MarshalUnsafe(dst []byte) []byte { 2103 if l.Link.Packed() { 2104 size := l.SizeBytes() 2105 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 2106 return dst[size:] 2107 } 2108 // Type LinkAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 2109 return l.MarshalBytes(dst) 2110 } 2111 2112 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2113 func (l *LinkAtResp) UnmarshalUnsafe(src []byte) []byte { 2114 if l.Link.Packed() { 2115 size := l.SizeBytes() 2116 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 2117 return src[size:] 2118 } 2119 // Type LinkAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2120 return l.UnmarshalBytes(src) 2121 } 2122 2123 // CopyOutN implements marshal.Marshallable.CopyOutN. 2124 func (l *LinkAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2125 if !l.Link.Packed() { 2126 // Type LinkAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 2127 buf := cc.CopyScratchBuffer(l.SizeBytes()) // escapes: okay. 2128 l.MarshalBytes(buf) // escapes: fallback. 2129 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2130 } 2131 2132 // Construct a slice backed by dst's underlying memory. 2133 var buf []byte 2134 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2135 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 2136 hdr.Len = l.SizeBytes() 2137 hdr.Cap = l.SizeBytes() 2138 2139 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2140 // Since we bypassed the compiler's escape analysis, indicate that l 2141 // must live until the use above. 2142 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 2143 return length, err 2144 } 2145 2146 // CopyOut implements marshal.Marshallable.CopyOut. 2147 func (l *LinkAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2148 return l.CopyOutN(cc, addr, l.SizeBytes()) 2149 } 2150 2151 // CopyIn implements marshal.Marshallable.CopyIn. 2152 func (l *LinkAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2153 if !l.Link.Packed() { 2154 // Type LinkAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2155 buf := cc.CopyScratchBuffer(l.SizeBytes()) // escapes: okay. 2156 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2157 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2158 // partially unmarshalled struct. 2159 l.UnmarshalBytes(buf) // escapes: fallback. 2160 return length, err 2161 } 2162 2163 // Construct a slice backed by dst's underlying memory. 2164 var buf []byte 2165 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2166 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 2167 hdr.Len = l.SizeBytes() 2168 hdr.Cap = l.SizeBytes() 2169 2170 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2171 // Since we bypassed the compiler's escape analysis, indicate that l 2172 // must live until the use above. 2173 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 2174 return length, err 2175 } 2176 2177 // WriteTo implements io.WriterTo.WriteTo. 2178 func (l *LinkAtResp) WriteTo(writer io.Writer) (int64, error) { 2179 if !l.Link.Packed() { 2180 // Type LinkAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 2181 buf := make([]byte, l.SizeBytes()) 2182 l.MarshalBytes(buf) 2183 length, err := writer.Write(buf) 2184 return int64(length), err 2185 } 2186 2187 // Construct a slice backed by dst's underlying memory. 2188 var buf []byte 2189 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2190 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 2191 hdr.Len = l.SizeBytes() 2192 hdr.Cap = l.SizeBytes() 2193 2194 length, err := writer.Write(buf) 2195 // Since we bypassed the compiler's escape analysis, indicate that l 2196 // must live until the use above. 2197 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 2198 return int64(length), err 2199 } 2200 2201 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2202 func (l *LinkAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 2203 if l.SizeBytes() > len(dst) { 2204 return dst, false 2205 } 2206 return l.MarshalUnsafe(dst), true 2207 } 2208 2209 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2210 func (l *LinkAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 2211 if l.SizeBytes() > len(src) { 2212 return src, false 2213 } 2214 return l.UnmarshalUnsafe(src), true 2215 } 2216 2217 // SizeBytes implements marshal.Marshallable.SizeBytes. 2218 func (l *ListenReq) SizeBytes() int { 2219 return 8 + 2220 (*FDID)(nil).SizeBytes() 2221 } 2222 2223 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2224 func (l *ListenReq) MarshalBytes(dst []byte) []byte { 2225 dst = l.FD.MarshalUnsafe(dst) 2226 hostarch.ByteOrder.PutUint32(dst[:4], uint32(l.Backlog)) 2227 dst = dst[4:] 2228 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2229 dst = dst[4:] 2230 return dst 2231 } 2232 2233 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2234 func (l *ListenReq) UnmarshalBytes(src []byte) []byte { 2235 src = l.FD.UnmarshalUnsafe(src) 2236 l.Backlog = int32(hostarch.ByteOrder.Uint32(src[:4])) 2237 src = src[4:] 2238 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2239 src = src[4:] 2240 return src 2241 } 2242 2243 // Packed implements marshal.Marshallable.Packed. 2244 //go:nosplit 2245 func (l *ListenReq) Packed() bool { 2246 return l.FD.Packed() 2247 } 2248 2249 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2250 func (l *ListenReq) MarshalUnsafe(dst []byte) []byte { 2251 if l.FD.Packed() { 2252 size := l.SizeBytes() 2253 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(l), uintptr(size)) 2254 return dst[size:] 2255 } 2256 // Type ListenReq doesn't have a packed layout in memory, fallback to MarshalBytes. 2257 return l.MarshalBytes(dst) 2258 } 2259 2260 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2261 func (l *ListenReq) UnmarshalUnsafe(src []byte) []byte { 2262 if l.FD.Packed() { 2263 size := l.SizeBytes() 2264 gohacks.Memmove(unsafe.Pointer(l), unsafe.Pointer(&src[0]), uintptr(size)) 2265 return src[size:] 2266 } 2267 // Type ListenReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2268 return l.UnmarshalBytes(src) 2269 } 2270 2271 // CopyOutN implements marshal.Marshallable.CopyOutN. 2272 func (l *ListenReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2273 if !l.FD.Packed() { 2274 // Type ListenReq doesn't have a packed layout in memory, fall back to MarshalBytes. 2275 buf := cc.CopyScratchBuffer(l.SizeBytes()) // escapes: okay. 2276 l.MarshalBytes(buf) // escapes: fallback. 2277 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2278 } 2279 2280 // Construct a slice backed by dst's underlying memory. 2281 var buf []byte 2282 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2283 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 2284 hdr.Len = l.SizeBytes() 2285 hdr.Cap = l.SizeBytes() 2286 2287 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2288 // Since we bypassed the compiler's escape analysis, indicate that l 2289 // must live until the use above. 2290 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 2291 return length, err 2292 } 2293 2294 // CopyOut implements marshal.Marshallable.CopyOut. 2295 func (l *ListenReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2296 return l.CopyOutN(cc, addr, l.SizeBytes()) 2297 } 2298 2299 // CopyIn implements marshal.Marshallable.CopyIn. 2300 func (l *ListenReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2301 if !l.FD.Packed() { 2302 // Type ListenReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2303 buf := cc.CopyScratchBuffer(l.SizeBytes()) // escapes: okay. 2304 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2305 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2306 // partially unmarshalled struct. 2307 l.UnmarshalBytes(buf) // escapes: fallback. 2308 return length, err 2309 } 2310 2311 // Construct a slice backed by dst's underlying memory. 2312 var buf []byte 2313 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2314 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 2315 hdr.Len = l.SizeBytes() 2316 hdr.Cap = l.SizeBytes() 2317 2318 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2319 // Since we bypassed the compiler's escape analysis, indicate that l 2320 // must live until the use above. 2321 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 2322 return length, err 2323 } 2324 2325 // WriteTo implements io.WriterTo.WriteTo. 2326 func (l *ListenReq) WriteTo(writer io.Writer) (int64, error) { 2327 if !l.FD.Packed() { 2328 // Type ListenReq doesn't have a packed layout in memory, fall back to MarshalBytes. 2329 buf := make([]byte, l.SizeBytes()) 2330 l.MarshalBytes(buf) 2331 length, err := writer.Write(buf) 2332 return int64(length), err 2333 } 2334 2335 // Construct a slice backed by dst's underlying memory. 2336 var buf []byte 2337 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2338 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(l))) 2339 hdr.Len = l.SizeBytes() 2340 hdr.Cap = l.SizeBytes() 2341 2342 length, err := writer.Write(buf) 2343 // Since we bypassed the compiler's escape analysis, indicate that l 2344 // must live until the use above. 2345 runtime.KeepAlive(l) // escapes: replaced by intrinsic. 2346 return int64(length), err 2347 } 2348 2349 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2350 func (l *ListenReq) CheckedMarshal(dst []byte) ([]byte, bool) { 2351 if l.SizeBytes() > len(dst) { 2352 return dst, false 2353 } 2354 return l.MarshalUnsafe(dst), true 2355 } 2356 2357 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2358 func (l *ListenReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 2359 if l.SizeBytes() > len(src) { 2360 return src, false 2361 } 2362 return l.UnmarshalUnsafe(src), true 2363 } 2364 2365 // SizeBytes implements marshal.Marshallable.SizeBytes. 2366 //go:nosplit 2367 func (m *MID) SizeBytes() int { 2368 return 2 2369 } 2370 2371 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2372 func (m *MID) MarshalBytes(dst []byte) []byte { 2373 hostarch.ByteOrder.PutUint16(dst[:2], uint16(*m)) 2374 return dst[2:] 2375 } 2376 2377 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2378 func (m *MID) UnmarshalBytes(src []byte) []byte { 2379 *m = MID(uint16(hostarch.ByteOrder.Uint16(src[:2]))) 2380 return src[2:] 2381 } 2382 2383 // Packed implements marshal.Marshallable.Packed. 2384 //go:nosplit 2385 func (m *MID) Packed() bool { 2386 // Scalar newtypes are always packed. 2387 return true 2388 } 2389 2390 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2391 func (m *MID) MarshalUnsafe(dst []byte) []byte { 2392 size := m.SizeBytes() 2393 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 2394 return dst[size:] 2395 } 2396 2397 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2398 func (m *MID) UnmarshalUnsafe(src []byte) []byte { 2399 size := m.SizeBytes() 2400 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 2401 return src[size:] 2402 } 2403 2404 // CopyOutN implements marshal.Marshallable.CopyOutN. 2405 func (m *MID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2406 // Construct a slice backed by dst's underlying memory. 2407 var buf []byte 2408 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2409 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2410 hdr.Len = m.SizeBytes() 2411 hdr.Cap = m.SizeBytes() 2412 2413 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2414 // Since we bypassed the compiler's escape analysis, indicate that m 2415 // must live until the use above. 2416 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2417 return length, err 2418 } 2419 2420 // CopyOut implements marshal.Marshallable.CopyOut. 2421 func (m *MID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2422 return m.CopyOutN(cc, addr, m.SizeBytes()) 2423 } 2424 2425 // CopyIn implements marshal.Marshallable.CopyIn. 2426 func (m *MID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2427 // Construct a slice backed by dst's underlying memory. 2428 var buf []byte 2429 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2430 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2431 hdr.Len = m.SizeBytes() 2432 hdr.Cap = m.SizeBytes() 2433 2434 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2435 // Since we bypassed the compiler's escape analysis, indicate that m 2436 // must live until the use above. 2437 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2438 return length, err 2439 } 2440 2441 // WriteTo implements io.WriterTo.WriteTo. 2442 func (m *MID) WriteTo(writer io.Writer) (int64, error) { 2443 // Construct a slice backed by dst's underlying memory. 2444 var buf []byte 2445 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2446 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2447 hdr.Len = m.SizeBytes() 2448 hdr.Cap = m.SizeBytes() 2449 2450 length, err := writer.Write(buf) 2451 // Since we bypassed the compiler's escape analysis, indicate that m 2452 // must live until the use above. 2453 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2454 return int64(length), err 2455 } 2456 2457 // CopyMIDSliceIn copies in a slice of MID objects from the task's memory. 2458 func CopyMIDSliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []MID) (int, error) { 2459 count := len(dst) 2460 if count == 0 { 2461 return 0, nil 2462 } 2463 size := (*MID)(nil).SizeBytes() 2464 2465 ptr := unsafe.Pointer(&dst) 2466 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2467 2468 // Construct a slice backed by dst's underlying memory. 2469 var buf []byte 2470 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2471 hdr.Data = uintptr(val) 2472 hdr.Len = size * count 2473 hdr.Cap = size * count 2474 2475 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2476 // Since we bypassed the compiler's escape analysis, indicate that dst 2477 // must live until the use above. 2478 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 2479 return length, err 2480 } 2481 2482 // CopyMIDSliceOut copies a slice of MID objects to the task's memory. 2483 func CopyMIDSliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []MID) (int, error) { 2484 count := len(src) 2485 if count == 0 { 2486 return 0, nil 2487 } 2488 size := (*MID)(nil).SizeBytes() 2489 2490 ptr := unsafe.Pointer(&src) 2491 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 2492 2493 // Construct a slice backed by dst's underlying memory. 2494 var buf []byte 2495 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2496 hdr.Data = uintptr(val) 2497 hdr.Len = size * count 2498 hdr.Cap = size * count 2499 2500 length, err := cc.CopyOutBytes(addr, buf) // escapes: okay. 2501 // Since we bypassed the compiler's escape analysis, indicate that src 2502 // must live until the use above. 2503 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 2504 return length, err 2505 } 2506 2507 // MarshalUnsafeMIDSlice is like MID.MarshalUnsafe, but for a []MID. 2508 func MarshalUnsafeMIDSlice(src []MID, dst []byte) []byte { 2509 count := len(src) 2510 if count == 0 { 2511 return dst 2512 } 2513 size := (*MID)(nil).SizeBytes() 2514 2515 buf := dst[:size*count] 2516 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 2517 return dst[size*count:] 2518 } 2519 2520 // UnmarshalUnsafeMIDSlice is like MID.UnmarshalUnsafe, but for a []MID. 2521 func UnmarshalUnsafeMIDSlice(dst []MID, src []byte) []byte { 2522 count := len(dst) 2523 if count == 0 { 2524 return src 2525 } 2526 size := (*MID)(nil).SizeBytes() 2527 2528 buf := src[:size*count] 2529 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 2530 return src[size*count:] 2531 } 2532 2533 // SizeBytes implements marshal.Marshallable.SizeBytes. 2534 func (m *MkdirAtResp) SizeBytes() int { 2535 return 0 + 2536 (*Inode)(nil).SizeBytes() 2537 } 2538 2539 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2540 func (m *MkdirAtResp) MarshalBytes(dst []byte) []byte { 2541 dst = m.ChildDir.MarshalUnsafe(dst) 2542 return dst 2543 } 2544 2545 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2546 func (m *MkdirAtResp) UnmarshalBytes(src []byte) []byte { 2547 src = m.ChildDir.UnmarshalUnsafe(src) 2548 return src 2549 } 2550 2551 // Packed implements marshal.Marshallable.Packed. 2552 //go:nosplit 2553 func (m *MkdirAtResp) Packed() bool { 2554 return m.ChildDir.Packed() 2555 } 2556 2557 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2558 func (m *MkdirAtResp) MarshalUnsafe(dst []byte) []byte { 2559 if m.ChildDir.Packed() { 2560 size := m.SizeBytes() 2561 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 2562 return dst[size:] 2563 } 2564 // Type MkdirAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 2565 return m.MarshalBytes(dst) 2566 } 2567 2568 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2569 func (m *MkdirAtResp) UnmarshalUnsafe(src []byte) []byte { 2570 if m.ChildDir.Packed() { 2571 size := m.SizeBytes() 2572 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 2573 return src[size:] 2574 } 2575 // Type MkdirAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2576 return m.UnmarshalBytes(src) 2577 } 2578 2579 // CopyOutN implements marshal.Marshallable.CopyOutN. 2580 func (m *MkdirAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2581 if !m.ChildDir.Packed() { 2582 // Type MkdirAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 2583 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 2584 m.MarshalBytes(buf) // escapes: fallback. 2585 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2586 } 2587 2588 // Construct a slice backed by dst's underlying memory. 2589 var buf []byte 2590 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2591 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2592 hdr.Len = m.SizeBytes() 2593 hdr.Cap = m.SizeBytes() 2594 2595 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2596 // Since we bypassed the compiler's escape analysis, indicate that m 2597 // must live until the use above. 2598 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2599 return length, err 2600 } 2601 2602 // CopyOut implements marshal.Marshallable.CopyOut. 2603 func (m *MkdirAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2604 return m.CopyOutN(cc, addr, m.SizeBytes()) 2605 } 2606 2607 // CopyIn implements marshal.Marshallable.CopyIn. 2608 func (m *MkdirAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2609 if !m.ChildDir.Packed() { 2610 // Type MkdirAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2611 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 2612 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2613 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2614 // partially unmarshalled struct. 2615 m.UnmarshalBytes(buf) // escapes: fallback. 2616 return length, err 2617 } 2618 2619 // Construct a slice backed by dst's underlying memory. 2620 var buf []byte 2621 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2622 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2623 hdr.Len = m.SizeBytes() 2624 hdr.Cap = m.SizeBytes() 2625 2626 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2627 // Since we bypassed the compiler's escape analysis, indicate that m 2628 // must live until the use above. 2629 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2630 return length, err 2631 } 2632 2633 // WriteTo implements io.WriterTo.WriteTo. 2634 func (m *MkdirAtResp) WriteTo(writer io.Writer) (int64, error) { 2635 if !m.ChildDir.Packed() { 2636 // Type MkdirAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 2637 buf := make([]byte, m.SizeBytes()) 2638 m.MarshalBytes(buf) 2639 length, err := writer.Write(buf) 2640 return int64(length), err 2641 } 2642 2643 // Construct a slice backed by dst's underlying memory. 2644 var buf []byte 2645 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2646 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2647 hdr.Len = m.SizeBytes() 2648 hdr.Cap = m.SizeBytes() 2649 2650 length, err := writer.Write(buf) 2651 // Since we bypassed the compiler's escape analysis, indicate that m 2652 // must live until the use above. 2653 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2654 return int64(length), err 2655 } 2656 2657 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2658 func (m *MkdirAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 2659 if m.SizeBytes() > len(dst) { 2660 return dst, false 2661 } 2662 return m.MarshalUnsafe(dst), true 2663 } 2664 2665 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2666 func (m *MkdirAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 2667 if m.SizeBytes() > len(src) { 2668 return src, false 2669 } 2670 return m.UnmarshalUnsafe(src), true 2671 } 2672 2673 // SizeBytes implements marshal.Marshallable.SizeBytes. 2674 func (m *MknodAtResp) SizeBytes() int { 2675 return 0 + 2676 (*Inode)(nil).SizeBytes() 2677 } 2678 2679 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2680 func (m *MknodAtResp) MarshalBytes(dst []byte) []byte { 2681 dst = m.Child.MarshalUnsafe(dst) 2682 return dst 2683 } 2684 2685 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2686 func (m *MknodAtResp) UnmarshalBytes(src []byte) []byte { 2687 src = m.Child.UnmarshalUnsafe(src) 2688 return src 2689 } 2690 2691 // Packed implements marshal.Marshallable.Packed. 2692 //go:nosplit 2693 func (m *MknodAtResp) Packed() bool { 2694 return m.Child.Packed() 2695 } 2696 2697 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2698 func (m *MknodAtResp) MarshalUnsafe(dst []byte) []byte { 2699 if m.Child.Packed() { 2700 size := m.SizeBytes() 2701 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 2702 return dst[size:] 2703 } 2704 // Type MknodAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 2705 return m.MarshalBytes(dst) 2706 } 2707 2708 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2709 func (m *MknodAtResp) UnmarshalUnsafe(src []byte) []byte { 2710 if m.Child.Packed() { 2711 size := m.SizeBytes() 2712 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 2713 return src[size:] 2714 } 2715 // Type MknodAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2716 return m.UnmarshalBytes(src) 2717 } 2718 2719 // CopyOutN implements marshal.Marshallable.CopyOutN. 2720 func (m *MknodAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2721 if !m.Child.Packed() { 2722 // Type MknodAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 2723 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 2724 m.MarshalBytes(buf) // escapes: fallback. 2725 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2726 } 2727 2728 // Construct a slice backed by dst's underlying memory. 2729 var buf []byte 2730 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2731 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2732 hdr.Len = m.SizeBytes() 2733 hdr.Cap = m.SizeBytes() 2734 2735 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2736 // Since we bypassed the compiler's escape analysis, indicate that m 2737 // must live until the use above. 2738 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2739 return length, err 2740 } 2741 2742 // CopyOut implements marshal.Marshallable.CopyOut. 2743 func (m *MknodAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2744 return m.CopyOutN(cc, addr, m.SizeBytes()) 2745 } 2746 2747 // CopyIn implements marshal.Marshallable.CopyIn. 2748 func (m *MknodAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2749 if !m.Child.Packed() { 2750 // Type MknodAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2751 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 2752 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2753 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2754 // partially unmarshalled struct. 2755 m.UnmarshalBytes(buf) // escapes: fallback. 2756 return length, err 2757 } 2758 2759 // Construct a slice backed by dst's underlying memory. 2760 var buf []byte 2761 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2762 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2763 hdr.Len = m.SizeBytes() 2764 hdr.Cap = m.SizeBytes() 2765 2766 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2767 // Since we bypassed the compiler's escape analysis, indicate that m 2768 // must live until the use above. 2769 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2770 return length, err 2771 } 2772 2773 // WriteTo implements io.WriterTo.WriteTo. 2774 func (m *MknodAtResp) WriteTo(writer io.Writer) (int64, error) { 2775 if !m.Child.Packed() { 2776 // Type MknodAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 2777 buf := make([]byte, m.SizeBytes()) 2778 m.MarshalBytes(buf) 2779 length, err := writer.Write(buf) 2780 return int64(length), err 2781 } 2782 2783 // Construct a slice backed by dst's underlying memory. 2784 var buf []byte 2785 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2786 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 2787 hdr.Len = m.SizeBytes() 2788 hdr.Cap = m.SizeBytes() 2789 2790 length, err := writer.Write(buf) 2791 // Since we bypassed the compiler's escape analysis, indicate that m 2792 // must live until the use above. 2793 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 2794 return int64(length), err 2795 } 2796 2797 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2798 func (m *MknodAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 2799 if m.SizeBytes() > len(dst) { 2800 return dst, false 2801 } 2802 return m.MarshalUnsafe(dst), true 2803 } 2804 2805 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2806 func (m *MknodAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 2807 if m.SizeBytes() > len(src) { 2808 return src, false 2809 } 2810 return m.UnmarshalUnsafe(src), true 2811 } 2812 2813 // SizeBytes implements marshal.Marshallable.SizeBytes. 2814 func (o *OpenAtReq) SizeBytes() int { 2815 return 8 + 2816 (*FDID)(nil).SizeBytes() 2817 } 2818 2819 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2820 func (o *OpenAtReq) MarshalBytes(dst []byte) []byte { 2821 dst = o.FD.MarshalUnsafe(dst) 2822 hostarch.ByteOrder.PutUint32(dst[:4], uint32(o.Flags)) 2823 dst = dst[4:] 2824 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 2825 dst = dst[4:] 2826 return dst 2827 } 2828 2829 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2830 func (o *OpenAtReq) UnmarshalBytes(src []byte) []byte { 2831 src = o.FD.UnmarshalUnsafe(src) 2832 o.Flags = uint32(hostarch.ByteOrder.Uint32(src[:4])) 2833 src = src[4:] 2834 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 2835 src = src[4:] 2836 return src 2837 } 2838 2839 // Packed implements marshal.Marshallable.Packed. 2840 //go:nosplit 2841 func (o *OpenAtReq) Packed() bool { 2842 return o.FD.Packed() 2843 } 2844 2845 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2846 func (o *OpenAtReq) MarshalUnsafe(dst []byte) []byte { 2847 if o.FD.Packed() { 2848 size := o.SizeBytes() 2849 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(size)) 2850 return dst[size:] 2851 } 2852 // Type OpenAtReq doesn't have a packed layout in memory, fallback to MarshalBytes. 2853 return o.MarshalBytes(dst) 2854 } 2855 2856 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2857 func (o *OpenAtReq) UnmarshalUnsafe(src []byte) []byte { 2858 if o.FD.Packed() { 2859 size := o.SizeBytes() 2860 gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(size)) 2861 return src[size:] 2862 } 2863 // Type OpenAtReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 2864 return o.UnmarshalBytes(src) 2865 } 2866 2867 // CopyOutN implements marshal.Marshallable.CopyOutN. 2868 func (o *OpenAtReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 2869 if !o.FD.Packed() { 2870 // Type OpenAtReq doesn't have a packed layout in memory, fall back to MarshalBytes. 2871 buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. 2872 o.MarshalBytes(buf) // escapes: fallback. 2873 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2874 } 2875 2876 // Construct a slice backed by dst's underlying memory. 2877 var buf []byte 2878 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2879 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 2880 hdr.Len = o.SizeBytes() 2881 hdr.Cap = o.SizeBytes() 2882 2883 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 2884 // Since we bypassed the compiler's escape analysis, indicate that o 2885 // must live until the use above. 2886 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 2887 return length, err 2888 } 2889 2890 // CopyOut implements marshal.Marshallable.CopyOut. 2891 func (o *OpenAtReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2892 return o.CopyOutN(cc, addr, o.SizeBytes()) 2893 } 2894 2895 // CopyIn implements marshal.Marshallable.CopyIn. 2896 func (o *OpenAtReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 2897 if !o.FD.Packed() { 2898 // Type OpenAtReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 2899 buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. 2900 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2901 // Unmarshal unconditionally. If we had a short copy-in, this results in a 2902 // partially unmarshalled struct. 2903 o.UnmarshalBytes(buf) // escapes: fallback. 2904 return length, err 2905 } 2906 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(o))) 2911 hdr.Len = o.SizeBytes() 2912 hdr.Cap = o.SizeBytes() 2913 2914 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 2915 // Since we bypassed the compiler's escape analysis, indicate that o 2916 // must live until the use above. 2917 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 2918 return length, err 2919 } 2920 2921 // WriteTo implements io.WriterTo.WriteTo. 2922 func (o *OpenAtReq) WriteTo(writer io.Writer) (int64, error) { 2923 if !o.FD.Packed() { 2924 // Type OpenAtReq doesn't have a packed layout in memory, fall back to MarshalBytes. 2925 buf := make([]byte, o.SizeBytes()) 2926 o.MarshalBytes(buf) 2927 length, err := writer.Write(buf) 2928 return int64(length), err 2929 } 2930 2931 // Construct a slice backed by dst's underlying memory. 2932 var buf []byte 2933 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 2934 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 2935 hdr.Len = o.SizeBytes() 2936 hdr.Cap = o.SizeBytes() 2937 2938 length, err := writer.Write(buf) 2939 // Since we bypassed the compiler's escape analysis, indicate that o 2940 // must live until the use above. 2941 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 2942 return int64(length), err 2943 } 2944 2945 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 2946 func (o *OpenAtReq) CheckedMarshal(dst []byte) ([]byte, bool) { 2947 if o.SizeBytes() > len(dst) { 2948 return dst, false 2949 } 2950 return o.MarshalUnsafe(dst), true 2951 } 2952 2953 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 2954 func (o *OpenAtReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 2955 if o.SizeBytes() > len(src) { 2956 return src, false 2957 } 2958 return o.UnmarshalUnsafe(src), true 2959 } 2960 2961 // SizeBytes implements marshal.Marshallable.SizeBytes. 2962 func (o *OpenAtResp) SizeBytes() int { 2963 return 0 + 2964 (*FDID)(nil).SizeBytes() 2965 } 2966 2967 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 2968 func (o *OpenAtResp) MarshalBytes(dst []byte) []byte { 2969 dst = o.OpenFD.MarshalUnsafe(dst) 2970 return dst 2971 } 2972 2973 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 2974 func (o *OpenAtResp) UnmarshalBytes(src []byte) []byte { 2975 src = o.OpenFD.UnmarshalUnsafe(src) 2976 return src 2977 } 2978 2979 // Packed implements marshal.Marshallable.Packed. 2980 //go:nosplit 2981 func (o *OpenAtResp) Packed() bool { 2982 return o.OpenFD.Packed() 2983 } 2984 2985 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 2986 func (o *OpenAtResp) MarshalUnsafe(dst []byte) []byte { 2987 if o.OpenFD.Packed() { 2988 size := o.SizeBytes() 2989 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(size)) 2990 return dst[size:] 2991 } 2992 // Type OpenAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 2993 return o.MarshalBytes(dst) 2994 } 2995 2996 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 2997 func (o *OpenAtResp) UnmarshalUnsafe(src []byte) []byte { 2998 if o.OpenFD.Packed() { 2999 size := o.SizeBytes() 3000 gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(size)) 3001 return src[size:] 3002 } 3003 // Type OpenAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3004 return o.UnmarshalBytes(src) 3005 } 3006 3007 // CopyOutN implements marshal.Marshallable.CopyOutN. 3008 func (o *OpenAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3009 if !o.OpenFD.Packed() { 3010 // Type OpenAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 3011 buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. 3012 o.MarshalBytes(buf) // escapes: fallback. 3013 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3014 } 3015 3016 // Construct a slice backed by dst's underlying memory. 3017 var buf []byte 3018 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3019 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 3020 hdr.Len = o.SizeBytes() 3021 hdr.Cap = o.SizeBytes() 3022 3023 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3024 // Since we bypassed the compiler's escape analysis, indicate that o 3025 // must live until the use above. 3026 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 3027 return length, err 3028 } 3029 3030 // CopyOut implements marshal.Marshallable.CopyOut. 3031 func (o *OpenAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3032 return o.CopyOutN(cc, addr, o.SizeBytes()) 3033 } 3034 3035 // CopyIn implements marshal.Marshallable.CopyIn. 3036 func (o *OpenAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3037 if !o.OpenFD.Packed() { 3038 // Type OpenAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3039 buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. 3040 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3041 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3042 // partially unmarshalled struct. 3043 o.UnmarshalBytes(buf) // escapes: fallback. 3044 return length, err 3045 } 3046 3047 // Construct a slice backed by dst's underlying memory. 3048 var buf []byte 3049 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3050 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 3051 hdr.Len = o.SizeBytes() 3052 hdr.Cap = o.SizeBytes() 3053 3054 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3055 // Since we bypassed the compiler's escape analysis, indicate that o 3056 // must live until the use above. 3057 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 3058 return length, err 3059 } 3060 3061 // WriteTo implements io.WriterTo.WriteTo. 3062 func (o *OpenAtResp) WriteTo(writer io.Writer) (int64, error) { 3063 if !o.OpenFD.Packed() { 3064 // Type OpenAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 3065 buf := make([]byte, o.SizeBytes()) 3066 o.MarshalBytes(buf) 3067 length, err := writer.Write(buf) 3068 return int64(length), err 3069 } 3070 3071 // Construct a slice backed by dst's underlying memory. 3072 var buf []byte 3073 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3074 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 3075 hdr.Len = o.SizeBytes() 3076 hdr.Cap = o.SizeBytes() 3077 3078 length, err := writer.Write(buf) 3079 // Since we bypassed the compiler's escape analysis, indicate that o 3080 // must live until the use above. 3081 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 3082 return int64(length), err 3083 } 3084 3085 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3086 func (o *OpenAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 3087 if o.SizeBytes() > len(dst) { 3088 return dst, false 3089 } 3090 return o.MarshalUnsafe(dst), true 3091 } 3092 3093 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3094 func (o *OpenAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 3095 if o.SizeBytes() > len(src) { 3096 return src, false 3097 } 3098 return o.UnmarshalUnsafe(src), true 3099 } 3100 3101 // SizeBytes implements marshal.Marshallable.SizeBytes. 3102 func (o *OpenCreateAtResp) SizeBytes() int { 3103 return 0 + 3104 (*Inode)(nil).SizeBytes() + 3105 (*FDID)(nil).SizeBytes() 3106 } 3107 3108 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3109 func (o *OpenCreateAtResp) MarshalBytes(dst []byte) []byte { 3110 dst = o.Child.MarshalUnsafe(dst) 3111 dst = o.NewFD.MarshalUnsafe(dst) 3112 return dst 3113 } 3114 3115 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3116 func (o *OpenCreateAtResp) UnmarshalBytes(src []byte) []byte { 3117 src = o.Child.UnmarshalUnsafe(src) 3118 src = o.NewFD.UnmarshalUnsafe(src) 3119 return src 3120 } 3121 3122 // Packed implements marshal.Marshallable.Packed. 3123 //go:nosplit 3124 func (o *OpenCreateAtResp) Packed() bool { 3125 return o.Child.Packed() && o.NewFD.Packed() 3126 } 3127 3128 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3129 func (o *OpenCreateAtResp) MarshalUnsafe(dst []byte) []byte { 3130 if o.Child.Packed() && o.NewFD.Packed() { 3131 size := o.SizeBytes() 3132 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(o), uintptr(size)) 3133 return dst[size:] 3134 } 3135 // Type OpenCreateAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 3136 return o.MarshalBytes(dst) 3137 } 3138 3139 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3140 func (o *OpenCreateAtResp) UnmarshalUnsafe(src []byte) []byte { 3141 if o.Child.Packed() && o.NewFD.Packed() { 3142 size := o.SizeBytes() 3143 gohacks.Memmove(unsafe.Pointer(o), unsafe.Pointer(&src[0]), uintptr(size)) 3144 return src[size:] 3145 } 3146 // Type OpenCreateAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3147 return o.UnmarshalBytes(src) 3148 } 3149 3150 // CopyOutN implements marshal.Marshallable.CopyOutN. 3151 func (o *OpenCreateAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3152 if !o.Child.Packed() && o.NewFD.Packed() { 3153 // Type OpenCreateAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 3154 buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. 3155 o.MarshalBytes(buf) // escapes: fallback. 3156 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3157 } 3158 3159 // Construct a slice backed by dst's underlying memory. 3160 var buf []byte 3161 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3162 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 3163 hdr.Len = o.SizeBytes() 3164 hdr.Cap = o.SizeBytes() 3165 3166 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3167 // Since we bypassed the compiler's escape analysis, indicate that o 3168 // must live until the use above. 3169 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 3170 return length, err 3171 } 3172 3173 // CopyOut implements marshal.Marshallable.CopyOut. 3174 func (o *OpenCreateAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3175 return o.CopyOutN(cc, addr, o.SizeBytes()) 3176 } 3177 3178 // CopyIn implements marshal.Marshallable.CopyIn. 3179 func (o *OpenCreateAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3180 if !o.Child.Packed() && o.NewFD.Packed() { 3181 // Type OpenCreateAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3182 buf := cc.CopyScratchBuffer(o.SizeBytes()) // escapes: okay. 3183 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3184 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3185 // partially unmarshalled struct. 3186 o.UnmarshalBytes(buf) // escapes: fallback. 3187 return length, err 3188 } 3189 3190 // Construct a slice backed by dst's underlying memory. 3191 var buf []byte 3192 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3193 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 3194 hdr.Len = o.SizeBytes() 3195 hdr.Cap = o.SizeBytes() 3196 3197 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3198 // Since we bypassed the compiler's escape analysis, indicate that o 3199 // must live until the use above. 3200 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 3201 return length, err 3202 } 3203 3204 // WriteTo implements io.WriterTo.WriteTo. 3205 func (o *OpenCreateAtResp) WriteTo(writer io.Writer) (int64, error) { 3206 if !o.Child.Packed() && o.NewFD.Packed() { 3207 // Type OpenCreateAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 3208 buf := make([]byte, o.SizeBytes()) 3209 o.MarshalBytes(buf) 3210 length, err := writer.Write(buf) 3211 return int64(length), err 3212 } 3213 3214 // Construct a slice backed by dst's underlying memory. 3215 var buf []byte 3216 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3217 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(o))) 3218 hdr.Len = o.SizeBytes() 3219 hdr.Cap = o.SizeBytes() 3220 3221 length, err := writer.Write(buf) 3222 // Since we bypassed the compiler's escape analysis, indicate that o 3223 // must live until the use above. 3224 runtime.KeepAlive(o) // escapes: replaced by intrinsic. 3225 return int64(length), err 3226 } 3227 3228 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3229 func (o *OpenCreateAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 3230 if o.SizeBytes() > len(dst) { 3231 return dst, false 3232 } 3233 return o.MarshalUnsafe(dst), true 3234 } 3235 3236 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3237 func (o *OpenCreateAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 3238 if o.SizeBytes() > len(src) { 3239 return src, false 3240 } 3241 return o.UnmarshalUnsafe(src), true 3242 } 3243 3244 // SizeBytes implements marshal.Marshallable.SizeBytes. 3245 func (r *PReadReq) SizeBytes() int { 3246 return 16 + 3247 (*FDID)(nil).SizeBytes() 3248 } 3249 3250 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3251 func (r *PReadReq) MarshalBytes(dst []byte) []byte { 3252 hostarch.ByteOrder.PutUint64(dst[:8], uint64(r.Offset)) 3253 dst = dst[8:] 3254 dst = r.FD.MarshalUnsafe(dst) 3255 hostarch.ByteOrder.PutUint32(dst[:4], uint32(r.Count)) 3256 dst = dst[4:] 3257 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 3258 dst = dst[4:] 3259 return dst 3260 } 3261 3262 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3263 func (r *PReadReq) UnmarshalBytes(src []byte) []byte { 3264 r.Offset = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3265 src = src[8:] 3266 src = r.FD.UnmarshalUnsafe(src) 3267 r.Count = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3268 src = src[4:] 3269 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 3270 src = src[4:] 3271 return src 3272 } 3273 3274 // Packed implements marshal.Marshallable.Packed. 3275 //go:nosplit 3276 func (r *PReadReq) Packed() bool { 3277 return r.FD.Packed() 3278 } 3279 3280 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3281 func (r *PReadReq) MarshalUnsafe(dst []byte) []byte { 3282 if r.FD.Packed() { 3283 size := r.SizeBytes() 3284 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 3285 return dst[size:] 3286 } 3287 // Type PReadReq doesn't have a packed layout in memory, fallback to MarshalBytes. 3288 return r.MarshalBytes(dst) 3289 } 3290 3291 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3292 func (r *PReadReq) UnmarshalUnsafe(src []byte) []byte { 3293 if r.FD.Packed() { 3294 size := r.SizeBytes() 3295 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 3296 return src[size:] 3297 } 3298 // Type PReadReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3299 return r.UnmarshalBytes(src) 3300 } 3301 3302 // CopyOutN implements marshal.Marshallable.CopyOutN. 3303 func (r *PReadReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3304 if !r.FD.Packed() { 3305 // Type PReadReq doesn't have a packed layout in memory, fall back to MarshalBytes. 3306 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3307 r.MarshalBytes(buf) // escapes: fallback. 3308 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3309 } 3310 3311 // Construct a slice backed by dst's underlying memory. 3312 var buf []byte 3313 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3314 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 3315 hdr.Len = r.SizeBytes() 3316 hdr.Cap = r.SizeBytes() 3317 3318 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3319 // Since we bypassed the compiler's escape analysis, indicate that r 3320 // must live until the use above. 3321 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 3322 return length, err 3323 } 3324 3325 // CopyOut implements marshal.Marshallable.CopyOut. 3326 func (r *PReadReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3327 return r.CopyOutN(cc, addr, r.SizeBytes()) 3328 } 3329 3330 // CopyIn implements marshal.Marshallable.CopyIn. 3331 func (r *PReadReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3332 if !r.FD.Packed() { 3333 // Type PReadReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3334 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3335 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3336 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3337 // partially unmarshalled struct. 3338 r.UnmarshalBytes(buf) // escapes: fallback. 3339 return length, err 3340 } 3341 3342 // Construct a slice backed by dst's underlying memory. 3343 var buf []byte 3344 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3345 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 3346 hdr.Len = r.SizeBytes() 3347 hdr.Cap = r.SizeBytes() 3348 3349 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3350 // Since we bypassed the compiler's escape analysis, indicate that r 3351 // must live until the use above. 3352 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 3353 return length, err 3354 } 3355 3356 // WriteTo implements io.WriterTo.WriteTo. 3357 func (r *PReadReq) WriteTo(writer io.Writer) (int64, error) { 3358 if !r.FD.Packed() { 3359 // Type PReadReq doesn't have a packed layout in memory, fall back to MarshalBytes. 3360 buf := make([]byte, r.SizeBytes()) 3361 r.MarshalBytes(buf) 3362 length, err := writer.Write(buf) 3363 return int64(length), err 3364 } 3365 3366 // Construct a slice backed by dst's underlying memory. 3367 var buf []byte 3368 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3369 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 3370 hdr.Len = r.SizeBytes() 3371 hdr.Cap = r.SizeBytes() 3372 3373 length, err := writer.Write(buf) 3374 // Since we bypassed the compiler's escape analysis, indicate that r 3375 // must live until the use above. 3376 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 3377 return int64(length), err 3378 } 3379 3380 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3381 func (r *PReadReq) CheckedMarshal(dst []byte) ([]byte, bool) { 3382 if r.SizeBytes() > len(dst) { 3383 return dst, false 3384 } 3385 return r.MarshalUnsafe(dst), true 3386 } 3387 3388 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3389 func (r *PReadReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 3390 if r.SizeBytes() > len(src) { 3391 return src, false 3392 } 3393 return r.UnmarshalUnsafe(src), true 3394 } 3395 3396 // SizeBytes implements marshal.Marshallable.SizeBytes. 3397 func (w *PWriteResp) SizeBytes() int { 3398 return 8 3399 } 3400 3401 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3402 func (w *PWriteResp) MarshalBytes(dst []byte) []byte { 3403 hostarch.ByteOrder.PutUint64(dst[:8], uint64(w.Count)) 3404 dst = dst[8:] 3405 return dst 3406 } 3407 3408 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3409 func (w *PWriteResp) UnmarshalBytes(src []byte) []byte { 3410 w.Count = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3411 src = src[8:] 3412 return src 3413 } 3414 3415 // Packed implements marshal.Marshallable.Packed. 3416 //go:nosplit 3417 func (w *PWriteResp) Packed() bool { 3418 return true 3419 } 3420 3421 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3422 func (w *PWriteResp) MarshalUnsafe(dst []byte) []byte { 3423 size := w.SizeBytes() 3424 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(w), uintptr(size)) 3425 return dst[size:] 3426 } 3427 3428 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3429 func (w *PWriteResp) UnmarshalUnsafe(src []byte) []byte { 3430 size := w.SizeBytes() 3431 gohacks.Memmove(unsafe.Pointer(w), unsafe.Pointer(&src[0]), uintptr(size)) 3432 return src[size:] 3433 } 3434 3435 // CopyOutN implements marshal.Marshallable.CopyOutN. 3436 func (w *PWriteResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3437 // Construct a slice backed by dst's underlying memory. 3438 var buf []byte 3439 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3440 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 3441 hdr.Len = w.SizeBytes() 3442 hdr.Cap = w.SizeBytes() 3443 3444 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3445 // Since we bypassed the compiler's escape analysis, indicate that w 3446 // must live until the use above. 3447 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 3448 return length, err 3449 } 3450 3451 // CopyOut implements marshal.Marshallable.CopyOut. 3452 func (w *PWriteResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3453 return w.CopyOutN(cc, addr, w.SizeBytes()) 3454 } 3455 3456 // CopyIn implements marshal.Marshallable.CopyIn. 3457 func (w *PWriteResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3458 // Construct a slice backed by dst's underlying memory. 3459 var buf []byte 3460 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3461 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 3462 hdr.Len = w.SizeBytes() 3463 hdr.Cap = w.SizeBytes() 3464 3465 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3466 // Since we bypassed the compiler's escape analysis, indicate that w 3467 // must live until the use above. 3468 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 3469 return length, err 3470 } 3471 3472 // WriteTo implements io.WriterTo.WriteTo. 3473 func (w *PWriteResp) WriteTo(writer io.Writer) (int64, error) { 3474 // Construct a slice backed by dst's underlying memory. 3475 var buf []byte 3476 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3477 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(w))) 3478 hdr.Len = w.SizeBytes() 3479 hdr.Cap = w.SizeBytes() 3480 3481 length, err := writer.Write(buf) 3482 // Since we bypassed the compiler's escape analysis, indicate that w 3483 // must live until the use above. 3484 runtime.KeepAlive(w) // escapes: replaced by intrinsic. 3485 return int64(length), err 3486 } 3487 3488 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3489 func (w *PWriteResp) CheckedMarshal(dst []byte) ([]byte, bool) { 3490 if w.SizeBytes() > len(dst) { 3491 return dst, false 3492 } 3493 return w.MarshalUnsafe(dst), true 3494 } 3495 3496 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3497 func (w *PWriteResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 3498 if w.SizeBytes() > len(src) { 3499 return src, false 3500 } 3501 return w.UnmarshalUnsafe(src), true 3502 } 3503 3504 // SizeBytes implements marshal.Marshallable.SizeBytes. 3505 func (r *ReadLinkAtReq) SizeBytes() int { 3506 return 0 + 3507 (*FDID)(nil).SizeBytes() 3508 } 3509 3510 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3511 func (r *ReadLinkAtReq) MarshalBytes(dst []byte) []byte { 3512 dst = r.FD.MarshalUnsafe(dst) 3513 return dst 3514 } 3515 3516 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3517 func (r *ReadLinkAtReq) UnmarshalBytes(src []byte) []byte { 3518 src = r.FD.UnmarshalUnsafe(src) 3519 return src 3520 } 3521 3522 // Packed implements marshal.Marshallable.Packed. 3523 //go:nosplit 3524 func (r *ReadLinkAtReq) Packed() bool { 3525 return r.FD.Packed() 3526 } 3527 3528 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3529 func (r *ReadLinkAtReq) MarshalUnsafe(dst []byte) []byte { 3530 if r.FD.Packed() { 3531 size := r.SizeBytes() 3532 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(r), uintptr(size)) 3533 return dst[size:] 3534 } 3535 // Type ReadLinkAtReq doesn't have a packed layout in memory, fallback to MarshalBytes. 3536 return r.MarshalBytes(dst) 3537 } 3538 3539 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3540 func (r *ReadLinkAtReq) UnmarshalUnsafe(src []byte) []byte { 3541 if r.FD.Packed() { 3542 size := r.SizeBytes() 3543 gohacks.Memmove(unsafe.Pointer(r), unsafe.Pointer(&src[0]), uintptr(size)) 3544 return src[size:] 3545 } 3546 // Type ReadLinkAtReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3547 return r.UnmarshalBytes(src) 3548 } 3549 3550 // CopyOutN implements marshal.Marshallable.CopyOutN. 3551 func (r *ReadLinkAtReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3552 if !r.FD.Packed() { 3553 // Type ReadLinkAtReq doesn't have a packed layout in memory, fall back to MarshalBytes. 3554 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3555 r.MarshalBytes(buf) // escapes: fallback. 3556 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3557 } 3558 3559 // Construct a slice backed by dst's underlying memory. 3560 var buf []byte 3561 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3562 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 3563 hdr.Len = r.SizeBytes() 3564 hdr.Cap = r.SizeBytes() 3565 3566 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3567 // Since we bypassed the compiler's escape analysis, indicate that r 3568 // must live until the use above. 3569 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 3570 return length, err 3571 } 3572 3573 // CopyOut implements marshal.Marshallable.CopyOut. 3574 func (r *ReadLinkAtReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3575 return r.CopyOutN(cc, addr, r.SizeBytes()) 3576 } 3577 3578 // CopyIn implements marshal.Marshallable.CopyIn. 3579 func (r *ReadLinkAtReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3580 if !r.FD.Packed() { 3581 // Type ReadLinkAtReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3582 buf := cc.CopyScratchBuffer(r.SizeBytes()) // escapes: okay. 3583 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3584 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3585 // partially unmarshalled struct. 3586 r.UnmarshalBytes(buf) // escapes: fallback. 3587 return length, err 3588 } 3589 3590 // Construct a slice backed by dst's underlying memory. 3591 var buf []byte 3592 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3593 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 3594 hdr.Len = r.SizeBytes() 3595 hdr.Cap = r.SizeBytes() 3596 3597 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3598 // Since we bypassed the compiler's escape analysis, indicate that r 3599 // must live until the use above. 3600 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 3601 return length, err 3602 } 3603 3604 // WriteTo implements io.WriterTo.WriteTo. 3605 func (r *ReadLinkAtReq) WriteTo(writer io.Writer) (int64, error) { 3606 if !r.FD.Packed() { 3607 // Type ReadLinkAtReq doesn't have a packed layout in memory, fall back to MarshalBytes. 3608 buf := make([]byte, r.SizeBytes()) 3609 r.MarshalBytes(buf) 3610 length, err := writer.Write(buf) 3611 return int64(length), err 3612 } 3613 3614 // Construct a slice backed by dst's underlying memory. 3615 var buf []byte 3616 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3617 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(r))) 3618 hdr.Len = r.SizeBytes() 3619 hdr.Cap = r.SizeBytes() 3620 3621 length, err := writer.Write(buf) 3622 // Since we bypassed the compiler's escape analysis, indicate that r 3623 // must live until the use above. 3624 runtime.KeepAlive(r) // escapes: replaced by intrinsic. 3625 return int64(length), err 3626 } 3627 3628 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3629 func (r *ReadLinkAtReq) CheckedMarshal(dst []byte) ([]byte, bool) { 3630 if r.SizeBytes() > len(dst) { 3631 return dst, false 3632 } 3633 return r.MarshalUnsafe(dst), true 3634 } 3635 3636 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3637 func (r *ReadLinkAtReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 3638 if r.SizeBytes() > len(src) { 3639 return src, false 3640 } 3641 return r.UnmarshalUnsafe(src), true 3642 } 3643 3644 // SizeBytes implements marshal.Marshallable.SizeBytes. 3645 func (s *SetStatReq) SizeBytes() int { 3646 return 16 + 3647 (*FDID)(nil).SizeBytes() + 3648 (*UID)(nil).SizeBytes() + 3649 (*GID)(nil).SizeBytes() + 3650 (*linux.Timespec)(nil).SizeBytes() + 3651 (*linux.Timespec)(nil).SizeBytes() 3652 } 3653 3654 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3655 func (s *SetStatReq) MarshalBytes(dst []byte) []byte { 3656 dst = s.FD.MarshalUnsafe(dst) 3657 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mask)) 3658 dst = dst[4:] 3659 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.Mode)) 3660 dst = dst[4:] 3661 dst = s.UID.MarshalUnsafe(dst) 3662 dst = s.GID.MarshalUnsafe(dst) 3663 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Size)) 3664 dst = dst[8:] 3665 dst = s.Atime.MarshalUnsafe(dst) 3666 dst = s.Mtime.MarshalUnsafe(dst) 3667 return dst 3668 } 3669 3670 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3671 func (s *SetStatReq) UnmarshalBytes(src []byte) []byte { 3672 src = s.FD.UnmarshalUnsafe(src) 3673 s.Mask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3674 src = src[4:] 3675 s.Mode = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3676 src = src[4:] 3677 src = s.UID.UnmarshalUnsafe(src) 3678 src = s.GID.UnmarshalUnsafe(src) 3679 s.Size = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3680 src = src[8:] 3681 src = s.Atime.UnmarshalUnsafe(src) 3682 src = s.Mtime.UnmarshalUnsafe(src) 3683 return src 3684 } 3685 3686 // Packed implements marshal.Marshallable.Packed. 3687 //go:nosplit 3688 func (s *SetStatReq) Packed() bool { 3689 return s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() 3690 } 3691 3692 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3693 func (s *SetStatReq) MarshalUnsafe(dst []byte) []byte { 3694 if s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() { 3695 size := s.SizeBytes() 3696 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 3697 return dst[size:] 3698 } 3699 // Type SetStatReq doesn't have a packed layout in memory, fallback to MarshalBytes. 3700 return s.MarshalBytes(dst) 3701 } 3702 3703 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3704 func (s *SetStatReq) UnmarshalUnsafe(src []byte) []byte { 3705 if s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() { 3706 size := s.SizeBytes() 3707 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 3708 return src[size:] 3709 } 3710 // Type SetStatReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 3711 return s.UnmarshalBytes(src) 3712 } 3713 3714 // CopyOutN implements marshal.Marshallable.CopyOutN. 3715 func (s *SetStatReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3716 if !s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() { 3717 // Type SetStatReq doesn't have a packed layout in memory, fall back to MarshalBytes. 3718 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 3719 s.MarshalBytes(buf) // escapes: fallback. 3720 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3721 } 3722 3723 // Construct a slice backed by dst's underlying memory. 3724 var buf []byte 3725 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3726 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3727 hdr.Len = s.SizeBytes() 3728 hdr.Cap = s.SizeBytes() 3729 3730 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3731 // Since we bypassed the compiler's escape analysis, indicate that s 3732 // must live until the use above. 3733 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 3734 return length, err 3735 } 3736 3737 // CopyOut implements marshal.Marshallable.CopyOut. 3738 func (s *SetStatReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3739 return s.CopyOutN(cc, addr, s.SizeBytes()) 3740 } 3741 3742 // CopyIn implements marshal.Marshallable.CopyIn. 3743 func (s *SetStatReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3744 if !s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() { 3745 // Type SetStatReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 3746 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 3747 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3748 // Unmarshal unconditionally. If we had a short copy-in, this results in a 3749 // partially unmarshalled struct. 3750 s.UnmarshalBytes(buf) // escapes: fallback. 3751 return length, err 3752 } 3753 3754 // Construct a slice backed by dst's underlying memory. 3755 var buf []byte 3756 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3757 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3758 hdr.Len = s.SizeBytes() 3759 hdr.Cap = s.SizeBytes() 3760 3761 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3762 // Since we bypassed the compiler's escape analysis, indicate that s 3763 // must live until the use above. 3764 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 3765 return length, err 3766 } 3767 3768 // WriteTo implements io.WriterTo.WriteTo. 3769 func (s *SetStatReq) WriteTo(writer io.Writer) (int64, error) { 3770 if !s.Atime.Packed() && s.FD.Packed() && s.GID.Packed() && s.Mtime.Packed() && s.UID.Packed() { 3771 // Type SetStatReq doesn't have a packed layout in memory, fall back to MarshalBytes. 3772 buf := make([]byte, s.SizeBytes()) 3773 s.MarshalBytes(buf) 3774 length, err := writer.Write(buf) 3775 return int64(length), err 3776 } 3777 3778 // Construct a slice backed by dst's underlying memory. 3779 var buf []byte 3780 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3781 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3782 hdr.Len = s.SizeBytes() 3783 hdr.Cap = s.SizeBytes() 3784 3785 length, err := writer.Write(buf) 3786 // Since we bypassed the compiler's escape analysis, indicate that s 3787 // must live until the use above. 3788 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 3789 return int64(length), err 3790 } 3791 3792 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3793 func (s *SetStatReq) CheckedMarshal(dst []byte) ([]byte, bool) { 3794 if s.SizeBytes() > len(dst) { 3795 return dst, false 3796 } 3797 return s.MarshalUnsafe(dst), true 3798 } 3799 3800 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3801 func (s *SetStatReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 3802 if s.SizeBytes() > len(src) { 3803 return src, false 3804 } 3805 return s.UnmarshalUnsafe(src), true 3806 } 3807 3808 // SizeBytes implements marshal.Marshallable.SizeBytes. 3809 func (s *SetStatResp) SizeBytes() int { 3810 return 8 3811 } 3812 3813 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3814 func (s *SetStatResp) MarshalBytes(dst []byte) []byte { 3815 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FailureMask)) 3816 dst = dst[4:] 3817 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.FailureErrNo)) 3818 dst = dst[4:] 3819 return dst 3820 } 3821 3822 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3823 func (s *SetStatResp) UnmarshalBytes(src []byte) []byte { 3824 s.FailureMask = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3825 src = src[4:] 3826 s.FailureErrNo = uint32(hostarch.ByteOrder.Uint32(src[:4])) 3827 src = src[4:] 3828 return src 3829 } 3830 3831 // Packed implements marshal.Marshallable.Packed. 3832 //go:nosplit 3833 func (s *SetStatResp) Packed() bool { 3834 return true 3835 } 3836 3837 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3838 func (s *SetStatResp) MarshalUnsafe(dst []byte) []byte { 3839 size := s.SizeBytes() 3840 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 3841 return dst[size:] 3842 } 3843 3844 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3845 func (s *SetStatResp) UnmarshalUnsafe(src []byte) []byte { 3846 size := s.SizeBytes() 3847 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 3848 return src[size:] 3849 } 3850 3851 // CopyOutN implements marshal.Marshallable.CopyOutN. 3852 func (s *SetStatResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3853 // Construct a slice backed by dst's underlying memory. 3854 var buf []byte 3855 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3856 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3857 hdr.Len = s.SizeBytes() 3858 hdr.Cap = s.SizeBytes() 3859 3860 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3861 // Since we bypassed the compiler's escape analysis, indicate that s 3862 // must live until the use above. 3863 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 3864 return length, err 3865 } 3866 3867 // CopyOut implements marshal.Marshallable.CopyOut. 3868 func (s *SetStatResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3869 return s.CopyOutN(cc, addr, s.SizeBytes()) 3870 } 3871 3872 // CopyIn implements marshal.Marshallable.CopyIn. 3873 func (s *SetStatResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 3874 // Construct a slice backed by dst's underlying memory. 3875 var buf []byte 3876 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3877 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3878 hdr.Len = s.SizeBytes() 3879 hdr.Cap = s.SizeBytes() 3880 3881 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 3882 // Since we bypassed the compiler's escape analysis, indicate that s 3883 // must live until the use above. 3884 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 3885 return length, err 3886 } 3887 3888 // WriteTo implements io.WriterTo.WriteTo. 3889 func (s *SetStatResp) WriteTo(writer io.Writer) (int64, error) { 3890 // Construct a slice backed by dst's underlying memory. 3891 var buf []byte 3892 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3893 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3894 hdr.Len = s.SizeBytes() 3895 hdr.Cap = s.SizeBytes() 3896 3897 length, err := writer.Write(buf) 3898 // Since we bypassed the compiler's escape analysis, indicate that s 3899 // must live until the use above. 3900 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 3901 return int64(length), err 3902 } 3903 3904 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 3905 func (s *SetStatResp) CheckedMarshal(dst []byte) ([]byte, bool) { 3906 if s.SizeBytes() > len(dst) { 3907 return dst, false 3908 } 3909 return s.MarshalUnsafe(dst), true 3910 } 3911 3912 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 3913 func (s *SetStatResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 3914 if s.SizeBytes() > len(src) { 3915 return src, false 3916 } 3917 return s.UnmarshalUnsafe(src), true 3918 } 3919 3920 // SizeBytes implements marshal.Marshallable.SizeBytes. 3921 func (s *StatFS) SizeBytes() int { 3922 return 64 3923 } 3924 3925 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 3926 func (s *StatFS) MarshalBytes(dst []byte) []byte { 3927 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Type)) 3928 dst = dst[8:] 3929 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlockSize)) 3930 dst = dst[8:] 3931 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Blocks)) 3932 dst = dst[8:] 3933 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksFree)) 3934 dst = dst[8:] 3935 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.BlocksAvailable)) 3936 dst = dst[8:] 3937 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.Files)) 3938 dst = dst[8:] 3939 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.FilesFree)) 3940 dst = dst[8:] 3941 hostarch.ByteOrder.PutUint64(dst[:8], uint64(s.NameLength)) 3942 dst = dst[8:] 3943 return dst 3944 } 3945 3946 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 3947 func (s *StatFS) UnmarshalBytes(src []byte) []byte { 3948 s.Type = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3949 src = src[8:] 3950 s.BlockSize = int64(hostarch.ByteOrder.Uint64(src[:8])) 3951 src = src[8:] 3952 s.Blocks = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3953 src = src[8:] 3954 s.BlocksFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3955 src = src[8:] 3956 s.BlocksAvailable = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3957 src = src[8:] 3958 s.Files = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3959 src = src[8:] 3960 s.FilesFree = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3961 src = src[8:] 3962 s.NameLength = uint64(hostarch.ByteOrder.Uint64(src[:8])) 3963 src = src[8:] 3964 return src 3965 } 3966 3967 // Packed implements marshal.Marshallable.Packed. 3968 //go:nosplit 3969 func (s *StatFS) Packed() bool { 3970 return true 3971 } 3972 3973 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 3974 func (s *StatFS) MarshalUnsafe(dst []byte) []byte { 3975 size := s.SizeBytes() 3976 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 3977 return dst[size:] 3978 } 3979 3980 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 3981 func (s *StatFS) UnmarshalUnsafe(src []byte) []byte { 3982 size := s.SizeBytes() 3983 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 3984 return src[size:] 3985 } 3986 3987 // CopyOutN implements marshal.Marshallable.CopyOutN. 3988 func (s *StatFS) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 3989 // Construct a slice backed by dst's underlying memory. 3990 var buf []byte 3991 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 3992 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 3993 hdr.Len = s.SizeBytes() 3994 hdr.Cap = s.SizeBytes() 3995 3996 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 3997 // Since we bypassed the compiler's escape analysis, indicate that s 3998 // must live until the use above. 3999 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4000 return length, err 4001 } 4002 4003 // CopyOut implements marshal.Marshallable.CopyOut. 4004 func (s *StatFS) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4005 return s.CopyOutN(cc, addr, s.SizeBytes()) 4006 } 4007 4008 // CopyIn implements marshal.Marshallable.CopyIn. 4009 func (s *StatFS) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4010 // Construct a slice backed by dst's underlying memory. 4011 var buf []byte 4012 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4013 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4014 hdr.Len = s.SizeBytes() 4015 hdr.Cap = s.SizeBytes() 4016 4017 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4018 // Since we bypassed the compiler's escape analysis, indicate that s 4019 // must live until the use above. 4020 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4021 return length, err 4022 } 4023 4024 // WriteTo implements io.WriterTo.WriteTo. 4025 func (s *StatFS) WriteTo(writer io.Writer) (int64, error) { 4026 // Construct a slice backed by dst's underlying memory. 4027 var buf []byte 4028 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4029 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4030 hdr.Len = s.SizeBytes() 4031 hdr.Cap = s.SizeBytes() 4032 4033 length, err := writer.Write(buf) 4034 // Since we bypassed the compiler's escape analysis, indicate that s 4035 // must live until the use above. 4036 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4037 return int64(length), err 4038 } 4039 4040 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 4041 func (s *StatFS) CheckedMarshal(dst []byte) ([]byte, bool) { 4042 if s.SizeBytes() > len(dst) { 4043 return dst, false 4044 } 4045 return s.MarshalUnsafe(dst), true 4046 } 4047 4048 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 4049 func (s *StatFS) CheckedUnmarshal(src []byte) ([]byte, bool) { 4050 if s.SizeBytes() > len(src) { 4051 return src, false 4052 } 4053 return s.UnmarshalUnsafe(src), true 4054 } 4055 4056 // SizeBytes implements marshal.Marshallable.SizeBytes. 4057 func (s *StatReq) SizeBytes() int { 4058 return 0 + 4059 (*FDID)(nil).SizeBytes() 4060 } 4061 4062 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4063 func (s *StatReq) MarshalBytes(dst []byte) []byte { 4064 dst = s.FD.MarshalUnsafe(dst) 4065 return dst 4066 } 4067 4068 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4069 func (s *StatReq) UnmarshalBytes(src []byte) []byte { 4070 src = s.FD.UnmarshalUnsafe(src) 4071 return src 4072 } 4073 4074 // Packed implements marshal.Marshallable.Packed. 4075 //go:nosplit 4076 func (s *StatReq) Packed() bool { 4077 return s.FD.Packed() 4078 } 4079 4080 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4081 func (s *StatReq) MarshalUnsafe(dst []byte) []byte { 4082 if s.FD.Packed() { 4083 size := s.SizeBytes() 4084 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 4085 return dst[size:] 4086 } 4087 // Type StatReq doesn't have a packed layout in memory, fallback to MarshalBytes. 4088 return s.MarshalBytes(dst) 4089 } 4090 4091 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4092 func (s *StatReq) UnmarshalUnsafe(src []byte) []byte { 4093 if s.FD.Packed() { 4094 size := s.SizeBytes() 4095 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 4096 return src[size:] 4097 } 4098 // Type StatReq doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4099 return s.UnmarshalBytes(src) 4100 } 4101 4102 // CopyOutN implements marshal.Marshallable.CopyOutN. 4103 func (s *StatReq) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4104 if !s.FD.Packed() { 4105 // Type StatReq doesn't have a packed layout in memory, fall back to MarshalBytes. 4106 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 4107 s.MarshalBytes(buf) // escapes: fallback. 4108 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4109 } 4110 4111 // Construct a slice backed by dst's underlying memory. 4112 var buf []byte 4113 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4114 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4115 hdr.Len = s.SizeBytes() 4116 hdr.Cap = s.SizeBytes() 4117 4118 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4119 // Since we bypassed the compiler's escape analysis, indicate that s 4120 // must live until the use above. 4121 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4122 return length, err 4123 } 4124 4125 // CopyOut implements marshal.Marshallable.CopyOut. 4126 func (s *StatReq) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4127 return s.CopyOutN(cc, addr, s.SizeBytes()) 4128 } 4129 4130 // CopyIn implements marshal.Marshallable.CopyIn. 4131 func (s *StatReq) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4132 if !s.FD.Packed() { 4133 // Type StatReq doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4134 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 4135 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4136 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4137 // partially unmarshalled struct. 4138 s.UnmarshalBytes(buf) // escapes: fallback. 4139 return length, err 4140 } 4141 4142 // Construct a slice backed by dst's underlying memory. 4143 var buf []byte 4144 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4145 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4146 hdr.Len = s.SizeBytes() 4147 hdr.Cap = s.SizeBytes() 4148 4149 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4150 // Since we bypassed the compiler's escape analysis, indicate that s 4151 // must live until the use above. 4152 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4153 return length, err 4154 } 4155 4156 // WriteTo implements io.WriterTo.WriteTo. 4157 func (s *StatReq) WriteTo(writer io.Writer) (int64, error) { 4158 if !s.FD.Packed() { 4159 // Type StatReq doesn't have a packed layout in memory, fall back to MarshalBytes. 4160 buf := make([]byte, s.SizeBytes()) 4161 s.MarshalBytes(buf) 4162 length, err := writer.Write(buf) 4163 return int64(length), err 4164 } 4165 4166 // Construct a slice backed by dst's underlying memory. 4167 var buf []byte 4168 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4169 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4170 hdr.Len = s.SizeBytes() 4171 hdr.Cap = s.SizeBytes() 4172 4173 length, err := writer.Write(buf) 4174 // Since we bypassed the compiler's escape analysis, indicate that s 4175 // must live until the use above. 4176 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4177 return int64(length), err 4178 } 4179 4180 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 4181 func (s *StatReq) CheckedMarshal(dst []byte) ([]byte, bool) { 4182 if s.SizeBytes() > len(dst) { 4183 return dst, false 4184 } 4185 return s.MarshalUnsafe(dst), true 4186 } 4187 4188 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 4189 func (s *StatReq) CheckedUnmarshal(src []byte) ([]byte, bool) { 4190 if s.SizeBytes() > len(src) { 4191 return src, false 4192 } 4193 return s.UnmarshalUnsafe(src), true 4194 } 4195 4196 // SizeBytes implements marshal.Marshallable.SizeBytes. 4197 func (s *SymlinkAtResp) SizeBytes() int { 4198 return 0 + 4199 (*Inode)(nil).SizeBytes() 4200 } 4201 4202 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4203 func (s *SymlinkAtResp) MarshalBytes(dst []byte) []byte { 4204 dst = s.Symlink.MarshalUnsafe(dst) 4205 return dst 4206 } 4207 4208 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4209 func (s *SymlinkAtResp) UnmarshalBytes(src []byte) []byte { 4210 src = s.Symlink.UnmarshalUnsafe(src) 4211 return src 4212 } 4213 4214 // Packed implements marshal.Marshallable.Packed. 4215 //go:nosplit 4216 func (s *SymlinkAtResp) Packed() bool { 4217 return s.Symlink.Packed() 4218 } 4219 4220 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4221 func (s *SymlinkAtResp) MarshalUnsafe(dst []byte) []byte { 4222 if s.Symlink.Packed() { 4223 size := s.SizeBytes() 4224 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 4225 return dst[size:] 4226 } 4227 // Type SymlinkAtResp doesn't have a packed layout in memory, fallback to MarshalBytes. 4228 return s.MarshalBytes(dst) 4229 } 4230 4231 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4232 func (s *SymlinkAtResp) UnmarshalUnsafe(src []byte) []byte { 4233 if s.Symlink.Packed() { 4234 size := s.SizeBytes() 4235 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 4236 return src[size:] 4237 } 4238 // Type SymlinkAtResp doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4239 return s.UnmarshalBytes(src) 4240 } 4241 4242 // CopyOutN implements marshal.Marshallable.CopyOutN. 4243 func (s *SymlinkAtResp) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4244 if !s.Symlink.Packed() { 4245 // Type SymlinkAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 4246 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 4247 s.MarshalBytes(buf) // escapes: fallback. 4248 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4249 } 4250 4251 // Construct a slice backed by dst's underlying memory. 4252 var buf []byte 4253 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4254 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4255 hdr.Len = s.SizeBytes() 4256 hdr.Cap = s.SizeBytes() 4257 4258 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4259 // Since we bypassed the compiler's escape analysis, indicate that s 4260 // must live until the use above. 4261 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4262 return length, err 4263 } 4264 4265 // CopyOut implements marshal.Marshallable.CopyOut. 4266 func (s *SymlinkAtResp) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4267 return s.CopyOutN(cc, addr, s.SizeBytes()) 4268 } 4269 4270 // CopyIn implements marshal.Marshallable.CopyIn. 4271 func (s *SymlinkAtResp) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4272 if !s.Symlink.Packed() { 4273 // Type SymlinkAtResp doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4274 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 4275 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4276 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4277 // partially unmarshalled struct. 4278 s.UnmarshalBytes(buf) // escapes: fallback. 4279 return length, err 4280 } 4281 4282 // Construct a slice backed by dst's underlying memory. 4283 var buf []byte 4284 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4285 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4286 hdr.Len = s.SizeBytes() 4287 hdr.Cap = s.SizeBytes() 4288 4289 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4290 // Since we bypassed the compiler's escape analysis, indicate that s 4291 // must live until the use above. 4292 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4293 return length, err 4294 } 4295 4296 // WriteTo implements io.WriterTo.WriteTo. 4297 func (s *SymlinkAtResp) WriteTo(writer io.Writer) (int64, error) { 4298 if !s.Symlink.Packed() { 4299 // Type SymlinkAtResp doesn't have a packed layout in memory, fall back to MarshalBytes. 4300 buf := make([]byte, s.SizeBytes()) 4301 s.MarshalBytes(buf) 4302 length, err := writer.Write(buf) 4303 return int64(length), err 4304 } 4305 4306 // Construct a slice backed by dst's underlying memory. 4307 var buf []byte 4308 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4309 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4310 hdr.Len = s.SizeBytes() 4311 hdr.Cap = s.SizeBytes() 4312 4313 length, err := writer.Write(buf) 4314 // Since we bypassed the compiler's escape analysis, indicate that s 4315 // must live until the use above. 4316 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4317 return int64(length), err 4318 } 4319 4320 // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal. 4321 func (s *SymlinkAtResp) CheckedMarshal(dst []byte) ([]byte, bool) { 4322 if s.SizeBytes() > len(dst) { 4323 return dst, false 4324 } 4325 return s.MarshalUnsafe(dst), true 4326 } 4327 4328 // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal. 4329 func (s *SymlinkAtResp) CheckedUnmarshal(src []byte) ([]byte, bool) { 4330 if s.SizeBytes() > len(src) { 4331 return src, false 4332 } 4333 return s.UnmarshalUnsafe(src), true 4334 } 4335 4336 // SizeBytes implements marshal.Marshallable.SizeBytes. 4337 //go:nosplit 4338 func (uid *UID) SizeBytes() int { 4339 return 4 4340 } 4341 4342 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4343 func (uid *UID) MarshalBytes(dst []byte) []byte { 4344 hostarch.ByteOrder.PutUint32(dst[:4], uint32(*uid)) 4345 return dst[4:] 4346 } 4347 4348 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4349 func (uid *UID) UnmarshalBytes(src []byte) []byte { 4350 *uid = UID(uint32(hostarch.ByteOrder.Uint32(src[:4]))) 4351 return src[4:] 4352 } 4353 4354 // Packed implements marshal.Marshallable.Packed. 4355 //go:nosplit 4356 func (uid *UID) Packed() bool { 4357 // Scalar newtypes are always packed. 4358 return true 4359 } 4360 4361 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4362 func (uid *UID) MarshalUnsafe(dst []byte) []byte { 4363 size := uid.SizeBytes() 4364 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(uid), uintptr(size)) 4365 return dst[size:] 4366 } 4367 4368 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4369 func (uid *UID) UnmarshalUnsafe(src []byte) []byte { 4370 size := uid.SizeBytes() 4371 gohacks.Memmove(unsafe.Pointer(uid), unsafe.Pointer(&src[0]), uintptr(size)) 4372 return src[size:] 4373 } 4374 4375 // CopyOutN implements marshal.Marshallable.CopyOutN. 4376 func (uid *UID) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4377 // Construct a slice backed by dst's underlying memory. 4378 var buf []byte 4379 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4380 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(uid))) 4381 hdr.Len = uid.SizeBytes() 4382 hdr.Cap = uid.SizeBytes() 4383 4384 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4385 // Since we bypassed the compiler's escape analysis, indicate that uid 4386 // must live until the use above. 4387 runtime.KeepAlive(uid) // escapes: replaced by intrinsic. 4388 return length, err 4389 } 4390 4391 // CopyOut implements marshal.Marshallable.CopyOut. 4392 func (uid *UID) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4393 return uid.CopyOutN(cc, addr, uid.SizeBytes()) 4394 } 4395 4396 // CopyIn implements marshal.Marshallable.CopyIn. 4397 func (uid *UID) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4398 // Construct a slice backed by dst's underlying memory. 4399 var buf []byte 4400 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4401 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(uid))) 4402 hdr.Len = uid.SizeBytes() 4403 hdr.Cap = uid.SizeBytes() 4404 4405 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4406 // Since we bypassed the compiler's escape analysis, indicate that uid 4407 // must live until the use above. 4408 runtime.KeepAlive(uid) // escapes: replaced by intrinsic. 4409 return length, err 4410 } 4411 4412 // WriteTo implements io.WriterTo.WriteTo. 4413 func (uid *UID) WriteTo(writer io.Writer) (int64, error) { 4414 // Construct a slice backed by dst's underlying memory. 4415 var buf []byte 4416 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4417 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(uid))) 4418 hdr.Len = uid.SizeBytes() 4419 hdr.Cap = uid.SizeBytes() 4420 4421 length, err := writer.Write(buf) 4422 // Since we bypassed the compiler's escape analysis, indicate that uid 4423 // must live until the use above. 4424 runtime.KeepAlive(uid) // escapes: replaced by intrinsic. 4425 return int64(length), err 4426 } 4427 4428 // SizeBytes implements marshal.Marshallable.SizeBytes. 4429 func (c *createCommon) SizeBytes() int { 4430 return 6 + 4431 (*FDID)(nil).SizeBytes() + 4432 (*UID)(nil).SizeBytes() + 4433 (*GID)(nil).SizeBytes() + 4434 (*linux.FileMode)(nil).SizeBytes() 4435 } 4436 4437 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4438 func (c *createCommon) MarshalBytes(dst []byte) []byte { 4439 dst = c.DirFD.MarshalUnsafe(dst) 4440 dst = c.UID.MarshalUnsafe(dst) 4441 dst = c.GID.MarshalUnsafe(dst) 4442 dst = c.Mode.MarshalUnsafe(dst) 4443 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 4444 dst = dst[2:] 4445 // Padding: dst[:sizeof(uint32)] ~= uint32(0) 4446 dst = dst[4:] 4447 return dst 4448 } 4449 4450 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4451 func (c *createCommon) UnmarshalBytes(src []byte) []byte { 4452 src = c.DirFD.UnmarshalUnsafe(src) 4453 src = c.UID.UnmarshalUnsafe(src) 4454 src = c.GID.UnmarshalUnsafe(src) 4455 src = c.Mode.UnmarshalUnsafe(src) 4456 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 4457 src = src[2:] 4458 // Padding: var _ uint32 ~= src[:sizeof(uint32)] 4459 src = src[4:] 4460 return src 4461 } 4462 4463 // Packed implements marshal.Marshallable.Packed. 4464 //go:nosplit 4465 func (c *createCommon) Packed() bool { 4466 return c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() 4467 } 4468 4469 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4470 func (c *createCommon) MarshalUnsafe(dst []byte) []byte { 4471 if c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() { 4472 size := c.SizeBytes() 4473 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(c), uintptr(size)) 4474 return dst[size:] 4475 } 4476 // Type createCommon doesn't have a packed layout in memory, fallback to MarshalBytes. 4477 return c.MarshalBytes(dst) 4478 } 4479 4480 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4481 func (c *createCommon) UnmarshalUnsafe(src []byte) []byte { 4482 if c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() { 4483 size := c.SizeBytes() 4484 gohacks.Memmove(unsafe.Pointer(c), unsafe.Pointer(&src[0]), uintptr(size)) 4485 return src[size:] 4486 } 4487 // Type createCommon doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4488 return c.UnmarshalBytes(src) 4489 } 4490 4491 // CopyOutN implements marshal.Marshallable.CopyOutN. 4492 func (c *createCommon) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4493 if !c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() { 4494 // Type createCommon doesn't have a packed layout in memory, fall back to MarshalBytes. 4495 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 4496 c.MarshalBytes(buf) // escapes: fallback. 4497 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4498 } 4499 4500 // Construct a slice backed by dst's underlying memory. 4501 var buf []byte 4502 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4503 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 4504 hdr.Len = c.SizeBytes() 4505 hdr.Cap = c.SizeBytes() 4506 4507 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4508 // Since we bypassed the compiler's escape analysis, indicate that c 4509 // must live until the use above. 4510 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 4511 return length, err 4512 } 4513 4514 // CopyOut implements marshal.Marshallable.CopyOut. 4515 func (c *createCommon) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4516 return c.CopyOutN(cc, addr, c.SizeBytes()) 4517 } 4518 4519 // CopyIn implements marshal.Marshallable.CopyIn. 4520 func (c *createCommon) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4521 if !c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() { 4522 // Type createCommon doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4523 buf := cc.CopyScratchBuffer(c.SizeBytes()) // escapes: okay. 4524 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4525 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4526 // partially unmarshalled struct. 4527 c.UnmarshalBytes(buf) // escapes: fallback. 4528 return length, err 4529 } 4530 4531 // Construct a slice backed by dst's underlying memory. 4532 var buf []byte 4533 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4534 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 4535 hdr.Len = c.SizeBytes() 4536 hdr.Cap = c.SizeBytes() 4537 4538 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4539 // Since we bypassed the compiler's escape analysis, indicate that c 4540 // must live until the use above. 4541 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 4542 return length, err 4543 } 4544 4545 // WriteTo implements io.WriterTo.WriteTo. 4546 func (c *createCommon) WriteTo(writer io.Writer) (int64, error) { 4547 if !c.DirFD.Packed() && c.GID.Packed() && c.Mode.Packed() && c.UID.Packed() { 4548 // Type createCommon doesn't have a packed layout in memory, fall back to MarshalBytes. 4549 buf := make([]byte, c.SizeBytes()) 4550 c.MarshalBytes(buf) 4551 length, err := writer.Write(buf) 4552 return int64(length), err 4553 } 4554 4555 // Construct a slice backed by dst's underlying memory. 4556 var buf []byte 4557 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4558 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(c))) 4559 hdr.Len = c.SizeBytes() 4560 hdr.Cap = c.SizeBytes() 4561 4562 length, err := writer.Write(buf) 4563 // Since we bypassed the compiler's escape analysis, indicate that c 4564 // must live until the use above. 4565 runtime.KeepAlive(c) // escapes: replaced by intrinsic. 4566 return int64(length), err 4567 } 4568 4569 // Packed implements marshal.Marshallable.Packed. 4570 //go:nosplit 4571 func (m *MsgDynamic) Packed() bool { 4572 // Type MsgDynamic is dynamic so it might have slice/string headers. Hence, it is not packed. 4573 return false 4574 } 4575 4576 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4577 func (m *MsgDynamic) MarshalUnsafe(dst []byte) []byte { 4578 // Type MsgDynamic doesn't have a packed layout in memory, fallback to MarshalBytes. 4579 return m.MarshalBytes(dst) 4580 } 4581 4582 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4583 func (m *MsgDynamic) UnmarshalUnsafe(src []byte) []byte { 4584 // Type MsgDynamic doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4585 return m.UnmarshalBytes(src) 4586 } 4587 4588 // CopyOutN implements marshal.Marshallable.CopyOutN. 4589 //go:nosplit 4590 func (m *MsgDynamic) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4591 // Type MsgDynamic doesn't have a packed layout in memory, fall back to MarshalBytes. 4592 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 4593 m.MarshalBytes(buf) // escapes: fallback. 4594 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4595 } 4596 4597 // CopyOut implements marshal.Marshallable.CopyOut. 4598 func (m *MsgDynamic) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4599 return m.CopyOutN(cc, addr, m.SizeBytes()) 4600 } 4601 4602 // CopyIn implements marshal.Marshallable.CopyIn. 4603 func (m *MsgDynamic) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4604 // Type MsgDynamic doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4605 buf := cc.CopyScratchBuffer(m.SizeBytes()) // escapes: okay. 4606 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4607 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4608 // partially unmarshalled struct. 4609 m.UnmarshalBytes(buf) // escapes: fallback. 4610 return length, err 4611 } 4612 4613 // WriteTo implements io.WriterTo.WriteTo. 4614 func (m *MsgDynamic) WriteTo(writer io.Writer) (int64, error) { 4615 // Type MsgDynamic doesn't have a packed layout in memory, fall back to MarshalBytes. 4616 buf := make([]byte, m.SizeBytes()) 4617 m.MarshalBytes(buf) 4618 length, err := writer.Write(buf) 4619 return int64(length), err 4620 } 4621 4622 // SizeBytes implements marshal.Marshallable.SizeBytes. 4623 func (m *MsgSimple) SizeBytes() int { 4624 return 16 4625 } 4626 4627 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4628 func (m *MsgSimple) MarshalBytes(dst []byte) []byte { 4629 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.A)) 4630 dst = dst[2:] 4631 hostarch.ByteOrder.PutUint16(dst[:2], uint16(m.B)) 4632 dst = dst[2:] 4633 hostarch.ByteOrder.PutUint32(dst[:4], uint32(m.C)) 4634 dst = dst[4:] 4635 hostarch.ByteOrder.PutUint64(dst[:8], uint64(m.D)) 4636 dst = dst[8:] 4637 return dst 4638 } 4639 4640 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4641 func (m *MsgSimple) UnmarshalBytes(src []byte) []byte { 4642 m.A = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4643 src = src[2:] 4644 m.B = uint16(hostarch.ByteOrder.Uint16(src[:2])) 4645 src = src[2:] 4646 m.C = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4647 src = src[4:] 4648 m.D = uint64(hostarch.ByteOrder.Uint64(src[:8])) 4649 src = src[8:] 4650 return src 4651 } 4652 4653 // Packed implements marshal.Marshallable.Packed. 4654 //go:nosplit 4655 func (m *MsgSimple) Packed() bool { 4656 return true 4657 } 4658 4659 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4660 func (m *MsgSimple) MarshalUnsafe(dst []byte) []byte { 4661 size := m.SizeBytes() 4662 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(m), uintptr(size)) 4663 return dst[size:] 4664 } 4665 4666 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4667 func (m *MsgSimple) UnmarshalUnsafe(src []byte) []byte { 4668 size := m.SizeBytes() 4669 gohacks.Memmove(unsafe.Pointer(m), unsafe.Pointer(&src[0]), uintptr(size)) 4670 return src[size:] 4671 } 4672 4673 // CopyOutN implements marshal.Marshallable.CopyOutN. 4674 func (m *MsgSimple) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4675 // Construct a slice backed by dst's underlying memory. 4676 var buf []byte 4677 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4678 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 4679 hdr.Len = m.SizeBytes() 4680 hdr.Cap = m.SizeBytes() 4681 4682 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4683 // Since we bypassed the compiler's escape analysis, indicate that m 4684 // must live until the use above. 4685 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 4686 return length, err 4687 } 4688 4689 // CopyOut implements marshal.Marshallable.CopyOut. 4690 func (m *MsgSimple) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4691 return m.CopyOutN(cc, addr, m.SizeBytes()) 4692 } 4693 4694 // CopyIn implements marshal.Marshallable.CopyIn. 4695 func (m *MsgSimple) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4696 // Construct a slice backed by dst's underlying memory. 4697 var buf []byte 4698 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4699 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 4700 hdr.Len = m.SizeBytes() 4701 hdr.Cap = m.SizeBytes() 4702 4703 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4704 // Since we bypassed the compiler's escape analysis, indicate that m 4705 // must live until the use above. 4706 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 4707 return length, err 4708 } 4709 4710 // WriteTo implements io.WriterTo.WriteTo. 4711 func (m *MsgSimple) WriteTo(writer io.Writer) (int64, error) { 4712 // Construct a slice backed by dst's underlying memory. 4713 var buf []byte 4714 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4715 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(m))) 4716 hdr.Len = m.SizeBytes() 4717 hdr.Cap = m.SizeBytes() 4718 4719 length, err := writer.Write(buf) 4720 // Since we bypassed the compiler's escape analysis, indicate that m 4721 // must live until the use above. 4722 runtime.KeepAlive(m) // escapes: replaced by intrinsic. 4723 return int64(length), err 4724 } 4725 4726 // CopyMsg1SliceIn copies in a slice of MsgSimple objects from the task's memory. 4727 func CopyMsg1SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []MsgSimple) (int, error) { 4728 count := len(dst) 4729 if count == 0 { 4730 return 0, nil 4731 } 4732 size := (*MsgSimple)(nil).SizeBytes() 4733 4734 ptr := unsafe.Pointer(&dst) 4735 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 4736 4737 // Construct a slice backed by dst's underlying memory. 4738 var buf []byte 4739 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4740 hdr.Data = uintptr(val) 4741 hdr.Len = size * count 4742 hdr.Cap = size * count 4743 4744 length, err := cc.CopyInBytes(addr, buf) 4745 // Since we bypassed the compiler's escape analysis, indicate that dst 4746 // must live until the use above. 4747 runtime.KeepAlive(dst) // escapes: replaced by intrinsic. 4748 return length, err 4749 } 4750 4751 // CopyMsg1SliceOut copies a slice of MsgSimple objects to the task's memory. 4752 func CopyMsg1SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []MsgSimple) (int, error) { 4753 count := len(src) 4754 if count == 0 { 4755 return 0, nil 4756 } 4757 size := (*MsgSimple)(nil).SizeBytes() 4758 4759 ptr := unsafe.Pointer(&src) 4760 val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data)) 4761 4762 // Construct a slice backed by dst's underlying memory. 4763 var buf []byte 4764 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4765 hdr.Data = uintptr(val) 4766 hdr.Len = size * count 4767 hdr.Cap = size * count 4768 4769 length, err := cc.CopyOutBytes(addr, buf) 4770 // Since we bypassed the compiler's escape analysis, indicate that src 4771 // must live until the use above. 4772 runtime.KeepAlive(src) // escapes: replaced by intrinsic. 4773 return length, err 4774 } 4775 4776 // MarshalUnsafeMsg1Slice is like MsgSimple.MarshalUnsafe, but for a []MsgSimple. 4777 func MarshalUnsafeMsg1Slice(src []MsgSimple, dst []byte) []byte { 4778 count := len(src) 4779 if count == 0 { 4780 return dst 4781 } 4782 4783 size := (*MsgSimple)(nil).SizeBytes() 4784 buf := dst[:size*count] 4785 gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf))) 4786 return dst[size*count:] 4787 } 4788 4789 // UnmarshalUnsafeMsg1Slice is like MsgSimple.UnmarshalUnsafe, but for a []MsgSimple. 4790 func UnmarshalUnsafeMsg1Slice(dst []MsgSimple, src []byte) []byte { 4791 count := len(dst) 4792 if count == 0 { 4793 return src 4794 } 4795 4796 size := (*MsgSimple)(nil).SizeBytes() 4797 buf := src[:size*count] 4798 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf))) 4799 return src[size*count:] 4800 } 4801 4802 // SizeBytes implements marshal.Marshallable.SizeBytes. 4803 func (s *sockHeader) SizeBytes() int { 4804 return 6 + 4805 (*MID)(nil).SizeBytes() 4806 } 4807 4808 // MarshalBytes implements marshal.Marshallable.MarshalBytes. 4809 func (s *sockHeader) MarshalBytes(dst []byte) []byte { 4810 hostarch.ByteOrder.PutUint32(dst[:4], uint32(s.payloadLen)) 4811 dst = dst[4:] 4812 dst = s.message.MarshalUnsafe(dst) 4813 // Padding: dst[:sizeof(uint16)] ~= uint16(0) 4814 dst = dst[2:] 4815 return dst 4816 } 4817 4818 // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes. 4819 func (s *sockHeader) UnmarshalBytes(src []byte) []byte { 4820 s.payloadLen = uint32(hostarch.ByteOrder.Uint32(src[:4])) 4821 src = src[4:] 4822 src = s.message.UnmarshalUnsafe(src) 4823 // Padding: var _ uint16 ~= src[:sizeof(uint16)] 4824 src = src[2:] 4825 return src 4826 } 4827 4828 // Packed implements marshal.Marshallable.Packed. 4829 //go:nosplit 4830 func (s *sockHeader) Packed() bool { 4831 return s.message.Packed() 4832 } 4833 4834 // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe. 4835 func (s *sockHeader) MarshalUnsafe(dst []byte) []byte { 4836 if s.message.Packed() { 4837 size := s.SizeBytes() 4838 gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(s), uintptr(size)) 4839 return dst[size:] 4840 } 4841 // Type sockHeader doesn't have a packed layout in memory, fallback to MarshalBytes. 4842 return s.MarshalBytes(dst) 4843 } 4844 4845 // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe. 4846 func (s *sockHeader) UnmarshalUnsafe(src []byte) []byte { 4847 if s.message.Packed() { 4848 size := s.SizeBytes() 4849 gohacks.Memmove(unsafe.Pointer(s), unsafe.Pointer(&src[0]), uintptr(size)) 4850 return src[size:] 4851 } 4852 // Type sockHeader doesn't have a packed layout in memory, fallback to UnmarshalBytes. 4853 return s.UnmarshalBytes(src) 4854 } 4855 4856 // CopyOutN implements marshal.Marshallable.CopyOutN. 4857 func (s *sockHeader) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) { 4858 if !s.message.Packed() { 4859 // Type sockHeader doesn't have a packed layout in memory, fall back to MarshalBytes. 4860 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 4861 s.MarshalBytes(buf) // escapes: fallback. 4862 return cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4863 } 4864 4865 // Construct a slice backed by dst's underlying memory. 4866 var buf []byte 4867 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4868 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4869 hdr.Len = s.SizeBytes() 4870 hdr.Cap = s.SizeBytes() 4871 4872 length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay. 4873 // Since we bypassed the compiler's escape analysis, indicate that s 4874 // must live until the use above. 4875 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4876 return length, err 4877 } 4878 4879 // CopyOut implements marshal.Marshallable.CopyOut. 4880 func (s *sockHeader) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4881 return s.CopyOutN(cc, addr, s.SizeBytes()) 4882 } 4883 4884 // CopyIn implements marshal.Marshallable.CopyIn. 4885 func (s *sockHeader) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) { 4886 if !s.message.Packed() { 4887 // Type sockHeader doesn't have a packed layout in memory, fall back to UnmarshalBytes. 4888 buf := cc.CopyScratchBuffer(s.SizeBytes()) // escapes: okay. 4889 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4890 // Unmarshal unconditionally. If we had a short copy-in, this results in a 4891 // partially unmarshalled struct. 4892 s.UnmarshalBytes(buf) // escapes: fallback. 4893 return length, err 4894 } 4895 4896 // Construct a slice backed by dst's underlying memory. 4897 var buf []byte 4898 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4899 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4900 hdr.Len = s.SizeBytes() 4901 hdr.Cap = s.SizeBytes() 4902 4903 length, err := cc.CopyInBytes(addr, buf) // escapes: okay. 4904 // Since we bypassed the compiler's escape analysis, indicate that s 4905 // must live until the use above. 4906 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4907 return length, err 4908 } 4909 4910 // WriteTo implements io.WriterTo.WriteTo. 4911 func (s *sockHeader) WriteTo(writer io.Writer) (int64, error) { 4912 if !s.message.Packed() { 4913 // Type sockHeader doesn't have a packed layout in memory, fall back to MarshalBytes. 4914 buf := make([]byte, s.SizeBytes()) 4915 s.MarshalBytes(buf) 4916 length, err := writer.Write(buf) 4917 return int64(length), err 4918 } 4919 4920 // Construct a slice backed by dst's underlying memory. 4921 var buf []byte 4922 hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf)) 4923 hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(s))) 4924 hdr.Len = s.SizeBytes() 4925 hdr.Cap = s.SizeBytes() 4926 4927 length, err := writer.Write(buf) 4928 // Since we bypassed the compiler's escape analysis, indicate that s 4929 // must live until the use above. 4930 runtime.KeepAlive(s) // escapes: replaced by intrinsic. 4931 return int64(length), err 4932 } 4933