LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   " error unknown field 'ioctl' " while compiling a driver for Kernel 2.6.38.8 (https://www.linuxquestions.org/questions/linux-kernel-70/error-unknown-field-ioctl-while-compiling-a-driver-for-kernel-2-6-38-8-a-4175451281/)

micha1 02-22-2013 08:35 AM

" error unknown field 'ioctl' " while compiling a driver for Kernel 2.6.38.8
 
Hello,

I try to compile a driver module of a PCI/VME adapter card (Model 616 from GE-IP/formerly SBS) for Kernel Version 2.38.8. This driver was developed for Kernel 2.6.32 and worked fine with this kernel version. Now, if I try to compile for version 2.6.38.8 (which I need for specific reasons) it does not compile anymore. There is an error "unknown field 'ioctl' ".

I already googled a bit an found out, that is has to do with the remove of the Big Kernel Lock (BKL) and the field ioctl in Kernel >= 2.6.37. One should use unlocked_ioctl and remove locking kernel code from the driver. If it is not really necessary, I want to avoid trying to port the driver, because I am not an experienced driver hacker.

Is there a possibility to use older drivers (with BKL and ioctl) in Kernel 2.6.38?
I have seen, that in Kernel 2.6.38 there is still a kernel config option for BKL, which can be set to YES to enable BKL for older drivers. Is there a possibility to configure the kernel, so that the field ioctl is available? Then I could still use my older driver for kernel 2.6.38.8.

Thanks and best regards
michael

bsat 02-23-2013 03:22 AM

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 if the post helps
http://tuxthink.blogspot.in/2012/12/...or-kernel.html

micha1 02-25-2013 02:25 AM

Thanks for the link. I think it helps and I try it.

>You can not use drivers compiled for one version in another.
This is clear. I meant, if it is possible, to compile an older driver (with ioctl) for kernel 2.6.38, if this kernel is specially configured.

regards
michael

bsat 02-26-2013 08:11 AM

I don't think that would be possible. ioctls are used in so many places in the kernel, you will have to modify all the codes of ioctl to suit just one use in your driver.

micha1 02-28-2013 08:37 AM

Thanks again for your help, the driver works now. Fortunately the driver didn't use lock_kernel() anymore, so that the only change I had to do, was really the fops structure and ioctl-header change.


All times are GMT -5. The time now is 04:15 AM.