1
votes

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
As far as I can see, struct inode_operations does not have *_ioctl fields in 3.12. These callbacks are from struct file_operations, did you intend to use that instead? - Eugene
yes but i have modified fs.h and added int (*unlocked_ioctl) (struct file *,unsigned int , unsigned long); } in struct inode_operations ... then also it showing the same error - user3172621
hey please help for previous comment - user3172621
You added unlocked_ioctl but the code above uses compat_ioctl, this may be the cause of the error. Anyway, the complete solution depends on what you are trying to accomplish. - Eugene

1 Answers

1
votes

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