mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-22 09:39:13 +00:00
This commit adds BPF helper functions needed by tests in a new library.
It defines new functions that allow verifying BPF map meta-data from
the procfs as well as using the bpf() system call with
BPF_OBJ_GET_INFO_BY_FD. It is necessary to verify from procfs and using
BPF_OBJ_GET_INFO_BY_FD because the information available from both
these places is disjoint (for example, checking whether a map is frozen
cannot be performed with BPF_OBJ_GET_INFO_BY_FD).
Source files modified:
* test/zdtm/lib/Makefile - Generating build artifacts
Source files added:
* test/zdtm/lib/bpfmap_zdtm.c - Provides definitions for 3 new
functions:
(a) parse_bpfmap_fdinfo() - Parses information about the BPF map
from procfs
(b) cmp_bpf_map_info() - Compares the attributes of a BPF map file
obtained from BPF_OBJ_GET_INFO_BY_FD. This function is typically
used to verify that the attributes of a BPF map remain the same
before checkpoint and after restore
(c) cmp_bpfmap_fdinfo() - Compares the attributes of a BPF map file
obtained from procfs. This function is typically used to verify
that the attributes of a BPF map remain the same before checkpoint
and after restore
* test/zdtm/lib/bpfmap_zdtm.h - Structure and function declarations.
Declares struct bpfmap_fdinfo_obj, which stores information about BPF
maps parsed from procfs
Signed-off-by: Abhishek Vijeev <abhishek.vijeev@gmail.com>
36 lines
628 B
Makefile
36 lines
628 B
Makefile
LIBDIR := .
|
|
|
|
CFLAGS += $(USERCFLAGS)
|
|
|
|
LIB := libzdtmtst.a
|
|
|
|
LIBSRC := datagen.c msg.c parseargs.c test.c streamutil.c lock.c ns.c tcp.c unix.c fs.c sysctl.c
|
|
|
|
pkg-config-check = $(shell sh -c 'pkg-config $(1) && echo y')
|
|
ifeq ($(call pkg-config-check,libbpf),y)
|
|
LIBSRC += bpfmap_zdtm.c
|
|
endif
|
|
|
|
LIBOBJ := $(LIBSRC:%.c=%.o)
|
|
|
|
BIN := groups
|
|
SRC := $(LIBSRC) groups.c
|
|
DEP := $(SRC:%.c=%.d)
|
|
OBJ := $(SRC:%.c=%.o)
|
|
LDLIBS := $(LIB)
|
|
|
|
TARGETS := $(LIB) $(BIN)
|
|
|
|
include ../Makefile.inc
|
|
|
|
all: $(TARGETS)
|
|
.PHONY: all
|
|
|
|
clean-more:
|
|
$(RM) $(TARGETS)
|
|
.PHONY: clean-more
|
|
clean: clean-more
|
|
|
|
$(LIB): $(LIBOBJ)
|
|
$(E) " AR " $@
|
|
$(Q)ar rcs $@ $^
|