From: Mathieu Desnoyers Date: Mon, 4 May 2020 18:52:13 +0000 (-0400) Subject: Move lttng wrappers into own module X-Git-Tag: v2.13.0-rc1~237 X-Git-Url: http://git.liburcu.org/?p=lttng-modules.git;a=commitdiff_plain;h=1c999280e7f232e6c2e41d8c76020e795a649648 Move lttng wrappers into own module Currently, we only pull the wrapper symbols into a single sub-module, either: lttng-tracer.o: - wrapper/random.o - wrapper/trace-clock.o - wrapper/page_alloc.o or lttng-statedump.o: - wrapper/irqdesc.o - wrapper/fdtable.o Because lttng-tracer depends on lttng-statedump, we cannot just put all wrappers into lttng-tracer.o, because it would create a circular dependency. This will be an issue if we introduce common wrappers which are used in both lttng-tracer.o and in lttng-statedump.o. Introduce a new lttng-wrapper.o to contain all wrapper symbols for all lttng modules. Signed-off-by: Mathieu Desnoyers --- diff --git a/Makefile b/Makefile index ebd355c7..c9779960 100644 --- a/Makefile +++ b/Makefile @@ -41,6 +41,8 @@ ifneq ($(KERNELRELEASE),) obj-$(CONFIG_LTTNG) += lttng-tracer.o + obj-$(CONFIG_LTTNG) += lttng-wrapper.o + lttng-tracer-objs := lttng-events.o lttng-abi.o lttng-string-utils.o \ lttng-probes.o lttng-context.o \ lttng-context-pid.o lttng-context-procname.o \ @@ -63,15 +65,21 @@ ifneq ($(KERNELRELEASE),) lttng-context-interruptible.o \ lttng-context-need-reschedule.o \ lttng-context-callstack.o lttng-calibrate.o \ - lttng-context-hostname.o wrapper/random.o \ - probes/lttng.o wrapper/trace-clock.o \ - wrapper/page_alloc.o \ + lttng-context-hostname.o \ + probes/lttng.o \ lttng-tracker-id.o \ lttng-filter.o lttng-filter-interpreter.o \ lttng-filter-specialize.o \ lttng-filter-validator.o \ probes/lttng-probe-user.o \ - lttng-tp-mempool.o + lttng-tp-mempool.o \ + + lttng-wrapper-objs := wrapper/page_alloc.o \ + wrapper/random.o \ + wrapper/trace-clock.o \ + wrapper/irqdesc.o \ + wrapper/fdtable.o \ + lttng-wrapper-impl.o ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),) lttng-tracer-objs += lttng-syscalls.o @@ -122,8 +130,7 @@ ifneq ($(KERNELRELEASE),) endif obj-$(CONFIG_LTTNG) += lttng-statedump.o - lttng-statedump-objs := lttng-statedump-impl.o wrapper/irqdesc.o \ - wrapper/fdtable.o + lttng-statedump-objs := lttng-statedump-impl.o obj-$(CONFIG_LTTNG) += probes/ obj-$(CONFIG_LTTNG) += lib/ diff --git a/lttng-wrapper-impl.c b/lttng-wrapper-impl.c new file mode 100644 index 00000000..61319699 --- /dev/null +++ b/lttng-wrapper-impl.c @@ -0,0 +1,37 @@ +/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only) + * + * lttng-wrapper.c + * + * Copyright (C) 2020 Mathieu Desnoyers + */ + +#include +#include + +static int __init lttng_wrapper_init(void) +{ + return 0; +} + +module_init(lttng_wrapper_init); + +static void __exit lttng_exit(void) +{ +} + +module_exit(lttng_exit); + +#include "extra_version/patches.i" +#ifdef LTTNG_EXTRA_VERSION_GIT +MODULE_INFO(extra_version_git, LTTNG_EXTRA_VERSION_GIT); +#endif +#ifdef LTTNG_EXTRA_VERSION_NAME +MODULE_INFO(extra_version_name, LTTNG_EXTRA_VERSION_NAME); +#endif +MODULE_LICENSE("GPL and additional rights"); +MODULE_AUTHOR("Mathieu Desnoyers "); +MODULE_DESCRIPTION("LTTng wrapper"); +MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "." + __stringify(LTTNG_MODULES_MINOR_VERSION) "." + __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION) + LTTNG_MODULES_EXTRAVERSION); diff --git a/wrapper/irqdesc.c b/wrapper/irqdesc.c index a85a855e..365b6e11 100644 --- a/wrapper/irqdesc.c +++ b/wrapper/irqdesc.c @@ -34,6 +34,7 @@ struct irq_desc *wrapper_irq_to_desc(unsigned int irq) return NULL; } } +EXPORT_SYMBOL_GPL(wrapper_irq_to_desc); #else @@ -44,5 +45,6 @@ struct irq_desc *wrapper_irq_to_desc(unsigned int irq) { return irq_to_desc(irq); } +EXPORT_SYMBOL_GPL(wrapper_irq_to_desc); #endif diff --git a/wrapper/page_alloc.c b/wrapper/page_alloc.c index 7951e881..512e09f9 100644 --- a/wrapper/page_alloc.c +++ b/wrapper/page_alloc.c @@ -52,6 +52,7 @@ int wrapper_get_pfnblock_flags_mask_init(void) return -1; return 0; } +EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask_init); #else @@ -94,6 +95,7 @@ int wrapper_get_pageblock_flags_mask_init(void) return -1; return 0; } +EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask_init); #else diff --git a/wrapper/random.c b/wrapper/random.c index 74dce49f..8b03aec5 100644 --- a/wrapper/random.c +++ b/wrapper/random.c @@ -55,6 +55,7 @@ end: filp_close(file, current->files); return ret; } +EXPORT_SYMBOL_GPL(wrapper_get_bootid); #else @@ -62,5 +63,6 @@ int wrapper_get_bootid(char *bootid) { return -ENOSYS; } +EXPORT_SYMBOL_GPL(wrapper_get_bootid); #endif