diff options
author | 0xwille | 2011-07-08 18:46:53 +0200 |
---|---|---|
committer | 0xwille | 2011-07-08 18:46:53 +0200 |
commit | c8f116e17b471704abbb3b1508733aa1bddda7da (patch) | |
tree | fa78154afe30d58ea047abaeb105c9995a9a6969 /lists.c | |
parent | f1e9e18f1ad00ec9d78cd76105b3934980d2e09b (diff) | |
download | lkm-c8f116e17b471704abbb3b1508733aa1bddda7da.tar.gz |
AƱadidas cosicas y gitignore
Diffstat (limited to 'lists.c')
-rw-r--r-- | lists.c | 41 |
1 files changed, 41 insertions, 0 deletions
@@ -0,0 +1,41 @@ +#include <linux/kernel.h> +#include <linux/module.h> + +#define LENGTH 5 + +struct node { + struct list_head l; + int dato; +}; + +int init_module(void) +{ + int i; + struct node head, aux[LENGTH], *aux2; + struct list_head* iter; + + INIT_LIST_HEAD(&head.l); + head.dato = 666; + + for (i = 0; i < LENGTH; i++) { + aux[i].dato = i; + + list_add_tail(&aux[i].l, &head.l); + } + + list_for_each(iter, &head.l) { + aux2 = list_entry(iter, struct node, l); + printk(KERN_INFO "%d", aux2->dato); + } + + printk(KERN_INFO "Por cierto, en 0x0 hay: %d", ((struct node *)0)->dato); + + return 0; +} + +void cleanup_module(void) +{ +} + +MODULE_AUTHOR("Guillermo Ramos"); +MODULE_LICENSE("GPL"); |