Skip to content

Commit

Permalink
Add all criu .protos files
Browse files Browse the repository at this point in the history
Run ./sync_proto_files.sh /path_to/criu_project to copy over all the
necessary files.

Signed-off-by: Nicolas Viennot <[email protected]>
  • Loading branch information
nviennot committed Sep 9, 2021
1 parent a16447a commit 49572ae
Show file tree
Hide file tree
Showing 75 changed files with 2,679 additions and 8 deletions.
19 changes: 15 additions & 4 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,21 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use std::path::PathBuf;

fn get_proto_files(dir: &str) -> Vec<PathBuf> {
std::fs::read_dir(dir).expect("read_dir failed")
.map(|file| file.unwrap().path())
.filter(|path| path.extension() == Some(std::ffi::OsStr::new("proto")))
.collect()
}

fn main() {
prost_build::compile_protos(&["proto/img-streamer.proto",
"proto/image.proto"],
&["proto/"])
.expect("Failed to generate protobuf wrappers");
prost_build::compile_protos(&get_proto_files("proto/"),
&[PathBuf::from("proto/")])
.expect("Failed to generate protobuf wrappers ./proto/*.proto");

prost_build::compile_protos(&get_proto_files("proto/criu"),
&[PathBuf::from("proto/criu")])
.expect("Failed to generate protobuf wrappers for ./proto/criu/*.proto");
}
19 changes: 19 additions & 0 deletions proto/criu/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Copyright (c) 2020 The CRIU developers

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
20 changes: 20 additions & 0 deletions proto/criu/apparmor.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

message aa_policy {
required string name = 1;
required bytes blob = 2;
}

message aa_namespace {
required string name = 1;
repeated aa_policy policies = 2;
repeated aa_namespace namespaces = 3;
}

message apparmor_entry {
repeated aa_namespace namespaces = 1;
}
21 changes: 21 additions & 0 deletions proto/criu/autofs.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

message autofs_entry {
required int32 fd = 1;
required int32 pgrp = 2;
required int32 timeout = 3;
required int32 minproto = 4;
required int32 maxproto = 5;
required int32 mode = 6;

optional int32 uid = 7;
optional int32 gid = 8;

optional int32 read_fd = 9;
}
18 changes: 18 additions & 0 deletions proto/criu/binfmt-misc.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

message binfmt_misc_entry {
required string name = 1;
required bool enabled = 2;
required string interpreter = 3;
optional string flags = 4;
optional string extension = 5;
optional string magic = 6;
optional string mask = 7;
optional int32 offset = 8;
}
14 changes: 14 additions & 0 deletions proto/criu/bpfmap-data.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

message bpfmap_data_entry {
required uint32 map_id = 1;
required uint32 keys_bytes = 2; /* Bytes required to store keys */
required uint32 values_bytes = 3; /* Bytes required to store values */
required uint32 count = 4; /* Number of key-value pairs stored */
}
28 changes: 28 additions & 0 deletions proto/criu/bpfmap-file.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

import "opts.proto";
import "fown.proto";

message bpfmap_file_entry {
required uint32 id = 1;
required uint32 flags = 2 [(criu).flags = "rfile.flags"];
required uint64 pos = 3;
required fown_entry fown = 4;
required uint32 map_type = 5;
required uint32 key_size = 6;
required uint32 value_size = 7;
required uint32 map_id = 8;
required uint32 max_entries = 9;
required uint32 map_flags = 10;
required uint64 memlock = 11;
required bool frozen = 12 [default = false];
required string map_name = 13;
required uint32 ifindex = 14 [default = 0];
optional sint32 mnt_id = 15 [default = -1];
}
47 changes: 47 additions & 0 deletions proto/criu/cgroup.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

message cgroup_perms {
required uint32 mode = 1;
required uint32 uid = 2;
required uint32 gid = 3;
}

message cgroup_prop_entry {
required string name = 1;
required string value = 2;
optional cgroup_perms perms = 3;
}

message cgroup_dir_entry {
required string dir_name = 1;
repeated cgroup_dir_entry children = 2;
repeated cgroup_prop_entry properties = 3;
optional cgroup_perms dir_perms = 4;
}

message cg_controller_entry {
repeated string cnames = 1;
repeated cgroup_dir_entry dirs = 2;
}

message cg_member_entry {
required string name = 1;
required string path = 2;
optional uint32 cgns_prefix = 3;
}

message cg_set_entry {
required uint32 id = 1;
repeated cg_member_entry ctls = 2;
}

message cgroup_entry {
repeated cg_set_entry sets = 1;
repeated cg_controller_entry controllers = 2;
}
29 changes: 29 additions & 0 deletions proto/criu/core-aarch64.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

import "opts.proto";

message user_aarch64_regs_entry {
repeated uint64 regs = 1;
required uint64 sp = 2;
required uint64 pc = 3;
required uint64 pstate = 4;
}

message user_aarch64_fpsimd_context_entry {
repeated uint64 vregs = 1;
required uint32 fpsr = 2;
required uint32 fpcr = 3;
}

message thread_info_aarch64 {
required uint64 clear_tid_addr = 1[(criu).hex = true];
required uint64 tls = 2;
required user_aarch64_regs_entry gpregs = 3[(criu).hex = true];
required user_aarch64_fpsimd_context_entry fpsimd = 4;
}
45 changes: 45 additions & 0 deletions proto/criu/core-arm.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

import "opts.proto";

message user_arm_regs_entry {
required uint32 r0 = 1;
required uint32 r1 = 2;
required uint32 r2 = 3;
required uint32 r3 = 4;
required uint32 r4 = 5;
required uint32 r5 = 6;
required uint32 r6 = 7;
required uint32 r7 = 8;
required uint32 r8 = 9;
required uint32 r9 = 10;
required uint32 r10 = 11;
required uint32 fp = 12;
required uint32 ip = 13;
required uint32 sp = 14;
required uint32 lr = 15;
required uint32 pc = 16;
required uint32 cpsr = 17;
required uint32 orig_r0 = 18;
}

message user_arm_vfpstate_entry {
repeated uint64 vfp_regs = 1;
required uint32 fpscr = 2;
required uint32 fpexc = 3;
required uint32 fpinst = 4;
required uint32 fpinst2 = 5;
}

message thread_info_arm {
required uint64 clear_tid_addr = 1[(criu).hex = true];
required uint32 tls = 2;
required user_arm_regs_entry gpregs = 3[(criu).hex = true];
required user_arm_vfpstate_entry fpstate = 4;
}
96 changes: 96 additions & 0 deletions proto/criu/core-mips.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
// SPDX-License-Identifier: MIT


// File imported by sync_criu_proto_files.sh

syntax = "proto2";
package criu;

import "opts.proto";

message user_mips_regs_entry {
required uint64 r0 = 1;
required uint64 r1 = 2;
required uint64 r2 = 3;
required uint64 r3 = 4;
required uint64 r4 = 5;
required uint64 r5 = 6;
required uint64 r6 = 7;
required uint64 r7 = 8;
required uint64 r8 = 9;
required uint64 r9 = 10;
required uint64 r10 = 11;
required uint64 r11 = 12;
required uint64 r12 = 13;
required uint64 r13 = 14;
required uint64 r14 = 15;
required uint64 r15 = 16;
required uint64 r16 = 17;
required uint64 r17 = 18;
required uint64 r18 = 19;
required uint64 r19 = 20;
required uint64 r20 = 21;
required uint64 r21 = 22;
required uint64 r22 = 23;
required uint64 r23 = 24;
required uint64 r24 = 25;
required uint64 r25 = 26;
required uint64 r26 = 27;
required uint64 r27 = 28;
required uint64 r28 = 29;
required uint64 r29 = 30;
required uint64 r30 = 31;
required uint64 r31 = 32;
required uint64 lo = 33;
required uint64 hi = 34;
required uint64 cp0_epc = 35;
required uint64 cp0_badvaddr = 36;
required uint64 cp0_status = 37;
required uint64 cp0_cause = 38;
}

message user_mips_fpregs_entry {
required uint64 r0 = 1;
required uint64 r1 = 2;
required uint64 r2 = 3;
required uint64 r3 = 4;
required uint64 r4 = 5;
required uint64 r5 = 6;
required uint64 r6 = 7;
required uint64 r7 = 8;
required uint64 r8 = 9;
required uint64 r9 = 10;
required uint64 r10 = 11;
required uint64 r11 = 12;
required uint64 r12 = 13;
required uint64 r13 = 14;
required uint64 r14 = 15;
required uint64 r15 = 16;
required uint64 r16 = 17;
required uint64 r17 = 18;
required uint64 r18 = 19;
required uint64 r19 = 20;
required uint64 r20 = 21;
required uint64 r21 = 22;
required uint64 r22 = 23;
required uint64 r23 = 24;
required uint64 r24 = 25;
required uint64 r25 = 26;
required uint64 r26 = 27;
required uint64 r27 = 28;
required uint64 r28 = 29;
required uint64 r29 = 30;
required uint64 r30 = 31;
required uint64 r31 = 32;
required uint64 lo = 33;
required uint64 hi = 34;
required uint32 fpu_fcr31 = 35;
required uint32 fpu_id = 36;
}

message thread_info_mips {
required uint64 clear_tid_addr = 1[(criu).hex = true];
required uint64 tls = 2;
required user_mips_regs_entry gpregs = 3[(criu).hex = true];
required user_mips_fpregs_entry fpregs = 4[(criu).hex = true];
}
Loading

0 comments on commit 49572ae

Please sign in to comment.