���诒�写������时��������一���碌����,���位����指�,谢谢��源�������拢�
#ifndef __KERNEL__
#define __KERNEL__
#endif 
#ifndef MODULE
#define MODULE
#endif
#include<linux/config.h>
#include <linux/module.h>
#include<linux/kernel.h>
#include<linux/init.h>

MODULE_LICENSE("GPL");
MODULE_AUTHOR("lijian");
MODULE_DESCRIPTION("A simple drvier");
MODULE_SUPPORTED_DEVICE("test driver");

static short int myshort=1;
static int myint=420;
static long int mylong=9999;
static char * mystring;

MODULE_PARM(myshort,"h");
MODULE_PARM(myint,"i");
MODULE_PARM(mylong,"l");
MODULE_PARM(mystring,"s");

static int __init  init(void)
{
    printk("<0>This is the init part!---------------\n");
    printk("<0>Myshort is %hd\n",myshort);
    printk("<0>myint is %d\n",myint);
    printk("<0>mylong is %ld\n",mylong);
    printk("<0>mystring is %s\n",mystring);

    return 0;
}

static void __exit clean(void)
{
    printk("<0>This is inside the cleanup_module function!\n");
}

module_init(init);
module_exit(clean);
���:为什么�诤�帽9���薹�通�������写��莶����
也����说�����������������:insmod test.o 2 222 55555 great
����������却为��
Message from syslogd@localhost at Sun Mar 13 18:33:31 2005 ...
localhost kernel: This is the init part!---------------

Message from syslogd@localhost at Sun Mar 13 18:33:31 2005 ...
localhost kernel: Myshort is 1

Message from syslogd@localhost at Sun Mar 13 18:33:31 2005 ...
localhost kernel: myint is 420

Message from syslogd@localhost at Sun Mar 13 18:33:31 2005 ...
localhost kernel: mylong is 9999

Message from syslogd@localhost at Sun Mar 13 18:33:31 2005 ...
localhost kernel: mystring is <NULL>
������幕馗���谢谢��
--

�� ��源:��BBS 水木�华站 http://smth.org��[FROM: 210.72.13.*]