Revise proc_ops creation logic in ch2 proc kernel module exercise #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently I'm using Linux kernel version 5.15.0 with ubuntu 22.04.1 LTS.
In chapter 2, exercise for creating proc file system kernel module,
provided source code generates following error :
error: passing argument 4 of ‘proc_create’ from incompatible pointer type [-Werror=incompatible-pointer-types] 50 | proc_create(PROC_NAME, 0, NULL, &proc_ops); | ^~~~~~~~~ | | | struct file_operations * In file included from /home/lskhappychild/Desktop/Systems/Linux/ch2/hello.c:16: ./include/linux/proc_fs.h:110:122: note: expected ‘const struct proc_ops *’ but argument is of type ‘struct file_operations *’ 110 | t char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
And this seems to happen due to Linux version compatibility.
So added part needed for compatibility with higher version linux kernel.