Revise proc_ops creation logic in ch2 proc kernel module exercise#6
Open
LSKhappychild wants to merge 1 commit intogreggagne:masterfrom
Open
Revise proc_ops creation logic in ch2 proc kernel module exercise#6LSKhappychild wants to merge 1 commit intogreggagne:masterfrom
LSKhappychild wants to merge 1 commit intogreggagne:masterfrom
Conversation
|
Yes, I encounter the same problem.It need some fix I think |
qqwqqw689
approved these changes
Mar 30, 2023
lixit
approved these changes
Jun 4, 2023
|
Here's how to fix it proc_create(PROC_NAME, 0666, NULL, (const struct proc_ops *) &proc_ops); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.