Replacement for field ioctl in struct file_operations

asked 2015-07-13 15:41:03 -0500

Good afternoon,

I am trying to compile the source code of a driver that was written long time ago for the version 2.4 of Linux. The struct file_operations had a field called

int (*ioctl) (struct inode *, struct file *, unsigned int, unsigned long);

The ioctl system call offers a way to issue device-specific commands (such as for- matting a track of a floppy disk, which is neither reading nor writing). Addition- ally, a few ioctl commands are recognized by the kernel without referring to the fops table. If the device doesn’t provide an ioctl method, the system call returns an error for any request that isn’t predefined (-ENOTTY, “No such ioctl for device”).

The kernel under which I work (compile, etc) is version 3.6.10-2. struct file_operations evolved the field above disappeared and got replace by:

long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);

long (*compat_ioctl) (struct file *, unsigned int, unsigned long);

Q1 - Which one should I use?

Q2- The parameter struct inode* disappeared. Where can my fonction get the inode structure?

If someone can answer these questions, that would save me the work to browsw through the commits at this time.

Thank you,


edit retag flag offensive close merge delete