ある目的のためにLinuxのデバイスドライバを作成している。ioctlに対応する必要があるので.ioctlに関数ポインタ代入といきたかったがエラー。.file_operationsに.ioctlなんてねーよ!と言われてしまった。何故かと思いlinux/fs.hを覗いたら確かになかった。代わりにunlocked_ioctlとcompat_ioctlが見つかる。Twitterでioctlが見つからないと嘆いたところ、compat_ioctl使えばOKという返答が!なのでさっそくcompat_ioctlを使うことにした。linux/fs.hによると定義は
long (*compat_ioctl) (struct file*, unsigned int, unsigned long);
となっていた。さっそく使ってみよう...と思ったらioctlで叩いたらエラー...なのでunlocked_ioctl使ってみたら成功した。これでいいのだろうか?
long (*unlocked_ioctl) (struct file*, unsigned int, unsigned long);