|
static struct file_operations qq2440_leds_fops = {
.owner = THIS_MODULE,
.ioctl = qq2440_leds_ioctl,
};
请问这里的.owner是什么意思,我在vc里面写个简单的测试结构体,这样写不能编译啊:
#include
int fn(int i,int j){
return i+j;
}
struct s1{
int i;
int j;
};
struct s3c2410{
struct s1 index;
int (*ioctl) (int *, char *);
char flag;
};
struct s1 s1test={
1,
2
};
struct s3c2410 stest={
.index=s1test,
.ioctl=fn
};
int main(){
stest.addr[0]='z';
printf("index=%d,addr0=%d\n",stest.index,stest.addr[0]);
}
编译...........................
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(21) : error C2059: syntax error : '.'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(23) : error C2143: syntax error : missing ';' before '}'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(23) : error C2143: syntax error : missing ';' before '}'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(26) : error C2039: 'addr' : is not a member of 's3c2410'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(11) : see declaration of 's3c2410'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(27) : error C2039: 'addr' : is not a member of 's3c2410'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(11) : see declaration of 's3c2410'
D:\Program Files\Microsoft Visual Studio\MyProjects\struct\struct.cpp(28) : warning C4508: 'main' : function should return a value; 'void' return type assumed
???? cl.exe ?±???í.
struct.exe - 1 error(s), 0 warning(s)
说这个点号.owner语法有问题,那这个linux的驱动代码用的什么特别的语法?
|
|