Move lttng wrappers into own module
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 4 May 2020 18:52:13 +0000 (14:52 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 8 May 2020 17:56:40 +0000 (13:56 -0400)
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 <mathieu.desnoyers@efficios.com>
Makefile
lttng-wrapper-impl.c [new file with mode: 0644]
wrapper/irqdesc.c
wrapper/page_alloc.c
wrapper/random.c

index ae2b19538c1a52f1ec942656f86077cb76e95aa4..b487f2672a3f842878881d7dfba7bcb3e32b4a71 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -41,6 +41,8 @@ ifneq ($(KERNELRELEASE),)
 
   obj-$(CONFIG_LTTNG) += lttng-tracer.o
 
 
   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 \
   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 \
@@ -51,15 +53,21 @@ ifneq ($(KERNELRELEASE),)
                        lttng-context-interruptible.o \
                        lttng-context-need-reschedule.o \
                        lttng-context-callstack.o lttng-calibrate.o \
                        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-pid.o \
                        lttng-filter.o lttng-filter-interpreter.o \
                        lttng-filter-specialize.o \
                        lttng-filter-validator.o \
                        probes/lttng-probe-user.o \
                        lttng-tracker-pid.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
 
   ifneq ($(CONFIG_HAVE_SYSCALL_TRACEPOINTS),)
     lttng-tracer-objs += lttng-syscalls.o
@@ -87,8 +95,7 @@ ifneq ($(KERNELRELEASE),)
       echo "lttng-tracepoint.o" ; fi;)
 
   obj-$(CONFIG_LTTNG) += lttng-statedump.o
       echo "lttng-tracepoint.o" ; fi;)
 
   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/
 
   obj-$(CONFIG_LTTNG) += probes/
   obj-$(CONFIG_LTTNG) += lib/
diff --git a/lttng-wrapper-impl.c b/lttng-wrapper-impl.c
new file mode 100644 (file)
index 0000000..6131969
--- /dev/null
@@ -0,0 +1,37 @@
+/* SPDX-License-Identifier: (GPL-2.0-only or LGPL-2.1-only)
+ *
+ * lttng-wrapper.c
+ *
+ * Copyright (C) 2020 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ */
+
+#include <linux/module.h>
+#include <lttng-tracer.h>
+
+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 <mathieu.desnoyers@efficios.com>");
+MODULE_DESCRIPTION("LTTng wrapper");
+MODULE_VERSION(__stringify(LTTNG_MODULES_MAJOR_VERSION) "."
+       __stringify(LTTNG_MODULES_MINOR_VERSION) "."
+       __stringify(LTTNG_MODULES_PATCHLEVEL_VERSION)
+       LTTNG_MODULES_EXTRAVERSION);
index 29427d47dd71a8c622186e184b99e74fcd7c03c1..d524c63318c22f6b58f95b8016be8fd70629bf1a 100644 (file)
@@ -34,6 +34,7 @@ struct irq_desc *wrapper_irq_to_desc(unsigned int irq)
                return NULL;
        }
 }
                return NULL;
        }
 }
+EXPORT_SYMBOL_GPL(wrapper_irq_to_desc);
 
 #else
 
 
 #else
 
@@ -44,5 +45,6 @@ struct irq_desc *wrapper_irq_to_desc(unsigned int irq)
 {
        return irq_to_desc(irq);
 }
 {
        return irq_to_desc(irq);
 }
+EXPORT_SYMBOL_GPL(wrapper_irq_to_desc);
 
 #endif
 
 #endif
index baa8603f2898bc58de87393fad666f8d4ce0dace..40998199a5bcfa9a85f3de78c2e3a0ae5fddec2e 100644 (file)
@@ -52,6 +52,7 @@ int wrapper_get_pfnblock_flags_mask_init(void)
                return -1;
        return 0;
 }
                return -1;
        return 0;
 }
+EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask_init);
 
 #else
 
 
 #else
 
@@ -94,6 +95,7 @@ int wrapper_get_pageblock_flags_mask_init(void)
                return -1;
        return 0;
 }
                return -1;
        return 0;
 }
+EXPORT_SYMBOL_GPL(wrapper_get_pfnblock_flags_mask_init);
 
 #else
 
 
 #else
 
index c938ae35a4ac2a96a2a2deee26cb645a33792af2..eb41769c650f54d1ddb569f207a1bc45e0765292 100644 (file)
@@ -55,6 +55,7 @@ end:
        filp_close(file, current->files);
        return ret;
 }
        filp_close(file, current->files);
        return ret;
 }
+EXPORT_SYMBOL_GPL(wrapper_get_bootid);
 
 #else
 
 
 #else
 
@@ -62,5 +63,6 @@ int wrapper_get_bootid(char *bootid)
 {
        return -ENOSYS;
 }
 {
        return -ENOSYS;
 }
+EXPORT_SYMBOL_GPL(wrapper_get_bootid);
 
 #endif
 
 #endif
This page took 0.032233 seconds and 4 git commands to generate.