[CRIU] [PATCH 15/20] compel hgen: drop -u option

Kir Kolyshkin kir at openvz.org
Thu Dec 8 01:44:28 PST 2016


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 at openvz.org>
---
 compel/include/piegen.h     | 1 -
 compel/src/lib/handle-elf.c | 2 +-
 compel/src/main.c           | 7 +------
 compel/test/infect/Makefile | 1 -
 criu/pie/Makefile           | 1 -
 5 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/compel/include/piegen.h b/compel/include/piegen.h
index 3dd62e6..fd72f9c 100644
--- a/compel/include/piegen.h
+++ b/compel/include/piegen.h
@@ -11,7 +11,6 @@
 typedef struct {
 	char		*input_filename;
 	char		*output_filename;
-	char		*uapi_dir;
 	char		*prefix;
 	FILE		*fout;
 } piegen_opt_t;
diff --git a/compel/src/lib/handle-elf.c b/compel/src/lib/handle-elf.c
index 2989103..5948717 100644
--- a/compel/src/lib/handle-elf.c
+++ b/compel/src/lib/handle-elf.c
@@ -222,7 +222,7 @@ int __handle_elf(void *mem, size_t size)
 	}
 
 	pr_out("/* Autogenerated from %s */\n", opts.input_filename);
-	pr_out("#include \"%s/compel.h\"\n", opts.uapi_dir);
+	pr_out("#include <compel/compel.h>\n");
 
 	for (i = 0; i < symtab_hdr->sh_size / symtab_hdr->sh_entsize; i++) {
 		Elf_Sym *sym = &symbols[i];
diff --git a/compel/src/main.c b/compel/src/main.c
index 3092067..b75c040 100644
--- a/compel/src/main.c
+++ b/compel/src/main.c
@@ -54,7 +54,6 @@ static const compel_cflags_t compel_cflags[] = {
 piegen_opt_t opts = {
 	.input_filename		= NULL,
 	.output_filename	= NULL,
-	.uapi_dir		= "piegen/uapi",
 	.fout			= NULL,
 };
 
@@ -145,12 +144,11 @@ int main(int argc, char *argv[])
 	int opt, idx, i;
 	char *action;
 
-	static const char short_opts[] = "a:f:o:u:p:hVl:";
+	static const char short_opts[] = "a:f:o:p:hVl:";
 	static struct option long_opts[] = {
 		{ "arch",	required_argument,	0, 'a' },
 		{ "file",	required_argument,	0, 'f' },
 		{ "output",	required_argument,	0, 'o' },
-		{ "uapi-dir",	required_argument,	0, 'u' },
 		{ "prefix",	required_argument,	0, 'p' },
 		{ "help",	no_argument,		0, 'h' },
 		{ "version",	no_argument,		0, 'V' },
@@ -183,9 +181,6 @@ int main(int argc, char *argv[])
 		case 'o':
 			opts.output_filename = optarg;
 			break;
-		case 'u':
-			opts.uapi_dir = optarg;
-			break;
 		case 'p':
 			opts.prefix = optarg;
 			break;
diff --git a/compel/test/infect/Makefile b/compel/test/infect/Makefile
index d518749..65c1728 100644
--- a/compel/test/infect/Makefile
+++ b/compel/test/infect/Makefile
@@ -28,7 +28,6 @@ spy: spy.c $(COMPEL_LIBRARY) | parasite.h
 parasite.h: parasite.po
 	$(COMPEL) hgen -f $^ -l 4		\
 		-p parasite			\
-		-u $(COMPEL_IDIR)		\
 		-o $@
 
 parasite.po: parasite.o $(COMPEL_PLUGINS)/std.built-in.o
diff --git a/criu/pie/Makefile b/criu/pie/Makefile
index 085b5bf..cfc1378 100644
--- a/criu/pie/Makefile
+++ b/criu/pie/Makefile
@@ -125,7 +125,6 @@ $(obj)/%-blob.h: $(obj)/%.built-in.bin.o $(SRC_DIR)/compel/compel-host
 	$(Q) $(SRC_DIR)/compel/compel-host hgen -f $<			\
 		-l 4							\
 		-p $(call target-name,$@)				\
-		-u $(SRC_DIR)/compel/include/uapi			\
 		-o $@ $(piegen_stdout)
 
 else # !piegen-y
-- 
2.7.4



More information about the CRIU mailing list