“创建虚拟ioctl时,错误:初始化程序中指定的未知字段'compat_ioctl'

[英]“ error: unknown field ‘compat_ioctl’ specified in initializer ” while creating dummy ioctl


static const struct inode_operations msdos_dir_inode_operations = {

static const struct inode_operations msdos_dir_inode_operations = {

.create     = msdos_create,
.lookup     = msdos_lookup,
.unlink     = msdos_unlink,
.mkdir      = msdos_mkdir,
.rmdir      = msdos_rmdir,
.rename     = msdos_rename,
.setattr    = fat_setattr,
.getattr    = fat_getattr,
.compat_ioctl   = my_ioctl,   ---->error

};

i also tried with unlocked_ioctl but same error occured

我也试过unlocked_ioctl但发生了同样的错误

[root@localhost fat]# make

[root @ localhost fat] #make

make -C /lib/modules/3.11.10-100.fc18.x86_64/build M=/home/aditya/linux-3.12.6/fs/fat modules

make -C /lib/modules/3.11.10-100.fc18.x86_64/build M = / home / aditya / linux-3.12.6 / fs / fat modules

make[1]: Entering directory `/usr/src/kernels/3.11.10-100.fc18.x86_64' CC [M] /home/aditya/linux-3.12.6/fs/fat/namei_msdos.o

make [1]:输入目录`/usr/src/kernels/3.11.10-100.fc18.x86_64'CC [M] /home/aditya/linux-3.12.6/fs/fat/namei_msdos.o

/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: error: unknown field ‘compat_ioctl’ specified in initializer

/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2:错误:初始化程序中指定的未知字段'compat_ioctl'

/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: warning: initialization from incompatible pointer type [enabled by default] /home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2: warning: (near initialization for ‘msdos_dir_inode_operations.setxattr’) [enabled by default] make[2]: * [/home/aditya/linux-3.12.6/fs/fat/namei_msdos.o] Error 1 make[1]: * [module/home/aditya/linux-3.12.6/fs/fat] Error 2 make[1]: Leaving directory `/usr/src/kernels/3.11.10-100.fc18.x86_64' make: * [all] Error 2

/home/aditya/linux-3.12.6/fs/fat/namei_msdos.c:646:2:警告:从不兼容的指针类型初始化[默认启用] /home/aditya/linux-3.12.6/fs/fat/ namei_msdos.c:646:2:警告:(接近初始化'msdos_dir_inode_operations.setxattr')[默认启用] make [2]:* [/home/aditya/linux-3.12.6/fs/fat/namei_msdos.o ]错误1 make [1]:* [module / home / aditya / linux-3.12.6 / fs / fat]错误2 make [1]:离开目录`/usr/src/kernels/3.11.10-100.fc18 .x86_64'make:* [all]错误2

1 个解决方案

#1


1  

The ioctl has been changed for a reason and it would be best if you follow the kernel changes in your driver too. You can not use drivers compiled for one version in another. The change is not too difficult one.

ioctl已被更改是有原因的,如果您也遵循驱动程序中的内核更改,那将是最好的。您不能使用为另一个版本编译的驱动程序。这种变化并不太难。

In the fops structure change

在fops结构中改变

ioctl to unlocked_ioctl

ioctl到unlocked_ioctl

and in the ioctl function in your driver, do not pass the inode pointer. That is all, the rest of the code can remain the same.

并且在驱动程序的ioctl函数中,不要传递inode指针。就是这样,其余的代码可以保持不变。

see this tutorial for more details

有关详细信息,请参阅本教程

智能推荐

注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.itdaan.com/blog/2014/01/19/4cb04729eee0c23987c8be2e0eae2c5f.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号  

赞助商广告