static const struct file_operations globalmem_fops=
{
.owner=THIS_MODULE,
.llseek=globalmem_llseek,
.open=globalmem_open,
.read=globalmem_read,
.write=globalmem_write,
.ioctl=globalmem_ioctl,
.release=globalmem_release,
};
int globalmem_ioctl(struct inode* inode,struct file* filp, unsigned int cmd,unsigned long arg)
{
switch (cmd)
{
case:XXX: ...
……
}
}
改变后的
static const struct file_operations globalmem_fops=
{
.owner=THIS_MODULE,
.llseek=globalmem_llseek,
.open=globalmem_open,
.read=globalmem_read,
.write=globalmem_write,
.unlocked_ioctl=globalmem_ioctl,
.release=globalmem_release,
};
int globalmem_ioctl(struct file* filp, unsigned int cmd,unsigned long arg)//没有inode参数!
{
switch (cmd)
{
case:XXX: ...
……
}
}