X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fkernel.git;a=blobdiff_plain;f=hello%2Fhello-1.c;fp=hello%2Fhello-1.c;h=a0d241d51cf8f45bb78cea498bc4aadf7d516503;hp=24bcea7d1e81c1c9588de21515db074fcc1c6d5e;hb=5ef1719c674e2eeedbfaef7dacb982b3b7c3c74c;hpb=09f7937cd0bb525f3a5d73d1c9eeab92ff6e22f7 diff --git a/hello/hello-1.c b/hello/hello-1.c index 24bcea7..a0d241d 100644 --- a/hello/hello-1.c +++ b/hello/hello-1.c @@ -1,14 +1,46 @@ -/* hello world using init macros */ +/* hello world */ #include #include #include #include "../general.h" +#if CONFIG_MODVERSIONS==1 + #define MODVERSIONS +#endif + +#include + +#ifndef CONFIG_DEVFS_FS + #error no devfs +#endif + +#include +#include + +extern void *sys_call_table[]; + +static devfs_handle_t devfs_handle; + +static struct file_operations fops = +{ + .read=device_read, + .write=device_write, + .open=device_open, + .release=device_release, + .ioctl=device_ioctl +} + +int my_uid=0; +char *parm_string="blah"; + +MODULE_PARM(my_uid,"i"); +MODULE_PARM(parm_string,"s"); + int my_init(void) { - printk(KERN_ALERT "module loaded\n"); - printk("KERN_ALERT " + devfs_handle=devfs_register(NULL,"hackbard/1",DEVFS_FL_DEFAULT,0,0, + printk(KERN_ALERT "module loaded with uid %d, string %s\n",my_uid,parm_string); return 0; }