红联Linux门户
Linux帮助

如何编写LINUX设备驱动程序

发布时间:2008-08-07 11:49:23来源:红联作者:yyykkk1229
http://www.it.com.cn/f/edu/0411/30/53811.htm
按照上面连接的范例想要编写设备驱动程序
得到如下错误,请教高手该如何修改
test.c:13: warning: `struct file' declared inside parameter list
test.c:13: warning: its scope is only this definition or declaration, which is probably not what you want
test.c:13: warning: `struct inode' declared inside parameter list
test.c: In function `read_test':
test.c:18: `VERIFY_WRITE' undeclared (first use in this function)
test.c:18: (Each undeclared identifier is reported only once
test.c:18: for each function it appears in.)
test.c:21: parse error before "for"
test.c: At top level:
test.c:30: warning: `struct file' declared inside parameter list
test.c:30: warning: `struct inode' declared inside parameter list
test.c:35: warning: `struct file' declared inside parameter list
test.c:35: warning: `struct inode' declared inside parameter list
test.c: In function `open_tibet':
test.c:37: `MOD_ING_USE_COUNT' undeclared (first use in this function)
test.c: At top level:
test.c:41: warning: `struct file' declared inside parameter list
test.c:41: warning: `struct inode' declared inside parameter list
test.c: In function `release_tibet':
test.c:43: union has no member named `usecount'
test.c: At top level:
test.c:46: variable `test_fops' has initializer but incomplete type
test.c:47: warning: excess elements in struct initializer
test.c:47: warning: (near initialization for `test_fops')
test.c:48: warning: excess elements in struct initializer
test.c:48: warning: (near initialization for `test_fops')
test.c:49: `write_test' undeclared here (not in a function)
test.c:49: warning: excess elements in struct initializer
test.c:49: warning: (near initialization for `test_fops')
test.c:50: warning: excess elements in struct initializer
test.c:50: warning: (near initialization for `test_fops')
test.c:51: warning: excess elements in struct initializer
test.c:51: warning: (near initialization for `test_fops')
test.c:52: warning: excess elements in struct initializer
test.c:52: warning: (near initialization for `test_fops')
test.c:53: warning: excess elements in struct initializer
test.c:53: warning: (near initialization for `test_fops')
test.c:54: `open_test' undeclared here (not in a function)
test.c:54: warning: excess elements in struct initializer
test.c:54: warning: (near initialization for `test_fops')
test.c:55: `release_test' undeclared here (not in a function)
test.c:55: warning: excess elements in struct initializer
test.c:55: warning: (near initialization for `test_fops')
test.c:56: warning: excess elements in struct initializer
test.c:56: warning: (near initialization for `test_fops')
test.c:57: warning: excess elements in struct initializer
test.c:57: warning: (near initialization for `test_fops')
test.c: In function `init_module':
test.c:64: parse error before '=' token
test.c:67: `KERN_INFO' undeclared (first use in this function)
test.c:67: parse error before string constant
/usr/include/linux/timer.h: At top level:
test.c:46: storage size of `test_fops' isn't known

那本书的第三章看完了,但由于没有具体例子,很多地方都搞不懂,麻烦高手帮忙,谢谢!!!
文章评论

共有 0 条评论