RHEL and its derivatives report LINUX_VERSION_CODE 5.14.0 for the whole of el9
while backporting newer kernel APIs into it, so the version check alone picked
the pre-6.3 branch on every el9 >= 9.5 and the module failed to build with
"assignment of read-only member 'vm_flags'". HAVE_VM_FLAGS_SET could override
it, but nothing sets it and dkms.conf does not pass it, so a build from the RPM
had no way to reach it.
vm_flags_set() and the const vm_flags member appear between kernel-5.14.0-440
and -450.el9, during the 9.5 development stream. RHEL_MINOR tracks the released
minor exactly, so RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,5) is the test:
9.0-9.4 (GA -427) do not have them, 9.5 (-503), 9.6 (-570), 9.7 (-611) and
9.8 (-655) do. el10 is 6.12-based and LINUX_VERSION_CODE already covers it, as
it does the removal of no_llseek that the other guard in this driver handles.
Spelled through a JFJOCH_RHEL_GE() helper rather than inline, because the
obvious form
#if defined(RHEL_RELEASE_CODE) && RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9,5)
is a hard error on both gcc and clang for every non-RHEL kernel: && does not
short-circuit past a parse error, and the undefined function-like macro leaves
"0 (9,5)" behind.
Also corrects > to >= on the upstream check. The wrappers landed in 6.3, so a
vanilla 6.3.0 kernel was taking the pre-6.3 branch.
Generated code on el8 is unchanged.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PLMZgfMEdtPBZt1F2rNbRA