From e65209ffc21fc82b4e9a43621182e1b0cbecb487 Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Sun, 26 Mar 2023 13:22:42 +0530 Subject: [PATCH 1/4] chore: move magic-gen to subdirectory Since the proto-gen script will also be placed in the scripts directory, it is ideal to have each script in its own subdirectory along with the associated tests and Makefile. Signed-off-by: Prajwal S N --- .github/workflows/main.yml | 2 +- .gitignore | 6 +++--- scripts/README.md | 6 +++--- scripts/{ => magic-gen}/Makefile | 6 ++++-- scripts/{ => magic-gen}/magicgen-test.sh | 0 scripts/{ => magic-gen}/magicgen.go | 0 scripts/{ => magic-gen}/magicgen_test.go | 0 test/Makefile | 4 ++-- 8 files changed, 13 insertions(+), 11 deletions(-) rename scripts/{ => magic-gen}/Makefile (74%) rename scripts/{ => magic-gen}/magicgen-test.sh (100%) rename scripts/{ => magic-gen}/magicgen.go (100%) rename scripts/{ => magic-gen}/magicgen_test.go (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f82b0bd51..c5db95ef9 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,7 +44,7 @@ jobs: run: sudo -E make test - name: Test magicgen script - run: sudo -E make -C scripts test + run: make -C scripts/magic-gen test - name: Test CRIT run: | diff --git a/.gitignore b/.gitignore index 5fc93424a..0129af9a5 100644 --- a/.gitignore +++ b/.gitignore @@ -9,8 +9,8 @@ test/crit/test-imgs test/crit/crit-test.coverage test/.coverage/ image -scripts/*.h -scripts/expected.go -scripts/output.go +scripts/magic-gen/*.h +scripts/magic-gen/expected.go +scripts/magic-gen/output.go crit/bin crit/test-imgs/ diff --git a/scripts/README.md b/scripts/README.md index 8dfd4da03..d3d619327 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -1,7 +1,7 @@ -This directory contains scripts used by go-criu. +This directory provides scripts used by go-criu. Each script is contained in its own directory, along with the respective Makefile and tests. -# `magicgen` -CRIU uses a 32-bit integer value to determine the type of image file. These values are called *magics*, and are defined [here](https://github.com/checkpoint-restore/criu/tree/master/criu/include/magic.h). `magicgen.go` processes this header file and generates `../magic/magic.go` with a map of magic names and values. +## `magic-gen` +CRIU uses a 32-bit integer value to determine the type of image file. These values are called *magics*, and are defined [here](https://github.com/checkpoint-restore/criu/tree/master/criu/include/magic.h). `magicgen.go` processes this header file and generates `magic.go` with a map of magic names and values. If the destination path is not provided, the script uses `../magic/magic.go` by default. `Usage: magicgen.go /path/to/magic.h /path/to/magic.go` diff --git a/scripts/Makefile b/scripts/magic-gen/Makefile similarity index 74% rename from scripts/Makefile rename to scripts/magic-gen/Makefile index 9f7044371..f0bbeace3 100644 --- a/scripts/Makefile +++ b/scripts/magic-gen/Makefile @@ -1,7 +1,9 @@ GO ?= go +MAGIC_DEST ?= ../../magic/magic.go + magic-gen: clean magic.h - $(GO) run magicgen.go magic.h ../magic/magic.go + $(GO) run magicgen.go magic.h $(MAGIC_DEST) magic.h: curl -s https://raw.githubusercontent.com/checkpoint-restore/criu/criu-dev/criu/include/magic.h -o magic.h @@ -14,6 +16,6 @@ test: @rm -f input.h output.go expected.go clean: - rm -f ../magic/magic.go magic.h + rm -f $(MAGIC_DEST) magic.h .PHONY: magic-gen test clean diff --git a/scripts/magicgen-test.sh b/scripts/magic-gen/magicgen-test.sh similarity index 100% rename from scripts/magicgen-test.sh rename to scripts/magic-gen/magicgen-test.sh diff --git a/scripts/magicgen.go b/scripts/magic-gen/magicgen.go similarity index 100% rename from scripts/magicgen.go rename to scripts/magic-gen/magicgen.go diff --git a/scripts/magicgen_test.go b/scripts/magic-gen/magicgen_test.go similarity index 100% rename from scripts/magicgen_test.go rename to scripts/magic-gen/magicgen_test.go diff --git a/test/Makefile b/test/Makefile index f3f90a36c..280133427 100644 --- a/test/Makefile +++ b/test/Makefile @@ -90,8 +90,8 @@ coverage: check-go-version $(COVERAGE_BINARIES) $(TEST_PAYLOAD) $(MAKE) -C ../crit/ unit-test GOFLAGS="-coverprofile=${COVERAGE_PATH}/coverprofile-crit-unit-test" $(MAKE) -C crit/ e2e-test GOCOVERDIR=${COVERAGE_PATH} $(MAKE) -C crit/ clean - # Generate coverage for ../scripts - $(MAKE) -C ../scripts/ test GOFLAGS="-coverprofile=${COVERAGE_PATH}/coverprofile-scripts-unit-test" GOCOVERDIR="${COVERAGE_PATH}" + # Generate coverage for ../scripts/magic-gen + $(MAKE) -C ../scripts/magic-gen test GOFLAGS="-coverprofile=${COVERAGE_PATH}/coverprofile-scripts-unit-test" GOCOVERDIR="${COVERAGE_PATH}" # Print coverage from this run $(GO) tool covdata percent -i=${COVERAGE_PATH} $(GO) tool covdata textfmt -i=${COVERAGE_PATH} -o ${COVERAGE_PATH}/coverage.out From 61f826637cb480f3df7aaedbedbd4590e40e46a3 Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Sun, 26 Mar 2023 20:09:29 +0530 Subject: [PATCH 2/4] crit(proto-gen): move to Python script Previously, CRIT was using an overengineered Makefile stunt to generate protobuf bindings for the CLI. The problem of statically linking all the bindings while using the library as a dependency cannot be resolved in a reasonable manner in the Makefile. The logic has been moved out into a Python script. Signed-off-by: Prajwal S N --- scripts/README.md | 15 +++++++++++- scripts/proto-gen/Makefile | 30 +++++++++++++++++++++++ scripts/proto-gen/protogen.py | 45 +++++++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 scripts/proto-gen/Makefile create mode 100644 scripts/proto-gen/protogen.py diff --git a/scripts/README.md b/scripts/README.md index d3d619327..223435cde 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -5,7 +5,20 @@ CRIU uses a 32-bit integer value to determine the type of image file. These valu `Usage: magicgen.go /path/to/magic.h /path/to/magic.go` -A set of Makefile targets are provided for convenience: +Makefile targets provided: + - `make` or `make magic-gen`: Generate `../magic/magic.go` - `make test`: Run unit test and E2E test for `magicgen.go` - `make clean`: Remove `../magic/magic.go` and `magic.h` + +## `proto-gen` +CRIT uses protobuf bindings to serialise and deserialise CRIU image files. The definitions for these bindings are available in [criu/images](https://github.com/checkpoint-restore/criu/tree/master/images). `protogen.py` fetches these definitions and generates the `.pb.go` files used by CRIT. If the source or destination directory is not provided, the script uses `../crit/images` by default. + +`Usage: protogen.py /path/to/definitions/dir /path/to/destination/dir` + +Makefile targets provided: + +- `make` or `make pb-gen`: Generate the `.pb.go` bindings +- `make proto-update`: Update the `.proto` files with the latest copy from the CRIU repo. The GIT_BRANCH variable can be used to specify the branch to fetch the files from. +- `make clean-proto`: Delete all `.proto` bindings +- `make clean-pb`: Delete all `.pb.go` bindings diff --git a/scripts/proto-gen/Makefile b/scripts/proto-gen/Makefile new file mode 100644 index 000000000..1b5763e1d --- /dev/null +++ b/scripts/proto-gen/Makefile @@ -0,0 +1,30 @@ +PY ?= python3 +PROTO_PATH ?= ../../crit/images +PB_PATH ?= ../../crit/images +GIT_BRANCH ?= master + +pb-gen: clean-pb + @$(PY) protogen.py $(PROTO_PATH) $(PB_PATH) + +proto-update: clean-proto + git clone --depth 1 --branch $(GIT_BRANCH) https://github.com/checkpoint-restore/criu criu-temp + cp criu-temp/images/*.proto $(PROTO_PATH)/ + # rpc.proto is not an image and it is used only to communicate criu-service and swrk. + rm -rf criu-temp $(PROTO_PATH)/rpc.proto + # To prevent namespace conflict with proto files + # in github.com/letsencrypt/boulder, we prepend + # a prefix to the filenames. + mv $(PROTO_PATH)/sa.proto $(PROTO_PATH)/criu-sa.proto + sed -i 's/sa\.proto/criu-sa\.proto/g' $(PROTO_PATH)/*.proto + mv $(PROTO_PATH)/core.proto $(PROTO_PATH)/criu-core.proto + sed -i 's/core\.proto/criu-core\.proto/g' $(PROTO_PATH)/*.proto + +clean-proto: + @echo "Removing existing .proto files..." + rm $(PROTO_PATH)/*.proto || true + +clean-pb: + @echo "Removing existing .pb.go files..." + find $(PB_PATH) -type f -name '*.pb.go' -delete + +.PHONY: pb-gen proto-update clean-proto clean-pb diff --git a/scripts/proto-gen/protogen.py b/scripts/proto-gen/protogen.py new file mode 100644 index 000000000..f265e07a2 --- /dev/null +++ b/scripts/proto-gen/protogen.py @@ -0,0 +1,45 @@ +import os +import shutil +import argparse +import subprocess + +parser = argparse.ArgumentParser( + description='A script to generate Go bindings for the protobuf definitions provided by CRIU') +parser.add_argument( + 'src', help='Path to the definitions directory', type=str) +parser.add_argument( + 'dest', help='Path to the destination directory', type=str) + +args = parser.parse_args() + +# The import paths for each package passed to --go_opt +pkg_opts = '' +# The names of the .proto files without the extension +names = [] + +# Loop over the files in the src dir +for file in os.listdir(args.src): + if file.endswith('.proto'): + # Strip the .proto extension + name = os.path.splitext(file)[0] + names.append(name) + # Add the import path for the protoc file + pkg_opts += ',M{0}.proto=github.com/checkpoint-restore/go-criu/v6/crit/images/{0}'.format( + name) + +# Create the dest dir +if not os.path.exists(args.dest): + os.makedirs(args.dest) +# Generate the .pb.go files +command = 'protoc -I {} --go_opt=paths=source_relative{} --go_out={} {}'.format( + args.src, pkg_opts, args.dest, ' '.join(map(lambda s: os.path.join(args.src, s + '.proto'), names))) +result = subprocess.run(command, shell=True) + +# Move the files to the respective dirs +for name in names: + # Create dir with the same name as the file + dir_name = os.path.join(args.dest, name) + os.makedirs(dir_name, exist_ok=True) + # Move the generated .pb.go file from the dest dir + shutil.move(os.path.join(args.dest, name + '.pb.go'), + os.path.join(dir_name, name + '.pb.go')) From 854004d4798e0c3d23afd0fdc6ec12564532361a Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Mon, 27 Mar 2023 20:51:56 +0530 Subject: [PATCH 3/4] refactor(crit): move pb.go files to separate dirs Using the new Python script, the protobuf bindings are now generated in independent packages. This commit refactors CRIT to work with the new organisation of files. It does not change the implementation of CRIT in any way apart from resolving the imports correctly. Signed-off-by: Prajwal S N --- .github/workflows/main.yml | 17 +- crit/Makefile | 40 +--- crit/cmd/cli.go | 2 +- crit/crit.go | 10 +- crit/decode-extra.go | 24 ++- crit/decode.go | 10 +- crit/encode-extra.go | 4 +- crit/explore.go | 53 ++--- crit/image.go | 10 +- crit/images/{ => apparmor}/apparmor.pb.go | 6 +- crit/images/{ => autofs}/autofs.pb.go | 6 +- .../{ => binfmt-misc}/binfmt-misc.pb.go | 6 +- .../{ => bpfmap-data}/bpfmap-data.pb.go | 6 +- .../{ => bpfmap-file}/bpfmap-file.pb.go | 46 ++--- crit/images/{ => cgroup}/cgroup.pb.go | 6 +- .../{ => core-aarch64}/core-aarch64.pb.go | 8 +- crit/images/{ => core-arm}/core-arm.pb.go | 8 +- crit/images/core-mips.proto | 0 crit/images/{ => core-mips}/core-mips.pb.go | 8 +- crit/images/{ => core-ppc64}/core-ppc64.pb.go | 8 +- crit/images/{ => core-s390}/core-s390.pb.go | 8 +- crit/images/{ => core-x86}/core-x86.pb.go | 8 +- crit/images/{ => cpuinfo}/cpuinfo.pb.go | 6 +- crit/images/{ => creds}/creds.pb.go | 6 +- crit/images/{ => criu-core}/criu-core.pb.go | 184 +++++++++--------- crit/images/{ => criu-sa}/criu-sa.pb.go | 8 +- crit/images/{ => eventfd}/eventfd.pb.go | 20 +- crit/images/{ => eventpoll}/eventpoll.pb.go | 14 +- crit/images/{ => ext-file}/ext-file.pb.go | 18 +- crit/images/{ => fdinfo}/fdinfo.pb.go | 166 ++++++++-------- crit/images/{ => fh}/fh.pb.go | 24 +-- crit/images/{ => fifo}/fifo.pb.go | 6 +- crit/images/{ => file-lock}/file-lock.pb.go | 6 +- crit/images/{ => fown}/fown.pb.go | 6 +- crit/images/{ => fs}/fs.pb.go | 6 +- crit/images/{ => fsnotify}/fsnotify.pb.go | 46 ++--- crit/images/{ => ghost-file}/ghost-file.pb.go | 68 +++---- crit/images/handler.go | 181 +++++++++++------ .../{ => img-streamer}/img-streamer.pb.go | 6 +- crit/images/{ => inventory}/inventory.pb.go | 36 ++-- crit/images/{ => ipc-desc}/ipc-desc.pb.go | 6 +- crit/images/{ => ipc-msg}/ipc-msg.pb.go | 22 +-- crit/images/{ => ipc-sem}/ipc-sem.pb.go | 18 +- crit/images/{ => ipc-shm}/ipc-shm.pb.go | 22 +-- crit/images/{ => ipc-var}/ipc-var.pb.go | 6 +- crit/images/{ => macvlan}/macvlan.pb.go | 6 +- crit/images/{ => memfd}/memfd.pb.go | 24 +-- crit/images/{ => mm}/mm.pb.go | 16 +- crit/images/{ => mnt}/mnt.pb.go | 8 +- crit/images/{ => netdev}/netdev.pb.go | 100 +++++----- crit/images/{ => ns}/ns.pb.go | 6 +- crit/images/{ => opts}/opts.pb.go | 6 +- .../{ => packet-sock}/packet-sock.pb.go | 66 +++---- crit/images/{ => pagemap}/pagemap.pb.go | 8 +- crit/images/{ => pidns}/pidns.pb.go | 6 +- crit/images/{ => pipe-data}/pipe-data.pb.go | 6 +- crit/images/{ => pipe}/pipe.pb.go | 24 +-- crit/images/{ => pstree}/pstree.pb.go | 6 +- crit/images/{ => regfile}/regfile.pb.go | 34 ++-- .../remap-file-path.pb.go | 6 +- crit/images/{ => rlimit}/rlimit.pb.go | 6 +- crit/images/{ => rseq}/rseq.pb.go | 6 +- crit/images/{ => seccomp}/seccomp.pb.go | 6 +- crit/images/{ => siginfo}/siginfo.pb.go | 6 +- crit/images/{ => signalfd}/signalfd.pb.go | 24 +-- crit/images/{ => sit}/sit.pb.go | 8 +- crit/images/{ => sk-inet}/sk-inet.pb.go | 70 +++---- crit/images/{ => sk-netlink}/sk-netlink.pb.go | 46 ++--- crit/images/{ => sk-opts}/sk-opts.pb.go | 6 +- crit/images/{ => sk-packet}/sk-packet.pb.go | 6 +- crit/images/{ => sk-unix}/sk-unix.pb.go | 56 +++--- crit/images/{ => stats}/stats.pb.go | 6 +- crit/images/{ => sysctl}/sysctl.pb.go | 6 +- crit/images/{ => tcp-stream}/tcp-stream.pb.go | 8 +- crit/images/{ => time}/time.pb.go | 6 +- crit/images/{ => timens}/timens.pb.go | 6 +- crit/images/{ => timer}/timer.pb.go | 6 +- crit/images/{ => timerfd}/timerfd.pb.go | 36 ++-- crit/images/{ => tty}/tty.pb.go | 36 ++-- crit/images/{ => tun}/tun.pb.go | 8 +- crit/images/{ => userns}/userns.pb.go | 6 +- crit/images/{ => utsns}/utsns.pb.go | 6 +- crit/images/{ => vma}/vma.pb.go | 8 +- crit/stats.go | 10 +- crit/utils.go | 31 +-- phaul/client.go | 8 +- 86 files changed, 980 insertions(+), 944 deletions(-) rename crit/images/{ => apparmor}/apparmor.pb.go (99%) rename crit/images/{ => autofs}/autofs.pb.go (98%) rename crit/images/{ => binfmt-misc}/binfmt-misc.pb.go (98%) rename crit/images/{ => bpfmap-data}/bpfmap-data.pb.go (98%) rename crit/images/{ => bpfmap-file}/bpfmap-file.pb.go (82%) rename crit/images/{ => cgroup}/cgroup.pb.go (99%) rename crit/images/{ => core-aarch64}/core-aarch64.pb.go (98%) rename crit/images/{ => core-arm}/core-arm.pb.go (99%) mode change 100644 => 100755 crit/images/core-mips.proto rename crit/images/{ => core-mips}/core-mips.pb.go (99%) rename crit/images/{ => core-ppc64}/core-ppc64.pb.go (99%) rename crit/images/{ => core-s390}/core-s390.pb.go (99%) rename crit/images/{ => core-x86}/core-x86.pb.go (99%) rename crit/images/{ => cpuinfo}/cpuinfo.pb.go (99%) rename crit/images/{ => creds}/creds.pb.go (99%) rename crit/images/{ => criu-core}/criu-core.pb.go (82%) rename crit/images/{ => criu-sa}/criu-sa.pb.go (97%) rename crit/images/{ => eventfd}/eventfd.pb.go (89%) rename crit/images/{ => eventpoll}/eventpoll.pb.go (96%) rename crit/images/{ => ext-file}/ext-file.pb.go (90%) rename crit/images/{ => fdinfo}/fdinfo.pb.go (77%) rename crit/images/{ => fh}/fh.pb.go (90%) rename crit/images/{ => fifo}/fifo.pb.go (98%) rename crit/images/{ => file-lock}/file-lock.pb.go (98%) rename crit/images/{ => fown}/fown.pb.go (98%) rename crit/images/{ => fs}/fs.pb.go (98%) rename crit/images/{ => fsnotify}/fsnotify.pb.go (93%) rename crit/images/{ => ghost-file}/ghost-file.pb.go (74%) rename crit/images/{ => img-streamer}/img-streamer.pb.go (98%) rename crit/images/{ => inventory}/inventory.pb.go (83%) rename crit/images/{ => ipc-desc}/ipc-desc.pb.go (98%) rename crit/images/{ => ipc-msg}/ipc-msg.pb.go (91%) rename crit/images/{ => ipc-sem}/ipc-sem.pb.go (89%) rename crit/images/{ => ipc-shm}/ipc-shm.pb.go (86%) rename crit/images/{ => ipc-var}/ipc-var.pb.go (99%) rename crit/images/{ => macvlan}/macvlan.pb.go (98%) rename crit/images/{ => memfd}/memfd.pb.go (92%) rename crit/images/{ => mm}/mm.pb.go (97%) rename crit/images/{ => mnt}/mnt.pb.go (99%) rename crit/images/{ => netdev}/netdev.pb.go (81%) rename crit/images/{ => ns}/ns.pb.go (98%) rename crit/images/{ => opts}/opts.pb.go (99%) rename crit/images/{ => packet-sock}/packet-sock.pb.go (86%) rename crit/images/{ => pagemap}/pagemap.pb.go (98%) rename crit/images/{ => pidns}/pidns.pb.go (98%) rename crit/images/{ => pipe-data}/pipe-data.pb.go (98%) rename crit/images/{ => pipe}/pipe.pb.go (87%) rename crit/images/{ => pstree}/pstree.pb.go (98%) rename crit/images/{ => regfile}/regfile.pb.go (88%) rename crit/images/{ => remap-file-path}/remap-file-path.pb.go (98%) rename crit/images/{ => rlimit}/rlimit.pb.go (98%) rename crit/images/{ => rseq}/rseq.pb.go (98%) rename crit/images/{ => seccomp}/seccomp.pb.go (98%) rename crit/images/{ => siginfo}/siginfo.pb.go (98%) rename crit/images/{ => signalfd}/signalfd.pb.go (87%) rename crit/images/{ => sit}/sit.pb.go (98%) rename crit/images/{ => sk-inet}/sk-inet.pb.go (85%) rename crit/images/{ => sk-netlink}/sk-netlink.pb.go (80%) rename crit/images/{ => sk-opts}/sk-opts.pb.go (99%) rename crit/images/{ => sk-packet}/sk-packet.pb.go (98%) rename crit/images/{ => sk-unix}/sk-unix.pb.go (86%) rename crit/images/{ => stats}/stats.pb.go (99%) rename crit/images/{ => sysctl}/sysctl.pb.go (98%) rename crit/images/{ => tcp-stream}/tcp-stream.pb.go (98%) rename crit/images/{ => time}/time.pb.go (98%) rename crit/images/{ => timens}/timens.pb.go (98%) rename crit/images/{ => timer}/timer.pb.go (99%) rename crit/images/{ => timerfd}/timerfd.pb.go (83%) rename crit/images/{ => tty}/tty.pb.go (96%) rename crit/images/{ => tun}/tun.pb.go (98%) rename crit/images/{ => userns}/userns.pb.go (99%) rename crit/images/{ => utsns}/utsns.pb.go (98%) rename crit/images/{ => vma}/vma.pb.go (98%) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c5db95ef9..24a7a1ad4 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -44,20 +44,21 @@ jobs: run: sudo -E make test - name: Test magicgen script - run: make -C scripts/magic-gen test + run: sudo -E make -C scripts/magic-gen test - name: Test CRIT run: | if [ "${{ matrix.criu_branch }}" = "criu-dev" ]; then - # We need to use the protobuf definitions from the criu-dev - # branch as it might have changed. - make -C crit update-proto GIT_BRANCH=${{ matrix.criu_branch }} # First update protobuf. It is too old in the Ubuntu image. - curl -Lo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v3.20.3/protoc-3.20.3-linux-x86_64.zip + curl -Lo protoc.zip https://github.com/protocolbuffers/protobuf/releases/download/v22.2/protoc-22.2-linux-x86_64.zip sudo unzip -o protoc.zip -d /usr - sudo -E make -C crit clean - make -C crit gen-proto - sudo -E make -C crit all + # We need to use the protobuf definitions from the criu-dev + # branch as it might have changed. + sudo -E make -C scripts/proto-gen proto-update GIT_BRANCH=${{ matrix.criu_branch }} + # Generate the bindings + sudo -E make -C scripts/proto-gen + # Build the CRIT binary + sudo -E make -C crit clean bin/crit fi sudo -E make -C crit unit-test sudo -E make -C test crit-test diff --git a/crit/Makefile b/crit/Makefile index 1d8205ca5..0de82c453 100644 --- a/crit/Makefile +++ b/crit/Makefile @@ -1,42 +1,6 @@ GO ?= go CRIU ?= criu -# The import path that protoc will use if a proto file imports another one -import_path := github.com/checkpoint-restore/go-criu/crit/images -# Path to .proto source files -proto_path := ./images -# Generate string of all .proto filenames -proto_files := $(sort $(subst $(proto_path)/,,$(wildcard $(proto_path)/*.proto))) -# Generate M flag to specify import path for all .proto files -# and replace all spaces with commas to use with go_opt flag -comma := , -proto_opts := $(subst $() $(),$(comma),$(patsubst %,M%=$(import_path),$(proto_files))) -GIT_BRANCH := master - -all: gen-proto bin/crit - -update-proto: - rm ./images/*.proto || true - git clone --depth 1 --branch $(GIT_BRANCH) https://github.com/checkpoint-restore/criu criu-temp - cp criu-temp/images/*.proto ./images/ - # rpc.proto is not an image and it is used only to communicate criu-service and swrk. - rm -rf criu-temp images/rpc.proto - # To prevent namespace conflict with proto files - # in github.com/letsencrypt/boulder, we prepend - # a prefix to the filenames. - mv ./images/sa.proto ./images/criu-sa.proto - sed -i 's/sa\.proto/criu-sa\.proto/g' images/*.proto - mv ./images/core.proto ./images/criu-core.proto - sed -i 's/core\.proto/criu-core\.proto/g' images/*.proto - -gen-proto: - rm -f ./images/*.pb.go - @protoc \ - --proto_path=$(proto_path) \ - --go_out=$(proto_path) \ - --go_opt=paths=source_relative,$(proto_opts) \ - $(proto_files) - bin/crit: cmd/cli.go $(GO) build ${GOFLAGS} -o $@ $^ @@ -52,10 +16,10 @@ test-imgs: ../test/loop/loop unit-test: test-imgs $(eval GOFLAGS ?= -cover) - go test ${GOFLAGS} -v ./... + $(GO) test ${GOFLAGS} -v ./... clean: @rm -f bin/crit @rm -rf test-imgs -.PHONY: all gen-proto update-proto unit-test clean +.PHONY: unit-test clean diff --git a/crit/cmd/cli.go b/crit/cmd/cli.go index 45701c47c..e65b82f47 100644 --- a/crit/cmd/cli.go +++ b/crit/cmd/cli.go @@ -13,7 +13,7 @@ import ( var ( // The crit service used to invoke all commands - c crit.CritSvc + c crit.Critter // All members needed for crit struct inputFilePath string diff --git a/crit/crit.go b/crit/crit.go index a7d401e1f..449a2f5ea 100644 --- a/crit/crit.go +++ b/crit/crit.go @@ -8,9 +8,9 @@ import ( "os" ) -// CritSvc is the interface that wraps all CRIT operations. +// Critter is the interface that wraps all CRIT operations. // To create a CRIT service instance, use New(). -type CritSvc interface { +type Critter interface { // Read binary image file into Go struct (decode.go) Decode() (*CriuImage, error) // Read only counts of image file entries into Go struct @@ -26,7 +26,7 @@ type CritSvc interface { ExploreRss() ([]*RssMap, error) } -// crit implements the CritSvc interface. It contains: +// crit implements the Critter interface. It contains: // * Path of the input file // * Path of the output file // * Path of the input directory (for `crit explore`) @@ -48,7 +48,7 @@ func New( inputFilePath, outputFilePath, inputDirPath string, pretty, noPayload bool, -) CritSvc { +) Critter { return &crit{ inputFilePath: inputFilePath, outputFilePath: outputFilePath, @@ -66,7 +66,7 @@ func NewCli( inputFilePath, outputFilePath, inputDirPath string, pretty, noPayload bool, -) CritSvc { +) Critter { return &crit{ inputFilePath: inputFilePath, outputFilePath: outputFilePath, diff --git a/crit/decode-extra.go b/crit/decode-extra.go index d3121561a..864a1fe93 100644 --- a/crit/decode-extra.go +++ b/crit/decode-extra.go @@ -8,7 +8,13 @@ import ( "io" "os" - "github.com/checkpoint-restore/go-criu/v6/crit/images" + bpfmap_data "github.com/checkpoint-restore/go-criu/v6/crit/images/bpfmap-data" + ipc_msg "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-msg" + ipc_sem "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-sem" + ipc_shm "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-shm" + pipe_data "github.com/checkpoint-restore/go-criu/v6/crit/images/pipe-data" + sk_packet "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-packet" + tcp_stream "github.com/checkpoint-restore/go-criu/v6/crit/images/tcp-stream" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) @@ -19,7 +25,7 @@ func decodePipesData( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.PipeDataEntry) + p, ok := payload.(*pipe_data.PipeDataEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -45,7 +51,7 @@ func decodeSkQueues( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.SkPacketEntry) + p, ok := payload.(*sk_packet.SkPacketEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -76,7 +82,7 @@ func decodeTCPStream( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.TcpStreamEntry) + p, ok := payload.(*tcp_stream.TcpStreamEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -113,7 +119,7 @@ func decodeBpfmapData( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.BpfmapDataEntry) + p, ok := payload.(*bpfmap_data.BpfmapDataEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -139,7 +145,7 @@ func decodeIpcSem( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.IpcSemEntry) + p, ok := payload.(*ipc_sem.IpcSemEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -178,7 +184,7 @@ func decodeIpcShm( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.IpcShmEntry) + p, ok := payload.(*ipc_shm.IpcShmEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -210,7 +216,7 @@ func decodeIpcMsg( payload proto.Message, noPayload bool, ) (string, error) { - p, ok := payload.(*images.IpcMsgEntry) + p, ok := payload.(*ipc_msg.IpcMsgEntry) if !ok { return "", errors.New("unable to assert payload type") } @@ -234,7 +240,7 @@ func decodeIpcMsg( if _, err = f.Read(msgBuf); err != nil { return "", err } - msg := &images.IpcMsg{} + msg := &ipc_msg.IpcMsg{} if err = proto.Unmarshal(msgBuf, msg); err != nil { return "", err } diff --git a/crit/decode.go b/crit/decode.go index 12d25fa83..00492f8e3 100644 --- a/crit/decode.go +++ b/crit/decode.go @@ -8,6 +8,8 @@ import ( "os" "github.com/checkpoint-restore/go-criu/v6/crit/images" + ghost_file "github.com/checkpoint-restore/go-criu/v6/crit/images/ghost-file" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pagemap" "google.golang.org/protobuf/proto" ) @@ -101,7 +103,7 @@ func (img *CriuImage) decodeDefault( func (img *CriuImage) decodePagemap(f *os.File) error { sizeBuf := make([]byte, 4) // First entry is pagemap head - var payload proto.Message = &images.PagemapHead{} + var payload proto.Message = &pagemap.PagemapHead{} // Read payload size and payload until EOF for { if n, err := f.Read(sizeBuf); err != nil { @@ -122,7 +124,7 @@ func (img *CriuImage) decodePagemap(f *os.File) error { entry := CriuEntry{Message: payload} img.Entries = append(img.Entries, &entry) // Create struct for next entry - payload = &images.PagemapEntry{} + payload = &pagemap.PagemapEntry{} } return nil } @@ -134,7 +136,7 @@ func (img *CriuImage) decodeGhostFile(f *os.File, noPayload bool) error { return err } // Create proto struct for primary entry - payload := &images.GhostFileEntry{} + payload := &ghost_file.GhostFileEntry{} payloadSize := uint64(binary.LittleEndian.Uint32(sizeBuf)) payloadBuf := make([]byte, payloadSize) if _, err := f.Read(payloadBuf); err != nil { @@ -156,7 +158,7 @@ func (img *CriuImage) decodeGhostFile(f *os.File, noPayload bool) error { return err } // Create proto struct for chunk - payload := &images.GhostChunkEntry{} + payload := &ghost_file.GhostChunkEntry{} payloadSize := uint64(binary.LittleEndian.Uint32(sizeBuf)) payloadBuf := make([]byte, payloadSize) if _, err := f.Read(payloadBuf); err != nil { diff --git a/crit/encode-extra.go b/crit/encode-extra.go index f9af4c8ea..e8aacb636 100644 --- a/crit/encode-extra.go +++ b/crit/encode-extra.go @@ -5,7 +5,7 @@ import ( "encoding/binary" "encoding/json" - "github.com/checkpoint-restore/go-criu/v6/crit/images" + ipc_msg "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-msg" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) @@ -91,7 +91,7 @@ func encodeIpcMsg(extra string) ([]byte, error) { sizeBuf := make([]byte, 4) for i := 0; i < len(extraEntries)/2; i++ { - msg := &images.IpcMsg{} + msg := &ipc_msg.IpcMsg{} // Unmarshal JSON into proto struct if err := protojson.Unmarshal([]byte(extraEntries[i]), msg); err != nil { return nil, err diff --git a/crit/explore.go b/crit/explore.go index 43a966250..58c5cbb07 100644 --- a/crit/explore.go +++ b/crit/explore.go @@ -5,18 +5,23 @@ import ( "path/filepath" "strconv" - "github.com/checkpoint-restore/go-criu/v6/crit/images" + criu_core "github.com/checkpoint-restore/go-criu/v6/crit/images/criu-core" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fdinfo" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fs" + "github.com/checkpoint-restore/go-criu/v6/crit/images/mm" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pagemap" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pstree" ) // PsTree represents the process tree type PsTree struct { - PID uint32 `json:"pId"` - PgID uint32 `json:"pgId"` - SID uint32 `json:"sId"` - Comm string `json:"comm"` - Process *images.PstreeEntry `json:"-"` - Core *images.CoreEntry `json:"-"` - Children []*PsTree `json:"children,omitempty"` + PID uint32 `json:"pId"` + PgID uint32 `json:"pgId"` + SID uint32 `json:"sId"` + Comm string `json:"comm"` + Process *pstree.PstreeEntry `json:"-"` + Core *criu_core.CoreEntry `json:"-"` + Children []*PsTree `json:"children,omitempty"` } // ExplorePs constructs the process tree and returns the root process @@ -29,14 +34,14 @@ func (c *crit) ExplorePs() (*PsTree, error) { processes := make(map[uint32]*PsTree) var psTreeRoot *PsTree for _, entry := range psTreeImg.Entries { - process := entry.Message.(*images.PstreeEntry) + process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() coreImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("core-%d.img", pID))) if err != nil { return nil, err } - coreData := coreImg.Entries[0].Message.(*images.CoreEntry) + coreData := coreImg.Entries[0].Message.(*criu_core.CoreEntry) ps := &PsTree{ PID: pID, @@ -85,14 +90,14 @@ func (c *crit) ExploreFds() ([]*Fd, error) { fds := make([]*Fd, 0) for _, entry := range psTreeImg.Entries { - process := entry.Message.(*images.PstreeEntry) + process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() // Get file with object IDs idsImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("ids-%d.img", pID))) if err != nil { return nil, err } - filesID := idsImg.Entries[0].Message.(*images.TaskKobjIdsEntry).GetFilesId() + filesID := idsImg.Entries[0].Message.(*criu_core.TaskKobjIdsEntry).GetFilesId() // Get open file descriptors fdInfoImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("fdinfo-%d.img", filesID))) if err != nil { @@ -101,7 +106,7 @@ func (c *crit) ExploreFds() ([]*Fd, error) { fdEntry := Fd{PId: pID} for _, fdInfoEntry := range fdInfoImg.Entries { - fdInfo := fdInfoEntry.Message.(*images.FdinfoEntry) + fdInfo := fdInfoEntry.Message.(*fdinfo.FdinfoEntry) filePath, err := getFilePath(c.inputDirPath, fdInfo.GetId(), fdInfo.GetType()) if err != nil { @@ -118,9 +123,9 @@ func (c *crit) ExploreFds() ([]*Fd, error) { if err != nil { return nil, err } - fs := fsImg.Entries[0].Message.(*images.FsEntry) + fs := fsImg.Entries[0].Message.(*fs.FsEntry) filePath, err := getFilePath(c.inputDirPath, - fs.GetCwdId(), images.FdTypes_REG) + fs.GetCwdId(), fdinfo.FdTypes_REG) if err != nil { return nil, err } @@ -129,7 +134,7 @@ func (c *crit) ExploreFds() ([]*Fd, error) { Path: filePath, }) filePath, err = getFilePath(c.inputDirPath, - fs.GetRootId(), images.FdTypes_REG) + fs.GetRootId(), fdinfo.FdTypes_REG) if err != nil { return nil, err } @@ -179,16 +184,16 @@ func (c *crit) ExploreMems() ([]*MemMap, error) { memMaps := make([]*MemMap, 0) for _, entry := range psTreeImg.Entries { - process := entry.Message.(*images.PstreeEntry) + process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() // Get memory mappings mmImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("mm-%d.img", pID))) if err != nil { return nil, err } - mmInfo := mmImg.Entries[0].Message.(*images.MmEntry) + mmInfo := mmImg.Entries[0].Message.(*mm.MmEntry) exePath, err := getFilePath(c.inputDirPath, - mmInfo.GetExeFileId(), images.FdTypes_REG) + mmInfo.GetExeFileId(), fdinfo.FdTypes_REG) if err != nil { return nil, err } @@ -207,7 +212,7 @@ func (c *crit) ExploreMems() ([]*MemMap, error) { // Pages used by a file case status&((1<<7)|(1<<6)) != 0: file, err := getFilePath(c.inputDirPath, - uint32(vma.GetShmid()), images.FdTypes_REG) + uint32(vma.GetShmid()), fdinfo.FdTypes_REG) if err != nil { return nil, err } @@ -296,14 +301,14 @@ func (c *crit) ExploreRss() ([]*RssMap, error) { rssMaps := make([]*RssMap, 0) for _, entry := range psTreeImg.Entries { - process := entry.Message.(*images.PstreeEntry) + process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() // Get virtual memory addresses mmImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("mm-%d.img", pID))) if err != nil { return nil, err } - vmas := mmImg.Entries[0].Message.(*images.MmEntry).GetVmas() + vmas := mmImg.Entries[0].Message.(*mm.MmEntry).GetVmas() // Get physical memory addresses pagemapImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("pagemap-%d.img", pID))) if err != nil { @@ -314,7 +319,7 @@ func (c *crit) ExploreRss() ([]*RssMap, error) { rssMap := RssMap{PId: pID} // Skip pagemap head entry for _, pagemapEntry := range pagemapImg.Entries[1:] { - pagemapData := pagemapEntry.Message.(*images.PagemapEntry) + pagemapData := pagemapEntry.Message.(*pagemap.PagemapEntry) rss := Rss{ PhyAddr: fmt.Sprintf("%x", pagemapData.GetVaddr()), PhyPages: int64(pagemapData.GetNrPages()), @@ -341,7 +346,7 @@ func (c *crit) ExploreRss() ([]*RssMap, error) { // Pages used by a file if vmas[vmaIndex].GetStatus()&((1<<6)|(1<<7)) != 0 { file, err := getFilePath(c.inputDirPath, - uint32(vmas[vmaIndex].GetShmid()), images.FdTypes_REG) + uint32(vmas[vmaIndex].GetShmid()), fdinfo.FdTypes_REG) if err != nil { return nil, err } diff --git a/crit/image.go b/crit/image.go index a37ecd63c..8a0addf0c 100644 --- a/crit/image.go +++ b/crit/image.go @@ -6,6 +6,8 @@ import ( "strings" "github.com/checkpoint-restore/go-criu/v6/crit/images" + ghost_file "github.com/checkpoint-restore/go-criu/v6/crit/images/ghost-file" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pagemap" "google.golang.org/protobuf/encoding/protojson" "google.golang.org/protobuf/proto" ) @@ -120,7 +122,7 @@ func unmarshalDefault(imgData *jsonImage, img *CriuImage) error { // Special handler for ghost image func unmarshalGhostFile(imgData *jsonImage, img *CriuImage) error { // Process primary entry - entry := CriuEntry{Message: &images.GhostFileEntry{}} + entry := CriuEntry{Message: &ghost_file.GhostFileEntry{}} jsonPayload, extraPayload := splitJSONData(imgData.JSONEntries[0]) if err := protojson.Unmarshal(jsonPayload, entry.Message); err != nil { return err @@ -135,7 +137,7 @@ func unmarshalGhostFile(imgData *jsonImage, img *CriuImage) error { // Process chunks for _, data := range imgData.JSONEntries[1:] { - entry = CriuEntry{Message: &images.GhostChunkEntry{}} + entry = CriuEntry{Message: &ghost_file.GhostChunkEntry{}} jsonPayload, extraPayload = splitJSONData(data) if err := protojson.Unmarshal(jsonPayload, entry.Message); err != nil { return err @@ -150,7 +152,7 @@ func unmarshalGhostFile(imgData *jsonImage, img *CriuImage) error { // Special handler for pagemap image func unmarshalPagemap(imgData *jsonImage, img *CriuImage) error { // First entry is pagemap head - var payload proto.Message = &images.PagemapHead{} + var payload proto.Message = &pagemap.PagemapHead{} for _, data := range imgData.JSONEntries { entry := CriuEntry{Message: payload} if err := protojson.Unmarshal(data, entry.Message); err != nil { @@ -158,7 +160,7 @@ func unmarshalPagemap(imgData *jsonImage, img *CriuImage) error { } img.Entries = append(img.Entries, &entry) // Create struct for next entry - payload = &images.PagemapEntry{} + payload = &pagemap.PagemapEntry{} } return nil diff --git a/crit/images/apparmor.pb.go b/crit/images/apparmor/apparmor.pb.go similarity index 99% rename from crit/images/apparmor.pb.go rename to crit/images/apparmor/apparmor.pb.go index 67bef0aa1..f6ed67195 100644 --- a/crit/images/apparmor.pb.go +++ b/crit/images/apparmor/apparmor.pb.go @@ -1,10 +1,10 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: apparmor.proto -package images +package apparmor import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/autofs.pb.go b/crit/images/autofs/autofs.pb.go similarity index 98% rename from crit/images/autofs.pb.go rename to crit/images/autofs/autofs.pb.go index 828bd7f88..bcc21767a 100644 --- a/crit/images/autofs.pb.go +++ b/crit/images/autofs/autofs.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: autofs.proto -package images +package autofs import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/binfmt-misc.pb.go b/crit/images/binfmt-misc/binfmt-misc.pb.go similarity index 98% rename from crit/images/binfmt-misc.pb.go rename to crit/images/binfmt-misc/binfmt-misc.pb.go index 1f85eb426..06f3ffa82 100644 --- a/crit/images/binfmt-misc.pb.go +++ b/crit/images/binfmt-misc/binfmt-misc.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: binfmt-misc.proto -package images +package binfmt_misc import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/bpfmap-data.pb.go b/crit/images/bpfmap-data/bpfmap-data.pb.go similarity index 98% rename from crit/images/bpfmap-data.pb.go rename to crit/images/bpfmap-data/bpfmap-data.pb.go index df3343d17..5493d2eb1 100644 --- a/crit/images/bpfmap-data.pb.go +++ b/crit/images/bpfmap-data/bpfmap-data.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: bpfmap-data.proto -package images +package bpfmap_data import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/bpfmap-file.pb.go b/crit/images/bpfmap-file/bpfmap-file.pb.go similarity index 82% rename from crit/images/bpfmap-file.pb.go rename to crit/images/bpfmap-file/bpfmap-file.pb.go index f50a45974..a9937d88e 100644 --- a/crit/images/bpfmap-file.pb.go +++ b/crit/images/bpfmap-file/bpfmap-file.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: bpfmap-file.proto -package images +package bpfmap_file import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,22 +29,22 @@ type BpfmapFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Pos *uint64 `protobuf:"varint,3,req,name=pos" json:"pos,omitempty"` - Fown *FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` - MapType *uint32 `protobuf:"varint,5,req,name=map_type,json=mapType" json:"map_type,omitempty"` - KeySize *uint32 `protobuf:"varint,6,req,name=key_size,json=keySize" json:"key_size,omitempty"` - ValueSize *uint32 `protobuf:"varint,7,req,name=value_size,json=valueSize" json:"value_size,omitempty"` - MapId *uint32 `protobuf:"varint,8,req,name=map_id,json=mapId" json:"map_id,omitempty"` - MaxEntries *uint32 `protobuf:"varint,9,req,name=max_entries,json=maxEntries" json:"max_entries,omitempty"` - MapFlags *uint32 `protobuf:"varint,10,req,name=map_flags,json=mapFlags" json:"map_flags,omitempty"` - Memlock *uint64 `protobuf:"varint,11,req,name=memlock" json:"memlock,omitempty"` - Frozen *bool `protobuf:"varint,12,req,name=frozen,def=0" json:"frozen,omitempty"` - MapName *string `protobuf:"bytes,13,req,name=map_name,json=mapName" json:"map_name,omitempty"` - Ifindex *uint32 `protobuf:"varint,14,req,name=ifindex,def=0" json:"ifindex,omitempty"` - MntId *int32 `protobuf:"zigzag32,15,opt,name=mnt_id,json=mntId,def=-1" json:"mnt_id,omitempty"` - MapExtra *uint64 `protobuf:"varint,16,opt,name=map_extra,json=mapExtra" json:"map_extra,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` + Pos *uint64 `protobuf:"varint,3,req,name=pos" json:"pos,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` + MapType *uint32 `protobuf:"varint,5,req,name=map_type,json=mapType" json:"map_type,omitempty"` + KeySize *uint32 `protobuf:"varint,6,req,name=key_size,json=keySize" json:"key_size,omitempty"` + ValueSize *uint32 `protobuf:"varint,7,req,name=value_size,json=valueSize" json:"value_size,omitempty"` + MapId *uint32 `protobuf:"varint,8,req,name=map_id,json=mapId" json:"map_id,omitempty"` + MaxEntries *uint32 `protobuf:"varint,9,req,name=max_entries,json=maxEntries" json:"max_entries,omitempty"` + MapFlags *uint32 `protobuf:"varint,10,req,name=map_flags,json=mapFlags" json:"map_flags,omitempty"` + Memlock *uint64 `protobuf:"varint,11,req,name=memlock" json:"memlock,omitempty"` + Frozen *bool `protobuf:"varint,12,req,name=frozen,def=0" json:"frozen,omitempty"` + MapName *string `protobuf:"bytes,13,req,name=map_name,json=mapName" json:"map_name,omitempty"` + Ifindex *uint32 `protobuf:"varint,14,req,name=ifindex,def=0" json:"ifindex,omitempty"` + MntId *int32 `protobuf:"zigzag32,15,opt,name=mnt_id,json=mntId,def=-1" json:"mnt_id,omitempty"` + MapExtra *uint64 `protobuf:"varint,16,opt,name=map_extra,json=mapExtra" json:"map_extra,omitempty"` } // Default values for BpfmapFileEntry fields. @@ -105,7 +107,7 @@ func (x *BpfmapFileEntry) GetPos() uint64 { return 0 } -func (x *BpfmapFileEntry) GetFown() *FownEntry { +func (x *BpfmapFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -248,7 +250,7 @@ func file_bpfmap_file_proto_rawDescGZIP() []byte { var file_bpfmap_file_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_bpfmap_file_proto_goTypes = []interface{}{ (*BpfmapFileEntry)(nil), // 0: bpfmap_file_entry - (*FownEntry)(nil), // 1: fown_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_bpfmap_file_proto_depIdxs = []int32{ 1, // 0: bpfmap_file_entry.fown:type_name -> fown_entry @@ -264,8 +266,6 @@ func file_bpfmap_file_proto_init() { if File_bpfmap_file_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_bpfmap_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*BpfmapFileEntry); i { diff --git a/crit/images/cgroup.pb.go b/crit/images/cgroup/cgroup.pb.go similarity index 99% rename from crit/images/cgroup.pb.go rename to crit/images/cgroup/cgroup.pb.go index e9668422e..aacd36c45 100644 --- a/crit/images/cgroup.pb.go +++ b/crit/images/cgroup/cgroup.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: cgroup.proto -package images +package cgroup import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/core-aarch64.pb.go b/crit/images/core-aarch64/core-aarch64.pb.go similarity index 98% rename from crit/images/core-aarch64.pb.go rename to crit/images/core-aarch64/core-aarch64.pb.go index 3001acd9f..a5fa0e823 100644 --- a/crit/images/core-aarch64.pb.go +++ b/crit/images/core-aarch64/core-aarch64.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: core-aarch64.proto -package images +package core_aarch64 import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -293,7 +294,6 @@ func file_core_aarch64_proto_init() { if File_core_aarch64_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_core_aarch64_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserAarch64RegsEntry); i { diff --git a/crit/images/core-arm.pb.go b/crit/images/core-arm/core-arm.pb.go similarity index 99% rename from crit/images/core-arm.pb.go rename to crit/images/core-arm/core-arm.pb.go index d59fd6b10..cfffadbc2 100644 --- a/crit/images/core-arm.pb.go +++ b/crit/images/core-arm/core-arm.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: core-arm.proto -package images +package core_arm import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -437,7 +438,6 @@ func file_core_arm_proto_init() { if File_core_arm_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_core_arm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserArmRegsEntry); i { diff --git a/crit/images/core-mips.proto b/crit/images/core-mips.proto old mode 100644 new mode 100755 diff --git a/crit/images/core-mips.pb.go b/crit/images/core-mips/core-mips.pb.go similarity index 99% rename from crit/images/core-mips.pb.go rename to crit/images/core-mips/core-mips.pb.go index 9b9e7982b..a6df3f816 100644 --- a/crit/images/core-mips.pb.go +++ b/crit/images/core-mips/core-mips.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: core-mips.proto -package images +package core_mips import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -903,7 +904,6 @@ func file_core_mips_proto_init() { if File_core_mips_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_core_mips_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserMipsRegsEntry); i { diff --git a/crit/images/core-ppc64.pb.go b/crit/images/core-ppc64/core-ppc64.pb.go similarity index 99% rename from crit/images/core-ppc64.pb.go rename to crit/images/core-ppc64/core-ppc64.pb.go index b6eb9d5a5..9dde5f274 100644 --- a/crit/images/core-ppc64.pb.go +++ b/crit/images/core-ppc64/core-ppc64.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: core-ppc64.proto -package images +package core_ppc64 import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -599,7 +600,6 @@ func file_core_ppc64_proto_init() { if File_core_ppc64_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_core_ppc64_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserPpc64RegsEntry); i { diff --git a/crit/images/core-s390.pb.go b/crit/images/core-s390/core-s390.pb.go similarity index 99% rename from crit/images/core-s390.pb.go rename to crit/images/core-s390/core-s390.pb.go index 67b0eda0b..0e7039cca 100644 --- a/crit/images/core-s390.pb.go +++ b/crit/images/core-s390/core-s390.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: core-s390.proto -package images +package core_s390 import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -573,7 +574,6 @@ func file_core_s390_proto_init() { if File_core_s390_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_core_s390_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserS390RegsEntry); i { diff --git a/crit/images/core-x86.pb.go b/crit/images/core-x86/core-x86.pb.go similarity index 99% rename from crit/images/core-x86.pb.go rename to crit/images/core-x86/core-x86.pb.go index be6be9e22..93c75ed06 100644 --- a/crit/images/core-x86.pb.go +++ b/crit/images/core-x86/core-x86.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: core-x86.proto -package images +package core_x86 import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -944,7 +945,6 @@ func file_core_x86_proto_init() { if File_core_x86_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_core_x86_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*UserX86RegsEntry); i { diff --git a/crit/images/cpuinfo.pb.go b/crit/images/cpuinfo/cpuinfo.pb.go similarity index 99% rename from crit/images/cpuinfo.pb.go rename to crit/images/cpuinfo/cpuinfo.pb.go index 5cff4dc55..c9843b65e 100644 --- a/crit/images/cpuinfo.pb.go +++ b/crit/images/cpuinfo/cpuinfo.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: cpuinfo.proto -package images +package cpuinfo import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/creds.pb.go b/crit/images/creds/creds.pb.go similarity index 99% rename from crit/images/creds.pb.go rename to crit/images/creds/creds.pb.go index 87e504acb..8f81f043e 100644 --- a/crit/images/creds.pb.go +++ b/crit/images/creds/creds.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: creds.proto -package images +package creds import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/criu-core.pb.go b/crit/images/criu-core/criu-core.pb.go similarity index 82% rename from crit/images/criu-core.pb.go rename to crit/images/criu-core/criu-core.pb.go index ab05f4647..099e892a3 100644 --- a/crit/images/criu-core.pb.go +++ b/crit/images/criu-core/criu-core.pb.go @@ -2,13 +2,26 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: criu-core.proto -package images +package criu_core import ( + core_aarch64 "github.com/checkpoint-restore/go-criu/v6/crit/images/core-aarch64" + core_arm "github.com/checkpoint-restore/go-criu/v6/crit/images/core-arm" + core_mips "github.com/checkpoint-restore/go-criu/v6/crit/images/core-mips" + core_ppc64 "github.com/checkpoint-restore/go-criu/v6/crit/images/core-ppc64" + core_s390 "github.com/checkpoint-restore/go-criu/v6/crit/images/core-s390" + core_x86 "github.com/checkpoint-restore/go-criu/v6/crit/images/core-x86" + creds "github.com/checkpoint-restore/go-criu/v6/crit/images/creds" + criu_sa "github.com/checkpoint-restore/go-criu/v6/crit/images/criu-sa" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + rlimit "github.com/checkpoint-restore/go-criu/v6/crit/images/rlimit" + rseq "github.com/checkpoint-restore/go-criu/v6/crit/images/rseq" + siginfo "github.com/checkpoint-restore/go-criu/v6/crit/images/siginfo" + timer "github.com/checkpoint-restore/go-criu/v6/crit/images/timer" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -158,24 +171,24 @@ type TaskCoreEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - TaskState *uint32 `protobuf:"varint,1,req,name=task_state,json=taskState" json:"task_state,omitempty"` - ExitCode *uint32 `protobuf:"varint,2,req,name=exit_code,json=exitCode" json:"exit_code,omitempty"` - Personality *uint32 `protobuf:"varint,3,req,name=personality" json:"personality,omitempty"` - Flags *uint32 `protobuf:"varint,4,req,name=flags" json:"flags,omitempty"` - BlkSigset *uint64 `protobuf:"varint,5,req,name=blk_sigset,json=blkSigset" json:"blk_sigset,omitempty"` - Comm *string `protobuf:"bytes,6,req,name=comm" json:"comm,omitempty"` - Timers *TaskTimersEntry `protobuf:"bytes,7,opt,name=timers" json:"timers,omitempty"` - Rlimits *TaskRlimitsEntry `protobuf:"bytes,8,opt,name=rlimits" json:"rlimits,omitempty"` + TaskState *uint32 `protobuf:"varint,1,req,name=task_state,json=taskState" json:"task_state,omitempty"` + ExitCode *uint32 `protobuf:"varint,2,req,name=exit_code,json=exitCode" json:"exit_code,omitempty"` + Personality *uint32 `protobuf:"varint,3,req,name=personality" json:"personality,omitempty"` + Flags *uint32 `protobuf:"varint,4,req,name=flags" json:"flags,omitempty"` + BlkSigset *uint64 `protobuf:"varint,5,req,name=blk_sigset,json=blkSigset" json:"blk_sigset,omitempty"` + Comm *string `protobuf:"bytes,6,req,name=comm" json:"comm,omitempty"` + Timers *timer.TaskTimersEntry `protobuf:"bytes,7,opt,name=timers" json:"timers,omitempty"` + Rlimits *TaskRlimitsEntry `protobuf:"bytes,8,opt,name=rlimits" json:"rlimits,omitempty"` // This is deprecated, should be per-thread - CgSet *uint32 `protobuf:"varint,9,opt,name=cg_set,json=cgSet" json:"cg_set,omitempty"` - SignalsS *SignalQueueEntry `protobuf:"bytes,10,opt,name=signals_s,json=signalsS" json:"signals_s,omitempty"` + CgSet *uint32 `protobuf:"varint,9,opt,name=cg_set,json=cgSet" json:"cg_set,omitempty"` + SignalsS *siginfo.SignalQueueEntry `protobuf:"bytes,10,opt,name=signals_s,json=signalsS" json:"signals_s,omitempty"` // These two are deprecated, should be per-thread - OldSeccompMode *SeccompMode `protobuf:"varint,11,opt,name=old_seccomp_mode,json=oldSeccompMode,enum=SeccompMode" json:"old_seccomp_mode,omitempty"` - OldSeccompFilter *uint32 `protobuf:"varint,12,opt,name=old_seccomp_filter,json=oldSeccompFilter" json:"old_seccomp_filter,omitempty"` - Loginuid *uint32 `protobuf:"varint,13,opt,name=loginuid" json:"loginuid,omitempty"` - OomScoreAdj *int32 `protobuf:"varint,14,opt,name=oom_score_adj,json=oomScoreAdj" json:"oom_score_adj,omitempty"` - Sigactions []*SaEntry `protobuf:"bytes,15,rep,name=sigactions" json:"sigactions,omitempty"` - ChildSubreaper *bool `protobuf:"varint,18,opt,name=child_subreaper,json=childSubreaper" json:"child_subreaper,omitempty"` + OldSeccompMode *SeccompMode `protobuf:"varint,11,opt,name=old_seccomp_mode,json=oldSeccompMode,enum=SeccompMode" json:"old_seccomp_mode,omitempty"` + OldSeccompFilter *uint32 `protobuf:"varint,12,opt,name=old_seccomp_filter,json=oldSeccompFilter" json:"old_seccomp_filter,omitempty"` + Loginuid *uint32 `protobuf:"varint,13,opt,name=loginuid" json:"loginuid,omitempty"` + OomScoreAdj *int32 `protobuf:"varint,14,opt,name=oom_score_adj,json=oomScoreAdj" json:"oom_score_adj,omitempty"` + Sigactions []*criu_sa.SaEntry `protobuf:"bytes,15,rep,name=sigactions" json:"sigactions,omitempty"` + ChildSubreaper *bool `protobuf:"varint,18,opt,name=child_subreaper,json=childSubreaper" json:"child_subreaper,omitempty"` // Reserved for container relative start time // optional uint64 start_time = 19; BlkSigsetExtended *uint64 `protobuf:"varint,20,opt,name=blk_sigset_extended,json=blkSigsetExtended" json:"blk_sigset_extended,omitempty"` @@ -256,7 +269,7 @@ func (x *TaskCoreEntry) GetComm() string { return "" } -func (x *TaskCoreEntry) GetTimers() *TaskTimersEntry { +func (x *TaskCoreEntry) GetTimers() *timer.TaskTimersEntry { if x != nil { return x.Timers } @@ -277,7 +290,7 @@ func (x *TaskCoreEntry) GetCgSet() uint32 { return 0 } -func (x *TaskCoreEntry) GetSignalsS() *SignalQueueEntry { +func (x *TaskCoreEntry) GetSignalsS() *siginfo.SignalQueueEntry { if x != nil { return x.SignalsS } @@ -312,7 +325,7 @@ func (x *TaskCoreEntry) GetOomScoreAdj() int32 { return 0 } -func (x *TaskCoreEntry) GetSigactions() []*SaEntry { +func (x *TaskCoreEntry) GetSigactions() []*criu_sa.SaEntry { if x != nil { return x.Sigactions } @@ -543,22 +556,22 @@ type ThreadCoreEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - FutexRla *uint64 `protobuf:"varint,1,req,name=futex_rla,json=futexRla" json:"futex_rla,omitempty"` - FutexRlaLen *uint32 `protobuf:"varint,2,req,name=futex_rla_len,json=futexRlaLen" json:"futex_rla_len,omitempty"` - SchedNice *int32 `protobuf:"zigzag32,3,opt,name=sched_nice,json=schedNice" json:"sched_nice,omitempty"` - SchedPolicy *uint32 `protobuf:"varint,4,opt,name=sched_policy,json=schedPolicy" json:"sched_policy,omitempty"` - SchedPrio *uint32 `protobuf:"varint,5,opt,name=sched_prio,json=schedPrio" json:"sched_prio,omitempty"` - BlkSigset *uint64 `protobuf:"varint,6,opt,name=blk_sigset,json=blkSigset" json:"blk_sigset,omitempty"` - Sas *ThreadSasEntry `protobuf:"bytes,7,opt,name=sas" json:"sas,omitempty"` - PdeathSig *uint32 `protobuf:"varint,8,opt,name=pdeath_sig,json=pdeathSig" json:"pdeath_sig,omitempty"` - SignalsP *SignalQueueEntry `protobuf:"bytes,9,opt,name=signals_p,json=signalsP" json:"signals_p,omitempty"` - Creds *CredsEntry `protobuf:"bytes,10,opt,name=creds" json:"creds,omitempty"` - SeccompMode *SeccompMode `protobuf:"varint,11,opt,name=seccomp_mode,json=seccompMode,enum=SeccompMode" json:"seccomp_mode,omitempty"` - SeccompFilter *uint32 `protobuf:"varint,12,opt,name=seccomp_filter,json=seccompFilter" json:"seccomp_filter,omitempty"` - Comm *string `protobuf:"bytes,13,opt,name=comm" json:"comm,omitempty"` - BlkSigsetExtended *uint64 `protobuf:"varint,14,opt,name=blk_sigset_extended,json=blkSigsetExtended" json:"blk_sigset_extended,omitempty"` - RseqEntry *RseqEntry `protobuf:"bytes,15,opt,name=rseq_entry,json=rseqEntry" json:"rseq_entry,omitempty"` - CgSet *uint32 `protobuf:"varint,16,opt,name=cg_set,json=cgSet" json:"cg_set,omitempty"` + FutexRla *uint64 `protobuf:"varint,1,req,name=futex_rla,json=futexRla" json:"futex_rla,omitempty"` + FutexRlaLen *uint32 `protobuf:"varint,2,req,name=futex_rla_len,json=futexRlaLen" json:"futex_rla_len,omitempty"` + SchedNice *int32 `protobuf:"zigzag32,3,opt,name=sched_nice,json=schedNice" json:"sched_nice,omitempty"` + SchedPolicy *uint32 `protobuf:"varint,4,opt,name=sched_policy,json=schedPolicy" json:"sched_policy,omitempty"` + SchedPrio *uint32 `protobuf:"varint,5,opt,name=sched_prio,json=schedPrio" json:"sched_prio,omitempty"` + BlkSigset *uint64 `protobuf:"varint,6,opt,name=blk_sigset,json=blkSigset" json:"blk_sigset,omitempty"` + Sas *ThreadSasEntry `protobuf:"bytes,7,opt,name=sas" json:"sas,omitempty"` + PdeathSig *uint32 `protobuf:"varint,8,opt,name=pdeath_sig,json=pdeathSig" json:"pdeath_sig,omitempty"` + SignalsP *siginfo.SignalQueueEntry `protobuf:"bytes,9,opt,name=signals_p,json=signalsP" json:"signals_p,omitempty"` + Creds *creds.CredsEntry `protobuf:"bytes,10,opt,name=creds" json:"creds,omitempty"` + SeccompMode *SeccompMode `protobuf:"varint,11,opt,name=seccomp_mode,json=seccompMode,enum=SeccompMode" json:"seccomp_mode,omitempty"` + SeccompFilter *uint32 `protobuf:"varint,12,opt,name=seccomp_filter,json=seccompFilter" json:"seccomp_filter,omitempty"` + Comm *string `protobuf:"bytes,13,opt,name=comm" json:"comm,omitempty"` + BlkSigsetExtended *uint64 `protobuf:"varint,14,opt,name=blk_sigset_extended,json=blkSigsetExtended" json:"blk_sigset_extended,omitempty"` + RseqEntry *rseq.RseqEntry `protobuf:"bytes,15,opt,name=rseq_entry,json=rseqEntry" json:"rseq_entry,omitempty"` + CgSet *uint32 `protobuf:"varint,16,opt,name=cg_set,json=cgSet" json:"cg_set,omitempty"` } func (x *ThreadCoreEntry) Reset() { @@ -649,14 +662,14 @@ func (x *ThreadCoreEntry) GetPdeathSig() uint32 { return 0 } -func (x *ThreadCoreEntry) GetSignalsP() *SignalQueueEntry { +func (x *ThreadCoreEntry) GetSignalsP() *siginfo.SignalQueueEntry { if x != nil { return x.SignalsP } return nil } -func (x *ThreadCoreEntry) GetCreds() *CredsEntry { +func (x *ThreadCoreEntry) GetCreds() *creds.CredsEntry { if x != nil { return x.Creds } @@ -691,7 +704,7 @@ func (x *ThreadCoreEntry) GetBlkSigsetExtended() uint64 { return 0 } -func (x *ThreadCoreEntry) GetRseqEntry() *RseqEntry { +func (x *ThreadCoreEntry) GetRseqEntry() *rseq.RseqEntry { if x != nil { return x.RseqEntry } @@ -710,7 +723,7 @@ type TaskRlimitsEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Rlimits []*RlimitEntry `protobuf:"bytes,1,rep,name=rlimits" json:"rlimits,omitempty"` + Rlimits []*rlimit.RlimitEntry `protobuf:"bytes,1,rep,name=rlimits" json:"rlimits,omitempty"` } func (x *TaskRlimitsEntry) Reset() { @@ -745,7 +758,7 @@ func (*TaskRlimitsEntry) Descriptor() ([]byte, []int) { return file_criu_core_proto_rawDescGZIP(), []int{4} } -func (x *TaskRlimitsEntry) GetRlimits() []*RlimitEntry { +func (x *TaskRlimitsEntry) GetRlimits() []*rlimit.RlimitEntry { if x != nil { return x.Rlimits } @@ -757,16 +770,16 @@ type CoreEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Mtype *CoreEntryMarch `protobuf:"varint,1,req,name=mtype,enum=CoreEntryMarch" json:"mtype,omitempty"` - ThreadInfo *ThreadInfoX86 `protobuf:"bytes,2,opt,name=thread_info,json=threadInfo" json:"thread_info,omitempty"` - TiArm *ThreadInfoArm `protobuf:"bytes,6,opt,name=ti_arm,json=tiArm" json:"ti_arm,omitempty"` - TiAarch64 *ThreadInfoAarch64 `protobuf:"bytes,8,opt,name=ti_aarch64,json=tiAarch64" json:"ti_aarch64,omitempty"` - TiPpc64 *ThreadInfoPpc64 `protobuf:"bytes,9,opt,name=ti_ppc64,json=tiPpc64" json:"ti_ppc64,omitempty"` - TiS390 *ThreadInfoS390 `protobuf:"bytes,10,opt,name=ti_s390,json=tiS390" json:"ti_s390,omitempty"` - TiMips *ThreadInfoMips `protobuf:"bytes,11,opt,name=ti_mips,json=tiMips" json:"ti_mips,omitempty"` - Tc *TaskCoreEntry `protobuf:"bytes,3,opt,name=tc" json:"tc,omitempty"` - Ids *TaskKobjIdsEntry `protobuf:"bytes,4,opt,name=ids" json:"ids,omitempty"` - ThreadCore *ThreadCoreEntry `protobuf:"bytes,5,opt,name=thread_core,json=threadCore" json:"thread_core,omitempty"` + Mtype *CoreEntryMarch `protobuf:"varint,1,req,name=mtype,enum=CoreEntryMarch" json:"mtype,omitempty"` + ThreadInfo *core_x86.ThreadInfoX86 `protobuf:"bytes,2,opt,name=thread_info,json=threadInfo" json:"thread_info,omitempty"` + TiArm *core_arm.ThreadInfoArm `protobuf:"bytes,6,opt,name=ti_arm,json=tiArm" json:"ti_arm,omitempty"` + TiAarch64 *core_aarch64.ThreadInfoAarch64 `protobuf:"bytes,8,opt,name=ti_aarch64,json=tiAarch64" json:"ti_aarch64,omitempty"` + TiPpc64 *core_ppc64.ThreadInfoPpc64 `protobuf:"bytes,9,opt,name=ti_ppc64,json=tiPpc64" json:"ti_ppc64,omitempty"` + TiS390 *core_s390.ThreadInfoS390 `protobuf:"bytes,10,opt,name=ti_s390,json=tiS390" json:"ti_s390,omitempty"` + TiMips *core_mips.ThreadInfoMips `protobuf:"bytes,11,opt,name=ti_mips,json=tiMips" json:"ti_mips,omitempty"` + Tc *TaskCoreEntry `protobuf:"bytes,3,opt,name=tc" json:"tc,omitempty"` + Ids *TaskKobjIdsEntry `protobuf:"bytes,4,opt,name=ids" json:"ids,omitempty"` + ThreadCore *ThreadCoreEntry `protobuf:"bytes,5,opt,name=thread_core,json=threadCore" json:"thread_core,omitempty"` } func (x *CoreEntry) Reset() { @@ -808,42 +821,42 @@ func (x *CoreEntry) GetMtype() CoreEntryMarch { return CoreEntry_UNKNOWN } -func (x *CoreEntry) GetThreadInfo() *ThreadInfoX86 { +func (x *CoreEntry) GetThreadInfo() *core_x86.ThreadInfoX86 { if x != nil { return x.ThreadInfo } return nil } -func (x *CoreEntry) GetTiArm() *ThreadInfoArm { +func (x *CoreEntry) GetTiArm() *core_arm.ThreadInfoArm { if x != nil { return x.TiArm } return nil } -func (x *CoreEntry) GetTiAarch64() *ThreadInfoAarch64 { +func (x *CoreEntry) GetTiAarch64() *core_aarch64.ThreadInfoAarch64 { if x != nil { return x.TiAarch64 } return nil } -func (x *CoreEntry) GetTiPpc64() *ThreadInfoPpc64 { +func (x *CoreEntry) GetTiPpc64() *core_ppc64.ThreadInfoPpc64 { if x != nil { return x.TiPpc64 } return nil } -func (x *CoreEntry) GetTiS390() *ThreadInfoS390 { +func (x *CoreEntry) GetTiS390() *core_s390.ThreadInfoS390 { if x != nil { return x.TiS390 } return nil } -func (x *CoreEntry) GetTiMips() *ThreadInfoMips { +func (x *CoreEntry) GetTiMips() *core_mips.ThreadInfoMips { if x != nil { return x.TiMips } @@ -1056,26 +1069,26 @@ func file_criu_core_proto_rawDescGZIP() []byte { var file_criu_core_proto_enumTypes = make([]protoimpl.EnumInfo, 2) var file_criu_core_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_criu_core_proto_goTypes = []interface{}{ - (SeccompMode)(0), // 0: seccomp_mode - (CoreEntryMarch)(0), // 1: core_entry.march - (*TaskCoreEntry)(nil), // 2: task_core_entry - (*TaskKobjIdsEntry)(nil), // 3: task_kobj_ids_entry - (*ThreadSasEntry)(nil), // 4: thread_sas_entry - (*ThreadCoreEntry)(nil), // 5: thread_core_entry - (*TaskRlimitsEntry)(nil), // 6: task_rlimits_entry - (*CoreEntry)(nil), // 7: core_entry - (*TaskTimersEntry)(nil), // 8: task_timers_entry - (*SignalQueueEntry)(nil), // 9: signal_queue_entry - (*SaEntry)(nil), // 10: sa_entry - (*CredsEntry)(nil), // 11: creds_entry - (*RseqEntry)(nil), // 12: rseq_entry - (*RlimitEntry)(nil), // 13: rlimit_entry - (*ThreadInfoX86)(nil), // 14: thread_info_x86 - (*ThreadInfoArm)(nil), // 15: thread_info_arm - (*ThreadInfoAarch64)(nil), // 16: thread_info_aarch64 - (*ThreadInfoPpc64)(nil), // 17: thread_info_ppc64 - (*ThreadInfoS390)(nil), // 18: thread_info_s390 - (*ThreadInfoMips)(nil), // 19: thread_info_mips + (SeccompMode)(0), // 0: seccomp_mode + (CoreEntryMarch)(0), // 1: core_entry.march + (*TaskCoreEntry)(nil), // 2: task_core_entry + (*TaskKobjIdsEntry)(nil), // 3: task_kobj_ids_entry + (*ThreadSasEntry)(nil), // 4: thread_sas_entry + (*ThreadCoreEntry)(nil), // 5: thread_core_entry + (*TaskRlimitsEntry)(nil), // 6: task_rlimits_entry + (*CoreEntry)(nil), // 7: core_entry + (*timer.TaskTimersEntry)(nil), // 8: task_timers_entry + (*siginfo.SignalQueueEntry)(nil), // 9: signal_queue_entry + (*criu_sa.SaEntry)(nil), // 10: sa_entry + (*creds.CredsEntry)(nil), // 11: creds_entry + (*rseq.RseqEntry)(nil), // 12: rseq_entry + (*rlimit.RlimitEntry)(nil), // 13: rlimit_entry + (*core_x86.ThreadInfoX86)(nil), // 14: thread_info_x86 + (*core_arm.ThreadInfoArm)(nil), // 15: thread_info_arm + (*core_aarch64.ThreadInfoAarch64)(nil), // 16: thread_info_aarch64 + (*core_ppc64.ThreadInfoPpc64)(nil), // 17: thread_info_ppc64 + (*core_s390.ThreadInfoS390)(nil), // 18: thread_info_s390 + (*core_mips.ThreadInfoMips)(nil), // 19: thread_info_mips } var file_criu_core_proto_depIdxs = []int32{ 8, // 0: task_core_entry.timers:type_name -> task_timers_entry @@ -1111,19 +1124,6 @@ func file_criu_core_proto_init() { if File_criu_core_proto != nil { return } - file_core_x86_proto_init() - file_core_arm_proto_init() - file_core_aarch64_proto_init() - file_core_ppc64_proto_init() - file_core_s390_proto_init() - file_core_mips_proto_init() - file_rlimit_proto_init() - file_timer_proto_init() - file_creds_proto_init() - file_criu_sa_proto_init() - file_siginfo_proto_init() - file_rseq_proto_init() - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_criu_core_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TaskCoreEntry); i { diff --git a/crit/images/criu-sa.pb.go b/crit/images/criu-sa/criu-sa.pb.go similarity index 97% rename from crit/images/criu-sa.pb.go rename to crit/images/criu-sa/criu-sa.pb.go index 126ec674a..c1303f4ce 100644 --- a/crit/images/criu-sa.pb.go +++ b/crit/images/criu-sa/criu-sa.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: criu-sa.proto -package images +package criu_sa import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -159,7 +160,6 @@ func file_criu_sa_proto_init() { if File_criu_sa_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_criu_sa_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SaEntry); i { diff --git a/crit/images/eventfd.pb.go b/crit/images/eventfd/eventfd.pb.go similarity index 89% rename from crit/images/eventfd.pb.go rename to crit/images/eventfd/eventfd.pb.go index 59b5caddf..5eaac191e 100644 --- a/crit/images/eventfd.pb.go +++ b/crit/images/eventfd/eventfd.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: eventfd.proto -package images +package eventfd import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +28,10 @@ type EventfdFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` - Counter *uint64 `protobuf:"varint,4,req,name=counter" json:"counter,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` + Counter *uint64 `protobuf:"varint,4,req,name=counter" json:"counter,omitempty"` } func (x *EventfdFileEntry) Reset() { @@ -79,7 +80,7 @@ func (x *EventfdFileEntry) GetFlags() uint32 { return 0 } -func (x *EventfdFileEntry) GetFown() *FownEntry { +func (x *EventfdFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -123,7 +124,7 @@ func file_eventfd_proto_rawDescGZIP() []byte { var file_eventfd_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_eventfd_proto_goTypes = []interface{}{ (*EventfdFileEntry)(nil), // 0: eventfd_file_entry - (*FownEntry)(nil), // 1: fown_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_eventfd_proto_depIdxs = []int32{ 1, // 0: eventfd_file_entry.fown:type_name -> fown_entry @@ -139,7 +140,6 @@ func file_eventfd_proto_init() { if File_eventfd_proto != nil { return } - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_eventfd_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventfdFileEntry); i { diff --git a/crit/images/eventpoll.pb.go b/crit/images/eventpoll/eventpoll.pb.go similarity index 96% rename from crit/images/eventpoll.pb.go rename to crit/images/eventpoll/eventpoll.pb.go index 01b9676ac..dc9d66a77 100644 --- a/crit/images/eventpoll.pb.go +++ b/crit/images/eventpoll/eventpoll.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: eventpoll.proto -package images +package eventpoll import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -125,7 +126,7 @@ type EventpollFileEntry struct { Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` Tfd []*EventpollTfdEntry `protobuf:"bytes,4,rep,name=tfd" json:"tfd,omitempty"` } @@ -175,7 +176,7 @@ func (x *EventpollFileEntry) GetFlags() uint32 { return 0 } -func (x *EventpollFileEntry) GetFown() *FownEntry { +func (x *EventpollFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -231,7 +232,7 @@ var file_eventpoll_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_eventpoll_proto_goTypes = []interface{}{ (*EventpollTfdEntry)(nil), // 0: eventpoll_tfd_entry (*EventpollFileEntry)(nil), // 1: eventpoll_file_entry - (*FownEntry)(nil), // 2: fown_entry + (*fown.FownEntry)(nil), // 2: fown_entry } var file_eventpoll_proto_depIdxs = []int32{ 2, // 0: eventpoll_file_entry.fown:type_name -> fown_entry @@ -248,7 +249,6 @@ func file_eventpoll_proto_init() { if File_eventpoll_proto != nil { return } - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_eventpoll_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*EventpollTfdEntry); i { diff --git a/crit/images/ext-file.pb.go b/crit/images/ext-file/ext-file.pb.go similarity index 90% rename from crit/images/ext-file.pb.go rename to crit/images/ext-file/ext-file.pb.go index 714a0ea21..ed0c38f9c 100644 --- a/crit/images/ext-file.pb.go +++ b/crit/images/ext-file/ext-file.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ext-file.proto -package images +package ext_file import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,8 +28,8 @@ type ExtFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Fown *FownEntry `protobuf:"bytes,5,req,name=fown" json:"fown,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,5,req,name=fown" json:"fown,omitempty"` } func (x *ExtFileEntry) Reset() { @@ -70,7 +71,7 @@ func (x *ExtFileEntry) GetId() uint32 { return 0 } -func (x *ExtFileEntry) GetFown() *FownEntry { +func (x *ExtFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -102,8 +103,8 @@ func file_ext_file_proto_rawDescGZIP() []byte { var file_ext_file_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_ext_file_proto_goTypes = []interface{}{ - (*ExtFileEntry)(nil), // 0: ext_file_entry - (*FownEntry)(nil), // 1: fown_entry + (*ExtFileEntry)(nil), // 0: ext_file_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_ext_file_proto_depIdxs = []int32{ 1, // 0: ext_file_entry.fown:type_name -> fown_entry @@ -119,7 +120,6 @@ func file_ext_file_proto_init() { if File_ext_file_proto != nil { return } - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_ext_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*ExtFileEntry); i { diff --git a/crit/images/fdinfo.pb.go b/crit/images/fdinfo/fdinfo.pb.go similarity index 77% rename from crit/images/fdinfo.pb.go rename to crit/images/fdinfo/fdinfo.pb.go index 80abb2c1e..879c0c339 100644 --- a/crit/images/fdinfo.pb.go +++ b/crit/images/fdinfo/fdinfo.pb.go @@ -2,13 +2,31 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: fdinfo.proto -package images +package fdinfo import ( + bpfmap_file "github.com/checkpoint-restore/go-criu/v6/crit/images/bpfmap-file" + eventfd "github.com/checkpoint-restore/go-criu/v6/crit/images/eventfd" + eventpoll "github.com/checkpoint-restore/go-criu/v6/crit/images/eventpoll" + ext_file "github.com/checkpoint-restore/go-criu/v6/crit/images/ext-file" + fifo "github.com/checkpoint-restore/go-criu/v6/crit/images/fifo" + fsnotify "github.com/checkpoint-restore/go-criu/v6/crit/images/fsnotify" + memfd "github.com/checkpoint-restore/go-criu/v6/crit/images/memfd" + ns "github.com/checkpoint-restore/go-criu/v6/crit/images/ns" + packet_sock "github.com/checkpoint-restore/go-criu/v6/crit/images/packet-sock" + pipe "github.com/checkpoint-restore/go-criu/v6/crit/images/pipe" + regfile "github.com/checkpoint-restore/go-criu/v6/crit/images/regfile" + signalfd "github.com/checkpoint-restore/go-criu/v6/crit/images/signalfd" + sk_inet "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-inet" + sk_netlink "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-netlink" + sk_unix "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-unix" + timerfd "github.com/checkpoint-restore/go-criu/v6/crit/images/timerfd" + tty "github.com/checkpoint-restore/go-criu/v6/crit/images/tty" + tun "github.com/checkpoint-restore/go-criu/v6/crit/images/tun" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -223,27 +241,27 @@ type FileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type *FdTypes `protobuf:"varint,1,req,name=type,enum=FdTypes" json:"type,omitempty"` - Id *uint32 `protobuf:"varint,2,req,name=id" json:"id,omitempty"` - Reg *RegFileEntry `protobuf:"bytes,3,opt,name=reg" json:"reg,omitempty"` - Isk *InetSkEntry `protobuf:"bytes,4,opt,name=isk" json:"isk,omitempty"` - Nsf *NsFileEntry `protobuf:"bytes,5,opt,name=nsf" json:"nsf,omitempty"` - Psk *PacketSockEntry `protobuf:"bytes,6,opt,name=psk" json:"psk,omitempty"` - Nlsk *NetlinkSkEntry `protobuf:"bytes,7,opt,name=nlsk" json:"nlsk,omitempty"` - Efd *EventfdFileEntry `protobuf:"bytes,8,opt,name=efd" json:"efd,omitempty"` - Epfd *EventpollFileEntry `protobuf:"bytes,9,opt,name=epfd" json:"epfd,omitempty"` - Sgfd *SignalfdEntry `protobuf:"bytes,10,opt,name=sgfd" json:"sgfd,omitempty"` - Tunf *TunfileEntry `protobuf:"bytes,11,opt,name=tunf" json:"tunf,omitempty"` - Tfd *TimerfdEntry `protobuf:"bytes,12,opt,name=tfd" json:"tfd,omitempty"` - Ify *InotifyFileEntry `protobuf:"bytes,13,opt,name=ify" json:"ify,omitempty"` - Ffy *FanotifyFileEntry `protobuf:"bytes,14,opt,name=ffy" json:"ffy,omitempty"` - Ext *ExtFileEntry `protobuf:"bytes,15,opt,name=ext" json:"ext,omitempty"` - Usk *UnixSkEntry `protobuf:"bytes,16,opt,name=usk" json:"usk,omitempty"` - Fifo *FifoEntry `protobuf:"bytes,17,opt,name=fifo" json:"fifo,omitempty"` - Pipe *PipeEntry `protobuf:"bytes,18,opt,name=pipe" json:"pipe,omitempty"` - Tty *TtyFileEntry `protobuf:"bytes,19,opt,name=tty" json:"tty,omitempty"` - Memfd *MemfdFileEntry `protobuf:"bytes,20,opt,name=memfd" json:"memfd,omitempty"` - Bpf *BpfmapFileEntry `protobuf:"bytes,21,opt,name=bpf" json:"bpf,omitempty"` + Type *FdTypes `protobuf:"varint,1,req,name=type,enum=FdTypes" json:"type,omitempty"` + Id *uint32 `protobuf:"varint,2,req,name=id" json:"id,omitempty"` + Reg *regfile.RegFileEntry `protobuf:"bytes,3,opt,name=reg" json:"reg,omitempty"` + Isk *sk_inet.InetSkEntry `protobuf:"bytes,4,opt,name=isk" json:"isk,omitempty"` + Nsf *ns.NsFileEntry `protobuf:"bytes,5,opt,name=nsf" json:"nsf,omitempty"` + Psk *packet_sock.PacketSockEntry `protobuf:"bytes,6,opt,name=psk" json:"psk,omitempty"` + Nlsk *sk_netlink.NetlinkSkEntry `protobuf:"bytes,7,opt,name=nlsk" json:"nlsk,omitempty"` + Efd *eventfd.EventfdFileEntry `protobuf:"bytes,8,opt,name=efd" json:"efd,omitempty"` + Epfd *eventpoll.EventpollFileEntry `protobuf:"bytes,9,opt,name=epfd" json:"epfd,omitempty"` + Sgfd *signalfd.SignalfdEntry `protobuf:"bytes,10,opt,name=sgfd" json:"sgfd,omitempty"` + Tunf *tun.TunfileEntry `protobuf:"bytes,11,opt,name=tunf" json:"tunf,omitempty"` + Tfd *timerfd.TimerfdEntry `protobuf:"bytes,12,opt,name=tfd" json:"tfd,omitempty"` + Ify *fsnotify.InotifyFileEntry `protobuf:"bytes,13,opt,name=ify" json:"ify,omitempty"` + Ffy *fsnotify.FanotifyFileEntry `protobuf:"bytes,14,opt,name=ffy" json:"ffy,omitempty"` + Ext *ext_file.ExtFileEntry `protobuf:"bytes,15,opt,name=ext" json:"ext,omitempty"` + Usk *sk_unix.UnixSkEntry `protobuf:"bytes,16,opt,name=usk" json:"usk,omitempty"` + Fifo *fifo.FifoEntry `protobuf:"bytes,17,opt,name=fifo" json:"fifo,omitempty"` + Pipe *pipe.PipeEntry `protobuf:"bytes,18,opt,name=pipe" json:"pipe,omitempty"` + Tty *tty.TtyFileEntry `protobuf:"bytes,19,opt,name=tty" json:"tty,omitempty"` + Memfd *memfd.MemfdFileEntry `protobuf:"bytes,20,opt,name=memfd" json:"memfd,omitempty"` + Bpf *bpfmap_file.BpfmapFileEntry `protobuf:"bytes,21,opt,name=bpf" json:"bpf,omitempty"` } func (x *FileEntry) Reset() { @@ -292,133 +310,133 @@ func (x *FileEntry) GetId() uint32 { return 0 } -func (x *FileEntry) GetReg() *RegFileEntry { +func (x *FileEntry) GetReg() *regfile.RegFileEntry { if x != nil { return x.Reg } return nil } -func (x *FileEntry) GetIsk() *InetSkEntry { +func (x *FileEntry) GetIsk() *sk_inet.InetSkEntry { if x != nil { return x.Isk } return nil } -func (x *FileEntry) GetNsf() *NsFileEntry { +func (x *FileEntry) GetNsf() *ns.NsFileEntry { if x != nil { return x.Nsf } return nil } -func (x *FileEntry) GetPsk() *PacketSockEntry { +func (x *FileEntry) GetPsk() *packet_sock.PacketSockEntry { if x != nil { return x.Psk } return nil } -func (x *FileEntry) GetNlsk() *NetlinkSkEntry { +func (x *FileEntry) GetNlsk() *sk_netlink.NetlinkSkEntry { if x != nil { return x.Nlsk } return nil } -func (x *FileEntry) GetEfd() *EventfdFileEntry { +func (x *FileEntry) GetEfd() *eventfd.EventfdFileEntry { if x != nil { return x.Efd } return nil } -func (x *FileEntry) GetEpfd() *EventpollFileEntry { +func (x *FileEntry) GetEpfd() *eventpoll.EventpollFileEntry { if x != nil { return x.Epfd } return nil } -func (x *FileEntry) GetSgfd() *SignalfdEntry { +func (x *FileEntry) GetSgfd() *signalfd.SignalfdEntry { if x != nil { return x.Sgfd } return nil } -func (x *FileEntry) GetTunf() *TunfileEntry { +func (x *FileEntry) GetTunf() *tun.TunfileEntry { if x != nil { return x.Tunf } return nil } -func (x *FileEntry) GetTfd() *TimerfdEntry { +func (x *FileEntry) GetTfd() *timerfd.TimerfdEntry { if x != nil { return x.Tfd } return nil } -func (x *FileEntry) GetIfy() *InotifyFileEntry { +func (x *FileEntry) GetIfy() *fsnotify.InotifyFileEntry { if x != nil { return x.Ify } return nil } -func (x *FileEntry) GetFfy() *FanotifyFileEntry { +func (x *FileEntry) GetFfy() *fsnotify.FanotifyFileEntry { if x != nil { return x.Ffy } return nil } -func (x *FileEntry) GetExt() *ExtFileEntry { +func (x *FileEntry) GetExt() *ext_file.ExtFileEntry { if x != nil { return x.Ext } return nil } -func (x *FileEntry) GetUsk() *UnixSkEntry { +func (x *FileEntry) GetUsk() *sk_unix.UnixSkEntry { if x != nil { return x.Usk } return nil } -func (x *FileEntry) GetFifo() *FifoEntry { +func (x *FileEntry) GetFifo() *fifo.FifoEntry { if x != nil { return x.Fifo } return nil } -func (x *FileEntry) GetPipe() *PipeEntry { +func (x *FileEntry) GetPipe() *pipe.PipeEntry { if x != nil { return x.Pipe } return nil } -func (x *FileEntry) GetTty() *TtyFileEntry { +func (x *FileEntry) GetTty() *tty.TtyFileEntry { if x != nil { return x.Tty } return nil } -func (x *FileEntry) GetMemfd() *MemfdFileEntry { +func (x *FileEntry) GetMemfd() *memfd.MemfdFileEntry { if x != nil { return x.Memfd } return nil } -func (x *FileEntry) GetBpf() *BpfmapFileEntry { +func (x *FileEntry) GetBpf() *bpfmap_file.BpfmapFileEntry { if x != nil { return x.Bpf } @@ -538,28 +556,28 @@ func file_fdinfo_proto_rawDescGZIP() []byte { var file_fdinfo_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_fdinfo_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_fdinfo_proto_goTypes = []interface{}{ - (FdTypes)(0), // 0: fd_types - (*FdinfoEntry)(nil), // 1: fdinfo_entry - (*FileEntry)(nil), // 2: file_entry - (*RegFileEntry)(nil), // 3: reg_file_entry - (*InetSkEntry)(nil), // 4: inet_sk_entry - (*NsFileEntry)(nil), // 5: ns_file_entry - (*PacketSockEntry)(nil), // 6: packet_sock_entry - (*NetlinkSkEntry)(nil), // 7: netlink_sk_entry - (*EventfdFileEntry)(nil), // 8: eventfd_file_entry - (*EventpollFileEntry)(nil), // 9: eventpoll_file_entry - (*SignalfdEntry)(nil), // 10: signalfd_entry - (*TunfileEntry)(nil), // 11: tunfile_entry - (*TimerfdEntry)(nil), // 12: timerfd_entry - (*InotifyFileEntry)(nil), // 13: inotify_file_entry - (*FanotifyFileEntry)(nil), // 14: fanotify_file_entry - (*ExtFileEntry)(nil), // 15: ext_file_entry - (*UnixSkEntry)(nil), // 16: unix_sk_entry - (*FifoEntry)(nil), // 17: fifo_entry - (*PipeEntry)(nil), // 18: pipe_entry - (*TtyFileEntry)(nil), // 19: tty_file_entry - (*MemfdFileEntry)(nil), // 20: memfd_file_entry - (*BpfmapFileEntry)(nil), // 21: bpfmap_file_entry + (FdTypes)(0), // 0: fd_types + (*FdinfoEntry)(nil), // 1: fdinfo_entry + (*FileEntry)(nil), // 2: file_entry + (*regfile.RegFileEntry)(nil), // 3: reg_file_entry + (*sk_inet.InetSkEntry)(nil), // 4: inet_sk_entry + (*ns.NsFileEntry)(nil), // 5: ns_file_entry + (*packet_sock.PacketSockEntry)(nil), // 6: packet_sock_entry + (*sk_netlink.NetlinkSkEntry)(nil), // 7: netlink_sk_entry + (*eventfd.EventfdFileEntry)(nil), // 8: eventfd_file_entry + (*eventpoll.EventpollFileEntry)(nil), // 9: eventpoll_file_entry + (*signalfd.SignalfdEntry)(nil), // 10: signalfd_entry + (*tun.TunfileEntry)(nil), // 11: tunfile_entry + (*timerfd.TimerfdEntry)(nil), // 12: timerfd_entry + (*fsnotify.InotifyFileEntry)(nil), // 13: inotify_file_entry + (*fsnotify.FanotifyFileEntry)(nil), // 14: fanotify_file_entry + (*ext_file.ExtFileEntry)(nil), // 15: ext_file_entry + (*sk_unix.UnixSkEntry)(nil), // 16: unix_sk_entry + (*fifo.FifoEntry)(nil), // 17: fifo_entry + (*pipe.PipeEntry)(nil), // 18: pipe_entry + (*tty.TtyFileEntry)(nil), // 19: tty_file_entry + (*memfd.MemfdFileEntry)(nil), // 20: memfd_file_entry + (*bpfmap_file.BpfmapFileEntry)(nil), // 21: bpfmap_file_entry } var file_fdinfo_proto_depIdxs = []int32{ 0, // 0: fdinfo_entry.type:type_name -> fd_types @@ -595,24 +613,6 @@ func file_fdinfo_proto_init() { if File_fdinfo_proto != nil { return } - file_regfile_proto_init() - file_sk_inet_proto_init() - file_ns_proto_init() - file_packet_sock_proto_init() - file_sk_netlink_proto_init() - file_eventfd_proto_init() - file_eventpoll_proto_init() - file_signalfd_proto_init() - file_tun_proto_init() - file_timerfd_proto_init() - file_fsnotify_proto_init() - file_ext_file_proto_init() - file_sk_unix_proto_init() - file_fifo_proto_init() - file_pipe_proto_init() - file_tty_proto_init() - file_memfd_proto_init() - file_bpfmap_file_proto_init() if !protoimpl.UnsafeEnabled { file_fdinfo_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FdinfoEntry); i { diff --git a/crit/images/fh.pb.go b/crit/images/fh/fh.pb.go similarity index 90% rename from crit/images/fh.pb.go rename to crit/images/fh/fh.pb.go index c67a02ce3..e106f7906 100644 --- a/crit/images/fh.pb.go +++ b/crit/images/fh/fh.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: fh.proto -package images +package fh import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -230,14 +231,14 @@ var file_fh_proto_rawDesc = []byte{ 0x6e, 0x64, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x12, 0x15, 0x0a, 0x06, 0x6d, 0x6e, 0x74, 0x5f, 0x69, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x05, 0x6d, 0x6e, 0x74, 0x49, 0x64, 0x22, - 0x5b, 0x0a, 0x11, 0x69, 0x72, 0x6d, 0x61, 0x70, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x1c, 0x0a, 0x03, 0x64, 0x65, 0x76, 0x18, 0x01, 0x20, 0x02, 0x28, - 0x0d, 0x42, 0x0a, 0xd2, 0x3f, 0x02, 0x20, 0x01, 0xd2, 0x3f, 0x02, 0x28, 0x01, 0x52, 0x03, 0x64, - 0x65, 0x76, 0x12, 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, - 0x04, 0x52, 0x05, 0x69, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, - 0x18, 0x03, 0x20, 0x02, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x2a, 0x21, 0x0a, 0x0e, - 0x66, 0x68, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x73, 0x12, 0x0f, - 0x0a, 0x0b, 0x6d, 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x10, 0x10, + 0x58, 0x0a, 0x11, 0x69, 0x72, 0x6d, 0x61, 0x70, 0x5f, 0x63, 0x61, 0x63, 0x68, 0x65, 0x5f, 0x65, + 0x6e, 0x74, 0x72, 0x79, 0x12, 0x19, 0x0a, 0x03, 0x64, 0x65, 0x76, 0x18, 0x01, 0x20, 0x02, 0x28, + 0x0d, 0x42, 0x07, 0xd2, 0x3f, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x03, 0x64, 0x65, 0x76, 0x12, + 0x14, 0x0a, 0x05, 0x69, 0x6e, 0x6f, 0x64, 0x65, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, 0x52, 0x05, + 0x69, 0x6e, 0x6f, 0x64, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x74, 0x68, 0x18, 0x03, 0x20, + 0x02, 0x28, 0x09, 0x52, 0x04, 0x70, 0x61, 0x74, 0x68, 0x2a, 0x21, 0x0a, 0x0e, 0x66, 0x68, 0x5f, + 0x65, 0x6e, 0x74, 0x72, 0x79, 0x5f, 0x73, 0x69, 0x7a, 0x65, 0x73, 0x12, 0x0f, 0x0a, 0x0b, 0x6d, + 0x69, 0x6e, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x69, 0x65, 0x73, 0x10, 0x10, } var ( @@ -272,7 +273,6 @@ func file_fh_proto_init() { if File_fh_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_fh_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FhEntry); i { diff --git a/crit/images/fifo.pb.go b/crit/images/fifo/fifo.pb.go similarity index 98% rename from crit/images/fifo.pb.go rename to crit/images/fifo/fifo.pb.go index 57dfd4faa..4fe95cf48 100644 --- a/crit/images/fifo.pb.go +++ b/crit/images/fifo/fifo.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: fifo.proto -package images +package fifo import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/file-lock.pb.go b/crit/images/file-lock/file-lock.pb.go similarity index 98% rename from crit/images/file-lock.pb.go rename to crit/images/file-lock/file-lock.pb.go index 29af237be..a56b34776 100644 --- a/crit/images/file-lock.pb.go +++ b/crit/images/file-lock/file-lock.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: file-lock.proto -package images +package file_lock import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/fown.pb.go b/crit/images/fown/fown.pb.go similarity index 98% rename from crit/images/fown.pb.go rename to crit/images/fown/fown.pb.go index 94c4779c2..a378412aa 100644 --- a/crit/images/fown.pb.go +++ b/crit/images/fown/fown.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: fown.proto -package images +package fown import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/fs.pb.go b/crit/images/fs/fs.pb.go similarity index 98% rename from crit/images/fs.pb.go rename to crit/images/fs/fs.pb.go index 06e2f32e0..0e6834113 100644 --- a/crit/images/fs.pb.go +++ b/crit/images/fs/fs.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: fs.proto -package images +package fs import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/fsnotify.pb.go b/crit/images/fsnotify/fsnotify.pb.go similarity index 93% rename from crit/images/fsnotify.pb.go rename to crit/images/fsnotify/fsnotify.pb.go index 8200687bb..b7b2d8b25 100644 --- a/crit/images/fsnotify.pb.go +++ b/crit/images/fsnotify/fsnotify.pb.go @@ -2,13 +2,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: fsnotify.proto -package images +package fsnotify import ( + fh "github.com/checkpoint-restore/go-criu/v6/crit/images/fh" + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -83,13 +86,13 @@ type InotifyWdEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - IIno *uint64 `protobuf:"varint,2,req,name=i_ino,json=iIno" json:"i_ino,omitempty"` - Mask *uint32 `protobuf:"varint,3,req,name=mask" json:"mask,omitempty"` - IgnoredMask *uint32 `protobuf:"varint,4,req,name=ignored_mask,json=ignoredMask" json:"ignored_mask,omitempty"` - SDev *uint32 `protobuf:"varint,5,req,name=s_dev,json=sDev" json:"s_dev,omitempty"` - Wd *uint32 `protobuf:"varint,6,req,name=wd" json:"wd,omitempty"` - FHandle *FhEntry `protobuf:"bytes,7,req,name=f_handle,json=fHandle" json:"f_handle,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + IIno *uint64 `protobuf:"varint,2,req,name=i_ino,json=iIno" json:"i_ino,omitempty"` + Mask *uint32 `protobuf:"varint,3,req,name=mask" json:"mask,omitempty"` + IgnoredMask *uint32 `protobuf:"varint,4,req,name=ignored_mask,json=ignoredMask" json:"ignored_mask,omitempty"` + SDev *uint32 `protobuf:"varint,5,req,name=s_dev,json=sDev" json:"s_dev,omitempty"` + Wd *uint32 `protobuf:"varint,6,req,name=wd" json:"wd,omitempty"` + FHandle *fh.FhEntry `protobuf:"bytes,7,req,name=f_handle,json=fHandle" json:"f_handle,omitempty"` } func (x *InotifyWdEntry) Reset() { @@ -166,7 +169,7 @@ func (x *InotifyWdEntry) GetWd() uint32 { return 0 } -func (x *InotifyWdEntry) GetFHandle() *FhEntry { +func (x *InotifyWdEntry) GetFHandle() *fh.FhEntry { if x != nil { return x.FHandle } @@ -180,7 +183,7 @@ type InotifyFileEntry struct { Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` Wd []*InotifyWdEntry `protobuf:"bytes,5,rep,name=wd" json:"wd,omitempty"` } @@ -230,7 +233,7 @@ func (x *InotifyFileEntry) GetFlags() uint32 { return 0 } -func (x *InotifyFileEntry) GetFown() *FownEntry { +func (x *InotifyFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -249,8 +252,8 @@ type FanotifyInodeMarkEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - IIno *uint64 `protobuf:"varint,1,req,name=i_ino,json=iIno" json:"i_ino,omitempty"` - FHandle *FhEntry `protobuf:"bytes,2,req,name=f_handle,json=fHandle" json:"f_handle,omitempty"` + IIno *uint64 `protobuf:"varint,1,req,name=i_ino,json=iIno" json:"i_ino,omitempty"` + FHandle *fh.FhEntry `protobuf:"bytes,2,req,name=f_handle,json=fHandle" json:"f_handle,omitempty"` } func (x *FanotifyInodeMarkEntry) Reset() { @@ -292,7 +295,7 @@ func (x *FanotifyInodeMarkEntry) GetIIno() uint64 { return 0 } -func (x *FanotifyInodeMarkEntry) GetFHandle() *FhEntry { +func (x *FanotifyInodeMarkEntry) GetFHandle() *fh.FhEntry { if x != nil { return x.FHandle } @@ -464,7 +467,7 @@ type FanotifyFileEntry struct { Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` Faflags *uint32 `protobuf:"varint,4,req,name=faflags" json:"faflags,omitempty"` Evflags *uint32 `protobuf:"varint,5,req,name=evflags" json:"evflags,omitempty"` Mark []*FanotifyMarkEntry `protobuf:"bytes,6,rep,name=mark" json:"mark,omitempty"` @@ -516,7 +519,7 @@ func (x *FanotifyFileEntry) GetFlags() uint32 { return 0 } -func (x *FanotifyFileEntry) GetFown() *FownEntry { +func (x *FanotifyFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -639,8 +642,8 @@ var file_fsnotify_proto_goTypes = []interface{}{ (*FanotifyMountMarkEntry)(nil), // 4: fanotify_mount_mark_entry (*FanotifyMarkEntry)(nil), // 5: fanotify_mark_entry (*FanotifyFileEntry)(nil), // 6: fanotify_file_entry - (*FhEntry)(nil), // 7: fh_entry - (*FownEntry)(nil), // 8: fown_entry + (*fh.FhEntry)(nil), // 7: fh_entry + (*fown.FownEntry)(nil), // 8: fown_entry } var file_fsnotify_proto_depIdxs = []int32{ 7, // 0: inotify_wd_entry.f_handle:type_name -> fh_entry @@ -664,9 +667,6 @@ func file_fsnotify_proto_init() { if File_fsnotify_proto != nil { return } - file_opts_proto_init() - file_fh_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_fsnotify_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InotifyWdEntry); i { diff --git a/crit/images/ghost-file.pb.go b/crit/images/ghost-file/ghost-file.pb.go similarity index 74% rename from crit/images/ghost-file.pb.go rename to crit/images/ghost-file/ghost-file.pb.go index f4c198caa..62da9a511 100644 --- a/crit/images/ghost-file.pb.go +++ b/crit/images/ghost-file/ghost-file.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ghost-file.proto -package images +package ghost_file import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + time "github.com/checkpoint-restore/go-criu/v6/crit/images/time" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,16 +29,16 @@ type GhostFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Uid *uint32 `protobuf:"varint,1,req,name=uid" json:"uid,omitempty"` - Gid *uint32 `protobuf:"varint,2,req,name=gid" json:"gid,omitempty"` - Mode *uint32 `protobuf:"varint,3,req,name=mode" json:"mode,omitempty"` - Dev *uint32 `protobuf:"varint,4,opt,name=dev" json:"dev,omitempty"` - Ino *uint64 `protobuf:"varint,5,opt,name=ino" json:"ino,omitempty"` - Rdev *uint32 `protobuf:"varint,6,opt,name=rdev" json:"rdev,omitempty"` - Atim *Timeval `protobuf:"bytes,7,opt,name=atim" json:"atim,omitempty"` - Mtim *Timeval `protobuf:"bytes,8,opt,name=mtim" json:"mtim,omitempty"` - Chunks *bool `protobuf:"varint,9,opt,name=chunks" json:"chunks,omitempty"` - Size *uint64 `protobuf:"varint,10,opt,name=size" json:"size,omitempty"` + Uid *uint32 `protobuf:"varint,1,req,name=uid" json:"uid,omitempty"` + Gid *uint32 `protobuf:"varint,2,req,name=gid" json:"gid,omitempty"` + Mode *uint32 `protobuf:"varint,3,req,name=mode" json:"mode,omitempty"` + Dev *uint32 `protobuf:"varint,4,opt,name=dev" json:"dev,omitempty"` + Ino *uint64 `protobuf:"varint,5,opt,name=ino" json:"ino,omitempty"` + Rdev *uint32 `protobuf:"varint,6,opt,name=rdev" json:"rdev,omitempty"` + Atim *time.Timeval `protobuf:"bytes,7,opt,name=atim" json:"atim,omitempty"` + Mtim *time.Timeval `protobuf:"bytes,8,opt,name=mtim" json:"mtim,omitempty"` + Chunks *bool `protobuf:"varint,9,opt,name=chunks" json:"chunks,omitempty"` + Size *uint64 `protobuf:"varint,10,opt,name=size" json:"size,omitempty"` // this field makes sense only when S_ISLNK(mode) SymlnkTarget *string `protobuf:"bytes,11,opt,name=symlnk_target,json=symlnkTarget" json:"symlnk_target,omitempty"` } @@ -115,14 +117,14 @@ func (x *GhostFileEntry) GetRdev() uint32 { return 0 } -func (x *GhostFileEntry) GetAtim() *Timeval { +func (x *GhostFileEntry) GetAtim() *time.Timeval { if x != nil { return x.Atim } return nil } -func (x *GhostFileEntry) GetMtim() *Timeval { +func (x *GhostFileEntry) GetMtim() *time.Timeval { if x != nil { return x.Mtim } @@ -210,7 +212,7 @@ var File_ghost_file_proto protoreflect.FileDescriptor var file_ghost_file_proto_rawDesc = []byte{ 0x0a, 0x10, 0x67, 0x68, 0x6f, 0x73, 0x74, 0x2d, 0x66, 0x69, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, 0x6f, 0x70, 0x74, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x0a, - 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xa2, 0x02, 0x0a, 0x10, 0x67, + 0x74, 0x69, 0x6d, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x9f, 0x02, 0x0a, 0x10, 0x67, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x66, 0x69, 0x6c, 0x65, 0x5f, 0x65, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x69, 0x64, 0x18, 0x01, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x03, 0x75, 0x69, 0x64, 0x12, 0x10, 0x0a, 0x03, 0x67, 0x69, 0x64, 0x18, 0x02, 0x20, 0x02, 0x28, 0x0d, 0x52, 0x03, @@ -218,21 +220,21 @@ var file_ghost_file_proto_rawDesc = []byte{ 0x0d, 0x52, 0x04, 0x6d, 0x6f, 0x64, 0x65, 0x12, 0x17, 0x0a, 0x03, 0x64, 0x65, 0x76, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0d, 0x42, 0x05, 0xd2, 0x3f, 0x02, 0x20, 0x01, 0x52, 0x03, 0x64, 0x65, 0x76, 0x12, 0x10, 0x0a, 0x03, 0x69, 0x6e, 0x6f, 0x18, 0x05, 0x20, 0x01, 0x28, 0x04, 0x52, 0x03, 0x69, - 0x6e, 0x6f, 0x12, 0x1e, 0x0a, 0x04, 0x72, 0x64, 0x65, 0x76, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, - 0x42, 0x0a, 0xd2, 0x3f, 0x02, 0x20, 0x01, 0xd2, 0x3f, 0x02, 0x28, 0x01, 0x52, 0x04, 0x72, 0x64, - 0x65, 0x76, 0x12, 0x1c, 0x0a, 0x04, 0x61, 0x74, 0x69, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, - 0x32, 0x08, 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x76, 0x61, 0x6c, 0x52, 0x04, 0x61, 0x74, 0x69, 0x6d, - 0x12, 0x1c, 0x0a, 0x04, 0x6d, 0x74, 0x69, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, - 0x2e, 0x74, 0x69, 0x6d, 0x65, 0x76, 0x61, 0x6c, 0x52, 0x04, 0x6d, 0x74, 0x69, 0x6d, 0x12, 0x16, - 0x0a, 0x06, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, - 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0a, - 0x20, 0x01, 0x28, 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x79, - 0x6d, 0x6c, 0x6e, 0x6b, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, - 0x09, 0x52, 0x0c, 0x73, 0x79, 0x6d, 0x6c, 0x6e, 0x6b, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, - 0x37, 0x0a, 0x11, 0x67, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x65, - 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x02, 0x28, - 0x04, 0x52, 0x03, 0x6c, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x66, 0x66, 0x18, 0x02, 0x20, - 0x02, 0x28, 0x04, 0x52, 0x03, 0x6f, 0x66, 0x66, + 0x6e, 0x6f, 0x12, 0x1b, 0x0a, 0x04, 0x72, 0x64, 0x65, 0x76, 0x18, 0x06, 0x20, 0x01, 0x28, 0x0d, + 0x42, 0x07, 0xd2, 0x3f, 0x04, 0x20, 0x01, 0x28, 0x01, 0x52, 0x04, 0x72, 0x64, 0x65, 0x76, 0x12, + 0x1c, 0x0a, 0x04, 0x61, 0x74, 0x69, 0x6d, 0x18, 0x07, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, + 0x74, 0x69, 0x6d, 0x65, 0x76, 0x61, 0x6c, 0x52, 0x04, 0x61, 0x74, 0x69, 0x6d, 0x12, 0x1c, 0x0a, + 0x04, 0x6d, 0x74, 0x69, 0x6d, 0x18, 0x08, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x08, 0x2e, 0x74, 0x69, + 0x6d, 0x65, 0x76, 0x61, 0x6c, 0x52, 0x04, 0x6d, 0x74, 0x69, 0x6d, 0x12, 0x16, 0x0a, 0x06, 0x63, + 0x68, 0x75, 0x6e, 0x6b, 0x73, 0x18, 0x09, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x63, 0x68, 0x75, + 0x6e, 0x6b, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, + 0x04, 0x52, 0x04, 0x73, 0x69, 0x7a, 0x65, 0x12, 0x23, 0x0a, 0x0d, 0x73, 0x79, 0x6d, 0x6c, 0x6e, + 0x6b, 0x5f, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, + 0x73, 0x79, 0x6d, 0x6c, 0x6e, 0x6b, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x22, 0x37, 0x0a, 0x11, + 0x67, 0x68, 0x6f, 0x73, 0x74, 0x5f, 0x63, 0x68, 0x75, 0x6e, 0x6b, 0x5f, 0x65, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6c, 0x65, 0x6e, 0x18, 0x01, 0x20, 0x02, 0x28, 0x04, 0x52, 0x03, + 0x6c, 0x65, 0x6e, 0x12, 0x10, 0x0a, 0x03, 0x6f, 0x66, 0x66, 0x18, 0x02, 0x20, 0x02, 0x28, 0x04, + 0x52, 0x03, 0x6f, 0x66, 0x66, } var ( @@ -251,7 +253,7 @@ var file_ghost_file_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_ghost_file_proto_goTypes = []interface{}{ (*GhostFileEntry)(nil), // 0: ghost_file_entry (*GhostChunkEntry)(nil), // 1: ghost_chunk_entry - (*Timeval)(nil), // 2: timeval + (*time.Timeval)(nil), // 2: timeval } var file_ghost_file_proto_depIdxs = []int32{ 2, // 0: ghost_file_entry.atim:type_name -> timeval @@ -268,8 +270,6 @@ func file_ghost_file_proto_init() { if File_ghost_file_proto != nil { return } - file_opts_proto_init() - file_time_proto_init() if !protoimpl.UnsafeEnabled { file_ghost_file_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*GhostFileEntry); i { diff --git a/crit/images/handler.go b/crit/images/handler.go index b2ee7fdb6..876e2d6bd 100644 --- a/crit/images/handler.go +++ b/crit/images/handler.go @@ -3,139 +3,192 @@ package images import ( "fmt" + "github.com/checkpoint-restore/go-criu/v6/crit/images/apparmor" + "github.com/checkpoint-restore/go-criu/v6/crit/images/autofs" + binfmt_misc "github.com/checkpoint-restore/go-criu/v6/crit/images/binfmt-misc" + bpfmap_data "github.com/checkpoint-restore/go-criu/v6/crit/images/bpfmap-data" + bpfmap_file "github.com/checkpoint-restore/go-criu/v6/crit/images/bpfmap-file" + "github.com/checkpoint-restore/go-criu/v6/crit/images/cgroup" + "github.com/checkpoint-restore/go-criu/v6/crit/images/cpuinfo" + "github.com/checkpoint-restore/go-criu/v6/crit/images/creds" + criu_core "github.com/checkpoint-restore/go-criu/v6/crit/images/criu-core" + criu_sa "github.com/checkpoint-restore/go-criu/v6/crit/images/criu-sa" + "github.com/checkpoint-restore/go-criu/v6/crit/images/eventfd" + "github.com/checkpoint-restore/go-criu/v6/crit/images/eventpoll" + ext_file "github.com/checkpoint-restore/go-criu/v6/crit/images/ext-file" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fdinfo" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fh" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fifo" + file_lock "github.com/checkpoint-restore/go-criu/v6/crit/images/file-lock" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fs" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fsnotify" + "github.com/checkpoint-restore/go-criu/v6/crit/images/inventory" + ipc_msg "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-msg" + ipc_sem "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-sem" + ipc_shm "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-shm" + ipc_var "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-var" + "github.com/checkpoint-restore/go-criu/v6/crit/images/memfd" + "github.com/checkpoint-restore/go-criu/v6/crit/images/mm" + "github.com/checkpoint-restore/go-criu/v6/crit/images/mnt" + "github.com/checkpoint-restore/go-criu/v6/crit/images/netdev" + "github.com/checkpoint-restore/go-criu/v6/crit/images/ns" + packet_sock "github.com/checkpoint-restore/go-criu/v6/crit/images/packet-sock" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pidns" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pipe" + pipe_data "github.com/checkpoint-restore/go-criu/v6/crit/images/pipe-data" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pstree" + "github.com/checkpoint-restore/go-criu/v6/crit/images/regfile" + remap_file_path "github.com/checkpoint-restore/go-criu/v6/crit/images/remap-file-path" + "github.com/checkpoint-restore/go-criu/v6/crit/images/rlimit" + "github.com/checkpoint-restore/go-criu/v6/crit/images/seccomp" + "github.com/checkpoint-restore/go-criu/v6/crit/images/signalfd" + sk_inet "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-inet" + sk_netlink "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-netlink" + sk_packet "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-packet" + sk_unix "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-unix" + "github.com/checkpoint-restore/go-criu/v6/crit/images/stats" + tcp_stream "github.com/checkpoint-restore/go-criu/v6/crit/images/tcp-stream" + "github.com/checkpoint-restore/go-criu/v6/crit/images/timens" + "github.com/checkpoint-restore/go-criu/v6/crit/images/timer" + "github.com/checkpoint-restore/go-criu/v6/crit/images/timerfd" + "github.com/checkpoint-restore/go-criu/v6/crit/images/tty" + "github.com/checkpoint-restore/go-criu/v6/crit/images/tun" + "github.com/checkpoint-restore/go-criu/v6/crit/images/userns" + "github.com/checkpoint-restore/go-criu/v6/crit/images/utsns" + "github.com/checkpoint-restore/go-criu/v6/crit/images/vma" "google.golang.org/protobuf/proto" ) func ProtoHandler(magic string) (proto.Message, error) { switch magic { case "APPARMOR": - return &ApparmorEntry{}, nil + return &apparmor.ApparmorEntry{}, nil case "AUTOFS": - return &AutofsEntry{}, nil + return &autofs.AutofsEntry{}, nil case "BINFMT_MISC": - return &BinfmtMiscEntry{}, nil + return &binfmt_misc.BinfmtMiscEntry{}, nil case "BPFMAP_DATA": - return &BpfmapDataEntry{}, nil + return &bpfmap_data.BpfmapDataEntry{}, nil case "BPFMAP_FILE": - return &BpfmapFileEntry{}, nil + return &bpfmap_file.BpfmapFileEntry{}, nil case "CGROUP": - return &CgroupEntry{}, nil + return &cgroup.CgroupEntry{}, nil case "CORE": - return &CoreEntry{}, nil + return &criu_core.CoreEntry{}, nil case "CPUINFO": - return &CpuinfoEntry{}, nil + return &cpuinfo.CpuinfoEntry{}, nil case "CREDS": - return &CredsEntry{}, nil + return &creds.CredsEntry{}, nil case "EVENTFD_FILE": - return &EventfdFileEntry{}, nil + return &eventfd.EventfdFileEntry{}, nil case "EVENTPOLL_FILE": - return &EventpollFileEntry{}, nil + return &eventpoll.EventpollFileEntry{}, nil case "EVENTPOLL_TFD": - return &EventpollTfdEntry{}, nil + return &eventpoll.EventpollTfdEntry{}, nil case "EXT_FILES": - return &ExtFileEntry{}, nil + return &ext_file.ExtFileEntry{}, nil case "FANOTIFY_FILE": - return &FanotifyFileEntry{}, nil + return &fsnotify.FanotifyFileEntry{}, nil case "FANOTIFY_MARK": - return &FanotifyMarkEntry{}, nil + return &fsnotify.FanotifyMarkEntry{}, nil case "FDINFO": - return &FdinfoEntry{}, nil + return &fdinfo.FdinfoEntry{}, nil case "FIFO": - return &FifoEntry{}, nil + return &fifo.FifoEntry{}, nil case "FIFO_DATA": - return &PipeDataEntry{}, nil + return &pipe_data.PipeDataEntry{}, nil case "FILES": - return &FileEntry{}, nil + return &fdinfo.FileEntry{}, nil case "FILE_LOCKS": - return &FileLockEntry{}, nil + return &file_lock.FileLockEntry{}, nil case "FS": - return &FsEntry{}, nil + return &fs.FsEntry{}, nil case "IDS": - return &TaskKobjIdsEntry{}, nil + return &criu_core.TaskKobjIdsEntry{}, nil case "INETSK": - return &InetSkEntry{}, nil + return &sk_inet.InetSkEntry{}, nil case "INOTIFY_FILE": - return &InotifyFileEntry{}, nil + return &fsnotify.InotifyFileEntry{}, nil case "INOTIFY_WD": - return &InotifyWdEntry{}, nil + return &fsnotify.InotifyWdEntry{}, nil case "INVENTORY": - return &InventoryEntry{}, nil + return &inventory.InventoryEntry{}, nil case "IPCNS_MSG": - return &IpcMsgEntry{}, nil + return &ipc_msg.IpcMsgEntry{}, nil case "IPCNS_SEM": - return &IpcSemEntry{}, nil + return &ipc_sem.IpcSemEntry{}, nil case "IPCNS_SHM": - return &IpcShmEntry{}, nil + return &ipc_shm.IpcShmEntry{}, nil case "IPC_VAR": - return &IpcVarEntry{}, nil + return &ipc_var.IpcVarEntry{}, nil case "IRMAP_CACHE": - return &IrmapCacheEntry{}, nil + return &fh.IrmapCacheEntry{}, nil case "ITIMERS": - return &ItimerEntry{}, nil + return &timer.ItimerEntry{}, nil case "MEMFD_INODE": - return &MemfdInodeEntry{}, nil + return &memfd.MemfdInodeEntry{}, nil case "MM": - return &MmEntry{}, nil + return &mm.MmEntry{}, nil case "MNTS": - return &MntEntry{}, nil + return &mnt.MntEntry{}, nil case "NETDEV": - return &NetDeviceEntry{}, nil + return &netdev.NetDeviceEntry{}, nil case "NETLINK_SK": - return &NetlinkSkEntry{}, nil + return &sk_netlink.NetlinkSkEntry{}, nil case "NETNS": - return &NetnsEntry{}, nil + return &netdev.NetnsEntry{}, nil case "NS_FILES": - return &NsFileEntry{}, nil + return &ns.NsFileEntry{}, nil case "PACKETSK": - return &PacketSockEntry{}, nil + return &packet_sock.PacketSockEntry{}, nil case "PIDNS": - return &PidnsEntry{}, nil + return &pidns.PidnsEntry{}, nil case "PIPES": - return &PipeEntry{}, nil + return &pipe.PipeEntry{}, nil case "PIPES_DATA": - return &PipeDataEntry{}, nil + return &pipe_data.PipeDataEntry{}, nil case "POSIX_TIMERS": - return &PosixTimerEntry{}, nil + return &timer.PosixTimerEntry{}, nil case "PSTREE": - return &PstreeEntry{}, nil + return &pstree.PstreeEntry{}, nil case "REG_FILES": - return &RegFileEntry{}, nil + return ®file.RegFileEntry{}, nil case "REMAP_FPATH": - return &RemapFilePathEntry{}, nil + return &remap_file_path.RemapFilePathEntry{}, nil case "RLIMIT": - return &RlimitEntry{}, nil + return &rlimit.RlimitEntry{}, nil case "SECCOMP": - return &SeccompEntry{}, nil + return &seccomp.SeccompEntry{}, nil case "SIGACT": - return &SaEntry{}, nil + return &criu_sa.SaEntry{}, nil case "SIGNALFD": - return &SignalfdEntry{}, nil + return &signalfd.SignalfdEntry{}, nil case "SK_QUEUES": - return &SkPacketEntry{}, nil + return &sk_packet.SkPacketEntry{}, nil case "STATS": - return &StatsEntry{}, nil + return &stats.StatsEntry{}, nil case "TCP_STREAM": - return &TcpStreamEntry{}, nil + return &tcp_stream.TcpStreamEntry{}, nil case "TIMENS": - return &TimensEntry{}, nil + return &timens.TimensEntry{}, nil case "TIMERFD": - return &TimerfdEntry{}, nil + return &timerfd.TimerfdEntry{}, nil case "TTY_DATA": - return &TtyDataEntry{}, nil + return &tty.TtyDataEntry{}, nil case "TTY_FILES": - return &TtyFileEntry{}, nil + return &tty.TtyFileEntry{}, nil case "TTY_INFO": - return &TtyInfoEntry{}, nil + return &tty.TtyInfoEntry{}, nil case "TUNFILE": - return &TunfileEntry{}, nil + return &tun.TunfileEntry{}, nil case "UNIXSK": - return &UnixSkEntry{}, nil + return &sk_unix.UnixSkEntry{}, nil case "USERNS": - return &UsernsEntry{}, nil + return &userns.UsernsEntry{}, nil case "UTSNS": - return &UtsnsEntry{}, nil + return &utsns.UtsnsEntry{}, nil case "VMAS": - return &VmaEntry{}, nil + return &vma.VmaEntry{}, nil } return nil, fmt.Errorf("no handler found for magic 0x%x", magic) } diff --git a/crit/images/img-streamer.pb.go b/crit/images/img-streamer/img-streamer.pb.go similarity index 98% rename from crit/images/img-streamer.pb.go rename to crit/images/img-streamer/img-streamer.pb.go index 8f94a1b5c..70f789682 100644 --- a/crit/images/img-streamer.pb.go +++ b/crit/images/img-streamer/img-streamer.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: img-streamer.proto -package images +package img_streamer import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/inventory.pb.go b/crit/images/inventory/inventory.pb.go similarity index 83% rename from crit/images/inventory.pb.go rename to crit/images/inventory/inventory.pb.go index 872e6d3bf..e9e854b32 100644 --- a/crit/images/inventory.pb.go +++ b/crit/images/inventory/inventory.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: inventory.proto -package images +package inventory import ( + criu_core "github.com/checkpoint-restore/go-criu/v6/crit/images/criu-core" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -86,16 +87,16 @@ type InventoryEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - ImgVersion *uint32 `protobuf:"varint,1,req,name=img_version,json=imgVersion" json:"img_version,omitempty"` - FdinfoPerId *bool `protobuf:"varint,2,opt,name=fdinfo_per_id,json=fdinfoPerId" json:"fdinfo_per_id,omitempty"` - RootIds *TaskKobjIdsEntry `protobuf:"bytes,3,opt,name=root_ids,json=rootIds" json:"root_ids,omitempty"` - NsPerId *bool `protobuf:"varint,4,opt,name=ns_per_id,json=nsPerId" json:"ns_per_id,omitempty"` - RootCgSet *uint32 `protobuf:"varint,5,opt,name=root_cg_set,json=rootCgSet" json:"root_cg_set,omitempty"` - Lsmtype *Lsmtype `protobuf:"varint,6,opt,name=lsmtype,enum=Lsmtype" json:"lsmtype,omitempty"` - DumpUptime *uint64 `protobuf:"varint,8,opt,name=dump_uptime,json=dumpUptime" json:"dump_uptime,omitempty"` - PreDumpMode *uint32 `protobuf:"varint,9,opt,name=pre_dump_mode,json=preDumpMode" json:"pre_dump_mode,omitempty"` - TcpClose *bool `protobuf:"varint,10,opt,name=tcp_close,json=tcpClose" json:"tcp_close,omitempty"` - NetworkLockMethod *uint32 `protobuf:"varint,11,opt,name=network_lock_method,json=networkLockMethod" json:"network_lock_method,omitempty"` + ImgVersion *uint32 `protobuf:"varint,1,req,name=img_version,json=imgVersion" json:"img_version,omitempty"` + FdinfoPerId *bool `protobuf:"varint,2,opt,name=fdinfo_per_id,json=fdinfoPerId" json:"fdinfo_per_id,omitempty"` + RootIds *criu_core.TaskKobjIdsEntry `protobuf:"bytes,3,opt,name=root_ids,json=rootIds" json:"root_ids,omitempty"` + NsPerId *bool `protobuf:"varint,4,opt,name=ns_per_id,json=nsPerId" json:"ns_per_id,omitempty"` + RootCgSet *uint32 `protobuf:"varint,5,opt,name=root_cg_set,json=rootCgSet" json:"root_cg_set,omitempty"` + Lsmtype *Lsmtype `protobuf:"varint,6,opt,name=lsmtype,enum=Lsmtype" json:"lsmtype,omitempty"` + DumpUptime *uint64 `protobuf:"varint,8,opt,name=dump_uptime,json=dumpUptime" json:"dump_uptime,omitempty"` + PreDumpMode *uint32 `protobuf:"varint,9,opt,name=pre_dump_mode,json=preDumpMode" json:"pre_dump_mode,omitempty"` + TcpClose *bool `protobuf:"varint,10,opt,name=tcp_close,json=tcpClose" json:"tcp_close,omitempty"` + NetworkLockMethod *uint32 `protobuf:"varint,11,opt,name=network_lock_method,json=networkLockMethod" json:"network_lock_method,omitempty"` } func (x *InventoryEntry) Reset() { @@ -144,7 +145,7 @@ func (x *InventoryEntry) GetFdinfoPerId() bool { return false } -func (x *InventoryEntry) GetRootIds() *TaskKobjIdsEntry { +func (x *InventoryEntry) GetRootIds() *criu_core.TaskKobjIdsEntry { if x != nil { return x.RootIds } @@ -249,9 +250,9 @@ func file_inventory_proto_rawDescGZIP() []byte { var file_inventory_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_inventory_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_inventory_proto_goTypes = []interface{}{ - (Lsmtype)(0), // 0: lsmtype - (*InventoryEntry)(nil), // 1: inventory_entry - (*TaskKobjIdsEntry)(nil), // 2: task_kobj_ids_entry + (Lsmtype)(0), // 0: lsmtype + (*InventoryEntry)(nil), // 1: inventory_entry + (*criu_core.TaskKobjIdsEntry)(nil), // 2: task_kobj_ids_entry } var file_inventory_proto_depIdxs = []int32{ 2, // 0: inventory_entry.root_ids:type_name -> task_kobj_ids_entry @@ -268,7 +269,6 @@ func file_inventory_proto_init() { if File_inventory_proto != nil { return } - file_criu_core_proto_init() if !protoimpl.UnsafeEnabled { file_inventory_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*InventoryEntry); i { diff --git a/crit/images/ipc-desc.pb.go b/crit/images/ipc-desc/ipc-desc.pb.go similarity index 98% rename from crit/images/ipc-desc.pb.go rename to crit/images/ipc-desc/ipc-desc.pb.go index 9a8a2733d..af5fd8de5 100644 --- a/crit/images/ipc-desc.pb.go +++ b/crit/images/ipc-desc/ipc-desc.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ipc-desc.proto -package images +package ipc_desc import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/ipc-msg.pb.go b/crit/images/ipc-msg/ipc-msg.pb.go similarity index 91% rename from crit/images/ipc-msg.pb.go rename to crit/images/ipc-msg/ipc-msg.pb.go index d20331e55..6e66bb8b9 100644 --- a/crit/images/ipc-msg.pb.go +++ b/crit/images/ipc-msg/ipc-msg.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ipc-msg.proto -package images +package ipc_msg import ( + ipc_desc "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-desc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -82,9 +83,9 @@ type IpcMsgEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Desc *IpcDescEntry `protobuf:"bytes,1,req,name=desc" json:"desc,omitempty"` - Qbytes *uint32 `protobuf:"varint,2,req,name=qbytes" json:"qbytes,omitempty"` - Qnum *uint32 `protobuf:"varint,3,req,name=qnum" json:"qnum,omitempty"` + Desc *ipc_desc.IpcDescEntry `protobuf:"bytes,1,req,name=desc" json:"desc,omitempty"` + Qbytes *uint32 `protobuf:"varint,2,req,name=qbytes" json:"qbytes,omitempty"` + Qnum *uint32 `protobuf:"varint,3,req,name=qnum" json:"qnum,omitempty"` } func (x *IpcMsgEntry) Reset() { @@ -119,7 +120,7 @@ func (*IpcMsgEntry) Descriptor() ([]byte, []int) { return file_ipc_msg_proto_rawDescGZIP(), []int{1} } -func (x *IpcMsgEntry) GetDesc() *IpcDescEntry { +func (x *IpcMsgEntry) GetDesc() *ipc_desc.IpcDescEntry { if x != nil { return x.Desc } @@ -171,9 +172,9 @@ func file_ipc_msg_proto_rawDescGZIP() []byte { var file_ipc_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_ipc_msg_proto_goTypes = []interface{}{ - (*IpcMsg)(nil), // 0: ipc_msg - (*IpcMsgEntry)(nil), // 1: ipc_msg_entry - (*IpcDescEntry)(nil), // 2: ipc_desc_entry + (*IpcMsg)(nil), // 0: ipc_msg + (*IpcMsgEntry)(nil), // 1: ipc_msg_entry + (*ipc_desc.IpcDescEntry)(nil), // 2: ipc_desc_entry } var file_ipc_msg_proto_depIdxs = []int32{ 2, // 0: ipc_msg_entry.desc:type_name -> ipc_desc_entry @@ -189,7 +190,6 @@ func file_ipc_msg_proto_init() { if File_ipc_msg_proto != nil { return } - file_ipc_desc_proto_init() if !protoimpl.UnsafeEnabled { file_ipc_msg_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IpcMsg); i { diff --git a/crit/images/ipc-sem.pb.go b/crit/images/ipc-sem/ipc-sem.pb.go similarity index 89% rename from crit/images/ipc-sem.pb.go rename to crit/images/ipc-sem/ipc-sem.pb.go index a4b2be84c..3eff3b751 100644 --- a/crit/images/ipc-sem.pb.go +++ b/crit/images/ipc-sem/ipc-sem.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ipc-sem.proto -package images +package ipc_sem import ( + ipc_desc "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-desc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,8 +28,8 @@ type IpcSemEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Desc *IpcDescEntry `protobuf:"bytes,1,req,name=desc" json:"desc,omitempty"` - Nsems *uint32 `protobuf:"varint,2,req,name=nsems" json:"nsems,omitempty"` + Desc *ipc_desc.IpcDescEntry `protobuf:"bytes,1,req,name=desc" json:"desc,omitempty"` + Nsems *uint32 `protobuf:"varint,2,req,name=nsems" json:"nsems,omitempty"` } func (x *IpcSemEntry) Reset() { @@ -63,7 +64,7 @@ func (*IpcSemEntry) Descriptor() ([]byte, []int) { return file_ipc_sem_proto_rawDescGZIP(), []int{0} } -func (x *IpcSemEntry) GetDesc() *IpcDescEntry { +func (x *IpcSemEntry) GetDesc() *ipc_desc.IpcDescEntry { if x != nil { return x.Desc } @@ -103,8 +104,8 @@ func file_ipc_sem_proto_rawDescGZIP() []byte { var file_ipc_sem_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_ipc_sem_proto_goTypes = []interface{}{ - (*IpcSemEntry)(nil), // 0: ipc_sem_entry - (*IpcDescEntry)(nil), // 1: ipc_desc_entry + (*IpcSemEntry)(nil), // 0: ipc_sem_entry + (*ipc_desc.IpcDescEntry)(nil), // 1: ipc_desc_entry } var file_ipc_sem_proto_depIdxs = []int32{ 1, // 0: ipc_sem_entry.desc:type_name -> ipc_desc_entry @@ -120,7 +121,6 @@ func file_ipc_sem_proto_init() { if File_ipc_sem_proto != nil { return } - file_ipc_desc_proto_init() if !protoimpl.UnsafeEnabled { file_ipc_sem_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IpcSemEntry); i { diff --git a/crit/images/ipc-shm.pb.go b/crit/images/ipc-shm/ipc-shm.pb.go similarity index 86% rename from crit/images/ipc-shm.pb.go rename to crit/images/ipc-shm/ipc-shm.pb.go index 8dd089cfa..39bf90408 100644 --- a/crit/images/ipc-shm.pb.go +++ b/crit/images/ipc-shm/ipc-shm.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ipc-shm.proto -package images +package ipc_shm import ( + ipc_desc "github.com/checkpoint-restore/go-criu/v6/crit/images/ipc-desc" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +28,10 @@ type IpcShmEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Desc *IpcDescEntry `protobuf:"bytes,1,req,name=desc" json:"desc,omitempty"` - Size *uint64 `protobuf:"varint,2,req,name=size" json:"size,omitempty"` - InPagemaps *bool `protobuf:"varint,3,opt,name=in_pagemaps,json=inPagemaps" json:"in_pagemaps,omitempty"` - HugetlbFlag *uint32 `protobuf:"varint,4,opt,name=hugetlb_flag,json=hugetlbFlag" json:"hugetlb_flag,omitempty"` + Desc *ipc_desc.IpcDescEntry `protobuf:"bytes,1,req,name=desc" json:"desc,omitempty"` + Size *uint64 `protobuf:"varint,2,req,name=size" json:"size,omitempty"` + InPagemaps *bool `protobuf:"varint,3,opt,name=in_pagemaps,json=inPagemaps" json:"in_pagemaps,omitempty"` + HugetlbFlag *uint32 `protobuf:"varint,4,opt,name=hugetlb_flag,json=hugetlbFlag" json:"hugetlb_flag,omitempty"` } func (x *IpcShmEntry) Reset() { @@ -65,7 +66,7 @@ func (*IpcShmEntry) Descriptor() ([]byte, []int) { return file_ipc_shm_proto_rawDescGZIP(), []int{0} } -func (x *IpcShmEntry) GetDesc() *IpcDescEntry { +func (x *IpcShmEntry) GetDesc() *ipc_desc.IpcDescEntry { if x != nil { return x.Desc } @@ -123,8 +124,8 @@ func file_ipc_shm_proto_rawDescGZIP() []byte { var file_ipc_shm_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_ipc_shm_proto_goTypes = []interface{}{ - (*IpcShmEntry)(nil), // 0: ipc_shm_entry - (*IpcDescEntry)(nil), // 1: ipc_desc_entry + (*IpcShmEntry)(nil), // 0: ipc_shm_entry + (*ipc_desc.IpcDescEntry)(nil), // 1: ipc_desc_entry } var file_ipc_shm_proto_depIdxs = []int32{ 1, // 0: ipc_shm_entry.desc:type_name -> ipc_desc_entry @@ -140,7 +141,6 @@ func file_ipc_shm_proto_init() { if File_ipc_shm_proto != nil { return } - file_ipc_desc_proto_init() if !protoimpl.UnsafeEnabled { file_ipc_shm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IpcShmEntry); i { diff --git a/crit/images/ipc-var.pb.go b/crit/images/ipc-var/ipc-var.pb.go similarity index 99% rename from crit/images/ipc-var.pb.go rename to crit/images/ipc-var/ipc-var.pb.go index cba7310c3..30a785523 100644 --- a/crit/images/ipc-var.pb.go +++ b/crit/images/ipc-var/ipc-var.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ipc-var.proto -package images +package ipc_var import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/macvlan.pb.go b/crit/images/macvlan/macvlan.pb.go similarity index 98% rename from crit/images/macvlan.pb.go rename to crit/images/macvlan/macvlan.pb.go index abab1c181..6cfa4bc5f 100644 --- a/crit/images/macvlan.pb.go +++ b/crit/images/macvlan/macvlan.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: macvlan.proto -package images +package macvlan import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/memfd.pb.go b/crit/images/memfd/memfd.pb.go similarity index 92% rename from crit/images/memfd.pb.go rename to crit/images/memfd/memfd.pb.go index 23005e95d..3765068fd 100644 --- a/crit/images/memfd.pb.go +++ b/crit/images/memfd/memfd.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: memfd.proto -package images +package memfd import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,11 +29,11 @@ type MemfdFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Pos *uint64 `protobuf:"varint,3,req,name=pos" json:"pos,omitempty"` - Fown *FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` - InodeId *uint32 `protobuf:"varint,5,req,name=inode_id,json=inodeId" json:"inode_id,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` + Pos *uint64 `protobuf:"varint,3,req,name=pos" json:"pos,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` + InodeId *uint32 `protobuf:"varint,5,req,name=inode_id,json=inodeId" json:"inode_id,omitempty"` } func (x *MemfdFileEntry) Reset() { @@ -87,7 +89,7 @@ func (x *MemfdFileEntry) GetPos() uint64 { return 0 } -func (x *MemfdFileEntry) GetFown() *FownEntry { +func (x *MemfdFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -251,7 +253,7 @@ var file_memfd_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_memfd_proto_goTypes = []interface{}{ (*MemfdFileEntry)(nil), // 0: memfd_file_entry (*MemfdInodeEntry)(nil), // 1: memfd_inode_entry - (*FownEntry)(nil), // 2: fown_entry + (*fown.FownEntry)(nil), // 2: fown_entry } var file_memfd_proto_depIdxs = []int32{ 2, // 0: memfd_file_entry.fown:type_name -> fown_entry @@ -267,8 +269,6 @@ func file_memfd_proto_init() { if File_memfd_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_memfd_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MemfdFileEntry); i { diff --git a/crit/images/mm.pb.go b/crit/images/mm/mm.pb.go similarity index 97% rename from crit/images/mm.pb.go rename to crit/images/mm/mm.pb.go index c76b33bf4..c5b286c82 100644 --- a/crit/images/mm.pb.go +++ b/crit/images/mm/mm.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: mm.proto -package images +package mm import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + vma "github.com/checkpoint-restore/go-criu/v6/crit/images/vma" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -103,7 +105,7 @@ type MmEntry struct { MmEnvEnd *uint64 `protobuf:"varint,11,req,name=mm_env_end,json=mmEnvEnd" json:"mm_env_end,omitempty"` ExeFileId *uint32 `protobuf:"varint,12,req,name=exe_file_id,json=exeFileId" json:"exe_file_id,omitempty"` MmSavedAuxv []uint64 `protobuf:"varint,13,rep,name=mm_saved_auxv,json=mmSavedAuxv" json:"mm_saved_auxv,omitempty"` - Vmas []*VmaEntry `protobuf:"bytes,14,rep,name=vmas" json:"vmas,omitempty"` + Vmas []*vma.VmaEntry `protobuf:"bytes,14,rep,name=vmas" json:"vmas,omitempty"` Dumpable *int32 `protobuf:"varint,15,opt,name=dumpable" json:"dumpable,omitempty"` Aios []*AioRingEntry `protobuf:"bytes,16,rep,name=aios" json:"aios,omitempty"` ThpDisabled *bool `protobuf:"varint,17,opt,name=thp_disabled,json=thpDisabled" json:"thp_disabled,omitempty"` @@ -232,7 +234,7 @@ func (x *MmEntry) GetMmSavedAuxv() []uint64 { return nil } -func (x *MmEntry) GetVmas() []*VmaEntry { +func (x *MmEntry) GetVmas() []*vma.VmaEntry { if x != nil { return x.Vmas } @@ -329,7 +331,7 @@ var file_mm_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_mm_proto_goTypes = []interface{}{ (*AioRingEntry)(nil), // 0: aio_ring_entry (*MmEntry)(nil), // 1: mm_entry - (*VmaEntry)(nil), // 2: vma_entry + (*vma.VmaEntry)(nil), // 2: vma_entry } var file_mm_proto_depIdxs = []int32{ 2, // 0: mm_entry.vmas:type_name -> vma_entry @@ -346,8 +348,6 @@ func file_mm_proto_init() { if File_mm_proto != nil { return } - file_opts_proto_init() - file_vma_proto_init() if !protoimpl.UnsafeEnabled { file_mm_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*AioRingEntry); i { diff --git a/crit/images/mnt.pb.go b/crit/images/mnt/mnt.pb.go similarity index 99% rename from crit/images/mnt.pb.go rename to crit/images/mnt/mnt.pb.go index 3c0a385db..99fc6d9f1 100644 --- a/crit/images/mnt.pb.go +++ b/crit/images/mnt/mnt.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: mnt.proto -package images +package mnt import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -407,7 +408,6 @@ func file_mnt_proto_init() { if File_mnt_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_mnt_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*MntEntry); i { diff --git a/crit/images/netdev.pb.go b/crit/images/netdev/netdev.pb.go similarity index 81% rename from crit/images/netdev.pb.go rename to crit/images/netdev/netdev.pb.go index bcceee853..35c69219f 100644 --- a/crit/images/netdev.pb.go +++ b/crit/images/netdev/netdev.pb.go @@ -2,13 +2,18 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: netdev.proto -package images +package netdev import ( + macvlan "github.com/checkpoint-restore/go-criu/v6/crit/images/macvlan" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + sit "github.com/checkpoint-restore/go-criu/v6/crit/images/sit" + sysctl "github.com/checkpoint-restore/go-criu/v6/crit/images/sysctl" + tun "github.com/checkpoint-restore/go-criu/v6/crit/images/tun" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -105,21 +110,21 @@ type NetDeviceEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Type *NdType `protobuf:"varint,1,req,name=type,enum=NdType" json:"type,omitempty"` - Ifindex *uint32 `protobuf:"varint,2,req,name=ifindex" json:"ifindex,omitempty"` - Mtu *uint32 `protobuf:"varint,3,req,name=mtu" json:"mtu,omitempty"` - Flags *uint32 `protobuf:"varint,4,req,name=flags" json:"flags,omitempty"` - Name *string `protobuf:"bytes,5,req,name=name" json:"name,omitempty"` - Tun *TunLinkEntry `protobuf:"bytes,6,opt,name=tun" json:"tun,omitempty"` - Address []byte `protobuf:"bytes,7,opt,name=address" json:"address,omitempty"` - Conf []int32 `protobuf:"varint,8,rep,name=conf" json:"conf,omitempty"` - Conf4 []*SysctlEntry `protobuf:"bytes,9,rep,name=conf4" json:"conf4,omitempty"` - Conf6 []*SysctlEntry `protobuf:"bytes,10,rep,name=conf6" json:"conf6,omitempty"` - Macvlan *MacvlanLinkEntry `protobuf:"bytes,11,opt,name=macvlan" json:"macvlan,omitempty"` - PeerIfindex *uint32 `protobuf:"varint,12,opt,name=peer_ifindex,json=peerIfindex" json:"peer_ifindex,omitempty"` - PeerNsid *uint32 `protobuf:"varint,13,opt,name=peer_nsid,json=peerNsid" json:"peer_nsid,omitempty"` - Master *uint32 `protobuf:"varint,14,opt,name=master" json:"master,omitempty"` - Sit *SitEntry `protobuf:"bytes,15,opt,name=sit" json:"sit,omitempty"` + Type *NdType `protobuf:"varint,1,req,name=type,enum=NdType" json:"type,omitempty"` + Ifindex *uint32 `protobuf:"varint,2,req,name=ifindex" json:"ifindex,omitempty"` + Mtu *uint32 `protobuf:"varint,3,req,name=mtu" json:"mtu,omitempty"` + Flags *uint32 `protobuf:"varint,4,req,name=flags" json:"flags,omitempty"` + Name *string `protobuf:"bytes,5,req,name=name" json:"name,omitempty"` + Tun *tun.TunLinkEntry `protobuf:"bytes,6,opt,name=tun" json:"tun,omitempty"` + Address []byte `protobuf:"bytes,7,opt,name=address" json:"address,omitempty"` + Conf []int32 `protobuf:"varint,8,rep,name=conf" json:"conf,omitempty"` + Conf4 []*sysctl.SysctlEntry `protobuf:"bytes,9,rep,name=conf4" json:"conf4,omitempty"` + Conf6 []*sysctl.SysctlEntry `protobuf:"bytes,10,rep,name=conf6" json:"conf6,omitempty"` + Macvlan *macvlan.MacvlanLinkEntry `protobuf:"bytes,11,opt,name=macvlan" json:"macvlan,omitempty"` + PeerIfindex *uint32 `protobuf:"varint,12,opt,name=peer_ifindex,json=peerIfindex" json:"peer_ifindex,omitempty"` + PeerNsid *uint32 `protobuf:"varint,13,opt,name=peer_nsid,json=peerNsid" json:"peer_nsid,omitempty"` + Master *uint32 `protobuf:"varint,14,opt,name=master" json:"master,omitempty"` + Sit *sit.SitEntry `protobuf:"bytes,15,opt,name=sit" json:"sit,omitempty"` } func (x *NetDeviceEntry) Reset() { @@ -189,7 +194,7 @@ func (x *NetDeviceEntry) GetName() string { return "" } -func (x *NetDeviceEntry) GetTun() *TunLinkEntry { +func (x *NetDeviceEntry) GetTun() *tun.TunLinkEntry { if x != nil { return x.Tun } @@ -210,21 +215,21 @@ func (x *NetDeviceEntry) GetConf() []int32 { return nil } -func (x *NetDeviceEntry) GetConf4() []*SysctlEntry { +func (x *NetDeviceEntry) GetConf4() []*sysctl.SysctlEntry { if x != nil { return x.Conf4 } return nil } -func (x *NetDeviceEntry) GetConf6() []*SysctlEntry { +func (x *NetDeviceEntry) GetConf6() []*sysctl.SysctlEntry { if x != nil { return x.Conf6 } return nil } -func (x *NetDeviceEntry) GetMacvlan() *MacvlanLinkEntry { +func (x *NetDeviceEntry) GetMacvlan() *macvlan.MacvlanLinkEntry { if x != nil { return x.Macvlan } @@ -252,7 +257,7 @@ func (x *NetDeviceEntry) GetMaster() uint32 { return 0 } -func (x *NetDeviceEntry) GetSit() *SitEntry { +func (x *NetDeviceEntry) GetSit() *sit.SitEntry { if x != nil { return x.Sit } @@ -323,15 +328,15 @@ type NetnsEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - DefConf []int32 `protobuf:"varint,1,rep,name=def_conf,json=defConf" json:"def_conf,omitempty"` - AllConf []int32 `protobuf:"varint,2,rep,name=all_conf,json=allConf" json:"all_conf,omitempty"` - DefConf4 []*SysctlEntry `protobuf:"bytes,3,rep,name=def_conf4,json=defConf4" json:"def_conf4,omitempty"` - AllConf4 []*SysctlEntry `protobuf:"bytes,4,rep,name=all_conf4,json=allConf4" json:"all_conf4,omitempty"` - DefConf6 []*SysctlEntry `protobuf:"bytes,5,rep,name=def_conf6,json=defConf6" json:"def_conf6,omitempty"` - AllConf6 []*SysctlEntry `protobuf:"bytes,6,rep,name=all_conf6,json=allConf6" json:"all_conf6,omitempty"` - Nsids []*NetnsId `protobuf:"bytes,7,rep,name=nsids" json:"nsids,omitempty"` - ExtKey *string `protobuf:"bytes,8,opt,name=ext_key,json=extKey" json:"ext_key,omitempty"` - UnixConf []*SysctlEntry `protobuf:"bytes,9,rep,name=unix_conf,json=unixConf" json:"unix_conf,omitempty"` + DefConf []int32 `protobuf:"varint,1,rep,name=def_conf,json=defConf" json:"def_conf,omitempty"` + AllConf []int32 `protobuf:"varint,2,rep,name=all_conf,json=allConf" json:"all_conf,omitempty"` + DefConf4 []*sysctl.SysctlEntry `protobuf:"bytes,3,rep,name=def_conf4,json=defConf4" json:"def_conf4,omitempty"` + AllConf4 []*sysctl.SysctlEntry `protobuf:"bytes,4,rep,name=all_conf4,json=allConf4" json:"all_conf4,omitempty"` + DefConf6 []*sysctl.SysctlEntry `protobuf:"bytes,5,rep,name=def_conf6,json=defConf6" json:"def_conf6,omitempty"` + AllConf6 []*sysctl.SysctlEntry `protobuf:"bytes,6,rep,name=all_conf6,json=allConf6" json:"all_conf6,omitempty"` + Nsids []*NetnsId `protobuf:"bytes,7,rep,name=nsids" json:"nsids,omitempty"` + ExtKey *string `protobuf:"bytes,8,opt,name=ext_key,json=extKey" json:"ext_key,omitempty"` + UnixConf []*sysctl.SysctlEntry `protobuf:"bytes,9,rep,name=unix_conf,json=unixConf" json:"unix_conf,omitempty"` } func (x *NetnsEntry) Reset() { @@ -380,28 +385,28 @@ func (x *NetnsEntry) GetAllConf() []int32 { return nil } -func (x *NetnsEntry) GetDefConf4() []*SysctlEntry { +func (x *NetnsEntry) GetDefConf4() []*sysctl.SysctlEntry { if x != nil { return x.DefConf4 } return nil } -func (x *NetnsEntry) GetAllConf4() []*SysctlEntry { +func (x *NetnsEntry) GetAllConf4() []*sysctl.SysctlEntry { if x != nil { return x.AllConf4 } return nil } -func (x *NetnsEntry) GetDefConf6() []*SysctlEntry { +func (x *NetnsEntry) GetDefConf6() []*sysctl.SysctlEntry { if x != nil { return x.DefConf6 } return nil } -func (x *NetnsEntry) GetAllConf6() []*SysctlEntry { +func (x *NetnsEntry) GetAllConf6() []*sysctl.SysctlEntry { if x != nil { return x.AllConf6 } @@ -422,7 +427,7 @@ func (x *NetnsEntry) GetExtKey() string { return "" } -func (x *NetnsEntry) GetUnixConf() []*SysctlEntry { +func (x *NetnsEntry) GetUnixConf() []*sysctl.SysctlEntry { if x != nil { return x.UnixConf } @@ -517,14 +522,14 @@ func file_netdev_proto_rawDescGZIP() []byte { var file_netdev_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_netdev_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_netdev_proto_goTypes = []interface{}{ - (NdType)(0), // 0: nd_type - (*NetDeviceEntry)(nil), // 1: net_device_entry - (*NetnsId)(nil), // 2: netns_id - (*NetnsEntry)(nil), // 3: netns_entry - (*TunLinkEntry)(nil), // 4: tun_link_entry - (*SysctlEntry)(nil), // 5: sysctl_entry - (*MacvlanLinkEntry)(nil), // 6: macvlan_link_entry - (*SitEntry)(nil), // 7: sit_entry + (NdType)(0), // 0: nd_type + (*NetDeviceEntry)(nil), // 1: net_device_entry + (*NetnsId)(nil), // 2: netns_id + (*NetnsEntry)(nil), // 3: netns_entry + (*tun.TunLinkEntry)(nil), // 4: tun_link_entry + (*sysctl.SysctlEntry)(nil), // 5: sysctl_entry + (*macvlan.MacvlanLinkEntry)(nil), // 6: macvlan_link_entry + (*sit.SitEntry)(nil), // 7: sit_entry } var file_netdev_proto_depIdxs = []int32{ 0, // 0: net_device_entry.type:type_name -> nd_type @@ -551,11 +556,6 @@ func file_netdev_proto_init() { if File_netdev_proto != nil { return } - file_macvlan_proto_init() - file_opts_proto_init() - file_tun_proto_init() - file_sysctl_proto_init() - file_sit_proto_init() if !protoimpl.UnsafeEnabled { file_netdev_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetDeviceEntry); i { diff --git a/crit/images/ns.pb.go b/crit/images/ns/ns.pb.go similarity index 98% rename from crit/images/ns.pb.go rename to crit/images/ns/ns.pb.go index 361308164..f30addde5 100644 --- a/crit/images/ns.pb.go +++ b/crit/images/ns/ns.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: ns.proto -package images +package ns import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/opts.pb.go b/crit/images/opts/opts.pb.go similarity index 99% rename from crit/images/opts.pb.go rename to crit/images/opts/opts.pb.go index 6c4d4be8a..47f35b3f7 100644 --- a/crit/images/opts.pb.go +++ b/crit/images/opts/opts.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: opts.proto -package images +package opts import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/packet-sock.pb.go b/crit/images/packet-sock/packet-sock.pb.go similarity index 86% rename from crit/images/packet-sock.pb.go rename to crit/images/packet-sock/packet-sock.pb.go index c4b9d7475..f9307fe46 100644 --- a/crit/images/packet-sock.pb.go +++ b/crit/images/packet-sock/packet-sock.pb.go @@ -2,13 +2,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: packet-sock.proto -package images +package packet_sock import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + sk_opts "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -185,26 +188,26 @@ type PacketSockEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Type *uint32 `protobuf:"varint,2,req,name=type" json:"type,omitempty"` - Protocol *uint32 `protobuf:"varint,3,req,name=protocol" json:"protocol,omitempty"` - Flags *uint32 `protobuf:"varint,4,req,name=flags" json:"flags,omitempty"` - Ifindex *uint32 `protobuf:"varint,5,req,name=ifindex" json:"ifindex,omitempty"` - Fown *FownEntry `protobuf:"bytes,6,req,name=fown" json:"fown,omitempty"` - Opts *SkOptsEntry `protobuf:"bytes,7,req,name=opts" json:"opts,omitempty"` - Version *uint32 `protobuf:"varint,8,req,name=version" json:"version,omitempty"` - Reserve *uint32 `protobuf:"varint,9,req,name=reserve" json:"reserve,omitempty"` - AuxData *bool `protobuf:"varint,10,req,name=aux_data,json=auxData" json:"aux_data,omitempty"` - OrigDev *bool `protobuf:"varint,11,req,name=orig_dev,json=origDev" json:"orig_dev,omitempty"` - VnetHdr *bool `protobuf:"varint,12,req,name=vnet_hdr,json=vnetHdr" json:"vnet_hdr,omitempty"` - Loss *bool `protobuf:"varint,13,req,name=loss" json:"loss,omitempty"` - Timestamp *uint32 `protobuf:"varint,14,req,name=timestamp" json:"timestamp,omitempty"` - CopyThresh *uint32 `protobuf:"varint,15,req,name=copy_thresh,json=copyThresh" json:"copy_thresh,omitempty"` - Mclist []*PacketMclist `protobuf:"bytes,16,rep,name=mclist" json:"mclist,omitempty"` - Fanout *uint32 `protobuf:"varint,17,opt,name=fanout,def=4294967295" json:"fanout,omitempty"` - RxRing *PacketRing `protobuf:"bytes,18,opt,name=rx_ring,json=rxRing" json:"rx_ring,omitempty"` - TxRing *PacketRing `protobuf:"bytes,19,opt,name=tx_ring,json=txRing" json:"tx_ring,omitempty"` - NsId *uint32 `protobuf:"varint,20,opt,name=ns_id,json=nsId" json:"ns_id,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Type *uint32 `protobuf:"varint,2,req,name=type" json:"type,omitempty"` + Protocol *uint32 `protobuf:"varint,3,req,name=protocol" json:"protocol,omitempty"` + Flags *uint32 `protobuf:"varint,4,req,name=flags" json:"flags,omitempty"` + Ifindex *uint32 `protobuf:"varint,5,req,name=ifindex" json:"ifindex,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,6,req,name=fown" json:"fown,omitempty"` + Opts *sk_opts.SkOptsEntry `protobuf:"bytes,7,req,name=opts" json:"opts,omitempty"` + Version *uint32 `protobuf:"varint,8,req,name=version" json:"version,omitempty"` + Reserve *uint32 `protobuf:"varint,9,req,name=reserve" json:"reserve,omitempty"` + AuxData *bool `protobuf:"varint,10,req,name=aux_data,json=auxData" json:"aux_data,omitempty"` + OrigDev *bool `protobuf:"varint,11,req,name=orig_dev,json=origDev" json:"orig_dev,omitempty"` + VnetHdr *bool `protobuf:"varint,12,req,name=vnet_hdr,json=vnetHdr" json:"vnet_hdr,omitempty"` + Loss *bool `protobuf:"varint,13,req,name=loss" json:"loss,omitempty"` + Timestamp *uint32 `protobuf:"varint,14,req,name=timestamp" json:"timestamp,omitempty"` + CopyThresh *uint32 `protobuf:"varint,15,req,name=copy_thresh,json=copyThresh" json:"copy_thresh,omitempty"` + Mclist []*PacketMclist `protobuf:"bytes,16,rep,name=mclist" json:"mclist,omitempty"` + Fanout *uint32 `protobuf:"varint,17,opt,name=fanout,def=4294967295" json:"fanout,omitempty"` + RxRing *PacketRing `protobuf:"bytes,18,opt,name=rx_ring,json=rxRing" json:"rx_ring,omitempty"` + TxRing *PacketRing `protobuf:"bytes,19,opt,name=tx_ring,json=txRing" json:"tx_ring,omitempty"` + NsId *uint32 `protobuf:"varint,20,opt,name=ns_id,json=nsId" json:"ns_id,omitempty"` } // Default values for PacketSockEntry fields. @@ -279,14 +282,14 @@ func (x *PacketSockEntry) GetIfindex() uint32 { return 0 } -func (x *PacketSockEntry) GetFown() *FownEntry { +func (x *PacketSockEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } return nil } -func (x *PacketSockEntry) GetOpts() *SkOptsEntry { +func (x *PacketSockEntry) GetOpts() *sk_opts.SkOptsEntry { if x != nil { return x.Opts } @@ -464,11 +467,11 @@ func file_packet_sock_proto_rawDescGZIP() []byte { var file_packet_sock_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_packet_sock_proto_goTypes = []interface{}{ - (*PacketMclist)(nil), // 0: packet_mclist - (*PacketRing)(nil), // 1: packet_ring - (*PacketSockEntry)(nil), // 2: packet_sock_entry - (*FownEntry)(nil), // 3: fown_entry - (*SkOptsEntry)(nil), // 4: sk_opts_entry + (*PacketMclist)(nil), // 0: packet_mclist + (*PacketRing)(nil), // 1: packet_ring + (*PacketSockEntry)(nil), // 2: packet_sock_entry + (*fown.FownEntry)(nil), // 3: fown_entry + (*sk_opts.SkOptsEntry)(nil), // 4: sk_opts_entry } var file_packet_sock_proto_depIdxs = []int32{ 3, // 0: packet_sock_entry.fown:type_name -> fown_entry @@ -488,9 +491,6 @@ func file_packet_sock_proto_init() { if File_packet_sock_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() - file_sk_opts_proto_init() if !protoimpl.UnsafeEnabled { file_packet_sock_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PacketMclist); i { diff --git a/crit/images/pagemap.pb.go b/crit/images/pagemap/pagemap.pb.go similarity index 98% rename from crit/images/pagemap.pb.go rename to crit/images/pagemap/pagemap.pb.go index 725135530..4c6536acc 100644 --- a/crit/images/pagemap.pb.go +++ b/crit/images/pagemap/pagemap.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: pagemap.proto -package images +package pagemap import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -189,7 +190,6 @@ func file_pagemap_proto_init() { if File_pagemap_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_pagemap_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PagemapHead); i { diff --git a/crit/images/pidns.pb.go b/crit/images/pidns/pidns.pb.go similarity index 98% rename from crit/images/pidns.pb.go rename to crit/images/pidns/pidns.pb.go index f6db5b14f..0ea59c9c4 100644 --- a/crit/images/pidns.pb.go +++ b/crit/images/pidns/pidns.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: pidns.proto -package images +package pidns import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/pipe-data.pb.go b/crit/images/pipe-data/pipe-data.pb.go similarity index 98% rename from crit/images/pipe-data.pb.go rename to crit/images/pipe-data/pipe-data.pb.go index a0eef6cbb..f9a3f5bc7 100644 --- a/crit/images/pipe-data.pb.go +++ b/crit/images/pipe-data/pipe-data.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: pipe-data.proto -package images +package pipe_data import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/pipe.pb.go b/crit/images/pipe/pipe.pb.go similarity index 87% rename from crit/images/pipe.pb.go rename to crit/images/pipe/pipe.pb.go index d406ca58d..30245b009 100644 --- a/crit/images/pipe.pb.go +++ b/crit/images/pipe/pipe.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: pipe.proto -package images +package pipe import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +29,10 @@ type PipeEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - PipeId *uint32 `protobuf:"varint,2,req,name=pipe_id,json=pipeId" json:"pipe_id,omitempty"` - Flags *uint32 `protobuf:"varint,3,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + PipeId *uint32 `protobuf:"varint,2,req,name=pipe_id,json=pipeId" json:"pipe_id,omitempty"` + Flags *uint32 `protobuf:"varint,3,req,name=flags" json:"flags,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` } func (x *PipeEntry) Reset() { @@ -86,7 +88,7 @@ func (x *PipeEntry) GetFlags() uint32 { return 0 } -func (x *PipeEntry) GetFown() *FownEntry { +func (x *PipeEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -122,8 +124,8 @@ func file_pipe_proto_rawDescGZIP() []byte { var file_pipe_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_pipe_proto_goTypes = []interface{}{ - (*PipeEntry)(nil), // 0: pipe_entry - (*FownEntry)(nil), // 1: fown_entry + (*PipeEntry)(nil), // 0: pipe_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_pipe_proto_depIdxs = []int32{ 1, // 0: pipe_entry.fown:type_name -> fown_entry @@ -139,8 +141,6 @@ func file_pipe_proto_init() { if File_pipe_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_pipe_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*PipeEntry); i { diff --git a/crit/images/pstree.pb.go b/crit/images/pstree/pstree.pb.go similarity index 98% rename from crit/images/pstree.pb.go rename to crit/images/pstree/pstree.pb.go index f8d1b012d..066755ae2 100644 --- a/crit/images/pstree.pb.go +++ b/crit/images/pstree/pstree.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: pstree.proto -package images +package pstree import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/regfile.pb.go b/crit/images/regfile/regfile.pb.go similarity index 88% rename from crit/images/regfile.pb.go rename to crit/images/regfile/regfile.pb.go index 7ce215844..f67219076 100644 --- a/crit/images/regfile.pb.go +++ b/crit/images/regfile/regfile.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: regfile.proto -package images +package regfile import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,15 +29,15 @@ type RegFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Pos *uint64 `protobuf:"varint,3,req,name=pos" json:"pos,omitempty"` - Fown *FownEntry `protobuf:"bytes,5,req,name=fown" json:"fown,omitempty"` - Name *string `protobuf:"bytes,6,req,name=name" json:"name,omitempty"` - MntId *int32 `protobuf:"zigzag32,7,opt,name=mnt_id,json=mntId,def=-1" json:"mnt_id,omitempty"` - Size *uint64 `protobuf:"varint,8,opt,name=size" json:"size,omitempty"` - Ext *bool `protobuf:"varint,9,opt,name=ext" json:"ext,omitempty"` - Mode *uint32 `protobuf:"varint,10,opt,name=mode" json:"mode,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` + Pos *uint64 `protobuf:"varint,3,req,name=pos" json:"pos,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,5,req,name=fown" json:"fown,omitempty"` + Name *string `protobuf:"bytes,6,req,name=name" json:"name,omitempty"` + MntId *int32 `protobuf:"zigzag32,7,opt,name=mnt_id,json=mntId,def=-1" json:"mnt_id,omitempty"` + Size *uint64 `protobuf:"varint,8,opt,name=size" json:"size,omitempty"` + Ext *bool `protobuf:"varint,9,opt,name=ext" json:"ext,omitempty"` + Mode *uint32 `protobuf:"varint,10,opt,name=mode" json:"mode,omitempty"` // This field stores the build-ID of the file if it could be obtained. BuildId []uint32 `protobuf:"varint,11,rep,name=build_id,json=buildId" json:"build_id,omitempty"` // This field stores the CRC32C checksum of the file if it could be obtained. @@ -106,7 +108,7 @@ func (x *RegFileEntry) GetPos() uint64 { return 0 } -func (x *RegFileEntry) GetFown() *FownEntry { +func (x *RegFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -221,8 +223,8 @@ func file_regfile_proto_rawDescGZIP() []byte { var file_regfile_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_regfile_proto_goTypes = []interface{}{ - (*RegFileEntry)(nil), // 0: reg_file_entry - (*FownEntry)(nil), // 1: fown_entry + (*RegFileEntry)(nil), // 0: reg_file_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_regfile_proto_depIdxs = []int32{ 1, // 0: reg_file_entry.fown:type_name -> fown_entry @@ -238,8 +240,6 @@ func file_regfile_proto_init() { if File_regfile_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_regfile_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*RegFileEntry); i { diff --git a/crit/images/remap-file-path.pb.go b/crit/images/remap-file-path/remap-file-path.pb.go similarity index 98% rename from crit/images/remap-file-path.pb.go rename to crit/images/remap-file-path/remap-file-path.pb.go index 07933216c..696431be2 100644 --- a/crit/images/remap-file-path.pb.go +++ b/crit/images/remap-file-path/remap-file-path.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: remap-file-path.proto -package images +package remap_file_path import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/rlimit.pb.go b/crit/images/rlimit/rlimit.pb.go similarity index 98% rename from crit/images/rlimit.pb.go rename to crit/images/rlimit/rlimit.pb.go index eb608f8e7..21660b05b 100644 --- a/crit/images/rlimit.pb.go +++ b/crit/images/rlimit/rlimit.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: rlimit.proto -package images +package rlimit import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/rseq.pb.go b/crit/images/rseq/rseq.pb.go similarity index 98% rename from crit/images/rseq.pb.go rename to crit/images/rseq/rseq.pb.go index 53d961e69..4e03d9c50 100644 --- a/crit/images/rseq.pb.go +++ b/crit/images/rseq/rseq.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: rseq.proto -package images +package rseq import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/seccomp.pb.go b/crit/images/seccomp/seccomp.pb.go similarity index 98% rename from crit/images/seccomp.pb.go rename to crit/images/seccomp/seccomp.pb.go index 124a6cc85..b7706a9bd 100644 --- a/crit/images/seccomp.pb.go +++ b/crit/images/seccomp/seccomp.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: seccomp.proto -package images +package seccomp import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/siginfo.pb.go b/crit/images/siginfo/siginfo.pb.go similarity index 98% rename from crit/images/siginfo.pb.go rename to crit/images/siginfo/siginfo.pb.go index 97db33982..a47afcb46 100644 --- a/crit/images/siginfo.pb.go +++ b/crit/images/siginfo/siginfo.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: siginfo.proto -package images +package siginfo import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/signalfd.pb.go b/crit/images/signalfd/signalfd.pb.go similarity index 87% rename from crit/images/signalfd.pb.go rename to crit/images/signalfd/signalfd.pb.go index 02a80b143..90f18ee7c 100644 --- a/crit/images/signalfd.pb.go +++ b/crit/images/signalfd/signalfd.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: signalfd.proto -package images +package signalfd import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,10 +29,10 @@ type SignalfdEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` - Sigmask *uint64 `protobuf:"varint,4,req,name=sigmask" json:"sigmask,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` + Sigmask *uint64 `protobuf:"varint,4,req,name=sigmask" json:"sigmask,omitempty"` } func (x *SignalfdEntry) Reset() { @@ -79,7 +81,7 @@ func (x *SignalfdEntry) GetFlags() uint32 { return 0 } -func (x *SignalfdEntry) GetFown() *FownEntry { +func (x *SignalfdEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -123,8 +125,8 @@ func file_signalfd_proto_rawDescGZIP() []byte { var file_signalfd_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_signalfd_proto_goTypes = []interface{}{ - (*SignalfdEntry)(nil), // 0: signalfd_entry - (*FownEntry)(nil), // 1: fown_entry + (*SignalfdEntry)(nil), // 0: signalfd_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_signalfd_proto_depIdxs = []int32{ 1, // 0: signalfd_entry.fown:type_name -> fown_entry @@ -140,8 +142,6 @@ func file_signalfd_proto_init() { if File_signalfd_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_signalfd_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SignalfdEntry); i { diff --git a/crit/images/sit.pb.go b/crit/images/sit/sit.pb.go similarity index 98% rename from crit/images/sit.pb.go rename to crit/images/sit/sit.pb.go index 3572130de..eed5f340a 100644 --- a/crit/images/sit.pb.go +++ b/crit/images/sit/sit.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sit.proto -package images +package sit import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -255,7 +256,6 @@ func file_sit_proto_init() { if File_sit_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_sit_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*SitEntry); i { diff --git a/crit/images/sk-inet.pb.go b/crit/images/sk-inet/sk-inet.pb.go similarity index 85% rename from crit/images/sk-inet.pb.go rename to crit/images/sk-inet/sk-inet.pb.go index 5272e903c..4a2683110 100644 --- a/crit/images/sk-inet.pb.go +++ b/crit/images/sk-inet/sk-inet.pb.go @@ -2,13 +2,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sk-inet.proto -package images +package sk_inet import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + sk_opts "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -168,27 +171,27 @@ type InetSkEntry struct { // in sk-inet.c internally, in particular we identify // a TCP stream to restore into this socket using the // ino value. - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Ino *uint32 `protobuf:"varint,2,req,name=ino" json:"ino,omitempty"` - Family *uint32 `protobuf:"varint,3,req,name=family" json:"family,omitempty"` - Type *uint32 `protobuf:"varint,4,req,name=type" json:"type,omitempty"` - Proto *uint32 `protobuf:"varint,5,req,name=proto" json:"proto,omitempty"` - State *uint32 `protobuf:"varint,6,req,name=state" json:"state,omitempty"` - SrcPort *uint32 `protobuf:"varint,7,req,name=src_port,json=srcPort" json:"src_port,omitempty"` - DstPort *uint32 `protobuf:"varint,8,req,name=dst_port,json=dstPort" json:"dst_port,omitempty"` - Flags *uint32 `protobuf:"varint,9,req,name=flags" json:"flags,omitempty"` - Backlog *uint32 `protobuf:"varint,10,req,name=backlog" json:"backlog,omitempty"` - SrcAddr []uint32 `protobuf:"varint,11,rep,name=src_addr,json=srcAddr" json:"src_addr,omitempty"` - DstAddr []uint32 `protobuf:"varint,12,rep,name=dst_addr,json=dstAddr" json:"dst_addr,omitempty"` - Fown *FownEntry `protobuf:"bytes,13,req,name=fown" json:"fown,omitempty"` - Opts *SkOptsEntry `protobuf:"bytes,14,req,name=opts" json:"opts,omitempty"` - V6Only *bool `protobuf:"varint,15,opt,name=v6only" json:"v6only,omitempty"` - IpOpts *IpOptsEntry `protobuf:"bytes,16,opt,name=ip_opts,json=ipOpts" json:"ip_opts,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Ino *uint32 `protobuf:"varint,2,req,name=ino" json:"ino,omitempty"` + Family *uint32 `protobuf:"varint,3,req,name=family" json:"family,omitempty"` + Type *uint32 `protobuf:"varint,4,req,name=type" json:"type,omitempty"` + Proto *uint32 `protobuf:"varint,5,req,name=proto" json:"proto,omitempty"` + State *uint32 `protobuf:"varint,6,req,name=state" json:"state,omitempty"` + SrcPort *uint32 `protobuf:"varint,7,req,name=src_port,json=srcPort" json:"src_port,omitempty"` + DstPort *uint32 `protobuf:"varint,8,req,name=dst_port,json=dstPort" json:"dst_port,omitempty"` + Flags *uint32 `protobuf:"varint,9,req,name=flags" json:"flags,omitempty"` + Backlog *uint32 `protobuf:"varint,10,req,name=backlog" json:"backlog,omitempty"` + SrcAddr []uint32 `protobuf:"varint,11,rep,name=src_addr,json=srcAddr" json:"src_addr,omitempty"` + DstAddr []uint32 `protobuf:"varint,12,rep,name=dst_addr,json=dstAddr" json:"dst_addr,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,13,req,name=fown" json:"fown,omitempty"` + Opts *sk_opts.SkOptsEntry `protobuf:"bytes,14,req,name=opts" json:"opts,omitempty"` + V6Only *bool `protobuf:"varint,15,opt,name=v6only" json:"v6only,omitempty"` + IpOpts *IpOptsEntry `protobuf:"bytes,16,opt,name=ip_opts,json=ipOpts" json:"ip_opts,omitempty"` // for ipv6, we need to send the ifindex to bind(); we keep the ifname // here and convert it on restore - Ifname *string `protobuf:"bytes,17,opt,name=ifname" json:"ifname,omitempty"` - NsId *uint32 `protobuf:"varint,18,opt,name=ns_id,json=nsId" json:"ns_id,omitempty"` - Shutdown *SkShutdown `protobuf:"varint,19,opt,name=shutdown,enum=SkShutdown" json:"shutdown,omitempty"` + Ifname *string `protobuf:"bytes,17,opt,name=ifname" json:"ifname,omitempty"` + NsId *uint32 `protobuf:"varint,18,opt,name=ns_id,json=nsId" json:"ns_id,omitempty"` + Shutdown *sk_opts.SkShutdown `protobuf:"varint,19,opt,name=shutdown,enum=SkShutdown" json:"shutdown,omitempty"` } func (x *InetSkEntry) Reset() { @@ -307,14 +310,14 @@ func (x *InetSkEntry) GetDstAddr() []uint32 { return nil } -func (x *InetSkEntry) GetFown() *FownEntry { +func (x *InetSkEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } return nil } -func (x *InetSkEntry) GetOpts() *SkOptsEntry { +func (x *InetSkEntry) GetOpts() *sk_opts.SkOptsEntry { if x != nil { return x.Opts } @@ -349,11 +352,11 @@ func (x *InetSkEntry) GetNsId() uint32 { return 0 } -func (x *InetSkEntry) GetShutdown() SkShutdown { +func (x *InetSkEntry) GetShutdown() sk_opts.SkShutdown { if x != nil && x.Shutdown != nil { return *x.Shutdown } - return SkShutdown_NONE + return sk_opts.SkShutdown(0) } var File_sk_inet_proto protoreflect.FileDescriptor @@ -430,12 +433,12 @@ func file_sk_inet_proto_rawDescGZIP() []byte { var file_sk_inet_proto_msgTypes = make([]protoimpl.MessageInfo, 3) var file_sk_inet_proto_goTypes = []interface{}{ - (*IpOptsRawEntry)(nil), // 0: ip_opts_raw_entry - (*IpOptsEntry)(nil), // 1: ip_opts_entry - (*InetSkEntry)(nil), // 2: inet_sk_entry - (*FownEntry)(nil), // 3: fown_entry - (*SkOptsEntry)(nil), // 4: sk_opts_entry - (SkShutdown)(0), // 5: sk_shutdown + (*IpOptsRawEntry)(nil), // 0: ip_opts_raw_entry + (*IpOptsEntry)(nil), // 1: ip_opts_entry + (*InetSkEntry)(nil), // 2: inet_sk_entry + (*fown.FownEntry)(nil), // 3: fown_entry + (*sk_opts.SkOptsEntry)(nil), // 4: sk_opts_entry + (sk_opts.SkShutdown)(0), // 5: sk_shutdown } var file_sk_inet_proto_depIdxs = []int32{ 0, // 0: ip_opts_entry.raw:type_name -> ip_opts_raw_entry @@ -455,9 +458,6 @@ func file_sk_inet_proto_init() { if File_sk_inet_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() - file_sk_opts_proto_init() if !protoimpl.UnsafeEnabled { file_sk_inet_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*IpOptsRawEntry); i { diff --git a/crit/images/sk-netlink.pb.go b/crit/images/sk-netlink/sk-netlink.pb.go similarity index 80% rename from crit/images/sk-netlink.pb.go rename to crit/images/sk-netlink/sk-netlink.pb.go index 75bac2ed0..c7fe292a9 100644 --- a/crit/images/sk-netlink.pb.go +++ b/crit/images/sk-netlink/sk-netlink.pb.go @@ -2,13 +2,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sk-netlink.proto -package images +package sk_netlink import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + sk_opts "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,18 +30,18 @@ type NetlinkSkEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Ino *uint32 `protobuf:"varint,2,req,name=ino" json:"ino,omitempty"` - Protocol *uint32 `protobuf:"varint,3,req,name=protocol" json:"protocol,omitempty"` - State *uint32 `protobuf:"varint,4,req,name=state" json:"state,omitempty"` - Flags *uint32 `protobuf:"varint,6,req,name=flags" json:"flags,omitempty"` - Portid *uint32 `protobuf:"varint,7,req,name=portid" json:"portid,omitempty"` - Groups []uint32 `protobuf:"varint,8,rep,name=groups" json:"groups,omitempty"` - DstPortid *uint32 `protobuf:"varint,9,req,name=dst_portid,json=dstPortid" json:"dst_portid,omitempty"` - DstGroup *uint32 `protobuf:"varint,10,req,name=dst_group,json=dstGroup" json:"dst_group,omitempty"` - Fown *FownEntry `protobuf:"bytes,11,req,name=fown" json:"fown,omitempty"` - Opts *SkOptsEntry `protobuf:"bytes,12,req,name=opts" json:"opts,omitempty"` - NsId *uint32 `protobuf:"varint,13,opt,name=ns_id,json=nsId" json:"ns_id,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Ino *uint32 `protobuf:"varint,2,req,name=ino" json:"ino,omitempty"` + Protocol *uint32 `protobuf:"varint,3,req,name=protocol" json:"protocol,omitempty"` + State *uint32 `protobuf:"varint,4,req,name=state" json:"state,omitempty"` + Flags *uint32 `protobuf:"varint,6,req,name=flags" json:"flags,omitempty"` + Portid *uint32 `protobuf:"varint,7,req,name=portid" json:"portid,omitempty"` + Groups []uint32 `protobuf:"varint,8,rep,name=groups" json:"groups,omitempty"` + DstPortid *uint32 `protobuf:"varint,9,req,name=dst_portid,json=dstPortid" json:"dst_portid,omitempty"` + DstGroup *uint32 `protobuf:"varint,10,req,name=dst_group,json=dstGroup" json:"dst_group,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,11,req,name=fown" json:"fown,omitempty"` + Opts *sk_opts.SkOptsEntry `protobuf:"bytes,12,req,name=opts" json:"opts,omitempty"` + NsId *uint32 `protobuf:"varint,13,opt,name=ns_id,json=nsId" json:"ns_id,omitempty"` } func (x *NetlinkSkEntry) Reset() { @@ -136,14 +139,14 @@ func (x *NetlinkSkEntry) GetDstGroup() uint32 { return 0 } -func (x *NetlinkSkEntry) GetFown() *FownEntry { +func (x *NetlinkSkEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } return nil } -func (x *NetlinkSkEntry) GetOpts() *SkOptsEntry { +func (x *NetlinkSkEntry) GetOpts() *sk_opts.SkOptsEntry { if x != nil { return x.Opts } @@ -201,9 +204,9 @@ func file_sk_netlink_proto_rawDescGZIP() []byte { var file_sk_netlink_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_sk_netlink_proto_goTypes = []interface{}{ - (*NetlinkSkEntry)(nil), // 0: netlink_sk_entry - (*FownEntry)(nil), // 1: fown_entry - (*SkOptsEntry)(nil), // 2: sk_opts_entry + (*NetlinkSkEntry)(nil), // 0: netlink_sk_entry + (*fown.FownEntry)(nil), // 1: fown_entry + (*sk_opts.SkOptsEntry)(nil), // 2: sk_opts_entry } var file_sk_netlink_proto_depIdxs = []int32{ 1, // 0: netlink_sk_entry.fown:type_name -> fown_entry @@ -220,9 +223,6 @@ func file_sk_netlink_proto_init() { if File_sk_netlink_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() - file_sk_opts_proto_init() if !protoimpl.UnsafeEnabled { file_sk_netlink_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*NetlinkSkEntry); i { diff --git a/crit/images/sk-opts.pb.go b/crit/images/sk-opts/sk-opts.pb.go similarity index 99% rename from crit/images/sk-opts.pb.go rename to crit/images/sk-opts/sk-opts.pb.go index 137603412..377a77dbb 100644 --- a/crit/images/sk-opts.pb.go +++ b/crit/images/sk-opts/sk-opts.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sk-opts.proto -package images +package sk_opts import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/sk-packet.pb.go b/crit/images/sk-packet/sk-packet.pb.go similarity index 98% rename from crit/images/sk-packet.pb.go rename to crit/images/sk-packet/sk-packet.pb.go index 9dd7176de..ca6a26f4d 100644 --- a/crit/images/sk-packet.pb.go +++ b/crit/images/sk-packet/sk-packet.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sk-packet.proto -package images +package sk_packet import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/sk-unix.pb.go b/crit/images/sk-unix/sk-unix.pb.go similarity index 86% rename from crit/images/sk-unix.pb.go rename to crit/images/sk-unix/sk-unix.pb.go index 068b7648f..4324f4bf6 100644 --- a/crit/images/sk-unix.pb.go +++ b/crit/images/sk-unix/sk-unix.pb.go @@ -2,13 +2,16 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sk-unix.proto -package images +package sk_unix import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" + sk_opts "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -99,21 +102,21 @@ type UnixSkEntry struct { // The latter one ties together unix peers -- the peer // member on this structure is the ino one of its peer // and simetimes vise-versa. - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Ino *uint32 `protobuf:"varint,2,req,name=ino" json:"ino,omitempty"` - Type *uint32 `protobuf:"varint,3,req,name=type" json:"type,omitempty"` - State *uint32 `protobuf:"varint,4,req,name=state" json:"state,omitempty"` - Flags *uint32 `protobuf:"varint,5,req,name=flags" json:"flags,omitempty"` - Uflags *uint32 `protobuf:"varint,6,req,name=uflags" json:"uflags,omitempty"` - Backlog *uint32 `protobuf:"varint,7,req,name=backlog" json:"backlog,omitempty"` - Peer *uint32 `protobuf:"varint,8,req,name=peer" json:"peer,omitempty"` - Fown *FownEntry `protobuf:"bytes,9,req,name=fown" json:"fown,omitempty"` - Opts *SkOptsEntry `protobuf:"bytes,10,req,name=opts" json:"opts,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Ino *uint32 `protobuf:"varint,2,req,name=ino" json:"ino,omitempty"` + Type *uint32 `protobuf:"varint,3,req,name=type" json:"type,omitempty"` + State *uint32 `protobuf:"varint,4,req,name=state" json:"state,omitempty"` + Flags *uint32 `protobuf:"varint,5,req,name=flags" json:"flags,omitempty"` + Uflags *uint32 `protobuf:"varint,6,req,name=uflags" json:"uflags,omitempty"` + Backlog *uint32 `protobuf:"varint,7,req,name=backlog" json:"backlog,omitempty"` + Peer *uint32 `protobuf:"varint,8,req,name=peer" json:"peer,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,9,req,name=fown" json:"fown,omitempty"` + Opts *sk_opts.SkOptsEntry `protobuf:"bytes,10,req,name=opts" json:"opts,omitempty"` // Abstract name may contain \0 at any point, // so we need to carry it as byte sequence... - Name []byte `protobuf:"bytes,11,req,name=name" json:"name,omitempty"` - Shutdown *SkShutdown `protobuf:"varint,12,opt,name=shutdown,enum=SkShutdown" json:"shutdown,omitempty"` - FilePerms *FilePermsEntry `protobuf:"bytes,13,opt,name=file_perms,json=filePerms" json:"file_perms,omitempty"` + Name []byte `protobuf:"bytes,11,req,name=name" json:"name,omitempty"` + Shutdown *sk_opts.SkShutdown `protobuf:"varint,12,opt,name=shutdown,enum=SkShutdown" json:"shutdown,omitempty"` + FilePerms *FilePermsEntry `protobuf:"bytes,13,opt,name=file_perms,json=filePerms" json:"file_perms,omitempty"` // Relative socket name may have prefix. NameDir *string `protobuf:"bytes,14,opt,name=name_dir,json=nameDir" json:"name_dir,omitempty"` Deleted *bool `protobuf:"varint,15,opt,name=deleted" json:"deleted,omitempty"` @@ -214,14 +217,14 @@ func (x *UnixSkEntry) GetPeer() uint32 { return 0 } -func (x *UnixSkEntry) GetFown() *FownEntry { +func (x *UnixSkEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } return nil } -func (x *UnixSkEntry) GetOpts() *SkOptsEntry { +func (x *UnixSkEntry) GetOpts() *sk_opts.SkOptsEntry { if x != nil { return x.Opts } @@ -235,11 +238,11 @@ func (x *UnixSkEntry) GetName() []byte { return nil } -func (x *UnixSkEntry) GetShutdown() SkShutdown { +func (x *UnixSkEntry) GetShutdown() sk_opts.SkShutdown { if x != nil && x.Shutdown != nil { return *x.Shutdown } - return SkShutdown_NONE + return sk_opts.SkShutdown(0) } func (x *UnixSkEntry) GetFilePerms() *FilePermsEntry { @@ -337,11 +340,11 @@ func file_sk_unix_proto_rawDescGZIP() []byte { var file_sk_unix_proto_msgTypes = make([]protoimpl.MessageInfo, 2) var file_sk_unix_proto_goTypes = []interface{}{ - (*FilePermsEntry)(nil), // 0: file_perms_entry - (*UnixSkEntry)(nil), // 1: unix_sk_entry - (*FownEntry)(nil), // 2: fown_entry - (*SkOptsEntry)(nil), // 3: sk_opts_entry - (SkShutdown)(0), // 4: sk_shutdown + (*FilePermsEntry)(nil), // 0: file_perms_entry + (*UnixSkEntry)(nil), // 1: unix_sk_entry + (*fown.FownEntry)(nil), // 2: fown_entry + (*sk_opts.SkOptsEntry)(nil), // 3: sk_opts_entry + (sk_opts.SkShutdown)(0), // 4: sk_shutdown } var file_sk_unix_proto_depIdxs = []int32{ 2, // 0: unix_sk_entry.fown:type_name -> fown_entry @@ -360,9 +363,6 @@ func file_sk_unix_proto_init() { if File_sk_unix_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() - file_sk_opts_proto_init() if !protoimpl.UnsafeEnabled { file_sk_unix_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*FilePermsEntry); i { diff --git a/crit/images/stats.pb.go b/crit/images/stats/stats.pb.go similarity index 99% rename from crit/images/stats.pb.go rename to crit/images/stats/stats.pb.go index c5a9c9d5a..d335ae192 100644 --- a/crit/images/stats.pb.go +++ b/crit/images/stats/stats.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: stats.proto -package images +package stats import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/sysctl.pb.go b/crit/images/sysctl/sysctl.pb.go similarity index 98% rename from crit/images/sysctl.pb.go rename to crit/images/sysctl/sysctl.pb.go index ec4819c4f..8f528dc8a 100644 --- a/crit/images/sysctl.pb.go +++ b/crit/images/sysctl/sysctl.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: sysctl.proto -package images +package sysctl import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/tcp-stream.pb.go b/crit/images/tcp-stream/tcp-stream.pb.go similarity index 98% rename from crit/images/tcp-stream.pb.go rename to crit/images/tcp-stream/tcp-stream.pb.go index 3e173d1c4..ac671df64 100644 --- a/crit/images/tcp-stream.pb.go +++ b/crit/images/tcp-stream/tcp-stream.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: tcp-stream.proto -package images +package tcp_stream import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -264,7 +265,6 @@ func file_tcp_stream_proto_init() { if File_tcp_stream_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_tcp_stream_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TcpStreamEntry); i { diff --git a/crit/images/time.pb.go b/crit/images/time/time.pb.go similarity index 98% rename from crit/images/time.pb.go rename to crit/images/time/time.pb.go index a3bdfc0c2..938067f68 100644 --- a/crit/images/time.pb.go +++ b/crit/images/time/time.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: time.proto -package images +package time import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/timens.pb.go b/crit/images/timens/timens.pb.go similarity index 98% rename from crit/images/timens.pb.go rename to crit/images/timens/timens.pb.go index f8b629c1d..4fdbdda2b 100644 --- a/crit/images/timens.pb.go +++ b/crit/images/timens/timens.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: timens.proto -package images +package timens import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/timer.pb.go b/crit/images/timer/timer.pb.go similarity index 99% rename from crit/images/timer.pb.go rename to crit/images/timer/timer.pb.go index 88df9f88c..43caba10e 100644 --- a/crit/images/timer.pb.go +++ b/crit/images/timer/timer.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: timer.proto -package images +package timer import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/timerfd.pb.go b/crit/images/timerfd/timerfd.pb.go similarity index 83% rename from crit/images/timerfd.pb.go rename to crit/images/timerfd/timerfd.pb.go index 17cd382ae..1c4fda477 100644 --- a/crit/images/timerfd.pb.go +++ b/crit/images/timerfd/timerfd.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: timerfd.proto -package images +package timerfd import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -27,16 +29,16 @@ type TimerfdEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` - Clockid *uint32 `protobuf:"varint,4,req,name=clockid" json:"clockid,omitempty"` - Ticks *uint64 `protobuf:"varint,5,req,name=ticks" json:"ticks,omitempty"` - SettimeFlags *uint32 `protobuf:"varint,6,req,name=settime_flags,json=settimeFlags" json:"settime_flags,omitempty"` - Vsec *uint64 `protobuf:"varint,7,req,name=vsec" json:"vsec,omitempty"` - Vnsec *uint64 `protobuf:"varint,8,req,name=vnsec" json:"vnsec,omitempty"` - Isec *uint64 `protobuf:"varint,9,req,name=isec" json:"isec,omitempty"` - Insec *uint64 `protobuf:"varint,10,req,name=insec" json:"insec,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + Flags *uint32 `protobuf:"varint,2,req,name=flags" json:"flags,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,3,req,name=fown" json:"fown,omitempty"` + Clockid *uint32 `protobuf:"varint,4,req,name=clockid" json:"clockid,omitempty"` + Ticks *uint64 `protobuf:"varint,5,req,name=ticks" json:"ticks,omitempty"` + SettimeFlags *uint32 `protobuf:"varint,6,req,name=settime_flags,json=settimeFlags" json:"settime_flags,omitempty"` + Vsec *uint64 `protobuf:"varint,7,req,name=vsec" json:"vsec,omitempty"` + Vnsec *uint64 `protobuf:"varint,8,req,name=vnsec" json:"vnsec,omitempty"` + Isec *uint64 `protobuf:"varint,9,req,name=isec" json:"isec,omitempty"` + Insec *uint64 `protobuf:"varint,10,req,name=insec" json:"insec,omitempty"` } func (x *TimerfdEntry) Reset() { @@ -85,7 +87,7 @@ func (x *TimerfdEntry) GetFlags() uint32 { return 0 } -func (x *TimerfdEntry) GetFown() *FownEntry { +func (x *TimerfdEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -180,8 +182,8 @@ func file_timerfd_proto_rawDescGZIP() []byte { var file_timerfd_proto_msgTypes = make([]protoimpl.MessageInfo, 1) var file_timerfd_proto_goTypes = []interface{}{ - (*TimerfdEntry)(nil), // 0: timerfd_entry - (*FownEntry)(nil), // 1: fown_entry + (*TimerfdEntry)(nil), // 0: timerfd_entry + (*fown.FownEntry)(nil), // 1: fown_entry } var file_timerfd_proto_depIdxs = []int32{ 1, // 0: timerfd_entry.fown:type_name -> fown_entry @@ -197,8 +199,6 @@ func file_timerfd_proto_init() { if File_timerfd_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_timerfd_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TimerfdEntry); i { diff --git a/crit/images/tty.pb.go b/crit/images/tty/tty.pb.go similarity index 96% rename from crit/images/tty.pb.go rename to crit/images/tty/tty.pb.go index ae849ba61..f57223424 100644 --- a/crit/images/tty.pb.go +++ b/crit/images/tty/tty.pb.go @@ -2,13 +2,15 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: tty.proto -package images +package tty import ( + fown "github.com/checkpoint-restore/go-criu/v6/crit/images/fown" + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -538,10 +540,10 @@ type TtyFileEntry struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` - TtyInfoId *uint32 `protobuf:"varint,2,req,name=tty_info_id,json=ttyInfoId" json:"tty_info_id,omitempty"` - Flags *uint32 `protobuf:"varint,3,req,name=flags" json:"flags,omitempty"` - Fown *FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` + Id *uint32 `protobuf:"varint,1,req,name=id" json:"id,omitempty"` + TtyInfoId *uint32 `protobuf:"varint,2,req,name=tty_info_id,json=ttyInfoId" json:"tty_info_id,omitempty"` + Flags *uint32 `protobuf:"varint,3,req,name=flags" json:"flags,omitempty"` + Fown *fown.FownEntry `protobuf:"bytes,4,req,name=fown" json:"fown,omitempty"` // optional sint32 mnt_id = 5 [default = 0]; RegfId *uint32 `protobuf:"varint,6,opt,name=regf_id,json=regfId" json:"regf_id,omitempty"` } @@ -599,7 +601,7 @@ func (x *TtyFileEntry) GetFlags() uint32 { return 0 } -func (x *TtyFileEntry) GetFown() *FownEntry { +func (x *TtyFileEntry) GetFown() *fown.FownEntry { if x != nil { return x.Fown } @@ -705,14 +707,14 @@ func file_tty_proto_rawDescGZIP() []byte { var file_tty_proto_enumTypes = make([]protoimpl.EnumInfo, 1) var file_tty_proto_msgTypes = make([]protoimpl.MessageInfo, 6) var file_tty_proto_goTypes = []interface{}{ - (TtyType)(0), // 0: TtyType - (*WinsizeEntry)(nil), // 1: winsize_entry - (*TermiosEntry)(nil), // 2: termios_entry - (*TtyPtyEntry)(nil), // 3: tty_pty_entry - (*TtyDataEntry)(nil), // 4: tty_data_entry - (*TtyInfoEntry)(nil), // 5: tty_info_entry - (*TtyFileEntry)(nil), // 6: tty_file_entry - (*FownEntry)(nil), // 7: fown_entry + (TtyType)(0), // 0: TtyType + (*WinsizeEntry)(nil), // 1: winsize_entry + (*TermiosEntry)(nil), // 2: termios_entry + (*TtyPtyEntry)(nil), // 3: tty_pty_entry + (*TtyDataEntry)(nil), // 4: tty_data_entry + (*TtyInfoEntry)(nil), // 5: tty_info_entry + (*TtyFileEntry)(nil), // 6: tty_file_entry + (*fown.FownEntry)(nil), // 7: fown_entry } var file_tty_proto_depIdxs = []int32{ 0, // 0: tty_info_entry.type:type_name -> TtyType @@ -733,8 +735,6 @@ func file_tty_proto_init() { if File_tty_proto != nil { return } - file_opts_proto_init() - file_fown_proto_init() if !protoimpl.UnsafeEnabled { file_tty_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*WinsizeEntry); i { diff --git a/crit/images/tun.pb.go b/crit/images/tun/tun.pb.go similarity index 98% rename from crit/images/tun.pb.go rename to crit/images/tun/tun.pb.go index 7d33bdf6c..c0becc91f 100644 --- a/crit/images/tun.pb.go +++ b/crit/images/tun/tun.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: tun.proto -package images +package tun import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -224,7 +225,6 @@ func file_tun_proto_init() { if File_tun_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_tun_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*TunfileEntry); i { diff --git a/crit/images/userns.pb.go b/crit/images/userns/userns.pb.go similarity index 99% rename from crit/images/userns.pb.go rename to crit/images/userns/userns.pb.go index 57b30d473..1a84727a7 100644 --- a/crit/images/userns.pb.go +++ b/crit/images/userns/userns.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: userns.proto -package images +package userns import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/utsns.pb.go b/crit/images/utsns/utsns.pb.go similarity index 98% rename from crit/images/utsns.pb.go rename to crit/images/utsns/utsns.pb.go index 64d7139b0..83cfd98f0 100644 --- a/crit/images/utsns.pb.go +++ b/crit/images/utsns/utsns.pb.go @@ -2,11 +2,11 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: utsns.proto -package images +package utsns import ( protoreflect "google.golang.org/protobuf/reflect/protoreflect" diff --git a/crit/images/vma.pb.go b/crit/images/vma/vma.pb.go similarity index 98% rename from crit/images/vma.pb.go rename to crit/images/vma/vma.pb.go index 034350028..4d0c5b74c 100644 --- a/crit/images/vma.pb.go +++ b/crit/images/vma/vma.pb.go @@ -2,13 +2,14 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // versions: -// protoc-gen-go v1.28.1 -// protoc v3.21.5 +// protoc-gen-go v1.30.0 +// protoc v3.21.12 // source: vma.proto -package images +package vma import ( + _ "github.com/checkpoint-restore/go-criu/v6/crit/images/opts" protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" reflect "reflect" @@ -201,7 +202,6 @@ func file_vma_proto_init() { if File_vma_proto != nil { return } - file_opts_proto_init() if !protoimpl.UnsafeEnabled { file_vma_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { switch v := v.(*VmaEntry); i { diff --git a/crit/stats.go b/crit/stats.go index 0152e29da..c26fdcfdb 100644 --- a/crit/stats.go +++ b/crit/stats.go @@ -4,7 +4,7 @@ import ( "errors" "path/filepath" - "github.com/checkpoint-restore/go-criu/v6/crit/images" + "github.com/checkpoint-restore/go-criu/v6/crit/images/stats" ) const ( @@ -13,14 +13,14 @@ const ( ) // Helper function to load stats file into Go struct -func getStats(path string) (*images.StatsEntry, error) { +func getStats(path string) (*stats.StatsEntry, error) { c := New(path, "", "", false, false) statsImg, err := c.Decode() if err != nil { return nil, err } - stats, ok := statsImg.Entries[0].Message.(*images.StatsEntry) + stats, ok := statsImg.Entries[0].Message.(*stats.StatsEntry) if !ok { return nil, errors.New("failed to type assert stats image") } @@ -30,7 +30,7 @@ func getStats(path string) (*images.StatsEntry, error) { // GetDumpStats returns the dump statistics of a checkpoint. // dir is the path to the directory with the checkpoint images. -func GetDumpStats(dir string) (*images.DumpStatsEntry, error) { +func GetDumpStats(dir string) (*stats.DumpStatsEntry, error) { stats, err := getStats(filepath.Join(dir, StatsDump)) if err != nil { return nil, err @@ -41,7 +41,7 @@ func GetDumpStats(dir string) (*images.DumpStatsEntry, error) { // GetRestoreStats returns the restore statistics of a checkpoint. // dir is the path to the directory with the checkpoint images. -func GetRestoreStats(dir string) (*images.RestoreStatsEntry, error) { +func GetRestoreStats(dir string) (*stats.RestoreStatsEntry, error) { stats, err := getStats(filepath.Join(dir, StatsRestore)) if err != nil { return nil, err diff --git a/crit/utils.go b/crit/utils.go index 6a14faf65..91b6d44ca 100644 --- a/crit/utils.go +++ b/crit/utils.go @@ -9,7 +9,10 @@ import ( "path/filepath" "strconv" - "github.com/checkpoint-restore/go-criu/v6/crit/images" + "github.com/checkpoint-restore/go-criu/v6/crit/images/fdinfo" + "github.com/checkpoint-restore/go-criu/v6/crit/images/pipe" + "github.com/checkpoint-restore/go-criu/v6/crit/images/regfile" + sk_unix "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-unix" "github.com/checkpoint-restore/go-criu/v6/magic" ) @@ -108,7 +111,7 @@ var ( ) // Helper to get file path for exploring file descriptors -func getFilePath(dir string, fID uint32, fType images.FdTypes) (string, error) { +func getFilePath(dir string, fID uint32, fType fdinfo.FdTypes) (string, error) { var filePath string var err error // Get open files @@ -120,30 +123,30 @@ func getFilePath(dir string, fID uint32, fType images.FdTypes) (string, error) { } // Check if file entry is present - var file *images.FileEntry + var file *fdinfo.FileEntry for _, entry := range filesImg.Entries { - file = entry.Message.(*images.FileEntry) + file = entry.Message.(*fdinfo.FileEntry) if file.GetId() == fID { break } } switch fType { - case images.FdTypes_REG: + case fdinfo.FdTypes_REG: filePath, err = getRegFilePath(dir, file, fID) - case images.FdTypes_PIPE: + case fdinfo.FdTypes_PIPE: filePath, err = getPipeFilePath(dir, file, fID) - case images.FdTypes_UNIXSK: + case fdinfo.FdTypes_UNIXSK: filePath, err = getUnixSkFilePath(dir, file, fID) default: - filePath = fmt.Sprintf("%s.%d", images.FdTypes_name[int32(fType)], fID) + filePath = fmt.Sprintf("%s.%d", fdinfo.FdTypes_name[int32(fType)], fID) } return filePath, err } // Helper to get file path of regular files -func getRegFilePath(dir string, file *images.FileEntry, fID uint32) (string, error) { +func getRegFilePath(dir string, file *fdinfo.FileEntry, fID uint32) (string, error) { var err error if file != nil { if file.GetReg() != nil { @@ -159,7 +162,7 @@ func getRegFilePath(dir string, file *images.FileEntry, fID uint32) (string, err } } for _, entry := range regImg.Entries { - regFile := entry.Message.(*images.RegFileEntry) + regFile := entry.Message.(*regfile.RegFileEntry) if regFile.GetId() == fID { return regFile.GetName(), nil } @@ -169,7 +172,7 @@ func getRegFilePath(dir string, file *images.FileEntry, fID uint32) (string, err } // Helper to get file path of pipe files -func getPipeFilePath(dir string, file *images.FileEntry, fID uint32) (string, error) { +func getPipeFilePath(dir string, file *fdinfo.FileEntry, fID uint32) (string, error) { var err error if file != nil { if file.GetPipe() != nil { @@ -185,7 +188,7 @@ func getPipeFilePath(dir string, file *images.FileEntry, fID uint32) (string, er } } for _, entry := range pipeImg.Entries { - pipeFile := entry.Message.(*images.PipeEntry) + pipeFile := entry.Message.(*pipe.PipeEntry) if pipeFile.GetId() == fID { return fmt.Sprintf("pipe[%d]", pipeFile.GetPipeId()), nil } @@ -195,7 +198,7 @@ func getPipeFilePath(dir string, file *images.FileEntry, fID uint32) (string, er } // Helper to get file path of UNIX socket files -func getUnixSkFilePath(dir string, file *images.FileEntry, fID uint32) (string, error) { +func getUnixSkFilePath(dir string, file *fdinfo.FileEntry, fID uint32) (string, error) { var err error if file != nil { if file.GetUsk() != nil { @@ -216,7 +219,7 @@ func getUnixSkFilePath(dir string, file *images.FileEntry, fID uint32) (string, } } for _, entry := range unixSkImg.Entries { - unixSkFile := entry.Message.(*images.UnixSkEntry) + unixSkFile := entry.Message.(*sk_unix.UnixSkEntry) if unixSkFile.GetId() == fID { return fmt.Sprintf( "unix[%d (%d) %s]", diff --git a/phaul/client.go b/phaul/client.go index fd5e87754..bfdded021 100644 --- a/phaul/client.go +++ b/phaul/client.go @@ -6,7 +6,7 @@ import ( "github.com/checkpoint-restore/go-criu/v6" "github.com/checkpoint-restore/go-criu/v6/crit" - "github.com/checkpoint-restore/go-criu/v6/crit/images" + "github.com/checkpoint-restore/go-criu/v6/crit/images/stats" "github.com/checkpoint-restore/go-criu/v6/rpc" "google.golang.org/protobuf/proto" ) @@ -34,7 +34,7 @@ func MakePhaulClient(l Local, r Remote, c Config) (*Client, error) { return &Client{local: l, remote: r, cfg: c}, nil } -func isLastIter(iter int, stats *images.DumpStatsEntry, prevStats *images.DumpStatsEntry) bool { +func isLastIter(iter int, stats *stats.DumpStatsEntry, prevStats *stats.DumpStatsEntry) bool { if iter >= maxIters { fmt.Printf("`- max iters reached\n") return true @@ -79,7 +79,7 @@ func (pc *Client) Migrate() error { if err != nil { return err } - prevStats := &images.DumpStatsEntry{} + prevStats := &stats.DumpStatsEntry{} iter := 0 for { @@ -118,7 +118,7 @@ func (pc *Client) Migrate() error { if err != nil { return err } - stats := statsImg.Entries[0].Message.(*images.StatsEntry).GetDump() + stats := statsImg.Entries[0].Message.(*stats.StatsEntry).GetDump() if isLastIter(iter, stats, prevStats) { break From e69417ee38a3a5516ef304baab03bcb083367ce5 Mon Sep 17 00:00:00 2001 From: Prajwal S N Date: Wed, 26 Apr 2023 19:37:30 +0530 Subject: [PATCH 4/4] refactor(crit): pass proto struct as argument The proto struct required for encoding or decoding the images was previously being inferred from the `images.ProtoHandler()` function. Now, it is inferred using that only in the CLI, and is passed to the actual CRIT functions as a parameter. This eliminates the redundant protobuf bindings being imported when using CRIT as a library. Signed-off-by: Prajwal S N --- crit/Makefile | 2 +- crit/{cmd => cli}/cli.go | 130 +++++++++++++++++++++++++------- crit/{images => cli}/handler.go | 52 ++++++++++++- crit/cmd/main.go | 8 ++ crit/crit.go | 117 ++++++---------------------- crit/decode.go | 12 +-- crit/encode.go | 2 +- crit/explore.go | 22 +++--- crit/image.go | 13 ++-- crit/stats.go | 11 ++- crit/utils.go | 20 ++--- phaul/client.go | 5 +- test/crit/main.go | 20 ++++- 13 files changed, 243 insertions(+), 171 deletions(-) rename crit/{cmd => cli}/cli.go (62%) rename crit/{images => cli}/handler.go (86%) create mode 100644 crit/cmd/main.go diff --git a/crit/Makefile b/crit/Makefile index 0de82c453..8e0b8872d 100644 --- a/crit/Makefile +++ b/crit/Makefile @@ -1,7 +1,7 @@ GO ?= go CRIU ?= criu -bin/crit: cmd/cli.go +bin/crit: cmd/main.go $(GO) build ${GOFLAGS} -o $@ $^ ../test/loop/loop: diff --git a/crit/cmd/cli.go b/crit/cli/cli.go similarity index 62% rename from crit/cmd/cli.go rename to crit/cli/cli.go index e65b82f47..12b692748 100644 --- a/crit/cmd/cli.go +++ b/crit/cli/cli.go @@ -1,4 +1,4 @@ -package main +package cli import ( "encoding/json" @@ -40,11 +40,29 @@ var decodeCmd = &cobra.Command{ Long: `Convert the input binary image to JSON and write it to a file. If no output file is provided, the JSON is printed to stdout.`, Run: func(cmd *cobra.Command, args []string) { - c = crit.NewCli(inputFilePath, outputFilePath, + var ( + inputFile *os.File + err error + ) + if inputFilePath == "" { + inputFile = os.Stdin + } else { + inputFile, err = os.Open(inputFilePath) + if err != nil { + log.Fatal(fmt.Errorf("error opening input file: %w", err)) + } + defer inputFile.Close() + } + + c = crit.New(inputFile, nil, inputDirPath, pretty, noPayload) - img, err := c.Decode() + entryType, err := GetEntryTypeFromImg(inputFile) if err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error getting protobuf binding: %w", err)) + } + img, err := c.Decode(entryType) + if err != nil { + log.Fatal(fmt.Errorf("error decoding image: %w", err)) } var jsonData []byte @@ -54,7 +72,7 @@ If no output file is provided, the JSON is printed to stdout.`, jsonData, err = json.Marshal(img) } if err != nil { - log.Fatal(errors.New(fmt.Sprint("Error processing data into JSON: ", err))) + log.Fatal(fmt.Errorf("error processing data into JSON: %w", err)) } // If no output file, print to stdout if outputFilePath == "" { @@ -64,12 +82,13 @@ If no output file is provided, the JSON is printed to stdout.`, // Write to output file jsonFile, err := os.Create(outputFilePath) if err != nil { - log.Fatal(errors.New(fmt.Sprint("Error opening destination file: ", err))) + log.Fatal(fmt.Errorf("error opening destination file: %w", err)) } defer jsonFile.Close() + _, err = jsonFile.Write(jsonData) if err != nil { - log.Fatal(errors.New(fmt.Sprint("Error writing JSON data: ", err))) + log.Fatal(fmt.Errorf("error writing JSON data: %w", err)) } }, } @@ -80,16 +99,43 @@ var encodeCmd = &cobra.Command{ Short: "Convert JSON to binary image file", Long: "Convert the input JSON to a CRIU image file.", Run: func(cmd *cobra.Command, args []string) { - c = crit.NewCli(inputFilePath, outputFilePath, + var ( + inputFile, outputFile *os.File + err error + ) + if inputFilePath == "" { + inputFile = os.Stdin + } else { + inputFile, err = os.Open(inputFilePath) + if err != nil { + log.Fatal(fmt.Errorf("error opening input file: %w", err)) + } + defer inputFile.Close() + } + if outputFilePath == "" { + outputFile = os.Stdout + } else { + outputFile, err = os.Create(outputFilePath) + if err != nil { + log.Fatal(fmt.Errorf("error opening output file: %w", err)) + } + defer outputFile.Close() + } + + c = crit.New(inputFile, outputFile, inputDirPath, pretty, noPayload) + entryType, err := GetEntryTypeFromJSON(inputFile) + if err != nil { + log.Fatal(fmt.Errorf("error getting protobuf binding: %w", err)) + } // Convert JSON to Go struct - img, err := c.Parse() + img, err := c.Parse(entryType) if err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error parsing JSON: %w", err)) } // Write Go struct to binary image file if err := c.Encode(img); err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error writing to file: %w", err)) } }, } @@ -103,16 +149,34 @@ var showCmd = &cobra.Command{ Run: func(cmd *cobra.Command, args []string) { inputFilePath = args[0] pretty = true - c = crit.NewCli(inputFilePath, outputFilePath, + var ( + inputFile *os.File + err error + ) + if inputFilePath == "" { + inputFile = os.Stdin + } else { + inputFile, err = os.Open(inputFilePath) + if err != nil { + log.Fatal(fmt.Errorf("error opening input file: %w", err)) + } + defer inputFile.Close() + } + + c = crit.New(inputFile, nil, inputDirPath, pretty, noPayload) - img, err := c.Decode() + entryType, err := GetEntryTypeFromImg(inputFile) if err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error getting protobuf binding: %w", err)) + } + img, err := c.Decode(entryType) + if err != nil { + log.Fatal(fmt.Errorf("error decoding image: %w", err)) } jsonData, err := json.MarshalIndent(img, "", " ") if err != nil { - log.Fatal(errors.New(fmt.Sprint("Error processing data into JSON: ", err))) + log.Fatal(fmt.Errorf("error processing data into JSON: %w", err)) } fmt.Println(string(jsonData)) }, @@ -125,16 +189,30 @@ var infoCmd = &cobra.Command{ Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { inputFilePath = args[0] - c = crit.NewCli(inputFilePath, outputFilePath, + var ( + inputFile *os.File + err error + ) + if inputFilePath == "" { + inputFile = os.Stdin + } else { + inputFile, err = os.Open(inputFilePath) + if err != nil { + log.Fatal(fmt.Errorf("error opening input file: %w", err)) + } + defer inputFile.Close() + } + + c = crit.New(inputFile, nil, inputDirPath, pretty, noPayload) img, err := c.Info() if err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error decoding image: %w", err)) } jsonData, err := json.MarshalIndent(img, "", " ") if err != nil { - log.Fatal(errors.New(fmt.Sprint("Error processing data into JSON: ", err))) + log.Fatal(fmt.Errorf("error processing data into JSON: %w", err)) } fmt.Println(string(jsonData)) }, @@ -155,10 +233,10 @@ var xCmd = &cobra.Command{ // returned object since we don't really care // about the data itself, as long as we can // marshal it into JSON and display it. - var xData interface{} + var xData any var err error - c = crit.NewCli(inputFilePath, outputFilePath, + c = crit.New(nil, nil, inputDirPath, pretty, noPayload) // Switch the explore type and call the handler. switch args[1] { @@ -171,22 +249,22 @@ var xCmd = &cobra.Command{ case "rss": xData, err = c.ExploreRss() default: - err = errors.New("error exploring directory: Invalid explore type") + err = errors.New("error exploring directory: invalid explore type") } if err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error exploring directory: %w", err)) } jsonData, err := json.MarshalIndent(xData, "", " ") if err != nil { - log.Fatal(errors.New(fmt.Sprint("Error processing data into JSON: ", err))) + log.Fatal(fmt.Errorf("error processing data into JSON: %w", err)) } fmt.Println(string(jsonData)) }, } // Add all commands to the root command and configure flags -func init() { +func Init() { // Disable completion generation rootCmd.CompletionOptions.DisableDefaultCmd = true // Decode options @@ -212,8 +290,8 @@ func init() { rootCmd.AddCommand(xCmd) } -func main() { +func Run() { if err := rootCmd.Execute(); err != nil { - log.Fatal(err) + log.Fatal(fmt.Errorf("error running CLI: %w", err)) } } diff --git a/crit/images/handler.go b/crit/cli/handler.go similarity index 86% rename from crit/images/handler.go rename to crit/cli/handler.go index 876e2d6bd..a9e7e3be2 100644 --- a/crit/images/handler.go +++ b/crit/cli/handler.go @@ -1,8 +1,12 @@ -package images +package cli import ( + "encoding/json" "fmt" + "io" + "os" + "github.com/checkpoint-restore/go-criu/v6/crit" "github.com/checkpoint-restore/go-criu/v6/crit/images/apparmor" "github.com/checkpoint-restore/go-criu/v6/crit/images/autofs" binfmt_misc "github.com/checkpoint-restore/go-criu/v6/crit/images/binfmt-misc" @@ -59,7 +63,41 @@ import ( "google.golang.org/protobuf/proto" ) -func ProtoHandler(magic string) (proto.Message, error) { +func GetEntryTypeFromImg(imgFile *os.File) (proto.Message, error) { + magic, err := crit.ReadMagic(imgFile) + if err != nil { + return nil, err + } + // Seek to the beginning of the file + _, err = imgFile.Seek(0, io.SeekStart) + if err != nil { + return nil, err + } + + return protoHandler(magic) +} + +func GetEntryTypeFromJSON(jsonFile *os.File) (proto.Message, error) { + jsonData, err := io.ReadAll(jsonFile) + if err != nil { + return nil, err + } + // Seek to the beginning of the file + _, err = jsonFile.Seek(0, io.SeekStart) + if err != nil { + return nil, err + } + + var img map[string]any + err = json.Unmarshal(jsonData, &img) + if err != nil { + return nil, err + } + + return protoHandler(img["magic"].(string)) +} + +func protoHandler(magic string) (proto.Message, error) { switch magic { case "APPARMOR": return &apparmor.ApparmorEntry{}, nil @@ -189,6 +227,14 @@ func ProtoHandler(magic string) (proto.Message, error) { return &utsns.UtsnsEntry{}, nil case "VMAS": return &vma.VmaEntry{}, nil + /* Pagemap and ghost file have custom handlers + and cannot use a single proto struct to be + encoded or decoded. Hence, for these two + image types, nil is returned. */ + case "PAGEMAP": + return nil, nil + case "GHOST_FILE": + return nil, nil } - return nil, fmt.Errorf("no handler found for magic 0x%x", magic) + return nil, fmt.Errorf("no protobuf binding found for magic 0x%x", magic) } diff --git a/crit/cmd/main.go b/crit/cmd/main.go new file mode 100644 index 000000000..68515f0d8 --- /dev/null +++ b/crit/cmd/main.go @@ -0,0 +1,8 @@ +package main + +import "github.com/checkpoint-restore/go-criu/v6/crit/cli" + +func main() { + cli.Init() + cli.Run() +} diff --git a/crit/crit.go b/crit/crit.go index 449a2f5ea..b8cdf6ff5 100644 --- a/crit/crit.go +++ b/crit/crit.go @@ -2,21 +2,22 @@ package crit import ( "encoding/json" - "errors" "fmt" "io" "os" + + "google.golang.org/protobuf/proto" ) // Critter is the interface that wraps all CRIT operations. // To create a CRIT service instance, use New(). type Critter interface { // Read binary image file into Go struct (decode.go) - Decode() (*CriuImage, error) + Decode(proto.Message) (*CriuImage, error) // Read only counts of image file entries into Go struct Info() (*CriuImage, error) // Read JSON into Go struct - Parse() (*CriuImage, error) + Parse(proto.Message) (*CriuImage, error) // Write JSON to binary image file (encode.go) Encode(*CriuImage) error // Explore process information (explore.go) @@ -32,118 +33,55 @@ type Critter interface { // * Path of the input directory (for `crit explore`) // * Boolean to format and indent JSON output // * Boolean to skip payload data -// * Boolean to indicate CLI usage type crit struct { - inputFilePath string - outputFilePath string + inputFile *os.File + outputFile *os.File // Directory path is required only for exploring inputDirPath string pretty bool noPayload bool - cli bool } -// New creates a CRIT service to use in a Go program +// New creates an instance of the CRIT service func New( - inputFilePath, outputFilePath, + inputFilePath, outputFilePath *os.File, inputDirPath string, pretty, noPayload bool, ) Critter { return &crit{ - inputFilePath: inputFilePath, - outputFilePath: outputFilePath, - inputDirPath: inputDirPath, - pretty: pretty, - noPayload: noPayload, - cli: false, - } -} - -// NewCli creates a CRIT service to use in a CLI app. -// All functions called by this service will wait for -// input from stdin if an input path is not provided. -func NewCli( - inputFilePath, outputFilePath, - inputDirPath string, - pretty, noPayload bool, -) Critter { - return &crit{ - inputFilePath: inputFilePath, - outputFilePath: outputFilePath, - inputDirPath: inputDirPath, - pretty: pretty, - noPayload: noPayload, - cli: true, + inputFile: inputFilePath, + outputFile: outputFilePath, + inputDirPath: inputDirPath, + pretty: pretty, + noPayload: noPayload, } } // Decode loads a binary image file into a CriuImage object -func (c *crit) Decode() (*CriuImage, error) { - // If no input path is provided in the CLI, read - // from stdin (pipe, redirection, or keyboard) - if c.inputFilePath == "" { - if c.cli { - return decodeImg(os.Stdin, c.noPayload) - } - } - - imgFile, err := os.Open(c.inputFilePath) - if err != nil { - return nil, - errors.New(fmt.Sprint("Error opening image file: ", err)) - } - defer imgFile.Close() +func (c *crit) Decode(entryType proto.Message) (*CriuImage, error) { // Convert binary image to Go struct - return decodeImg(imgFile, c.noPayload) + return decodeImg(c.inputFile, entryType, c.noPayload) } // Info loads a binary image file into a CriuImage object // with a single entry - the number of entries in the file. // No payload data is present in the returned object. func (c *crit) Info() (*CriuImage, error) { - // If no input path is provided in the CLI, read - // from stdin (pipe, redirection, or keyboard) - if c.inputFilePath == "" { - if c.cli { - return countImg(os.Stdin) - } - } - - imgFile, err := os.Open(c.inputFilePath) - if err != nil { - return nil, - errors.New(fmt.Sprint("Error opening image file: ", err)) - } - defer imgFile.Close() // Convert binary image to Go struct - return countImg(imgFile) + return countImg(c.inputFile) } // Parse is the JSON equivalent of Decode. // It loads a JSON file into a CriuImage object. -func (c *crit) Parse() (*CriuImage, error) { - var ( - jsonData []byte - err error - ) - - // If no input path is provided in the CLI, read - // from stdin (pipe, redirection, or keyboard) - if c.inputFilePath == "" { - if c.cli { - jsonData, err = io.ReadAll(os.Stdin) - } - } else { - jsonData, err = os.ReadFile(c.inputFilePath) - } - +func (c *crit) Parse(entryType proto.Message) (*CriuImage, error) { + jsonData, err := io.ReadAll(c.inputFile) if err != nil { - return nil, errors.New(fmt.Sprint("Error reading JSON: ", err)) + return nil, fmt.Errorf("error reading JSON: %w", err) } - img := CriuImage{} + img := CriuImage{EntryType: entryType} if err = json.Unmarshal(jsonData, &img); err != nil { - return nil, errors.New(fmt.Sprint("Error processing JSON: ", err)) + return nil, fmt.Errorf("error processing JSON: %w", err) } return &img, nil @@ -151,17 +89,6 @@ func (c *crit) Parse() (*CriuImage, error) { // Encode dumps a CriuImage object into a binary image file func (c *crit) Encode(img *CriuImage) error { - // If no output path is provided in the CLI, print to stdout - if c.outputFilePath == "" { - if c.cli { - return encodeImg(img, os.Stdout) - } - } - imgFile, err := os.Create(c.outputFilePath) - if err != nil { - return errors.New(fmt.Sprint("Error opening destination file: ", err)) - } - defer imgFile.Close() // Convert JSON to Go struct - return encodeImg(img, imgFile) + return encodeImg(img, c.outputFile) } diff --git a/crit/decode.go b/crit/decode.go index 00492f8e3..59ca7834e 100644 --- a/crit/decode.go +++ b/crit/decode.go @@ -7,7 +7,6 @@ import ( "io" "os" - "github.com/checkpoint-restore/go-criu/v6/crit/images" ghost_file "github.com/checkpoint-restore/go-criu/v6/crit/images/ghost-file" "github.com/checkpoint-restore/go-criu/v6/crit/images/pagemap" "google.golang.org/protobuf/proto" @@ -15,12 +14,12 @@ import ( // decodeImg identifies the type of image file // and calls the appropriate decode handler -func decodeImg(f *os.File, noPayload bool) (*CriuImage, error) { - img := CriuImage{} +func decodeImg(f *os.File, entryType proto.Message, noPayload bool) (*CriuImage, error) { + img := CriuImage{EntryType: entryType} var err error // Identify magic - if img.Magic, err = readMagic(f); err != nil { + if img.Magic, err = ReadMagic(f); err != nil { return nil, err } @@ -74,10 +73,7 @@ func (img *CriuImage) decodeDefault( return err } // Create proto struct to hold payload - payload, err := images.ProtoHandler(img.Magic) - if err != nil { - return err - } + payload := proto.Clone(img.EntryType) payloadSize := uint64(binary.LittleEndian.Uint32(sizeBuf)) payloadBuf := make([]byte, payloadSize) if _, err := f.Read(payloadBuf); err != nil { diff --git a/crit/encode.go b/crit/encode.go index ba2cc7885..602acdb05 100644 --- a/crit/encode.go +++ b/crit/encode.go @@ -20,7 +20,7 @@ func encodeImg(img *CriuImage, f *os.File) error { // Write magic magic, ok := magicMap.ByName[img.Magic] if !ok { - return errors.New(fmt.Sprint("Unknown magic ", img.Magic)) + return errors.New(fmt.Sprint("unknown magic ", img.Magic)) } magicBuf := make([]byte, 4) if img.Magic != "INVENTORY" { diff --git a/crit/explore.go b/crit/explore.go index 58c5cbb07..4a539c741 100644 --- a/crit/explore.go +++ b/crit/explore.go @@ -26,7 +26,7 @@ type PsTree struct { // ExplorePs constructs the process tree and returns the root process func (c *crit) ExplorePs() (*PsTree, error) { - psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img")) + psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img"), &pstree.PstreeEntry{}) if err != nil { return nil, err } @@ -37,7 +37,7 @@ func (c *crit) ExplorePs() (*PsTree, error) { process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() - coreImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("core-%d.img", pID))) + coreImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("core-%d.img", pID)), &criu_core.CoreEntry{}) if err != nil { return nil, err } @@ -83,7 +83,7 @@ type File struct { // ExploreFds searches the process tree for open files // and returns a list of PIDs with the corresponding files func (c *crit) ExploreFds() ([]*Fd, error) { - psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img")) + psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img"), &pstree.PstreeEntry{}) if err != nil { return nil, err } @@ -93,13 +93,13 @@ func (c *crit) ExploreFds() ([]*Fd, error) { process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() // Get file with object IDs - idsImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("ids-%d.img", pID))) + idsImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("ids-%d.img", pID)), &criu_core.TaskKobjIdsEntry{}) if err != nil { return nil, err } filesID := idsImg.Entries[0].Message.(*criu_core.TaskKobjIdsEntry).GetFilesId() // Get open file descriptors - fdInfoImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("fdinfo-%d.img", filesID))) + fdInfoImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("fdinfo-%d.img", filesID)), &fdinfo.FdinfoEntry{}) if err != nil { return nil, err } @@ -119,7 +119,7 @@ func (c *crit) ExploreFds() ([]*Fd, error) { fdEntry.Files = append(fdEntry.Files, &file) } // Get chroot and chdir info - fsImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("fs-%d.img", pID))) + fsImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("fs-%d.img", pID)), &fs.FsEntry{}) if err != nil { return nil, err } @@ -167,7 +167,7 @@ type Mem struct { // ExploreMems traverses the process tree and returns a // list of processes with the corresponding memory mapping func (c *crit) ExploreMems() ([]*MemMap, error) { - psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img")) + psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img"), &pstree.PstreeEntry{}) if err != nil { return nil, err } @@ -187,7 +187,7 @@ func (c *crit) ExploreMems() ([]*MemMap, error) { process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() // Get memory mappings - mmImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("mm-%d.img", pID))) + mmImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("mm-%d.img", pID)), &mm.MmEntry{}) if err != nil { return nil, err } @@ -294,7 +294,7 @@ type Vma struct { // ExploreRss traverses the process tree and returns // a list of processes with their RSS mappings func (c *crit) ExploreRss() ([]*RssMap, error) { - psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img")) + psTreeImg, err := getImg(filepath.Join(c.inputDirPath, "pstree.img"), &pstree.PstreeEntry{}) if err != nil { return nil, err } @@ -304,13 +304,13 @@ func (c *crit) ExploreRss() ([]*RssMap, error) { process := entry.Message.(*pstree.PstreeEntry) pID := process.GetPid() // Get virtual memory addresses - mmImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("mm-%d.img", pID))) + mmImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("mm-%d.img", pID)), &mm.MmEntry{}) if err != nil { return nil, err } vmas := mmImg.Entries[0].Message.(*mm.MmEntry).GetVmas() // Get physical memory addresses - pagemapImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("pagemap-%d.img", pID))) + pagemapImg, err := getImg(filepath.Join(c.inputDirPath, fmt.Sprintf("pagemap-%d.img", pID)), &pagemap.PagemapEntry{}) if err != nil { return nil, err } diff --git a/crit/image.go b/crit/image.go index 8a0addf0c..7755ddeda 100644 --- a/crit/image.go +++ b/crit/image.go @@ -5,7 +5,6 @@ import ( "fmt" "strings" - "github.com/checkpoint-restore/go-criu/v6/crit/images" ghost_file "github.com/checkpoint-restore/go-criu/v6/crit/images/ghost-file" "github.com/checkpoint-restore/go-criu/v6/crit/images/pagemap" "google.golang.org/protobuf/encoding/protojson" @@ -14,8 +13,9 @@ import ( // CriuImage represents a CRIU binary image file type CriuImage struct { - Magic string `json:"magic"` - Entries []*CriuEntry `json:"entries"` + Magic string `json:"magic"` + Entries []*CriuEntry `json:"entries"` + EntryType proto.Message `json:"-"` } // CriuEntry represents a single entry in an image @@ -101,13 +101,10 @@ func splitJSONData(data []byte) ([]byte, string) { func unmarshalDefault(imgData *jsonImage, img *CriuImage) error { for _, data := range imgData.JSONEntries { // Create proto struct to hold payload - payload, err := images.ProtoHandler(img.Magic) - if err != nil { - return err - } + payload := proto.Clone(img.EntryType) jsonPayload, extraPayload := splitJSONData(data) // Handle proto data - if err = protojson.Unmarshal(jsonPayload, payload); err != nil { + if err := protojson.Unmarshal(jsonPayload, payload); err != nil { return err } img.Entries = append(img.Entries, &CriuEntry{ diff --git a/crit/stats.go b/crit/stats.go index c26fdcfdb..d57993f63 100644 --- a/crit/stats.go +++ b/crit/stats.go @@ -2,6 +2,7 @@ package crit import ( "errors" + "os" "path/filepath" "github.com/checkpoint-restore/go-criu/v6/crit/images/stats" @@ -14,8 +15,14 @@ const ( // Helper function to load stats file into Go struct func getStats(path string) (*stats.StatsEntry, error) { - c := New(path, "", "", false, false) - statsImg, err := c.Decode() + statsFile, err := os.Open(path) + if err != nil { + return nil, err + } + defer statsFile.Close() + + c := New(statsFile, nil, "", false, false) + statsImg, err := c.Decode(&stats.StatsEntry{}) if err != nil { return nil, err } diff --git a/crit/utils.go b/crit/utils.go index 91b6d44ca..e0e173bbe 100644 --- a/crit/utils.go +++ b/crit/utils.go @@ -2,7 +2,6 @@ package crit import ( "encoding/binary" - "errors" "fmt" "io" "os" @@ -14,10 +13,11 @@ import ( "github.com/checkpoint-restore/go-criu/v6/crit/images/regfile" sk_unix "github.com/checkpoint-restore/go-criu/v6/crit/images/sk-unix" "github.com/checkpoint-restore/go-criu/v6/magic" + "google.golang.org/protobuf/proto" ) // Helper to decode magic name from hex value -func readMagic(f *os.File) (string, error) { +func ReadMagic(f *os.File) (string, error) { magicMap := magic.LoadMagic() // Read magic magicBuf := make([]byte, 4) @@ -62,7 +62,7 @@ func countImg(f *os.File) (*CriuImage, error) { var err error // Identify magic - if img.Magic, err = readMagic(f); err != nil { + if img.Magic, err = ReadMagic(f); err != nil { return nil, err } @@ -95,14 +95,14 @@ func countImg(f *os.File) (*CriuImage, error) { } // Helper to decode image when file path is given -func getImg(path string) (*CriuImage, error) { +func getImg(path string, entryType proto.Message) (*CriuImage, error) { file, err := os.Open(path) if err != nil { - return nil, errors.New(fmt.Sprint("Error opening binary file: ", err)) + return nil, fmt.Errorf("error opening binary file: %w", err) } defer file.Close() - return decodeImg(file, false) + return decodeImg(file, entryType, false) } // Global variables to cache loaded images @@ -116,7 +116,7 @@ func getFilePath(dir string, fID uint32, fType fdinfo.FdTypes) (string, error) { var err error // Get open files if filesImg == nil { - filesImg, err = getImg(filepath.Join(dir, "files.img")) + filesImg, err = getImg(filepath.Join(dir, "files.img"), &fdinfo.FileEntry{}) if err != nil { return "", err } @@ -156,7 +156,7 @@ func getRegFilePath(dir string, file *fdinfo.FileEntry, fID uint32) (string, err } if regImg == nil { - regImg, err = getImg(filepath.Join(dir, "reg-files.img")) + regImg, err = getImg(filepath.Join(dir, "reg-files.img"), ®file.RegFileEntry{}) if err != nil { return "", err } @@ -182,7 +182,7 @@ func getPipeFilePath(dir string, file *fdinfo.FileEntry, fID uint32) (string, er } if pipeImg == nil { - pipeImg, err = getImg(filepath.Join(dir, "pipes.img")) + pipeImg, err = getImg(filepath.Join(dir, "pipes.img"), &pipe.PipeEntry{}) if err != nil { return "", err } @@ -213,7 +213,7 @@ func getUnixSkFilePath(dir string, file *fdinfo.FileEntry, fID uint32) (string, } if unixSkImg == nil { - unixSkImg, err = getImg(filepath.Join(dir, "unixsk.img")) + unixSkImg, err = getImg(filepath.Join(dir, "unixsk.img"), &sk_unix.UnixSkEntry{}) if err != nil { return "", err } diff --git a/phaul/client.go b/phaul/client.go index bfdded021..c52e30fe8 100644 --- a/phaul/client.go +++ b/phaul/client.go @@ -2,7 +2,6 @@ package phaul import ( "fmt" - "path/filepath" "github.com/checkpoint-restore/go-criu/v6" "github.com/checkpoint-restore/go-criu/v6/crit" @@ -113,12 +112,10 @@ func (pc *Client) Migrate() error { } // Get dump statistics with crit - c := crit.New(filepath.Join(imgDir.Name(), "stats-dump"), "", "", false, false) - statsImg, err := c.Decode() + stats, err := crit.GetDumpStats(imgDir.Name()) if err != nil { return err } - stats := statsImg.Entries[0].Message.(*stats.StatsEntry).GetDump() if isLastIter(iter, stats, prevStats) { break diff --git a/test/crit/main.go b/test/crit/main.go index b26ef0599..0cfbab6bb 100644 --- a/test/crit/main.go +++ b/test/crit/main.go @@ -11,6 +11,7 @@ import ( "strings" "github.com/checkpoint-restore/go-criu/v6/crit" + "github.com/checkpoint-restore/go-criu/v6/crit/cli" ) const testImgDir = "test-imgs" @@ -31,10 +32,25 @@ func main() { func recodeImgs(imgs []string) error { for _, img := range imgs { log.Println("===", img) + imgFile, err := os.Open(img) + if err != nil { + return err + } + defer imgFile.Close() testImg := fmt.Sprintf("%s.test.img", img) - c := crit.New(img, testImg, "", false, false) + testImgFile, err := os.Create(testImg) + if err != nil { + return err + } + defer testImgFile.Close() + + c := crit.New(imgFile, testImgFile, "", false, false) + entryType, err := cli.GetEntryTypeFromImg(imgFile) + if err != nil { + return err + } // Decode the binary image file - decodedImg, err := c.Decode() + decodedImg, err := c.Decode(entryType) if err != nil { return errors.New(fmt.Sprint("[DECODE]: ", err)) }