从不兼容的指针类型传递‘proc_create’的参数 4
Passing argument 4 of ‘proc_create’ from incompatible pointer type
我正在尝试制作一个简单的 procfs 模块,但出现此错误:
error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
我尝试了很多在线示例,但都收到了相同的错误消息。
您必须在较新的内核中使用 proc_ops
而不是 file_operations
,请参阅 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
};
我正在尝试制作一个简单的 procfs 模块,但出现此错误:
error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types]
我尝试了很多在线示例,但都收到了相同的错误消息。
您必须在较新的内核中使用 proc_ops
而不是 file_operations
,请参阅 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
};