module: test code for waiting.

From: Rusty Russell
Date: Fri Sep 14 2012 - 03:12:32 EST


From: Rusty Russell <rusty@xxxxxxxxxxxxxxx>
Subject: module: dummy module to test loading race.
---
kernel/Makefile | 1 +
kernel/test-mod.c | 21 +++++++++++++++++++++
2 files changed, 22 insertions(+)

diff --git a/kernel/Makefile b/kernel/Makefile
--- a/kernel/Makefile
+++ b/kernel/Makefile
@@ -131,3 +131,4 @@ quiet_cmd_timeconst = TIMEC $@
targets += timeconst.h
$(obj)/timeconst.h: $(src)/timeconst.pl FORCE
$(call if_changed,timeconst)
+obj-m += test-mod.o
diff --git a/kernel/test-mod.c b/kernel/test-mod.c
new file mode 100644
--- /dev/null
+++ b/kernel/test-mod.c
@@ -0,0 +1,21 @@
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/delay.h>
+
+static bool fail;
+module_param(fail, bool, 0644);
+
+int init(void)
+{
+ printk("Module %p init start...\n", THIS_MODULE);
+ ssleep(10);
+ printk("...%p init %s\n", THIS_MODULE, fail ? "fail" : "succeed");
+ return fail ? -EINVAL : 0;
+}
+
+void fini(void)
+{
+}
+
+module_init(init);
+module_exit(fini);
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/