| Add macro _NO_CONVERT_IFNAME that prevent interface names to be converted to |
| eth*. Useful when using linprocfs separately without Linux binary |
| compatibility. |
| |
| diff -ru --exclude-from freebsd-src-diff-exclude-names /var/archive3/public/freebsd-releng-10.4-src/sys/compat/linprocfs/linprocfs.c freebsd-10.4/sys/compat/linprocfs/linprocfs.c |
| --- /var/archive3/public/freebsd-releng-10.4-src/sys/compat/linprocfs/linprocfs.c 2017-09-29 08:19:56.000000000 +0800 |
| +++ freebsd-10.4/sys/compat/linprocfs/linprocfs.c 2019-08-18 00:21:10.309142173 +0800 |
| @@ -39,6 +39,8 @@ |
| * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 |
| */ |
| |
| +#define _NO_CONVERT_IFNAME 1 |
| + |
| #include <sys/cdefs.h> |
| __FBSDID("$FreeBSD: releng/10.4/sys/compat/linprocfs/linprocfs.c 299221 2016-05-07 19:05:39Z dchagin $"); |
| |
| @@ -1096,6 +1098,7 @@ |
| return (error); |
| } |
| |
| +#ifndef _NO_CONVERT_IFNAME |
| /* |
| * Criteria for interface name translation |
| */ |
| @@ -1124,6 +1127,7 @@ |
| |
| return (0); |
| } |
| +#endif |
| |
| /* |
| * Filler function for proc/net/dev |
| @@ -1131,7 +1135,9 @@ |
| static int |
| linprocfs_donetdev(PFS_FILL_ARGS) |
| { |
| +#ifndef _NO_CONVERT_IFNAME |
| char ifname[16]; /* XXX LINUX_IFNAMSIZ */ |
| +#endif |
| struct ifnet *ifp; |
| |
| sbuf_printf(sb, "%6s|%58s|%s\n" |
| @@ -1144,8 +1150,12 @@ |
| CURVNET_SET(TD_TO_VNET(curthread)); |
| IFNET_RLOCK(); |
| TAILQ_FOREACH(ifp, &V_ifnet, if_link) { |
| +#ifdef _NO_CONVERT_IFNAME |
| + sbuf_printf(sb, "%6.6s: ", ifp->if_xname); |
| +#else |
| linux_ifname(ifp, ifname, sizeof ifname); |
| sbuf_printf(sb, "%6.6s: ", ifname); |
| +#endif |
| sbuf_printf(sb, "%7lu %7lu %4lu %4lu %4lu %5lu %10lu %9lu ", |
| ifp->if_ibytes, /* rx_bytes */ |
| ifp->if_ipackets, /* rx_packets */ |