在linux-2.6.36內核上加載編譯驅動時,出現
error:unknown field 'ioctl' specified in initializer
原因是:在2.6.36內核上file_operations發生了重大的改變:
原先的
int (*ioctl)(struct inode*, struct file*, unsigned int, unsigned long);
被改為了
long (*unlocked_ioctl) (struct file *, unsigned int, unsigned long);
long (*compat_ioctl) (struct file *, unsigned int, unsigned long);
因而在實際驅動中,我們需要將原先的寫的ioctl函數頭給改成下面的unlocked_ioctl,在file_operations結構體的填充中也是一樣。