'Build kernel module in CentOS 7 with changed API
I write NIC module driver and implement it base functions like ndo_open, ndo_stop, ndo_start_xmit...
Sometimes Linux Kernel API is changed in the recent versions. So macro like LINUX_VERSION_CODE helps adopt code of the module to recent Linux Kernel versions. In CentOS(RHEL) I meet that function name that changes MTU of NIC differs from vanilla Linux Kernel. In vanilla Linux Kernel v.3.10.0 it prototype is:
int (*ndo_change_mtu)(struct net_device *dev,
int new_mtu);
But in the CentOS 7.6.1810 3.10.0-957.el7.x86_64 it is:
RH_KABI_RENAME(int (*ndo_change_mtu),
int (*ndo_change_mtu_rh74))(struct net_device *dev,
int new_mtu);
So I must to use ndo_change_mtu_rh74 instead of ndo_change_mtu which works as I expected.
Is it possible to use some macro to adopt code of the module between different Linux Kernel versions without patching code to prevent compilation errors against CentOS(RHEL) Linux Kernels?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
