Messages in this thread | | | From | Tvrtko Ursulin <> | Subject | Re: Which one corresponds to ioctl in the file_operations struct in linux/fs.h? | Date | Thu, 1 Dec 2011 10:22:12 +0000 |
| |
On Thursday 01 Dec 2011 07:40:49 Peng Yu wrote: > Hi, > > I have some driver code for older version of kernel. It refers to > ioctl in the file_operations struct. But this field is change in > kernel 3.0.0-13 > > I find the following in linux/fs.h > > 1566 long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long); > 1567 long (*compat_ioctl) (struct file *, unsigned int, unsigned long); > > Does anybody know which one I should use in order to migrate the > driver code to the newer version of kernel? Thanks!
From Documentation/filesystems/vfs.txt:
unlocked_ioctl: called by the ioctl(2) system call.
compat_ioctl: called by the ioctl(2) system call when 32 bit system calls are used on 64 bit kernels.
You don't need compat_ioctl if your ioctl arguments are 32/64-bit safe.
For both your code needs to be re-entrant or take appropriate locks internally.
Hope this helps,
Tvrtko
| |