File tree Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Expand file tree Collapse file tree 2 files changed +39
-0
lines changed Original file line number Diff line number Diff line change
1
+ obj-m += buzz.o
2
+
3
+ all :
4
+ make -C /lib/modules/$(shell uname -r) /build M=$(PWD ) modules
5
+ clean :
6
+ make -C /lib/modules/$(shell uname -r) /build M=$(PWD ) clean
Original file line number Diff line number Diff line change
1
+ /**
2
+ * if (theNumber is divisible by 3) then
3
+ * print "Fizz"
4
+ * else if (theNumber is divisible by 5) then
5
+ * print "Buzz"
6
+ * else // theNumber is not divisible by 3 or 5
7
+ * print theNumber
8
+ * end if
9
+ */
10
+
11
+ #include <linux/kernel.h>
12
+ #include <linux/module.h>
13
+
14
+ int init_module (void ){
15
+
16
+ static int i = 0 ;
17
+ for (i = 0 ;i < 100 ;i ++ ){
18
+ if ( i % 3 )
19
+ printk (KERN_INFO "Fizz" );
20
+ if ( i % 5 )
21
+ printk (KERN_INFO "Buzz" );
22
+ else
23
+ printk (KERN_INFO "%d" , i );
24
+
25
+ }
26
+
27
+ return 0 ;
28
+
29
+ }
30
+
31
+ void cleanup_module (void ){
32
+ printk (KERN_INFO "goodbye world" );
33
+ }
You can’t perform that action at this time.
0 commit comments