diff --git a/go.mod b/go.mod index 849e982ff..061554256 100644 --- a/go.mod +++ b/go.mod @@ -4,7 +4,7 @@ go 1.25.0 require ( cyphar.com/go-pathrs v0.2.5 - github.com/checkpoint-restore/go-criu/v8 v8.3.0 + github.com/checkpoint-restore/go-criu/v8 v8.4.0 github.com/containerd/console v1.0.5 github.com/coreos/go-systemd/v22 v22.7.0 github.com/cyphar/filepath-securejoin v0.7.0 @@ -29,6 +29,6 @@ require ( ) require ( - github.com/aperturerobotics/protobuf-go-lite v0.14.0 // indirect + github.com/aperturerobotics/protobuf-go-lite v0.15.0 // indirect github.com/cilium/ebpf v0.17.3 // indirect ) diff --git a/go.sum b/go.sum index 8893357bc..868aff11e 100644 --- a/go.sum +++ b/go.sum @@ -1,9 +1,9 @@ cyphar.com/go-pathrs v0.2.5 h1:SnX9FBvnoyn3lUs1dkMgZ52bAETpirNu3FTRh5HlRik= cyphar.com/go-pathrs v0.2.5/go.mod h1:y8f1EMG7r+hCuFf/rXsKqMJrJAUoADZGNh5/vZPKcGc= -github.com/aperturerobotics/protobuf-go-lite v0.14.0 h1:6YhovtoUZtXgXLHZ2VV2GCYUzFfi8UN6172Vl2flNlE= -github.com/aperturerobotics/protobuf-go-lite v0.14.0/go.mod h1:lGH3s5ArCTXKI4wJdlNpaybUtwSjfAG0vdWjxOfMcF8= -github.com/checkpoint-restore/go-criu/v8 v8.3.0 h1:UC3Ioay1OMN2Wg33U53enRoG2701vJ9Y2Ex4APmC52w= -github.com/checkpoint-restore/go-criu/v8 v8.3.0/go.mod h1:33d6FwGJGwnzKVvaO0SxlN0tPSuArKU9X/inD/L7/qA= +github.com/aperturerobotics/protobuf-go-lite v0.15.0 h1:Ke9pkt5zO5iQf2q7iAYsXHlCDhGeQH0cvhCTIiiWUIg= +github.com/aperturerobotics/protobuf-go-lite v0.15.0/go.mod h1:3Ay/E7iaw2KWLirK3+dDdNJZHK0hu8Y1/kKeYeUa+8s= +github.com/checkpoint-restore/go-criu/v8 v8.4.0 h1:w6WDxjde4pvXYTIBuj6dsWsaPorKwSWuCk/qSKTO3Jw= +github.com/checkpoint-restore/go-criu/v8 v8.4.0/go.mod h1:SK5UexowK0P99gCcJJOavgVVlUWydGUfXSQUf1qDkHU= github.com/cilium/ebpf v0.17.3 h1:FnP4r16PWYSE4ux6zN+//jMcW4nMVRvuTLVTvCjyyjg= github.com/cilium/ebpf v0.17.3/go.mod h1:G5EDHij8yiLzaqn0WjyfJHvRa+3aDlReIaLVRMvOyJk= github.com/containerd/console v1.0.5 h1:R0ymNeydRqH2DmakFNdmjR2k0t7UPuiOV/N/27/qqsc= diff --git a/vendor/github.com/aperturerobotics/protobuf-go-lite/.gitignore b/vendor/github.com/aperturerobotics/protobuf-go-lite/.gitignore index 1a6d2284a..52614df12 100644 --- a/vendor/github.com/aperturerobotics/protobuf-go-lite/.gitignore +++ b/vendor/github.com/aperturerobotics/protobuf-go-lite/.gitignore @@ -1,5 +1,6 @@ /.cache/ /.gocache/ +/.tmp/ /bin/ /vendor/ .#* diff --git a/vendor/github.com/aperturerobotics/protobuf-go-lite/README.md b/vendor/github.com/aperturerobotics/protobuf-go-lite/README.md index a56e9000c..04faa08a1 100644 --- a/vendor/github.com/aperturerobotics/protobuf-go-lite/README.md +++ b/vendor/github.com/aperturerobotics/protobuf-go-lite/README.md @@ -12,7 +12,8 @@ **protobuf-go-lite** is a stripped-down version of the [protobuf-go] code generator modified to work without reflection and merged with [vtprotobuf] to provide modular features with static code generation for marshal/unmarshal, -size, clone, and equal. It bundles a fork of [protoc-gen-go-json] for JSON. +size, clone, equal, text, and JSON. JSON support is derived from a fork of +[protoc-gen-go-json]. [protobuf-go]: https://github.com/protocolbuffers/protobuf-go [vtprotobuf]: https://github.com/planetscale/vtprotobuf @@ -31,6 +32,15 @@ encoding, delimited message encoding, oneofs, maps, clone/equal, text, unmarshal, unsafe unmarshal, and JSON when the resolved JSON format is `ALLOW`. +Generated output is static Go code. The default `codegen=helper` mode emits +message methods that call small concrete helpers from the root +`protobuf-go-lite` runtime package to keep generated `.pb.go` files smaller. +The fallback `codegen=unrolled` mode keeps the older inline method-body shape +for helper-converted method families when callers need to inspect or compare +that output. Neither mode relies on Go reflection, descriptors, struct tags, or +runtime type metadata for generated marshal, unmarshal, size, clone, equal, +text, or JSON behavior. + protobuf-go-lite rejects Edition schemas that require closed enum semantics, `LEGACY_BEST_EFFORT` JSON, or explicit hybrid/opaque Go APIs. It does not support fieldmasks and extensions. @@ -94,7 +104,7 @@ Summary of the packages provided by this module: protoc \ --plugin protoc-gen-go-lite="${GOBIN}/protoc-gen-go-lite" \ --go-lite_out=. \ - --go-lite_opt=features=marshal+unmarshal+size+equal+clone \ + --go-lite_opt=features=marshal+unmarshal+size+equal+clone+text \ proto/$${name}.proto; \ done ``` @@ -103,21 +113,50 @@ Summary of the packages provided by this module: Check out the [template](https://github.com/aperturerobotics/template) for a quick start! +### Code generation modes + +`protoc-gen-go-lite` accepts `codegen=helper` and `codegen=unrolled`: + +- `codegen=helper` is the default. It emits static message methods that call + concrete runtime helpers such as encode, decode, clone/equal, size, and text + helpers. +- `codegen=unrolled` emits the older inline method-body style for + helper-converted method families. Select it by adding `codegen=unrolled` to + `--go-lite_opt`. + +Both modes are selected at generation time and produce normal Go packages for +callers. They do not add a reflection registry, descriptor builder, struct tag +interpreter, or runtime type-metadata dependency to generated fast paths. + +### Generated output + +Generated `.pb.go` files are checked in for this repository's fixtures and +well-known type packages. After changing the generator or runtime helpers, +regenerate and verify them with the GNU Make targets: + +``` +gmake gengo +gmake check-gengo +``` + +On systems where `make` is GNU Make, `make check-gengo` is equivalent. On macOS, +use `gmake` so the same GNU Make behavior is used locally and in Linux CI. + ## Available features -The following additional features from vtprotobuf can be enabled: +The following additional features can be enabled: -- `size`: generates a `func (p *YourProto) SizeVT() int` helper that behaves identically to calling `proto.Size(p)` on the message, except the size calculation is fully unrolled and does not use reflection. This helper function can be used directly, and it'll also be used by the `marshal` codegen to ensure the destination buffer is properly sized before ProtoBuf objects are marshalled to it. +- `size`: generates a `func (p *YourProto) SizeVT() int` helper that behaves identically to calling `proto.Size(p)` on the message, except the size calculation is static generated code and does not use reflection. This helper function can be used directly, and it'll also be used by the `marshal` codegen to ensure the destination buffer is properly sized before ProtoBuf objects are marshalled to it. - `equal`: generates the following helper methods - - `func (this *YourProto) EqualVT(that *YourProto) bool`: this function behaves almost identically to calling `proto.Equal(this, that)` on messages, except the equality calculation is fully unrolled and does not use reflection. This helper function can be used directly. + - `func (this *YourProto) EqualVT(that *YourProto) bool`: this function behaves almost identically to calling `proto.Equal(this, that)` on messages, except the equality calculation is static generated code and does not use reflection. This helper function can be used directly. - `func (this *YourProto) EqualMessageVT(thatMsg any) bool`: this function behaves like the above `this.EqualVT(that)`, but allows comparing against arbitrary proto messages. If `thatMsg` is not of type `*YourProto`, false is returned. The uniform signature provided by this method allows accessing this method via type assertions even if the message type is not known at compile time. This allows implementing a generic `func EqualVT(proto.Message, proto.Message) bool` without reflection. - `marshal`: generates the following helper methods - - `func (p *YourProto) MarshalVT() ([]byte, error)`: this function behaves identically to calling `proto.Marshal(p)`, except the actual marshalling has been fully unrolled and does not use reflection or allocate memory. This function simply allocates a properly sized buffer by calling `SizeVT` on the message and then uses `MarshalToSizedBufferVT` to marshal to it. + - `func (p *YourProto) MarshalVT() ([]byte, error)`: this function behaves identically to calling `proto.Marshal(p)`, except the actual marshalling is static generated code and does not use reflection or allocate memory. This function simply allocates a properly sized buffer by calling `SizeVT` on the message and then uses `MarshalToSizedBufferVT` to marshal to it. - `func (p *YourProto) MarshalToVT(data []byte) (int, error)`: this function can be used to marshal a message to an existing buffer. The buffer must be large enough to hold the marshalled message, otherwise this function will panic. It returns the number of bytes marshalled. This function is useful e.g. when using memory pooling to re-use serialization buffers. @@ -132,26 +171,31 @@ The following additional features from vtprotobuf can be enabled: - `func (p *YourProto) MarshalToSizedBufferVTStrict(data []byte) (int, error)`: this function behaves like `MarshalToSizedBufferVT`, except fields are marshalled in a strict order by field's numbers they were declared in .proto file. -- `unmarshal`: generates a `func (p *YourProto) UnmarshalVT(data []byte)` that behaves similarly to calling `proto.Unmarshal(data, p)` on the message, except the unmarshalling is performed by unrolled codegen without using reflection and allocating as little memory as possible. If the receiver `p` is **not** fully zeroed-out, the unmarshal call will actually behave like `proto.Merge(data, p)`. This is because the `proto.Unmarshal` in the ProtoBuf API is implemented by resetting the destination message and then calling `proto.Merge` on it. To ensure proper `Unmarshal` semantics, ensure you've called `proto.Reset` on your message before calling `UnmarshalVT`, or that your message has been newly allocated. +- `unmarshal`: generates a `func (p *YourProto) UnmarshalVT(data []byte)` that behaves similarly to calling `proto.Unmarshal(data, p)` on the message, except the unmarshalling is performed by static generated code without using reflection and allocating as little memory as possible. If the receiver `p` is **not** fully zeroed-out, the unmarshal call will actually behave like `proto.Merge(data, p)`. This is because the `proto.Unmarshal` in the ProtoBuf API is implemented by resetting the destination message and then calling `proto.Merge` on it. To ensure proper `Unmarshal` semantics, ensure you've called `proto.Reset` on your message before calling `UnmarshalVT`, or that your message has been newly allocated. - `unmarshal_unsafe` generates a `func (p *YourProto) UnmarshalVTUnsafe(data []byte)` that behaves like `UnmarshalVT`, except it unsafely casts slices of data to `bytes` and `string` fields instead of copying them to newly allocated arrays, so that it performs less allocations. **Data received from the wire has to be left untouched for the lifetime of the message.** Otherwise, the message's `bytes` and `string` fields can be corrupted. - `clone`: generates the following helper methods - - `func (p *YourProto) CloneVT() *YourProto`: this function behaves similarly to calling `proto.Clone(p)` on the message, except the cloning is performed by unrolled codegen without using reflection. If the receiver `p` is `nil` a typed `nil` is returned. + - `func (p *YourProto) CloneVT() *YourProto`: this function behaves similarly to calling `proto.Clone(p)` on the message, except the cloning is performed by static generated code without using reflection. If the receiver `p` is `nil` a typed `nil` is returned. - `func (p *YourProto) CloneMessageVT() any`: this function behaves like the above `p.CloneVT()`, but provides a uniform signature in order to be accessible via type assertions even if the type is not known at compile time. This allows implementing a generic `func CloneMessageVT() any` without reflection. If the receiver `p` is `nil`, a typed `nil` pointer of the message type will be returned inside a `any` interface. - `json`: generates the following helper methods - - `func (p *YourProto) UnmarshalJSON(data []byte) error` behaves similarly to calling `protojson.Unmarshal(data, p)` on the message, except the unmarshalling is performed by unrolled codegen without using reflection and allocating as little memory as possible (with json-iterator/go). If the receiver `p` is **not** fully zeroed-out, the unmarshal call will actually behave like `proto.Merge(data, p)`. To ensure proper `Unmarshal` semantics, ensure you've called `proto.Reset` on your message before calling `UnmarshalJSON`, or that your message has been newly allocated. + - `func (p *YourProto) UnmarshalJSON(data []byte) error` behaves similarly to calling `protojson.Unmarshal(data, p)` on the message, except the unmarshalling is performed by static generated code without using reflection and allocating as little memory as possible. If the receiver `p` is **not** fully zeroed-out, the unmarshal call will actually behave like `proto.Merge(data, p)`. To ensure proper `Unmarshal` semantics, ensure you've called `proto.Reset` on your message before calling `UnmarshalJSON`, or that your message has been newly allocated. - `func (p *YourProto) UnmarshalJSONValue(val *fastjson.Value) error` unmarshals a `*fastjson.Value`. - - `func (p *YourProto) MarshalJSON() ([]byte, error)` behaves similarly to calling `protojson.Marshal(p)` on the message, except the marshalling is performed by unrolled codegen without using reflection and allocating as little memory as possible (with json-iterator/go). + - `func (p *YourProto) MarshalJSON() ([]byte, error)` behaves similarly to calling `protojson.Marshal(p)` on the message, except the marshalling is performed by static generated code without using reflection and allocating as little memory as possible. - Adding a `//protobuf-go-lite:disable-json` comment before a message or enum will disable the json marshaler / unmarshaler. +- `text`: generates `MarshalProtoText() string` and `String() string` methods + that emit protobuf text-format-style output using static generated code + without reflection. Adding a `//protobuf-go-lite:disable-text` comment before + a message disables text generation for that message. + ## License BSD-3 diff --git a/vendor/github.com/aperturerobotics/protobuf-go-lite/protobuf-go-lite.go b/vendor/github.com/aperturerobotics/protobuf-go-lite/protobuf-go-lite.go index 98e2eb642..904dabede 100644 --- a/vendor/github.com/aperturerobotics/protobuf-go-lite/protobuf-go-lite.go +++ b/vendor/github.com/aperturerobotics/protobuf-go-lite/protobuf-go-lite.go @@ -1,12 +1,18 @@ package protobuf_go_lite import ( + "cmp" + "encoding/base64" + "encoding/binary" "errors" "fmt" "io" + "maps" "math" "math/bits" "slices" + "strconv" + "strings" "unsafe" ) @@ -41,6 +47,11 @@ type JSONMessage interface { UnmarshalJSON(data []byte) error } +// TextMarshaler is a message with a MarshalProtoText function. +type TextMarshaler interface { + MarshalProtoText() string +} + // CloneMessage is a message with a CloneMessage function. type CloneMessage interface { // Message extends the base message type. @@ -60,6 +71,9 @@ type CloneVT[T comparable] interface { // CloneVTSlice clones a slice of CloneVT messages. func CloneVTSlice[S ~[]E, E CloneVT[E]](s S) S { + if s == nil { + return nil + } out := make([]E, len(s)) var empty E for i := range s { @@ -70,6 +84,75 @@ func CloneVTSlice[S ~[]E, E CloneVT[E]](s S) S { return out } +// ClonePtr clones one explicit scalar pointer. +func ClonePtr[T any](v *T) *T { + if v == nil { + return nil + } + out := *v + return &out +} + +// CloneBytes clones one byte slice. +func CloneBytes[S ~[]byte](v S) S { + return slices.Clone(v) +} + +// CloneSlice clones a scalar slice. +func CloneSlice[S ~[]E, E any](s S) S { + return slices.Clone(s) +} + +// CloneMap clones a map whose values do not need deep cloning. +func CloneMap[M ~map[K]V, K comparable, V any](m M) M { + return maps.Clone(m) +} + +// CloneBytesSlice clones a repeated bytes field. +func CloneBytesSlice[S ~[]E, E ~[]byte](s S) S { + if s == nil { + return nil + } + out := make(S, len(s)) + for i := range s { + out[i] = slices.Clone(s[i]) + } + return out +} + +// CloneBytesMap clones a map whose values are bytes fields. +func CloneBytesMap[M ~map[K]V, K comparable, V ~[]byte](m M) M { + if m == nil { + return nil + } + out := make(M, len(m)) + for k, v := range m { + out[k] = slices.Clone(v) + } + return out +} + +// CloneVTValue clones one VT message value. +func CloneVTValue[T CloneVT[T]](v T) T { + var empty T + if v == empty { + return empty + } + return v.CloneVT() +} + +// CloneVTMap clones a map whose values are VT messages. +func CloneVTMap[M ~map[K]V, K comparable, V CloneVT[V]](m M) M { + if m == nil { + return nil + } + out := make(M, len(m)) + for k, v := range m { + out[k] = CloneVTValue(v) + } + return out +} + // EqualVT is a message with a EqualVT function (VTProtobuf). type EqualVT[T comparable] interface { comparable @@ -109,18 +192,340 @@ func IsEqualVTSlice[S ~[]E, E EqualVT[E]](s1, s2 S) bool { return slices.EqualFunc(s1, s2, CompareEqualVT[E]()) } +// EqualPtr compares two explicit scalar pointers. +func EqualPtr[T comparable](a, b *T) bool { + return a == nil && b == nil || a != nil && b != nil && *a == *b +} + +// EqualBytes compares two implicit bytes values. +func EqualBytes(a, b []byte) bool { + return string(a) == string(b) +} + +// EqualBytesPresent compares two explicit bytes values where nil and empty differ. +func EqualBytesPresent(a, b []byte) bool { + return a == nil && b == nil || a != nil && b != nil && string(a) == string(b) +} + +// EqualSlice compares repeated comparable values. +func EqualSlice[S ~[]E, E comparable](a, b S) bool { + return slices.Equal(a, b) +} + +// EqualMap compares maps with comparable values. +func EqualMap[M ~map[K]V, K comparable, V comparable](a, b M) bool { + return maps.Equal(a, b) +} + +// EqualBytesSlice compares repeated bytes values. +func EqualBytesSlice[S ~[]E, E ~[]byte](a, b S) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if !EqualBytes(a[i], b[i]) { + return false + } + } + return true +} + +// EqualBytesMap compares maps whose values are bytes fields. +func EqualBytesMap[M ~map[K]V, K comparable, V ~[]byte](a, b M) bool { + if len(a) != len(b) { + return false + } + for k, av := range a { + bv, ok := b[k] + if !ok || !EqualBytes(av, bv) { + return false + } + } + return true +} + +// EqualVTImplicit compares VT messages where nil is equivalent to an empty message. +func EqualVTImplicit[T EqualVT[T]](a, b T, empty func() T) bool { + if a == b { + return true + } + var zero T + if a == zero { + a = empty() + } + if b == zero { + b = empty() + } + return a.EqualVT(b) +} + +// EqualVTSliceImplicit compares repeated VT messages where nil elements are empty messages. +func EqualVTSliceImplicit[S ~[]E, E EqualVT[E]](a, b S, empty func() E) bool { + if len(a) != len(b) { + return false + } + for i := range a { + if !EqualVTImplicit(a[i], b[i], empty) { + return false + } + } + return true +} + +// EqualVTMapImplicit compares map VT values where nil values are empty messages. +func EqualVTMapImplicit[M ~map[K]V, K comparable, V EqualVT[V]](a, b M, empty func() V) bool { + if len(a) != len(b) { + return false + } + for k, av := range a { + bv, ok := b[k] + if !ok || !EqualVTImplicit(av, bv, empty) { + return false + } + } + return true +} + +// TextBuilder is the builder used by generated proto text marshalers. +type TextBuilder = strings.Builder + +// TextStartMessage writes the opening message label and returns its initial length. +func TextStartMessage(sb *TextBuilder, name string) int { + sb.WriteString(name) + sb.WriteString(" {") + return len(name) + 2 +} + +// TextFinishMessage writes the closing message delimiter and returns the final text. +func TextFinishMessage(sb *TextBuilder) string { + sb.WriteString("}") + return sb.String() +} + +// TextWriteFieldPrefix writes the optional separator, field name, and value separator. +func TextWriteFieldPrefix(sb *TextBuilder, initialLen int, name string) { + if sb.Len() > initialLen { + sb.WriteString(" ") + } + sb.WriteString(name) + sb.WriteString(": ") +} + +// TextWriteListStart writes a repeated field prefix and opening delimiter. +func TextWriteListStart(sb *TextBuilder, initialLen int, name string) { + TextWriteFieldPrefix(sb, initialLen, name) + sb.WriteString("[") +} + +// TextWriteListSeparator writes the separator before non-first repeated values. +func TextWriteListSeparator(sb *TextBuilder, index int) { + if index > 0 { + sb.WriteString(", ") + } +} + +// TextWriteListEnd writes the repeated field closing delimiter. +func TextWriteListEnd(sb *TextBuilder) { + sb.WriteString("]") +} + +// TextWriteMapStart writes a map field prefix and opening delimiter. +func TextWriteMapStart(sb *TextBuilder, initialLen int, name string) { + TextWriteFieldPrefix(sb, initialLen, name) + sb.WriteString("{") +} + +// TextWriteMapEntryPrefix writes the separator before one sorted map entry. +func TextWriteMapEntryPrefix(sb *TextBuilder) { + sb.WriteString(" ") +} + +// TextWriteMapKeyValueSeparator writes the separator between a map key and value. +func TextWriteMapKeyValueSeparator(sb *TextBuilder) { + sb.WriteString(": ") +} + +// TextWriteMapEnd writes the map field closing delimiter. +func TextWriteMapEnd(sb *TextBuilder) { + sb.WriteString(" }") +} + +// TextSortedMapKeys returns sorted keys for deterministic generated proto text maps. +func TextSortedMapKeys[M ~map[K]V, K cmp.Ordered, V any](m M) []K { + return slices.Sorted(maps.Keys(m)) +} + +// TextWriteTextMarshaler writes a nested proto text marshaler value. +func TextWriteTextMarshaler(sb *TextBuilder, v TextMarshaler) { + sb.WriteString(v.MarshalProtoText()) +} + +// TextWriteString writes a quoted string proto text value. +func TextWriteString(sb *TextBuilder, v string) { + sb.WriteString(strconv.Quote(v)) +} + +// TextWriteBytes writes a quoted base64 proto text bytes value. +func TextWriteBytes[B ~[]byte](sb *TextBuilder, v B) { + sb.WriteString("\"") + sb.WriteString(base64.StdEncoding.EncodeToString(v)) + sb.WriteString("\"") +} + +// TextWriteStringer writes a quoted String value. +func TextWriteStringer[T interface{ String() string }](sb *TextBuilder, v T) { + sb.WriteString("\"") + sb.WriteString(v.String()) + sb.WriteString("\"") +} + +// TextWriteInt writes a signed integer proto text value. +func TextWriteInt[T ~int32 | ~int64](sb *TextBuilder, v T) { + sb.WriteString(strconv.FormatInt(int64(v), 10)) +} + +// TextWriteUint writes an unsigned integer proto text value. +func TextWriteUint[T ~uint32 | ~uint64](sb *TextBuilder, v T) { + sb.WriteString(strconv.FormatUint(uint64(v), 10)) +} + +// TextWriteFloat32 writes a float32 proto text value. +func TextWriteFloat32(sb *TextBuilder, v float32) { + sb.WriteString(strconv.FormatFloat(float64(v), 'g', -1, 32)) +} + +// TextWriteFloat64 writes a float64 proto text value. +func TextWriteFloat64(sb *TextBuilder, v float64) { + sb.WriteString(strconv.FormatFloat(v, 'g', -1, 64)) +} + +// TextWriteBool writes a bool proto text value. +func TextWriteBool(sb *TextBuilder, v bool) { + sb.WriteString(strconv.FormatBool(v)) +} + // EncodeVarint encodes a uint64 into a varint-encoded byte slice and returns the offset of the encoded value. // The provided offset is the offset after the last byte of the encoded value. func EncodeVarint(dAtA []byte, offset int, v uint64) int { offset -= SizeOfVarint(v) base := offset + putVarintAt(dAtA, offset, v) + return base +} + +// EncodeRawBytes writes raw bytes before offset and returns the new offset. +func EncodeRawBytes[S ~[]byte](dAtA []byte, offset int, v S) int { + offset -= len(v) + copy(dAtA[offset:], v) + return offset +} + +// EncodeFixed32 writes a fixed-width 32-bit value before offset and returns the new offset. +func EncodeFixed32(dAtA []byte, offset int, v uint32) int { + offset -= 4 + binary.LittleEndian.PutUint32(dAtA[offset:], v) + return offset +} + +// EncodeFixed64 writes a fixed-width 64-bit value before offset and returns the new offset. +func EncodeFixed64(dAtA []byte, offset int, v uint64) int { + offset -= 8 + binary.LittleEndian.PutUint64(dAtA[offset:], v) + return offset +} + +// EncodeBool writes a bool value before offset and returns the new offset. +func EncodeBool(dAtA []byte, offset int, v bool) int { + offset-- + b := byte(0) + if v { + b = 1 + } + dAtA[offset] = b + return offset +} + +// EncodeString writes a length-delimited string before offset and returns the new offset. +func EncodeString[S ~string](dAtA []byte, offset int, v S) int { + offset -= len(v) + copy(dAtA[offset:], string(v)) + return EncodeVarint(dAtA, offset, uint64Len(len(v))) +} + +// EncodeBytes writes a length-delimited byte slice before offset and returns the new offset. +func EncodeBytes[S ~[]byte](dAtA []byte, offset int, v S) int { + offset = EncodeRawBytes(dAtA, offset, v) + return EncodeVarint(dAtA, offset, uint64Len(len(v))) +} + +// EncodeZigzag32 writes a zigzag-encoded 32-bit value before offset and returns the new offset. +func EncodeZigzag32[T ~int32](dAtA []byte, offset int, v T) int { + return EncodeVarint(dAtA, offset, uint64((uint32(v)<<1)^uint32(v>>31))) +} + +// EncodeZigzag64 writes a zigzag-encoded 64-bit value before offset and returns the new offset. +func EncodeZigzag64[T ~int64](dAtA []byte, offset int, v T) int { + return EncodeVarint(dAtA, offset, (uint64(v)<<1)^uint64(v>>63)) +} + +type marshalVarintNumber interface { + ~int32 | ~int64 | ~uint32 | ~uint64 +} + +// EncodeVarintPacked writes packed varint values before offset and returns the new offset. +func EncodeVarintPacked[S ~[]E, E marshalVarintNumber](dAtA []byte, offset int, vals S) int { + total := 0 + for _, v := range vals { + total += SizeOfVarint(uint64(v)) + } + offset -= total + j := offset + for _, v := range vals { + j = putVarintAt(dAtA, j, uint64(v)) + } + return EncodeVarint(dAtA, offset, uint64Len(total)) +} + +// EncodeZigzag32Packed writes packed zigzag-encoded 32-bit values before offset and returns the new offset. +func EncodeZigzag32Packed[S ~[]E, E ~int32](dAtA []byte, offset int, vals S) int { + total := 0 + for _, v := range vals { + total += SizeOfZigzag(uint64(v)) + } + offset -= total + j := offset + for _, v := range vals { + j = putVarintAt(dAtA, j, uint64((uint32(v)<<1)^uint32(v>>31))) + } + return EncodeVarint(dAtA, offset, uint64Len(total)) +} + +// EncodeZigzag64Packed writes packed zigzag-encoded 64-bit values before offset and returns the new offset. +func EncodeZigzag64Packed[S ~[]E, E ~int64](dAtA []byte, offset int, vals S) int { + total := 0 + for _, v := range vals { + total += SizeOfZigzag(uint64(v)) + } + offset -= total + j := offset + for _, v := range vals { + j = putVarintAt(dAtA, j, (uint64(v)<<1)^uint64(v>>63)) + } + return EncodeVarint(dAtA, offset, uint64Len(total)) +} + +func putVarintAt(dAtA []byte, offset int, v uint64) int { for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) //nolint:gosec v >>= 7 offset++ } dAtA[offset] = uint8(v) - return base + return offset + 1 +} + +func uint64Len(v int) uint64 { + return uint64(v) //nolint:gosec } // AppendVarint appends v to b as a varint-encoded uint64. @@ -445,67 +850,96 @@ func DecodeFloat64(b []byte, idx int) (float64, int, error) { return math.Float64frombits(v), idx, nil } -// DecodeBytes decodes a length-prefixed byte slice. If copy is false, returns a sub-slice. +// DecodeLengthDelimited decodes a length-delimited payload and returns its start and end offsets. // Assumes idx is within bounds (0 <= idx <= len(b)); generated code maintains this invariant. -func DecodeBytes(b []byte, idx int, cp bool) ([]byte, int, error) { +func DecodeLengthDelimited(b []byte, idx int) (int, int, error) { length, idx, err := DecodeVarint(b, idx) if err != nil { - return nil, 0, err + return 0, 0, err } l := int(length) //nolint:gosec if l < 0 { - return nil, 0, ErrInvalidLength + return 0, 0, ErrInvalidLength } end := idx + l - if end < idx || end > len(b) { - return nil, 0, io.ErrUnexpectedEOF + if end < 0 { + return 0, 0, ErrInvalidLength + } + if end > len(b) { + return 0, 0, io.ErrUnexpectedEOF + } + return idx, end, nil +} + +// DecodeBytes decodes a length-prefixed byte slice. If copy is false, returns a sub-slice. +// Assumes idx is within bounds (0 <= idx <= len(b)); generated code maintains this invariant. +func DecodeBytes(b []byte, idx int, cp bool) ([]byte, int, error) { + start, end, err := DecodeLengthDelimited(b, idx) + if err != nil { + return nil, 0, err } if cp { - out := make([]byte, l) - copy(out, b[idx:end]) + out := make([]byte, end-start) + copy(out, b[start:end]) return out, end, nil } - return b[idx:end], end, nil + return b[start:end], end, nil +} + +// DecodeBytesAppend decodes a length-prefixed byte slice into dst and returns the new offset. +// It preserves generated singular bytes behavior by reusing dst and making empty values non-nil. +func DecodeBytesAppend(dst []byte, b []byte, idx int) ([]byte, int, error) { + start, end, err := DecodeLengthDelimited(b, idx) + if err != nil { + return dst, 0, err + } + dst = append(dst[:0], b[start:end]...) + if dst == nil { + dst = []byte{} + } + return dst, end, nil } // DecodeString decodes a length-prefixed string (with copy). // Assumes idx is within bounds (0 <= idx <= len(b)); generated code maintains this invariant. func DecodeString(b []byte, idx int) (string, int, error) { - length, idx, err := DecodeVarint(b, idx) + start, end, err := DecodeLengthDelimited(b, idx) if err != nil { return "", 0, err } - l := int(length) //nolint:gosec - if l < 0 { - return "", 0, ErrInvalidLength - } - end := idx + l - if end < idx || end > len(b) { - return "", 0, io.ErrUnexpectedEOF - } - return string(b[idx:end]), end, nil + return string(b[start:end]), end, nil } // DecodeStringUnsafe decodes a length-prefixed string without copying. // The returned string shares memory with the input slice. // Assumes idx is within bounds (0 <= idx <= len(b)); generated code maintains this invariant. func DecodeStringUnsafe(b []byte, idx int) (string, int, error) { - length, idx, err := DecodeVarint(b, idx) + start, end, err := DecodeLengthDelimited(b, idx) if err != nil { return "", 0, err } - l := int(length) //nolint:gosec - if l < 0 { - return "", 0, ErrInvalidLength - } - end := idx + l - if end < idx || end > len(b) { - return "", 0, io.ErrUnexpectedEOF - } - if l == 0 { + if start == end { return "", end, nil } - return unsafe.String(&b[idx], l), end, nil + return unsafe.String(&b[start], end-start), end, nil +} + +// PackedVarintElementCount returns the number of varint elements in a packed payload. +func PackedVarintElementCount(b []byte) (n int) { + for _, v := range b { + if v < 0x80 { + n++ + } + } + return n +} + +// PackedFixedElementCount returns the number of fixed-width elements in a packed payload. +func PackedFixedElementCount(b []byte, width int) int { + if width <= 0 { + return 0 + } + return len(b) / width } // SizeOfZigzag returns the size of the zigzag-encoded value. @@ -513,6 +947,275 @@ func SizeOfZigzag(x uint64) (n int) { return SizeOfVarint(uint64((x << 1) ^ uint64((int64(x) >> 63)))) //nolint } +type sizeVarintNumber interface { + ~int32 | ~int64 | ~uint32 | ~uint64 +} + +type sizeZigzagNumber interface { + ~int32 | ~int64 +} + +type sizeFixed32Number interface { + ~int32 | ~uint32 | ~float32 +} + +type sizeFixed64Number interface { + ~int64 | ~uint64 | ~float64 +} + +// SizeVarintValue returns the encoded field size for one present varint value. +func SizeVarintValue[T sizeVarintNumber](keySize int, v T) int { + return keySize + SizeOfVarint(uint64(v)) +} + +// SizeVarintNonZero returns the encoded field size for one implicit varint value. +func SizeVarintNonZero[T sizeVarintNumber](keySize int, v T) int { + if v == 0 { + return 0 + } + return SizeVarintValue(keySize, v) +} + +// SizeVarintPtr returns the encoded field size for one explicit varint value. +func SizeVarintPtr[T sizeVarintNumber](keySize int, v *T) int { + if v == nil { + return 0 + } + return SizeVarintValue(keySize, *v) +} + +// SizeVarintSlice returns the encoded field size for unpacked repeated varints. +func SizeVarintSlice[S ~[]E, E sizeVarintNumber](keySize int, vals S) (n int) { + for _, v := range vals { + n += SizeVarintValue(keySize, v) + } + return n +} + +// SizeVarintPacked returns the encoded field size for packed repeated varints. +func SizeVarintPacked[S ~[]E, E sizeVarintNumber](keySize int, vals S) int { + if len(vals) == 0 { + return 0 + } + l := 0 + for _, v := range vals { + l += SizeOfVarint(uint64(v)) + } + return SizeBytesValue(keySize, l) +} + +// SizeZigzagValue returns the encoded field size for one present zigzag value. +func SizeZigzagValue[T sizeZigzagNumber](keySize int, v T) int { + return keySize + SizeOfZigzag(uint64(v)) +} + +// SizeZigzagNonZero returns the encoded field size for one implicit zigzag value. +func SizeZigzagNonZero[T sizeZigzagNumber](keySize int, v T) int { + if v == 0 { + return 0 + } + return SizeZigzagValue(keySize, v) +} + +// SizeZigzagPtr returns the encoded field size for one explicit zigzag value. +func SizeZigzagPtr[T sizeZigzagNumber](keySize int, v *T) int { + if v == nil { + return 0 + } + return SizeZigzagValue(keySize, *v) +} + +// SizeZigzagSlice returns the encoded field size for unpacked repeated zigzags. +func SizeZigzagSlice[S ~[]E, E sizeZigzagNumber](keySize int, vals S) (n int) { + for _, v := range vals { + n += SizeZigzagValue(keySize, v) + } + return n +} + +// SizeZigzagPacked returns the encoded field size for packed repeated zigzags. +func SizeZigzagPacked[S ~[]E, E sizeZigzagNumber](keySize int, vals S) int { + if len(vals) == 0 { + return 0 + } + l := 0 + for _, v := range vals { + l += SizeOfZigzag(uint64(v)) + } + return SizeBytesValue(keySize, l) +} + +// SizeFixed32Value returns the encoded field size for one present fixed32 value. +func SizeFixed32Value(keySize int) int { + return keySize + 4 +} + +// SizeFixed32NonZero returns the encoded field size for one implicit fixed32 value. +func SizeFixed32NonZero[T sizeFixed32Number](keySize int, v T) int { + if v == 0 { + return 0 + } + return SizeFixed32Value(keySize) +} + +// SizeFixed32Ptr returns the encoded field size for one explicit fixed32 value. +func SizeFixed32Ptr[T sizeFixed32Number](keySize int, v *T) int { + if v == nil { + return 0 + } + return SizeFixed32Value(keySize) +} + +// SizeFixed32Slice returns the encoded field size for unpacked repeated fixed32 values. +func SizeFixed32Slice[S ~[]E, E sizeFixed32Number](keySize int, vals S) int { + return len(vals) * SizeFixed32Value(keySize) +} + +// SizeFixed32Packed returns the encoded field size for packed repeated fixed32 values. +func SizeFixed32Packed[S ~[]E, E sizeFixed32Number](keySize int, vals S) int { + if len(vals) == 0 { + return 0 + } + return SizeBytesValue(keySize, len(vals)*4) +} + +// SizeFixed64Value returns the encoded field size for one present fixed64 value. +func SizeFixed64Value(keySize int) int { + return keySize + 8 +} + +// SizeFixed64NonZero returns the encoded field size for one implicit fixed64 value. +func SizeFixed64NonZero[T sizeFixed64Number](keySize int, v T) int { + if v == 0 { + return 0 + } + return SizeFixed64Value(keySize) +} + +// SizeFixed64Ptr returns the encoded field size for one explicit fixed64 value. +func SizeFixed64Ptr[T sizeFixed64Number](keySize int, v *T) int { + if v == nil { + return 0 + } + return SizeFixed64Value(keySize) +} + +// SizeFixed64Slice returns the encoded field size for unpacked repeated fixed64 values. +func SizeFixed64Slice[S ~[]E, E sizeFixed64Number](keySize int, vals S) int { + return len(vals) * SizeFixed64Value(keySize) +} + +// SizeFixed64Packed returns the encoded field size for packed repeated fixed64 values. +func SizeFixed64Packed[S ~[]E, E sizeFixed64Number](keySize int, vals S) int { + if len(vals) == 0 { + return 0 + } + return SizeBytesValue(keySize, len(vals)*8) +} + +// SizeBoolValue returns the encoded field size for one present bool value. +func SizeBoolValue(keySize int) int { + return keySize + 1 +} + +// SizeBoolNonZero returns the encoded field size for one implicit bool value. +func SizeBoolNonZero(keySize int, v bool) int { + if !v { + return 0 + } + return SizeBoolValue(keySize) +} + +// SizeBoolPtr returns the encoded field size for one explicit bool value. +func SizeBoolPtr(keySize int, v *bool) int { + if v == nil { + return 0 + } + return SizeBoolValue(keySize) +} + +// SizeBoolSlice returns the encoded field size for unpacked repeated bool values. +func SizeBoolSlice(keySize int, vals []bool) int { + return len(vals) * SizeBoolValue(keySize) +} + +// SizeBoolPacked returns the encoded field size for packed repeated bool values. +func SizeBoolPacked(keySize int, vals []bool) int { + if len(vals) == 0 { + return 0 + } + return SizeBytesValue(keySize, len(vals)) +} + +// SizeStringValue returns the encoded field size for one present string value. +func SizeStringValue(keySize int, v string) int { + l := len(v) + return keySize + l + SizeOfVarint(uint64Len(l)) +} + +// SizeStringNonEmpty returns the encoded field size for one implicit string value. +func SizeStringNonEmpty(keySize int, v string) int { + if v == "" { + return 0 + } + return SizeStringValue(keySize, v) +} + +// SizeStringPtr returns the encoded field size for one explicit string value. +func SizeStringPtr(keySize int, v *string) int { + if v == nil { + return 0 + } + return SizeStringValue(keySize, *v) +} + +// SizeStringSlice returns the encoded field size for repeated strings. +func SizeStringSlice[S ~[]E, E ~string](keySize int, vals S) (n int) { + for _, v := range vals { + n += SizeStringValue(keySize, string(v)) + } + return n +} + +// SizeBytesValue returns the encoded field size for one present length-delimited value. +func SizeBytesValue(keySize, l int) int { + return keySize + l + SizeOfVarint(uint64Len(l)) +} + +// SizeBytesNonEmpty returns the encoded field size for one implicit bytes value. +func SizeBytesNonEmpty(keySize int, v []byte) int { + if len(v) == 0 { + return 0 + } + return SizeBytesValue(keySize, len(v)) +} + +// SizeBytesPresent returns the encoded field size for one explicit bytes value. +func SizeBytesPresent(keySize int, v []byte) int { + if v == nil { + return 0 + } + return SizeBytesValue(keySize, len(v)) +} + +// SizeBytesSlice returns the encoded field size for repeated bytes values. +func SizeBytesSlice[S ~[]E, E ~[]byte](keySize int, vals S) (n int) { + for _, v := range vals { + n += SizeBytesValue(keySize, len(v)) + } + return n +} + +// SizeMessage returns the encoded field size for one length-delimited message or map entry. +func SizeMessage(keySize, msgSize int) int { + return SizeBytesValue(keySize, msgSize) +} + +// SizeGroup returns the encoded field size for one group value. +func SizeGroup(keySize, msgSize int) int { + return msgSize + 2*keySize +} + // Skip the first record of the byte slice and return the offset of the next record. func Skip(dAtA []byte) (n int, err error) { l := len(dAtA) @@ -592,3 +1295,19 @@ func Skip(dAtA []byte) (n int, err error) { } return 0, io.ErrUnexpectedEOF } + +// SkipWithin skips one encoded field at idx and verifies it stays within limit. +func SkipWithin(dAtA []byte, idx, limit int) (int, error) { + skippy, err := Skip(dAtA[idx:]) + if err != nil { + return 0, err + } + next := idx + skippy + if skippy < 0 || next < 0 { + return 0, ErrInvalidLength + } + if next > limit { + return 0, io.ErrUnexpectedEOF + } + return next, nil +} diff --git a/vendor/github.com/checkpoint-restore/go-criu/v8/README.md b/vendor/github.com/checkpoint-restore/go-criu/v8/README.md index 7e268bf69..f8157b039 100644 --- a/vendor/github.com/checkpoint-restore/go-criu/v8/README.md +++ b/vendor/github.com/checkpoint-restore/go-criu/v8/README.md @@ -62,7 +62,7 @@ The following table shows the relation between go-criu and criu versions: | Major version | Latest release | CRIU version | | -------------- | -------------- | ------------ | -| v8 | 8.2.0 | 4.2 | +| v8 | 8.4.0 | 4.2 | | v7 | 7.2.0 | 3.19 | | v7 | 7.0.0 | 3.18 | | v6 | 6.3.0 | 3.17 | diff --git a/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.pb.go b/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.pb.go index 4c053a921..e4c216f99 100644 --- a/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.pb.go +++ b/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.pb.go @@ -133,6 +133,39 @@ func (x CriuPreDumpMode) String() string { return strconv.Itoa(int(x)) } +type CriuImageIoMode int32 + +const ( + CriuImageIoMode_IMAGE_IO_WRITEBACK CriuImageIoMode = 0 + CriuImageIoMode_IMAGE_IO_DIRECT CriuImageIoMode = 1 +) + +// Enum value maps for CriuImageIoMode. +var ( + CriuImageIoMode_name = map[int32]string{ + 0: "IMAGE_IO_WRITEBACK", + 1: "IMAGE_IO_DIRECT", + } + CriuImageIoMode_value = map[string]int32{ + "IMAGE_IO_WRITEBACK": 0, + "IMAGE_IO_DIRECT": 1, + } +) + +func (x CriuImageIoMode) Enum() *CriuImageIoMode { + p := new(CriuImageIoMode) + *p = x + return p +} + +func (x CriuImageIoMode) String() string { + name, valid := CriuImageIoMode_name[int32(x)] + if valid { + return name + } + return strconv.Itoa(int(x)) +} + type CriuReqType int32 const ( @@ -471,7 +504,8 @@ type CriuOpts struct { Unprivileged *bool `protobuf:"varint,67,opt,name=unprivileged" json:"unprivileged,omitempty"` LeaveStopped *bool `protobuf:"varint,69,opt,name=leave_stopped,json=leaveStopped" json:"leaveStopped,omitempty"` DisplayStats *bool `protobuf:"varint,70,opt,name=display_stats,json=displayStats" json:"displayStats,omitempty"` - LogToStderr *bool `protobuf:"varint,71,opt,name=log_to_stderr,json=logToStderr" json:"logToStderr,omitempty"` // optional bool check_mounts = 128; + LogToStderr *bool `protobuf:"varint,71,opt,name=log_to_stderr,json=logToStderr" json:"logToStderr,omitempty"` + ImageIoMode *CriuImageIoMode `protobuf:"varint,72,opt,name=image_io_mode,json=imageIoMode,def=0" json:"imageIoMode,omitempty"` // optional bool check_mounts = 128; } // Default values for CriuOpts fields. @@ -482,6 +516,7 @@ const ( Default_CriuOpts_GhostLimit = uint32(1048576) Default_CriuOpts_PreDumpMode = CriuPreDumpMode_SPLICE Default_CriuOpts_NetworkLock = CriuNetworkLockMethod_IPTABLES + Default_CriuOpts_ImageIoMode = CriuImageIoMode_IMAGE_IO_WRITEBACK ) func (x *CriuOpts) Reset() { @@ -980,6 +1015,13 @@ func (x *CriuOpts) GetLogToStderr() bool { return false } +func (x *CriuOpts) GetImageIoMode() CriuImageIoMode { + if x != nil && x.ImageIoMode != nil { + return *x.ImageIoMode + } + return Default_CriuOpts_ImageIoMode +} + type CriuDumpResp struct { unknownFields []byte Restored *bool `protobuf:"varint,1,opt,name=restored" json:"restored,omitempty"` @@ -1757,6 +1799,10 @@ func (m *CriuOpts) CloneVT() *CriuOpts { tmpVal := *rhs r.LogToStderr = &tmpVal } + if rhs := m.ImageIoMode; rhs != nil { + tmpVal := *rhs + r.ImageIoMode = &tmpVal + } if len(m.unknownFields) > 0 { r.unknownFields = slices.Clone(m.unknownFields) } @@ -2464,6 +2510,9 @@ func (this *CriuOpts) EqualVT(that *CriuOpts) bool { if p, q := this.LogToStderr, that.LogToStderr; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { return false } + if p, q := this.ImageIoMode, that.ImageIoMode; (p == nil && q != nil) || (p != nil && (q == nil || *p != *q)) { + return false + } return string(this.unknownFields) == string(that.unknownFields) } @@ -3062,6 +3111,13 @@ func (m *CriuOpts) MarshalToSizedBufferVT(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.ImageIoMode != nil { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(*m.ImageIoMode)) + i-- + dAtA[i] = 0x4 + i-- + dAtA[i] = 0xc0 + } if m.LogToStderr != nil { i-- if *m.LogToStderr { @@ -4632,6 +4688,13 @@ func (m *CriuOpts) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) { i -= len(m.unknownFields) copy(dAtA[i:], m.unknownFields) } + if m.ImageIoMode != nil { + i = protobuf_go_lite.EncodeVarint(dAtA, i, uint64(*m.ImageIoMode)) + i-- + dAtA[i] = 0x4 + i-- + dAtA[i] = 0xc0 + } if m.LogToStderr != nil { i-- if *m.LogToStderr { @@ -6216,6 +6279,9 @@ func (m *CriuOpts) SizeVT() (n int) { if m.LogToStderr != nil { n += 3 } + if m.ImageIoMode != nil { + n += 2 + protobuf_go_lite.SizeOfVarint(uint64(*m.ImageIoMode)) + } n += len(m.unknownFields) return n } @@ -6401,6 +6467,9 @@ func (x CriuNetworkLockMethod) MarshalProtoText() string { func (x CriuPreDumpMode) MarshalProtoText() string { return x.String() } +func (x CriuImageIoMode) MarshalProtoText() string { + return x.String() +} func (x CriuReqType) MarshalProtoText() string { return x.String() } @@ -7181,6 +7250,15 @@ func (x *CriuOpts) MarshalProtoText() string { sb.WriteString("log_to_stderr: ") sb.WriteString(strconv.FormatBool(*x.LogToStderr)) } + if x.ImageIoMode != nil { + if sb.Len() > 11 { + sb.WriteString(" ") + } + sb.WriteString("image_io_mode: ") + sb.WriteString("\"") + sb.WriteString(x.ImageIoMode.String()) + sb.WriteString("\"") + } sb.WriteString("}") return sb.String() } @@ -9311,6 +9389,18 @@ func (m *CriuOpts) UnmarshalVT(dAtA []byte) error { } b := bool(v != 0) m.LogToStderr = &b + case 72: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ImageIoMode", wireType) + } + var v CriuImageIoMode + var _v uint64 + _v, iNdEx, err = protobuf_go_lite.DecodeVarint(dAtA, iNdEx) + v = CriuImageIoMode(_v) + if err != nil { + return err + } + m.ImageIoMode = &v default: iNdEx = preIndex skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) @@ -12146,6 +12236,18 @@ func (m *CriuOpts) UnmarshalVTUnsafe(dAtA []byte) error { } b := bool(v != 0) m.LogToStderr = &b + case 72: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ImageIoMode", wireType) + } + var v CriuImageIoMode + var _v uint64 + _v, iNdEx, err = protobuf_go_lite.DecodeVarint(dAtA, iNdEx) + v = CriuImageIoMode(_v) + if err != nil { + return err + } + m.ImageIoMode = &v default: iNdEx = preIndex skippy, err := protobuf_go_lite.Skip(dAtA[iNdEx:]) diff --git a/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.proto b/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.proto index 1a4722a9c..c63f33026 100644 --- a/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.proto +++ b/vendor/github.com/checkpoint-restore/go-criu/v8/rpc/rpc.proto @@ -60,6 +60,11 @@ enum criu_pre_dump_mode { VM_READ = 2; }; +enum criu_image_io_mode { + IMAGE_IO_WRITEBACK = 0; + IMAGE_IO_DIRECT = 1; +}; + message criu_opts { required int32 images_dir_fd = 1 [default = -1]; optional string images_dir = 68; /* used only if images_dir_fd == -1 */ @@ -145,6 +150,7 @@ message criu_opts { optional bool leave_stopped = 69; optional bool display_stats = 70; optional bool log_to_stderr = 71; + optional criu_image_io_mode image_io_mode = 72 [default = IMAGE_IO_WRITEBACK]; /* optional bool check_mounts = 128; */ } diff --git a/vendor/modules.txt b/vendor/modules.txt index ca9428494..c308d3549 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -4,10 +4,10 @@ cyphar.com/go-pathrs cyphar.com/go-pathrs/internal/fdutils cyphar.com/go-pathrs/internal/libpathrs cyphar.com/go-pathrs/procfs -# github.com/aperturerobotics/protobuf-go-lite v0.14.0 +# github.com/aperturerobotics/protobuf-go-lite v0.15.0 ## explicit; go 1.23 github.com/aperturerobotics/protobuf-go-lite -# github.com/checkpoint-restore/go-criu/v8 v8.3.0 +# github.com/checkpoint-restore/go-criu/v8 v8.4.0 ## explicit; go 1.25.0 github.com/checkpoint-restore/go-criu/v8 github.com/checkpoint-restore/go-criu/v8/internal/proto