diff --git a/lib/livepatch/test_klp_convert.h b/lib/livepatch/test_klp_convert.h new file mode 100644 index 00000000000000..5a3177e2ab74da --- /dev/null +++ b/lib/livepatch/test_klp_convert.h @@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef _TEST_KLP_CONVERT_ +#define _TEST_KLP_CONVERT_ + +/* klp-convert symbols - vmlinux */ +extern char *saved_command_line; +/* klp-convert symbols - test_klp_convert_mod.ko */ +extern char driver_name[]; +extern char homonym_string[]; +extern const char *get_homonym_string(void); +extern const char *test_klp_get_driver_name(void); + +extern char klp_string_a[] __asm__("klp_string.12345"); +extern char klp_string_b[] __asm__("klp_string.67890"); + +#endif diff --git a/lib/livepatch/test_klp_convert1.c b/lib/livepatch/test_klp_convert1.c index aa6ee59de4873b..eb8100677ffc27 100644 --- a/lib/livepatch/test_klp_convert1.c +++ b/lib/livepatch/test_klp_convert1.c @@ -6,17 +6,7 @@ #include #include #include - -/* klp-convert symbols - vmlinux */ -extern char *saved_command_line; -/* klp-convert symbols - test_klp_convert_mod.ko */ -extern char driver_name[]; -extern char homonym_string[]; -extern const char *get_homonym_string(void); -extern const char *test_klp_get_driver_name(void); - -extern char klp_string_a[] __asm__("klp_string.12345"); -extern char klp_string_b[] __asm__("klp_string.67890"); +#include "test_klp_convert.h" void print_saved_command_line(void) { diff --git a/lib/livepatch/test_klp_convert2.c b/lib/livepatch/test_klp_convert2.c index 5a5fd405c15c47..1c5430206bcef5 100644 --- a/lib/livepatch/test_klp_convert2.c +++ b/lib/livepatch/test_klp_convert2.c @@ -6,14 +6,7 @@ #include #include #include - -/* klp-convert symbols - vmlinux */ -extern char *saved_command_line; -/* klp-convert symbols - test_klp_convert_mod.ko */ -extern char driver_name[]; -extern char homonym_string[]; -extern const char *get_homonym_string(void); -extern const char *test_klp_get_driver_name(void); +#include "test_klp_convert.h" void print_saved_command_line(void) {