从不兼容的指针类型传递"proc_create"的参数4 [英] Passing argument 4 of ‘proc_create’ from incompatible pointer type

查看:38
本文介绍了从不兼容的指针类型传递"proc_create"的参数4的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试制作一个简单的procfs模块,但出现此错误:

I'm trying to make a simple procfs module, but I get this error:

error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]

我尝试了许多在线示例,但得到了相同的错误消息.

I tried many online examples and i got same error message.

推荐答案

您必须在较新的内核中使用 proc_ops 而不是 file_operations ,请参见

You have to use proc_ops in newer kernels instead of file_operations, see https://lore.kernel.org/linux-fsdevel/20191225172228.GA13378@avx2/:

static struct proc_ops my_fops={
    .proc_open = my_proc_open,
    .proc_release = single_release,
    .proc_read = seq_read,
    .proc_lseek = seq_lseek,
    .proc_write = my_proc_write
};

这篇关于从不兼容的指针类型传递"proc_create"的参数4的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆