0

像这样定义时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_readt_write静态和非静态函数声明不会引起警告时。例如:

static ssize_t t_read(struct file *filp, char __user * buf, size_t count, loff_t * f_pos);

为什么我在一种情况下收到警告,而在另一种情况下却没有?

4

1 回答 1

5

您很可能在同一个文件中有这样的定义:

static struct file_operations fileops = {
    .read     = t_read,
    .write    = t_write,
    /* etc. ... */
};

而你不见了

.compat_ioctl = t_ioctl, /* or .ioctl/.unlocked_ioctl, depending on version etc. */
于 2012-08-05T17:11:22.087 回答