问题
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.
回答1:
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
};
来源:https://stackoverflow.com/questions/61295277/passing-argument-4-of-proc-create-from-incompatible-pointer-type