allow simple-procfs to work with the new procfs api introduced RHEL9 #2
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.
kernel commit d56c0d45f0e27f814e87a1676b6bdccccbc252e9 changed the signature of the proc_create() function (used by simple-procfs-kmod.c) from taking an argument of type struct file_operations to taking a new struct, struct proc_ops. This change seems to have happened in the 5.6 kernel release so was not in RHEL8 but is now part of the RHEL9 kernel.
This causes simple-procfs-kmod.ko to fail to compile under RHEL9 with a message:
./include/linux/proc_fs.h:110:122: note: expected 'const struct proc_ops *' but argument is of type 'struct file_operations *'
110 | struct proc_dir_entry *proc_create(const char *name, umode_t mode, struct proc_dir_entry *parent, const struct proc_ops *proc_ops);
This PR updates the code to allocate and populate a (very) basic proc_ops structure using the exisiting myread and mywrite functions, and use that as the argument to proc_create. It also adds a proc_lseek function stub which proc_ops mandates. Without this running the spkut utility causes a kernel panic (due to a null pointer dereference).
It wraps the new code in an #ifdef preprocessor directive that checks for the 5.6 kernel and uses the appropriate version of the code so the kmod will continue to compile on RHEL8 as before, only using the new struct for later kernels.