Reputation: 223
I want to communicate with my kernel module using ioctl. I have written two c program one for kernel module and other for user mode. I am getting this error while compiling kernel module:
error: unknown field ‘ioctl’ specified in initializer
at this line :
struct file_operations Fops = {
.read = device_read,
.write = device_write,
.ioctl = device_ioctl, ------> at this point error is occuring.
.open = device_open,
.release = device_release,
};
any idea why this is happening.
thanks
Upvotes: 17
Views: 16524
Reputation: 41
In newer kernels, use .unlocked_ioctl
in the place of .ioctl
. It works fine.
Upvotes: 4
Reputation: 6097
In newer kernels, the preferred way is to use .unlocked_ioctl
or .compat_ioctl
fields. The plain .ioctl
was removed from struct file_operations
. This discussion may clarify what happened and how to deal with that.
Upvotes: 23