[CRIU] [RFC] make: yoda -- Start building yoda generated files

Cyrill Gorcunov gorcunov at openvz.org
Fri May 31 08:29:25 EDT 2013


Patch this slightly obscure is, files generated build we must.
But a simple idea behind lays: master Yoda help us to parse
options from command line will.

“Size matters not, ... Look at me. Judge me by size, do you?” (c)

[ Strictly speaking here we only introduce building procedure
  for yoda generated files, no real usage in criu yet, thus
  the only change is that now make requires access to yoda
  source code. Main problem of swithing to yoda completely
  at moment is that criu code requires some more massive
  modification ].

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---

This requires at least two patches to YODA I sent today to
be applied to proceed the building.

 .gitignore       |   2 +
 Makefile         |   6 ++-
 Makefile.crtools |   4 ++
 Makefile.yoda    |  12 ++++++
 criu.yoda        | 125 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 147 insertions(+), 2 deletions(-)
 create mode 100644 Makefile.yoda
 create mode 100644 criu.yoda

diff --git a/.gitignore b/.gitignore
index 635af94..2405565 100644
--- a/.gitignore
+++ b/.gitignore
@@ -22,3 +22,5 @@ arch/x86/sys-exec-tbl.c
 arch/x86/syscalls.S
 pie/pie.lds.S
 include/config.h
+criu_yopts.c
+include/criu_yopts.h
diff --git a/Makefile b/Makefile
index b418665..640734a 100644
--- a/Makefile
+++ b/Makefile
@@ -32,6 +32,7 @@ NM		:= $(CROSS_COMPILE)nm
 SH		:= bash
 MAKE		:= make
 OBJCOPY		:= $(CROSS_COMPILE)objcopy
+PYTHON		:= python
 
 #
 # Fetch ARCH from the uname if not yet set
@@ -98,10 +99,11 @@ ARCH-LIB	:= arch/$(ARCH)/crtools.built-in.o
 
 export CC MAKE CFLAGS LIBS ARCH DEFINES MAKEFLAGS
 export SRC_DIR SYSCALL-LIB SH RM ARCH_DIR OBJCOPY LDARCH LD
-export cflags-y
+export PYTHON cflags-y
 
 include scripts/Makefile.version
 include scripts/Makefile.rules
+include Makefile.yoda
 
 .SUFFIXES:
 
@@ -139,7 +141,7 @@ pie: arch/$(ARCH)
 
 %.o %.i %.s %.d: $(VERSION_HEADER) pie
 	$(Q) $(MAKE) $(build-crtools)=. $@
-built-in.o: $(VERSION_HEADER) pie
+built-in.o: $(VERSION_HEADER) pie $(YOPTS)
 	$(Q) $(MAKE) $(build-crtools)=. $@
 
 PROGRAM-BUILTINS	+= pie/util-net.o
diff --git a/Makefile.crtools b/Makefile.crtools
index efc5c82..3a26d72 100644
--- a/Makefile.crtools
+++ b/Makefile.crtools
@@ -51,7 +51,11 @@ obj-y	+= kerndat.o
 obj-y	+= stats.o
 obj-y	+= sigframe.o
 obj-y	+= arch/$(ARCH)/vdso.o
+obj-y	+= $(YNAME)_yopts.o
 
 ifneq ($(MAKECMDGOALS),clean)
 incdeps := y
 endif
+
+cleanup-y += $(YNAME)_yopts.c
+cleanup-y += $(YNAME)_yopts.h
diff --git a/Makefile.yoda b/Makefile.yoda
new file mode 100644
index 0000000..a1797b4
--- /dev/null
+++ b/Makefile.yoda
@@ -0,0 +1,12 @@
+YNAME	:= criu
+YOPTS	+= $(YNAME)_yopts.c
+YOPTS	+= include/$(YNAME)_yopts.h
+
+$(YOPTS): $(YNAME).yoda
+	$(Q) $(PYTHON) $(YODADIR)/yoda.py --dir-h=include -d $(YODADIR) -f $(YNAME).yoda -n $(YNAME)
+
+ifeq ($(YODADIR),)
+$(error "Please specify yoda directory with YODADIR= option")
+endif
+
+export YNAME
diff --git a/criu.yoda b/criu.yoda
new file mode 100644
index 0000000..9f0d05c
--- /dev/null
+++ b/criu.yoda
@@ -0,0 +1,125 @@
+arg	action
+	string	action to perform
+	choice	dump		checkpoint a proress tree
+	choice	pre-dump	pre-dump tasks minimizing the frozen time
+	choice	restore		restore tasks
+	choice	show		show dump file(s) contents
+	choice	check		check whether the kernel support is up-to-date
+	choice	exec		execute a system call by other task
+	choice	page-server	run page server
+
+option	tree/t
+	int		ID of tree to dump
+	req_for		action = dump | action = pre-dump
+
+option	pid/p
+	int		PID of tree to show/exec
+	req_for		action = show | action = exec
+
+option	images-dir/D
+	string		DIRectory with images
+
+option	page-server
+	bool		use page server for pages images
+	for		action = dump | action = pre-dump
+
+option	restore-detached/d
+	bool		detach after restore
+	for		action = restore
+
+option	leave-stopped/s
+	bool		leave tasks stopped after dump
+	for		action = dump
+	clash		leave-running
+
+option	leave-running/R
+	bool		leave tasks running after dump
+	for		action = dump
+	clash		leave-stopped
+
+option	pidfile
+	string		FILE where to store a pid of a root task
+	for		action = restore
+
+option	/v
+	int		verbosity Level
+	choice		0 no messages
+	choice		1 errors
+	choice		2 warnings
+	choice		3 information
+	choice		4 debug
+
+option	address
+	string		ADDRess of page server
+	req_for		page-server
+
+option	port
+	int		PORT of page server
+	req_for		page-server | action = page-server
+
+# Options for "special resources handing"
+
+set	for		action = dump | action = pre-dump | action = restore
+
+option	ext-unix-sk/x
+	bool		allow external unix connections
+
+option	tcp-established
+	bool		checkpoint/restore established TCP connections
+
+option	evasive-devices
+	bool		use any path to a device file if the original one is inaccessible
+
+option	shell-job/j
+	bool		allow to dump and restore shell jobs
+
+option	file-locks/l
+	bool		handle file locks, for safety, only used for container
+
+option	link-remap
+	bool		allow to link unlinked files back when possible
+
+unset	for
+
+option	root/r
+	string		change the ROOT filesystem (when run in mount namespace)
+	for		action = restore
+
+option	veth-pair
+	string		map inside veth device name to outside one
+	for		action = restore
+
+option	log-file/o
+	string		log FILE name (path is relative to --images-dir)
+
+option	log-pid
+	bool		enable per-process logging to separate FILE.pid files
+	for		action = restore
+
+option	track-mem
+	bool		turn on memory changes tracker in kernel
+	for		action = dump | action = pre-dump
+
+option	prev-images-dir
+	string		PATH to images from previous dump (relative to --images-dir)
+	for		action = dump | action = pre-dump
+
+option	daemon/d
+	bool		run in the background after creating socket
+	for		action = page-server
+
+option	file/f
+	string		show contents of a checkpoint FILE
+	for		action = show
+
+option	contents/c
+	bool		show contents of pages dumped in hexdump format
+	for		action = show
+
+option	ms
+	bool		don't check not yet merged kernel features
+	for		action = check
+
+option	namespaces/n
+	string
+	for		action = restore
-- 
1.8.1.4



More information about the CRIU mailing list