[英]Why do I get this compilation warning in a kernel module with ioctl?
When defining t_ioctl
like this, I get no warning: 像这样定义t_ioctl
,我没有得到警告:
long t_ioctl(struct file *filep, unsigned int cmd, unsigned long input){
When defining t_ioctl
like this: 像这样定义t_ioctl
:
static long t_ioctl(struct file *filep, unsigned int cmd, unsigned long input){
I get the warning: 我得到警告:
warning: 't_ioctl' defined but not used
but when it is up to t_read
or t_write
the static and non static function declaration doesn't cause the warning. 但是当达到t_read
或t_write
,静态和非静态函数声明不会引起警告。 eg: 例如:
static ssize_t t_read(struct file *filp, char __user * buf, size_t count, loff_t * f_pos);
Why do I get the warning in one case and not the other? 为什么在一种情况下而不是另一种情况下得到警告?
Most likely you have a definition like this in the same file: 您很可能在同一文件中具有如下定义:
static struct file_operations fileops = {
.read = t_read,
.write = t_write,
/* etc. ... */
};
And you're missing 而你失踪了
.compat_ioctl = t_ioctl, /* or .ioctl/.unlocked_ioctl, depending on version etc. */
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.