Information on ioctl32
Hi,
I've been working my way through what I think is probably the seminal work on the topic of device drivers, but it pre-dates ioctl32 and other 32 compatibility stuff.
(The O'Reilly linux device driver book) http://www.xml.com/ldd/chapter/book/ch03.html
Is there anywhere that I can find some more information on this, such as a howto? I've been googling but have only really stumbled across some brief info on lwn.net.
Thanks :)
James
Quoted 8 lines · On Fri, 21 Oct 2005 12:22:27 +0100 James Hansen wrote:
Hi,
I've been working my way through what I think is probably the seminal work on the topic of device drivers, but it pre-dates ioctl32 and other 32 compatibility stuff.
(The O'Reilly linux device driver book)
http://www.xml.com/ldd/chapter/book/ch03.html
That's LDD v2.
LDD v3 is here:
http://lwn.net/Kernel/LDD3/
I don't see ioctl32 here, but lwn.net also has driver-porting info at:
http://lwn.net/Articles/driver-porting/
Quoted 3 lines
Is there anywhere that I can find some more information on this, such as a howto? I've been googling but have only really stumbled across some brief info on lwn.net.
---
~Randy
Quoted 8 lines · Randy.Dunlap
On Fri, 21 Oct 2005 12:22:27 +0100 James Hansen wrote:
I don't see ioctl32 here, but lwn.net also has driver-porting info at:
http://lwn.net/Articles/driver-porting/Quoted 3 lines
Is there anywhere that I can find some more information on this, such as a howto? I've been googling but have only really stumbled across some brief info on lwn.net.
The currently relevant info at lwn.net is http://lwn.net/Articles/119652/
Arnd <><
Thanks for the info.
From what they say over on lwn.net, I need to apply a patch, but my current kernel (debian for amd64) is already trying to call it ioctl32.
Problem is, the kernel headers don't seem to have an entry in the file_operations struct for compat_ioctl. Does anyone know if there's any other place (struct) I should be looking to put this function?
I thought it a bit odd that the prebuilt default kernel is trying to call this function, but the headers for this kernel don't seem to allow me to insert it into the fops struct.
Thanks,
James
Quoted 27 lines · Arnd Bergmann
Quoted 10 lines · Randy.Dunlap
On Fri, 21 Oct 2005 12:22:27 +0100 James Hansen wrote:
I don't see ioctl32 here, but lwn.net also has driver-porting info at:
http://lwn.net/Articles/driver-porting/Quoted 3 lines
Is there anywhere that I can find some more information on this, such as a howto? I've been googling but have only really stumbled across some brief info on lwn.net.
The currently relevant info at lwn.net is http://lwn.net/Articles/119652/
Arnd <><-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 2 lines · James Hansen
From what they say over on lwn.net, I need to apply a patch, but my current kernel (debian for amd64) is already trying to call it ioctl32.
No, you should not need to apply any patch, the compat_ioctl infrastructure has been in there since 2.6.11. The old dynamic ioctl32 subsystem has been removed for 2.6.14.
Quoted 7 lines
Problem is, the kernel headers don't seem to have an entry in the
file_operationsstruct forcompat_ioctl. Does anyone know if there's any other place (struct) I should be looking to put this function?I thought it a bit odd that the prebuilt default kernel is trying to call this function, but the headers for this kernel don't seem to allow me to insert it into the fops struct.
You seem to be mixing up stuff. Are you looking at the headers in the kernel source tree or another copy? Are you sure you are running a recent kernel level?
Arnd <><
Sorry, I'll explain a little more about I'm doing.
The kernel I'm running is the default kernel from the (unofficial) debian amd64 distro. uname says it's 2.6.8-11-amd64-generic. When running a 32bit app, linked against the 32bit libraries, calling a 64bit driver in, the kernel logs messages saying something along the lines of "ioctl32 not defined".
The headers I'm building my modules against are from the package 'kernel-headers-2.6.8-11-amd64-generic' which leaves me with the directory 'kernel-headers-2.6.8-11-amd64-generic' in /usr/src.
My problem is that when I look in the headers at the file_operations struct for compat_ioctl there's no entry there, and I therefore can't define a function for it. I had no idea there was a dynamic system in place before what's mentioned on lwn. I'd assumed that as my kernel was trying to call ioctl32, that it would have had the patch applied, and it's headers should have contained an appropriate entry in file_operations.
So it looks like I'll have implement both ways of doing things, one for pre-2.6.11 and another for post 2.6.11 kernels.
Would you know of anywhere else I could look for information on the dynamic method you mentioned that existed in kernels before 2.6.11.
Thanks for the help btw. Much appreciated.
James
Quoted 34 lines · Arnd Bergmann
Quoted 3 lines · James Hansen
From what they say over on lwn.net, I need to apply a patch, but my current kernel (debian for amd64) is already trying to call it ioctl32.
No, you should not need to apply any patch, the
compat_ioctlinfrastructure has been in there since 2.6.11. The old dynamic ioctl32 subsystem has been removed for 2.6.14.Quoted 5 lines
Problem is, the kernel headers don't seem to have an entry in the
file_operationsstruct forcompat_ioctl. Does anyone know if there's any other place (struct) I should be looking to put this function?I thought it a bit odd that the prebuilt default kernel is trying to call this function, but the headers for this kernel don't seem to allow me to insert it into the fops struct.
You seem to be mixing up stuff. Are you looking at the headers in the kernel source tree or another copy? Are you sure you are running a recent kernel level?
Arnd <><-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Quoted 1 line · James Hansen
Sorry, I'll explain a little more about I'm doing.
Btw, please don't top-post.
Quoted 5 lines
The kernel I'm running is the default kernel from the (unofficial) debian amd64 distro. uname says it's 2.6.8-11-amd64-generic. When running a 32bit app, linked against the 32bit libraries, calling a 64bit driver in, the kernel logs messages saying something along the lines of "ioctl32 not defined".
Ok, that is a little clearer then. It's not missing the infrastructure but rather a conversion for a specific ioctl number in that device driver. Actually, the message should print out which number that is, otherwise, you can probably find out by running the program with 'strace' and looking for ioctl() calls that result in 'EINVAL' or 'ENOTTY'.
Quoted 11 lines
The headers I'm building my modules against are from the package 'kernel-headers-2.6.8-11-amd64-generic' which leaves me with the directory 'kernel-headers-2.6.8-11-amd64-generic' in
/usr/src.My problem is that when I look in the headers at the
file_operationsstruct forcompat_ioctlthere's no entry there, and I therefore can't define a function for it. I had no idea there was a dynamic system in place before what's mentioned on lwn. I'd assumed that as my kernel was trying to call ioctl32, that it would have had the patch applied, and it's headers should have contained an appropriate entry infile_operations.
Quoted 5 lines
So it looks like I'll have implement both ways of doing things, one for pre-2.6.11 and another for post 2.6.11 kernels.
Would you know of anywhere else I could look for information on the dynamic method you mentioned that existed in kernels before 2.6.11.
Actually, you should not implement anything for old kernels, they are just not supported. The only thing that helps is that you find out which driver is missing the conversion and (find someone to) add the compat_ioctl method to the device driver for 2.6.15.
The interesting information here is
- name of the device driver
- name of the application
- all the ioctl numbers that are missing (can be found out from the other two)
If you really want to do the extra work to get it running on kernels older than 2.6.11, look for register_ioctl32_conversion(). Just know that we had a good reason to replace that and I don't think you will have much lock in getting the handler for your driver into the Debian 2.6.8 kernel.
Arnd <><
Quoted 11 lines · Arnd Bergmann
Quoted 3 lines · James Hansen
Sorry, I'll explain a little more about I'm doing.
Btw, please don't top-post.
Whoops.. sorry :(
Quoted 4 lines
Quoted 3 lines
The kernel I'm running is the default kernel from the (unofficial) debian amd64 distro. uname says it's 2.6.8-11-amd64-generic. When running a 32bit app, linked against the 32bit libraries, calling a 64bit driver in, the kernel logs messages saying something along the lines of "ioctl32 not defined".
Quoted 9 lines
Ok, that is a little clearer then. It's not missing the infrastructure but rather a conversion for a specific ioctl number in that device driver. Actually, the message should print out which number that is, otherwise, you can probably find out by running the program with 'strace' and looking for
ioctl()calls that result in 'EINVAL' or 'ENOTTY'.
I should probably mention that this is a 3rd party device driver for a PCI card, which is not part of the kernel itself. I'm just looking to add 32bit compatibility options to make this device driver work with as many kernel versions as possible.
Quoted 21 lines
Quoted 9 lines
The headers I'm building my modules against are from the package 'kernel-headers-2.6.8-11-amd64-generic' which leaves me with the directory 'kernel-headers-2.6.8-11-amd64-generic' in
/usr/src.My problem is that when I look in the headers at the
file_operationsstruct forcompat_ioctlthere's no entry there, and I therefore can't define a function for it. I had no idea there was a dynamic system in place before what's mentioned on lwn. I'd assumed that as my kernel was trying to call ioctl32, that it would have had the patch applied, and it's headers should have contained an appropriate entry infile_operations.So it looks like I'll have implement both ways of doing things, one for pre-2.6.11 and another for post 2.6.11 kernels.
Would you know of anywhere else I could look for information on the dynamic method you mentioned that existed in kernels before 2.6.11.
Actually, you should not implement anything for old kernels, they are just not supported. The only thing that helps is that you find out which driver is missing the conversion and (find someone to) add the
compat_ioctlmethod to the device driver for 2.6.15.The interesting information here is
- name of the device driver
- name of the application
- all the ioctl numbers that are missing (can be found out from the other two)
Quoted 9 lines
If you really want to do the extra work to get it running on kernels older than 2.6.11, look for
register_ioctl32_conversion(). Just know that we had a good reason to replace that and I don't think you will have much lock in getting the handler for your driver into the Debian 2.6.8 kernel.Arnd <><
I'll put in a check for kernel version, and use compat_ioctl in the file_operations struct for 2.6.11. And then I'll have a read about register_ioctl32_conversion for versions of the kernels pre-2.6.11.
I'll also have a read about why it was changed, but just out of interest :)
Thanks Arnd,
James
Quoted 11 lines
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/.
Quoted 2 lines · James Hansen
I should probably mention that this is a 3rd party device driver for a PCI card, which is not part of the kernel itself.
can you post the url to the sourcecode of the driver? Maybe you should try to get it to be part of the kernel itself, that is a lot nicer... (and not even THAT hard)