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>
Mon, 4 May 2020 19:46:21 +0000 (15:46 -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 ebd355c7f575e908fd51d4434f443f63bd1b5496..c97799602c79647e616296c57fc2ff6dcd58932d 100644 (file)
--- 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 (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 a85a855e9f4acc0365ed7c9c162a4f450922ed28..365b6e1111016517533a4e08f69c458691273a90 100644 (file)
@@ -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
index 7951e881c7dfac4130035da68c2b402638506c5e..512e09f98ec0ee1308e1a75b54c6bf32df1e076c 100644 (file)
@@ -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
 
index 74dce49fe4864de486fa33bf6a4bfdbf9c1faf05..8b03aec5981e7927bdc2d8499c623661dcf383b1 100644 (file)
@@ -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
This page took 0.028005 seconds and 4 git commands to generate.