a0d241d51cf8f45bb78cea498bc4aadf7d516503
[my-code/kernel.git] / hello / hello-1.c
1 /* hello world */
2
3 #include <linux/module.h>
4 #include <linux/kernel.h>
5 #include <linux/init.h>
6 #include "../general.h"
7
8 #if CONFIG_MODVERSIONS==1
9  #define MODVERSIONS
10 #endif
11
12 #include <linux/devfs_fs_kernel.h>
13
14 #ifndef CONFIG_DEVFS_FS
15  #error no devfs
16 #endif
17
18 #include <sys/syscall.h>
19 #include <linux/sched.h>
20
21 extern void *sys_call_table[];
22
23 static devfs_handle_t devfs_handle; 
24
25 static struct file_operations fops = 
26 {
27  .read=device_read,
28  .write=device_write,
29  .open=device_open,
30  .release=device_release,
31  .ioctl=device_ioctl
32 }
33
34 int my_uid=0;
35 char *parm_string="blah";
36
37 MODULE_PARM(my_uid,"i");
38 MODULE_PARM(parm_string,"s");
39
40 int my_init(void)
41 {
42  devfs_handle=devfs_register(NULL,"hackbard/1",DEVFS_FL_DEFAULT,0,0,
43  printk(KERN_ALERT "module loaded with uid %d, string %s\n",my_uid,parm_string);
44  return 0;
45 }
46
47 void my_cleanup(void)
48 {
49  printk(KERN_ALERT "module unloaded\n");
50 }
51
52 module_init(my_init);
53 module_exit(my_cleanup);
54
55 MODULE_AUTHOR(ME_THE_AUTHOR);
56 MODULE_DESCRIPTION("bullshit ;)");
57 MODULE_LICENSE("GPL");
58