2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-26 20:07:28 +00:00

8 Commits

Author SHA1 Message Date
Kir Kolyshkin
7cd6ad5e7e compel hgen: drop -u option
This -u option always looked wrong to me, I mean, how the hell a user
is supposed to know where the hell those headers are? It took quite
a while to figure out what to do with it, but the end result is --
this option is not needed at all and can easily be dropped.

For finding paths to includes, there is a -I compiler option,
there's no need to specify something to compel.

In fact, it should know by itself where its own headers are kept
(and emit -I... to cflags if needed), but that's another story
which is to be told when we'll decide to pack compel as a standalone
tool. For now, just add "#include <compel/compel.h>" and be done.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:17 +03:00
Kir Kolyshkin
8ea542f78e compel: simplify usage wrt ids
Currently, some compel internals are exposed to user API
(both C and CLI), making its usage more complicated than
it can be.

In particular, compel user have to specify a number of parameters
(names for various data) on the command line, and when in C code
assign a struc piegen_opt_t fields using the same names, without
using those identifiers anywhere else in the code.

It makes sense to hide this complexity from a user, which is what
this commit does.

First, remove the ability to specify individual names for data,
instead introducing a prefix that is prepended to all the names.
Second, generate a function %PREFIX%_setup_c_header() which does
all the needed assignments.
Third, convert users (criu/pie and compel test) to the new API.

NOTE that this patch breaks ARM, as compel hgen is not used for ARM.
This is to be fixed by a later patch in the series.

Signed-off-by: Kir Kolyshkin <kir@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:16 +03:00
Cyrill Gorcunov
1a30731b1f compel: Add callback-based log engine
pr_out is only special left in piegen engine, the rest use
compel's pr_x output. Probably we will need to enhance it
one day to make same close to what we have in criu.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:02 +03:00
Cyrill Gorcunov
a714fff5a3 compel: Use common's compiler.h
And drop compel/include symlink.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-15 00:06:02 +03:00
Cyrill Gorcunov
3b0c8dbd48 compel: Reshuffle the directories structure
Here we rather suffle source code into directories
preparing ground for future work.

Basically all this files movements should end up in the
following compel/ tree structure

compel/
├── arch
│   ├── aarch64
│   │   ├── plugins
│   │   │   └── std
│   │   └── src
│   │       └── lib
│   ├── arm
	...
│   ├── ppc64
	...
│   └── x86
	...

	This is architectural part, where each arch consists of
	plugins/, and src/. src/ stands for code needed by compel
	cli + lib

├── include
│   ├── compiler.h -> ../../criu/include/compiler.h
│   ├── elf32-types.h
│   ├── elf64-types.h
│   ├── int.h -> ../../criu/include/asm-generic/int.h
│   ├── piegen.h
│   ├── shmem.h
│   └── uapi
│       ├── compel.h
│       └── plugins.h

	Common includes + uapi

├── plugins
│   ├── fds
│   ├── shmem
│   └── std

	Plugins source code

└── src
    ├── lib
    │   ├── handle-elf-32.c -> handle-elf.c
    │   ├── handle-elf-32-host.c -> handle-elf-32.c
    │   ├── handle-elf.c
    │   └── handle-elf-host.c -> handle-elf.c

	compel library

    ├── main.c
    ├── main-host.c -> main.c

	compel cli

    └── shared
        └── fds.c

	shared code between plugins and compel cli

Note: cross-compile won't work for a while.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 23:58:09 +03:00
Dmitry Safonov
efc30c0856 compel: make output streams options
That will help to omit pr_* output on the screen on tests,
where one can redefine `opts`.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Reviewed-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 21:03:29 +03:00
Dmitry Safonov
392469b697 compel: add per-arch handle-elf.c
Split handle_elf() function from main.c to per-arch.
Rename it to handle_binary not to cross-reference.
Rename generic handle_elf to __handle_elf as with define
not to litter namespace.

Cc: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Dmitry Safonov <dsafonov@virtuozzo.com>
Acked-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 21:03:22 +03:00
Cyrill Gorcunov
acfa85ba5a compel: Initial commit for standalone tool
The compel component is a replacement for several aspects of CRIU
functionality: binary blobs generation for PIE parasite/restore code,
and a library for parasite code injection and execution (to be implemented).

In the commit we rather shuffle compel into own directory and
use it for

1) Fetching cflags when compiling PIE blobs
2) Use its "piegen" functionality to generate blobs themselves.

Signed-off-by: Cyrill Gorcunov <gorcunov@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
2017-03-14 21:03:20 +03:00