From 5ef1719c674e2eeedbfaef7dacb982b3b7c3c74c Mon Sep 17 00:00:00 2001 From: hackbard Date: Tue, 4 Mar 2003 18:07:09 +0000 Subject: [PATCH] bla --- hello/Makefile | 2 +- hello/hello-1.c | 38 +++++++++++++++++++++++++++++++++++--- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/hello/Makefile b/hello/Makefile index 5947db3..c1f7bfc 100644 --- a/hello/Makefile +++ b/hello/Makefile @@ -7,7 +7,7 @@ CFLAGS = -D__KERNEL__ -DMODULE -O -Wall # -I$(INCLUDEDIR) # findout kernel version. VER = $(shell awk -F\" '/REL/ {print $$2}' $(INCLUDEDIR)/linux/version.h) -OBJS = hello.o +OBJS = hello.o hello-1.o all: $(OBJS) 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; } -- 2.39.2