khello/khello.c
author Markus Bröker <mbroeker@largo.dyndns.tv>
Thu, 16 Apr 2009 12:51:15 +0200
changeset 80 5d7057a1b202
parent 77 49e0babccb23
permissions -rw-r--r--
fak.c: proper values The normal fak function prints proper values from 0-20 and the bigfak function "guesses" up to 170! 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
}