LDD3中scull的例子
scull模块我已经编译成功,另外我在网上找了个测试程序想测试一下,但编译的时候老是出问题:
In file included from ioctl_test.c:5:
scull.h:34: error: field ‘sem’ has incomplete type
scull.h:35: error: field ‘cdev’ has incomplete type
源代码:
C/C++ code
我网上查了一下,说好像是用户空间和内核空间的问题,但还是没弄明白,希望有人能指点一下。
In file included from ioctl_test.c:5:
scull.h:34: error: field ‘sem’ has incomplete type
scull.h:35: error: field ‘cdev’ has incomplete type
源代码:
C/C++ code
#include <sys/ioctl.h> #include <fcntl.h> #include <stdlib.h> #include <stdio.h> #include "scull.h" int main() { int code = 0; …… exit(0); }
我网上查了一下,说好像是用户空间和内核空间的问题,但还是没弄明白,希望有人能指点一下。
作者: fdasf 发布时间: 2011-04-19
补一下涉及的结构体:
C/C++ code
C/C++ code
struct scull_dev { struct scull_qset *data; /* Pointer to first quantum set */ int quantum; /* the current quantum size */ int qset; /* the current array size */ unsigned long size; /* amount of data stored here */ unsigned int access_key; /* used by sculluid and scullpriv */ struct semaphore sem; /* mutual exclusion semaphore */ struct cdev cdev; /* Char device structure */ };
作者: fdasf 发布时间: 2011-04-19