Android 编译2.6.36的kernel akm8975 driver时unknown field 'ioctl' specified in initializer的问题
2011-02-15 21:53
483 查看
最近在学习Android源代码的结构,需要经常编译内核
在单独编译Andrioid linux kernel的时候再编译到/driver/misc/akm8975.c 时出现
问题主要是linux 2.6.36的驱动机制里file_operation关于ioctl这块改动比较大
所以导致了unknown field 'ioctl' specified in initializer的这个问题
原来内核的ioctl注册方法:
例:
static int ***_ioctl(Struct inode *in,struct file *filp,unsigned int cmd,unsigned long arg)
{
..........//内容
}
.........
static struct file_operations ***_fops={
.open = ***_open,
.read = ***_read,
.ioctl = ***_ioctl,
}
////////////////**********************************************//////////////////
2.6.36内核的ioctl改动:
去掉了原来的ioctl,添加两个新的成员,所以会出错
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
例:
static long ***_unlocked_ioctl(struct file *filp,unsigned int cmd,unsigned long arg)
{
..........//内容
}
static struct file_operations ***_fops={
.open=***_open,
.....,
.unlocked = ***_unlocked_ioctl;
}
////////////////**********************************************//////////////////
运气好的话按照这个样子更改,是能够通过编译通过 :)
在单独编译Andrioid linux kernel的时候再编译到/driver/misc/akm8975.c 时出现
问题主要是linux 2.6.36的驱动机制里file_operation关于ioctl这块改动比较大
所以导致了unknown field 'ioctl' specified in initializer的这个问题
原来内核的ioctl注册方法:
例:
static int ***_ioctl(Struct inode *in,struct file *filp,unsigned int cmd,unsigned long arg)
{
..........//内容
}
.........
static struct file_operations ***_fops={
.open = ***_open,
.read = ***_read,
.ioctl = ***_ioctl,
}
////////////////**********************************************//////////////////
2.6.36内核的ioctl改动:
去掉了原来的ioctl,添加两个新的成员,所以会出错
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
例:
static long ***_unlocked_ioctl(struct file *filp,unsigned int cmd,unsigned long arg)
{
..........//内容
}
static struct file_operations ***_fops={
.open=***_open,
.....,
.unlocked = ***_unlocked_ioctl;
}
////////////////**********************************************//////////////////
运气好的话按照这个样子更改,是能够通过编译通过 :)
相关文章推荐
- error: unknown field 'ioctl' specified in initializer问题
- error: unknown field 'ioctl' specified in initializer问题
- error: unknown field 'ioctl' specified in initializer问题
- error:unknown field 'ioctl' specified in initializer
- unknown field 'ioctl' specified in initializer
- 解决 error: unknown field 'ioctl' specified in initializer 的一种方法
- error:unknown field 'ioctl' specified in initializer
- yaffs,linux3.11,内核编译时报错, error: unknown field 'readdir' specified in initializer
- error: unknown field 'ioctl' specified in initializer (1)
- error: unknown field 'ioctl' specified in initializer
- unknown field ‘ioctl’ specified in initializer 问题解决方法
- Ralink雷凌rt3070驱动的ARM平台移植问题<error: unknown field ‘private’ specified in initializer>
- error: unknown field ‘ioctl’ specified in initializer
- error: unknown field ‘ioctl’ specified in initializer
- error: unknown field ‘ioctl’ specified in initializer
- error: unknown field ‘ioctl’ specified in initializer
- error: unknown field ‘ioctl’ specified in initializer
- dede(织梦)从5.5升级到5.6出现的“Unknown column 'weight' in 'field list'”的问题的解决办法
- error:unknown field ioctl specified in initializer
- 关于在eclipse中运行出错的一个小问题 Unknown column 'android' in 'where clause'