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