问题
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
[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[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
/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: 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
回答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.
In the fops structure change
ioctl
to 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.
see this tutorial for more details
来源:https://stackoverflow.com/questions/21218125/error-unknown-field-compat-ioctl-specified-in-initializer-while-creating