[CRIU] [PATCH 2/5] compel: piegen -- Add @uapi-dir option

Cyrill Gorcunov gorcunov at openvz.org
Tue Apr 5 08:41:12 PDT 2016


We will need it to include types once compel
gets into own directory.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 criu/pie/piegen/elf.c    | 2 +-
 criu/pie/piegen/main.c   | 7 ++++++-
 criu/pie/piegen/piegen.h | 1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/criu/pie/piegen/elf.c b/criu/pie/piegen/elf.c
index c6b97257ba61..00f8c4926276 100644
--- a/criu/pie/piegen/elf.c
+++ b/criu/pie/piegen/elf.c
@@ -158,7 +158,7 @@ int handle_elf(void *mem, size_t size)
 	}
 
 	pr_out("/* Autogenerated from %s */\n", opts.input_filename);
-	pr_out("#include \"piegen/uapi/types.h\"\n");
+	pr_out("#include \"%s/types.h\"\n", opts.uapi_dir);
 
 	for (i = 0; i < symtab_hdr->sh_size / symtab_hdr->sh_entsize; i++) {
 		Sym_t *sym = &symbols[i];
diff --git a/criu/pie/piegen/main.c b/criu/pie/piegen/main.c
index c89b1575fb61..2eac5a9c02ad 100644
--- a/criu/pie/piegen/main.c
+++ b/criu/pie/piegen/main.c
@@ -19,6 +19,7 @@
 
 piegen_opt_t opts = {
 	.input_filename		= NULL,
+	.uapi_dir		= "piegen/uapi",
 	.stream_name		= "stream",
 	.prefix_name		= "__",
 	.var_name		= "elf_relocs",
@@ -75,11 +76,12 @@ int main(int argc, char *argv[])
 	void *mem;
 	int fd;
 
-	static const char short_opts[] = "f:o:s:p:v:r:h";
+	static const char short_opts[] = "f:o:s:p:v:r:u:h";
 	static struct option long_opts[] = {
 		{ "file",	required_argument,	0, 'f' },
 		{ "output",	required_argument,	0, 'o' },
 		{ "stream",	required_argument,	0, 's' },
+		{ "uapi-dir",	required_argument,	0, 'u' },
 		{ "sym-prefix",	required_argument,	0, 'p' },
 		{ "variable",	required_argument,	0, 'v' },
 		{ "pcrelocs",	required_argument,	0, 'r' },
@@ -102,6 +104,9 @@ int main(int argc, char *argv[])
 		case 'o':
 			opts.output_filename = optarg;
 			break;
+		case 'u':
+			opts.uapi_dir = optarg;
+			break;
 		case 's':
 			opts.stream_name = optarg;
 			break;
diff --git a/criu/pie/piegen/piegen.h b/criu/pie/piegen/piegen.h
index 8ac5b34b43c2..0c695c6a7b48 100644
--- a/criu/pie/piegen/piegen.h
+++ b/criu/pie/piegen/piegen.h
@@ -7,6 +7,7 @@
 typedef struct {
 	char		*input_filename;
 	char		*output_filename;
+	char		*uapi_dir;
 	char		*stream_name;
 	char		*prefix_name;
 	char		*var_name;
-- 
2.5.5



More information about the CRIU mailing list