xref: /OK3568_Linux_fs/buildroot/package/atop/0001-ifprop.c-fix-build-with-kernel-4.6.patch (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593SmuzhiyunFrom aff473ee28903775e1bb35793b9c4c50ee0c7270 Mon Sep 17 00:00:00 2001
2*4882a593SmuzhiyunFrom: Fabrice Fontaine <fontaine.fabrice@gmail.com>
3*4882a593SmuzhiyunDate: Tue, 22 Dec 2020 12:23:33 +0100
4*4882a593SmuzhiyunSubject: [PATCH] ifprop.c: fix build with kernel < 4.6
5*4882a593Smuzhiyun
6*4882a593SmuzhiyunBuild fails with kernel headers < 4.6 since version 2.6.0 and
7*4882a593Smuzhiyunhttps://github.com/Atoptool/atop/commit/08c622ecaa5bb0bb260984ceaddc4730d1b312a7
8*4882a593Smuzhiyun
9*4882a593SmuzhiyunIndeed, ethtool_link_settings and ETHTOOL_GLINKSETTINGS are only
10*4882a593Smuzhiyunavailable since
11*4882a593Smuzhiyunhttps://github.com/torvalds/linux/commit/3f1ac7a700d039c61d8d8b99f28d605d489a60cf
12*4882a593Smuzhiyun
13*4882a593SmuzhiyunSigned-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
14*4882a593Smuzhiyun[Upstream status: https://github.com/Atoptool/atop/pull/142]
15*4882a593Smuzhiyun---
16*4882a593Smuzhiyun ifprop.c | 4 ++++
17*4882a593Smuzhiyun 1 file changed, 4 insertions(+)
18*4882a593Smuzhiyun
19*4882a593Smuzhiyundiff --git a/ifprop.c b/ifprop.c
20*4882a593Smuzhiyunindex 60fa3fa..63fce5a 100644
21*4882a593Smuzhiyun--- a/ifprop.c
22*4882a593Smuzhiyun+++ b/ifprop.c
23*4882a593Smuzhiyun@@ -104,7 +104,9 @@ initifprop(void)
24*4882a593Smuzhiyun 	char 				*cp, linebuf[2048];
25*4882a593Smuzhiyun 	int				i=0, sockfd;
26*4882a593Smuzhiyun
27*4882a593Smuzhiyun+#ifdef ETHTOOL_GLINKSETTINGS
28*4882a593Smuzhiyun 	struct ethtool_link_settings 	ethlink;	// preferred!
29*4882a593Smuzhiyun+#endif
30*4882a593Smuzhiyun 	struct ethtool_cmd 		ethcmd;		// deprecated
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun 	struct ifreq		 	ifreq;
33*4882a593Smuzhiyun@@ -153,6 +155,7 @@ initifprop(void)
34*4882a593Smuzhiyun 		strncpy((void *)&ifreq.ifr_ifrn.ifrn_name, ifprops[i].name,
35*4882a593Smuzhiyun 				sizeof ifreq.ifr_ifrn.ifrn_name-1);
36*4882a593Smuzhiyun
37*4882a593Smuzhiyun+#ifdef ETHTOOL_GLINKSETTINGS
38*4882a593Smuzhiyun 		ethlink.cmd              = ETHTOOL_GLINKSETTINGS;
39*4882a593Smuzhiyun 		ifreq.ifr_ifru.ifru_data = (void *)&ethlink;
40*4882a593Smuzhiyun
41*4882a593Smuzhiyun@@ -164,6 +167,7 @@ initifprop(void)
42*4882a593Smuzhiyun 			phy_addr = ethlink.phy_address;
43*4882a593Smuzhiyun 		}
44*4882a593Smuzhiyun 		else
45*4882a593Smuzhiyun+#endif
46*4882a593Smuzhiyun 		{
47*4882a593Smuzhiyun 			ethcmd.cmd               = ETHTOOL_GSET;
48*4882a593Smuzhiyun 			ifreq.ifr_ifru.ifru_data = (void *)&ethcmd;
49*4882a593Smuzhiyun--
50*4882a593Smuzhiyun2.29.2
51*4882a593Smuzhiyun
52