linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Information on ioctl32
@ 2005-10-21 11:22 James Hansen
  2005-10-22  0:36 ` Randy.Dunlap
  0 siblings, 1 reply; 9+ messages in thread
From: James Hansen @ 2005-10-21 11:22 UTC (permalink / raw)
  To: linux-kernel-list

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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-21 11:22 Information on ioctl32 James Hansen
@ 2005-10-22  0:36 ` Randy.Dunlap
  2005-10-23 14:03   ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: Randy.Dunlap @ 2005-10-22  0:36 UTC (permalink / raw)
  To: James Hansen; +Cc: linux-kernel

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/

> 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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-22  0:36 ` Randy.Dunlap
@ 2005-10-23 14:03   ` Arnd Bergmann
  2005-10-24  8:58     ` James Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2005-10-23 14:03 UTC (permalink / raw)
  To: Randy.Dunlap; +Cc: James Hansen, linux-kernel

On Sünnavend 22 Oktober 2005 02:36, Randy.Dunlap wrote:
> 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/
> 
> > 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 <><

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-23 14:03   ` Arnd Bergmann
@ 2005-10-24  8:58     ` James Hansen
  2005-10-24  9:32       ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: James Hansen @ 2005-10-24  8:58 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Randy.Dunlap, linux-kernel

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

Arnd Bergmann wrote:

>On Sünnavend 22 Oktober 2005 02:36, Randy.Dunlap wrote:
>  
>
>>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/
>>
>>    
>>
>>>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 majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>
>
>  
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-24  8:58     ` James Hansen
@ 2005-10-24  9:32       ` Arnd Bergmann
  2005-10-24 10:48         ` James Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2005-10-24  9:32 UTC (permalink / raw)
  To: James Hansen; +Cc: Randy.Dunlap, linux-kernel

On Maandag 24 Oktober 2005 10:58, James Hansen wrote:
>  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.

> 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.

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 <><

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-24  9:32       ` Arnd Bergmann
@ 2005-10-24 10:48         ` James Hansen
  2005-10-24 11:20           ` Arnd Bergmann
  0 siblings, 1 reply; 9+ messages in thread
From: James Hansen @ 2005-10-24 10:48 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Randy.Dunlap, linux-kernel

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

Arnd Bergmann wrote:

>On Maandag 24 Oktober 2005 10:58, James Hansen wrote:
>  
>
>> 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.
>
>  
>
>>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.
>>    
>>
>
>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 majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>
>
>  
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-24 10:48         ` James Hansen
@ 2005-10-24 11:20           ` Arnd Bergmann
  2005-10-24 12:26             ` James Hansen
  0 siblings, 1 reply; 9+ messages in thread
From: Arnd Bergmann @ 2005-10-24 11:20 UTC (permalink / raw)
  To: James Hansen; +Cc: Randy.Dunlap, linux-kernel

On Maandag 24 Oktober 2005 12:48, James Hansen wrote:
> Sorry, I'll explain a little more about I'm doing.

Btw, please don't top-post.

> 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'.

> 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.

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 <><

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-24 11:20           ` Arnd Bergmann
@ 2005-10-24 12:26             ` James Hansen
  2005-10-24 12:29               ` Arjan van de Ven
  0 siblings, 1 reply; 9+ messages in thread
From: James Hansen @ 2005-10-24 12:26 UTC (permalink / raw)
  To: Arnd Bergmann; +Cc: Randy.Dunlap, linux-kernel

Arnd Bergmann wrote:

>On Maandag 24 Oktober 2005 12:48, James Hansen wrote:
>  
>
>>Sorry, I'll explain a little more about I'm doing.
>>    
>>
>
>Btw, please don't top-post.
>
>  
>
Whoops..  sorry :(

>>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'.
>
>  
>
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.

>>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.
>>    
>>
>
>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 <><
>  
>
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

>-
>To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
>the body of a message to majordomo@vger.kernel.org
>More majordomo info at  http://vger.kernel.org/majordomo-info.html
>Please read the FAQ at  http://www.tux.org/lkml/
>
>
>.
>
>  
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: Information on ioctl32
  2005-10-24 12:26             ` James Hansen
@ 2005-10-24 12:29               ` Arjan van de Ven
  0 siblings, 0 replies; 9+ messages in thread
From: Arjan van de Ven @ 2005-10-24 12:29 UTC (permalink / raw)
  To: James Hansen; +Cc: Arnd Bergmann, Randy.Dunlap, linux-kernel

On Mon, 2005-10-24 at 13:26 +0100, James Hansen wrote:

> 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)




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2005-10-24 12:29 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-10-21 11:22 Information on ioctl32 James Hansen
2005-10-22  0:36 ` Randy.Dunlap
2005-10-23 14:03   ` Arnd Bergmann
2005-10-24  8:58     ` James Hansen
2005-10-24  9:32       ` Arnd Bergmann
2005-10-24 10:48         ` James Hansen
2005-10-24 11:20           ` Arnd Bergmann
2005-10-24 12:26             ` James Hansen
2005-10-24 12:29               ` Arjan van de Ven

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).