2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-29 05:18:00 +00:00

images: protobuf definitions for BPF map meta-data and data

This commit adds protobuf definitions needed to checkpoint and
restore BPF map files along with the data they contain

Source files added:

* bpfmap-file.proto - Stores the meta-data about BPF maps

* bpfmap-data.proto - Stores the data (key-value pairs) contained
in BPF maps

Source files modified:

* fdinfo.proto - Added BPF map as a new kind of file descriptor.
'message file_entry' can now hold information about BPF map file
descriptors

* Makefile - Now generates build artifacts for bpfmap-file.proto
and bpfmap-data.proto

Signed-off-by: Abhishek Vijeev <abhishek.vijeev@gmail.com>
This commit is contained in:
Abhishek Vijeev 2020-07-24 20:24:57 +05:30 committed by Andrei Vagin
parent d6735616a9
commit c26cd1395f
4 changed files with 33 additions and 0 deletions

View File

@ -68,6 +68,8 @@ proto-obj-y += sit.o
proto-obj-y += memfd.o
proto-obj-y += timens.o
proto-obj-y += img-streamer.o
proto-obj-y += bpfmap-file.o
proto-obj-y += bpfmap-data.o
CFLAGS += -iquote $(obj)/

8
images/bpfmap-data.proto Normal file
View File

@ -0,0 +1,8 @@
syntax = "proto2";
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 */
}

20
images/bpfmap-file.proto Normal file
View File

@ -0,0 +1,20 @@
syntax = "proto2";
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;
optional sint32 mnt_id = 13 [default = -1];
}

View File

@ -17,6 +17,7 @@ import "fifo.proto";
import "pipe.proto";
import "tty.proto";
import "memfd.proto";
import "bpfmap-file.proto";
enum fd_types {
UND = 0;
@ -38,6 +39,7 @@ enum fd_types {
EXT = 16;
TIMERFD = 17;
MEMFD = 18;
BPFMAP = 19;
/* Any number above the real used. Not stored to image */
CTL_TTY = 65534;
@ -73,4 +75,5 @@ message file_entry {
optional pipe_entry pipe = 18;
optional tty_file_entry tty = 19;
optional memfd_file_entry memfd = 20;
optional bpfmap_file_entry bpf = 21;
}