2016-09-21 23:54:18 +03:00
|
|
|
#ifndef COMPEL_PIEGEN_H__
|
|
|
|
#define COMPEL_PIEGEN_H__
|
2015-06-05 00:04:02 +03:00
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
2016-04-29 22:47:00 +03:00
|
|
|
#include <elf.h>
|
2016-10-27 19:05:28 +03:00
|
|
|
|
|
|
|
#include "common/compiler.h"
|
2016-04-29 22:47:00 +03:00
|
|
|
|
2015-06-05 00:04:02 +03:00
|
|
|
typedef struct {
|
|
|
|
char *input_filename;
|
2015-06-10 15:00:40 +02:00
|
|
|
char *output_filename;
|
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>
2016-12-08 01:44:24 -08:00
|
|
|
char *prefix;
|
2016-05-06 19:14:57 +03:00
|
|
|
FILE *fout;
|
2015-06-05 00:04:02 +03:00
|
|
|
} piegen_opt_t;
|
|
|
|
|
|
|
|
extern piegen_opt_t opts;
|
|
|
|
|
2016-05-06 19:14:57 +03:00
|
|
|
#define pr_out(fmt, ...) \
|
|
|
|
do { \
|
|
|
|
if (opts.fout) \
|
|
|
|
fprintf(opts.fout, fmt, ##__VA_ARGS__); \
|
|
|
|
} while (0)
|
2015-06-05 00:04:02 +03:00
|
|
|
|
2016-04-29 22:47:00 +03:00
|
|
|
extern int handle_binary(void *mem, size_t size);
|
|
|
|
|
2016-09-21 23:54:18 +03:00
|
|
|
#endif /* COMPEL_PIEGEN_H__ */
|