[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1415090582-14129-3-git-send-email-mcgrof@do-not-panic.com>
Date: Tue, 4 Nov 2014 00:42:53 -0800
From: "Luis R. Rodriguez" <mcgrof@...not-panic.com>
To: backports@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, yann.morin.1998@...e.fr,
mmarek@...e.cz, sassmann@...nic.de,
"Luis R. Rodriguez" <mcgrof@...e.com>
Subject: [PATCH v1 02/11] backports: extend module_init() module_exit() for built-in
From: "Luis R. Rodriguez" <mcgrof@...e.com>
When backports is used we want to identify the provenance
of the code used to generate the backport. We do this by
simply requiring all used drivers to at leats check in
with the backports module which identifies the backport.
We had this in place for modules but not for built-in, add
the respective set of helpers for it.
Signed-off-by: Luis R. Rodriguez <mcgrof@...e.com>
---
backport/backport-include/linux/module.h | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/backport/backport-include/linux/module.h b/backport/backport-include/linux/module.h
index 82c96bd..8942c5b 100644
--- a/backport/backport-include/linux/module.h
+++ b/backport/backport-include/linux/module.h
@@ -25,6 +25,30 @@ extern void backport_dependency_symbol(void);
" using backports " BACKPORTS_VERSION);
#endif
+#ifndef MODULE
+/*
+ * Forcing the backports module to load allows us to easily
+ * identify the backport.
+ */
+#undef module_init
+#define module_init(fn) \
+ static int __init __init_backport_##fn(void) \
+ { \
+ backport_dependency_symbol(); \
+ return fn(); \
+ } \
+ __initcall(__init_backport_##fn);
+
+#undef module_exit
+#define module_exit(fn) \
+ static void __exit __exit_backport_##fn(void) \
+ { \
+ fn(); \
+ rcu_barrier(); \
+ } \
+ __exitcall(__exit_backport_##fn);
+
+#else
#undef module_init
#define module_init(initfn) \
static int __init __init_backport(void) \
@@ -58,6 +82,7 @@ extern void backport_dependency_symbol(void);
rcu_barrier(); \
} \
void cleanup_module(void) __attribute__((alias("__exit_compat")));
+#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0)
#undef param_check_bool
--
2.1.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists