How to perform an ioctl call from a kernel module

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Here's the situation.  My kernel module is passed a file during
initialization, and it needs to check that the file is a SCSI device file.  
There is an ioctl that all SCSI device drivers respond to, so it would be
easy to do this from a userspace program.  But is it legal to call the
ioctl entry point from within my kernel module?

The ioctl requires a pointer to a buffer located in userspace.  I could 
pass a pointer to a buffer in the kernel, but that's not the same.  
Probably there are some architectures or variants of Linux where one 
cannot be substituted for the other (although I don't _know_ if that's 
true).

Anyway, how can I do this?  It seems ironic that there are aspects of the
kernel that are more easily accessible from a user process than from
within the kernel itself.

Alan Stern

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux