khello/khello.c
author Markus Bröker <mbroeker@largo.dyndns.tv>
Sun, 26 Jul 2009 18:22:31 +0200
changeset 104 b59f1c9895db
parent 77 49e0babccb23
permissions -rw-r--r--
Makefile: erases trailing spaces in java files committer: Markus Bröker <mbroeker@largo.homelinux.org>
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
77
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     1
/**
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     2
 * khello/khello.c
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     3
 * hello-1.c - The simplest kernel module.
50
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     4
 */
77
49e0babccb23 HEADER TAGS
Markus Bröker <mbroeker@largo.dyndns.tv>
parents: 50
diff changeset
     5
50
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     6
#include <linux/module.h>       /* Needed by all modules */
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     7
#include <linux/kernel.h>       /* Needed for KERN_INFO */
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     8
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
     9
int init_module (void)
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    10
{
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    11
    printk (KERN_INFO "Hello world 1.\n");
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    12
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    13
    /*
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    14
     * A non 0 return means init_module failed; module can't be loaded.
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    15
     */
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    16
    return 0;
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    17
}
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    18
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    19
void cleanup_module (void)
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    20
{
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    21
    printk (KERN_INFO "Goodbye world 1.\n");
a38f102556e5 khello: a nice kernel module
Markus Bröker <mbroeker@largo.dyndns.tv>
parents:
diff changeset
    22
}