diff options
Diffstat (limited to 'sys/compat/linprocfs/linprocfs.c')
-rw-r--r-- | sys/compat/linprocfs/linprocfs.c | 45 |
1 files changed, 35 insertions, 10 deletions
diff --git a/sys/compat/linprocfs/linprocfs.c b/sys/compat/linprocfs/linprocfs.c index 76760a1..c6ac47b 100644 --- a/sys/compat/linprocfs/linprocfs.c +++ b/sys/compat/linprocfs/linprocfs.c @@ -39,8 +39,6 @@ * @(#)procfs_status.c 8.4 (Berkeley) 6/15/94 */ -#include "opt_compat.h" - #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); @@ -68,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include <sys/smp.h> #include <sys/socket.h> #include <sys/sysctl.h> +#include <sys/sysent.h> #include <sys/systm.h> #include <sys/time.h> #include <sys/tty.h> @@ -78,7 +77,7 @@ __FBSDID("$FreeBSD$"); #include <sys/bus.h> #include <net/if.h> -#include <net/vnet.h> +#include <net/if_types.h> #include <vm/vm.h> #include <vm/vm_extern.h> @@ -98,11 +97,6 @@ __FBSDID("$FreeBSD$"); #include <machine/md_var.h> #endif /* __i386__ || __amd64__ */ -#ifdef COMPAT_FREEBSD32 -#include <compat/freebsd32/freebsd32_util.h> -#endif - -#include <compat/linux/linux_ioctl.h> #include <compat/linux/linux_mib.h> #include <compat/linux/linux_misc.h> #include <compat/linux/linux_util.h> @@ -1093,6 +1087,35 @@ linprocfs_doprocmaps(PFS_FILL_ARGS) } /* + * Criteria for interface name translation + */ +#define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) + +static int +linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen) +{ + struct ifnet *ifscan; + int ethno; + + IFNET_RLOCK_ASSERT(); + + /* Short-circuit non ethernet interfaces */ + if (!IFP_IS_ETH(ifp)) + return (strlcpy(buffer, ifp->if_xname, buflen)); + + /* Determine the (relative) unit number for ethernet interfaces */ + ethno = 0; + TAILQ_FOREACH(ifscan, &V_ifnet, if_link) { + if (ifscan == ifp) + return (snprintf(buffer, buflen, "eth%d", ethno)); + if (IFP_IS_ETH(ifscan)) + ethno++; + } + + return (0); +} + +/* * Filler function for proc/net/dev */ static int @@ -1239,8 +1262,6 @@ linprocfs_doscsiscsi(PFS_FILL_ARGS) return (0); } -extern struct cdevsw *cdevsw[]; - /* * Filler function for proc/devices */ @@ -1455,7 +1476,11 @@ linprocfs_uninit(PFS_INIT_ARGS) } PSEUDOFS(linprocfs, 1, 0); +#if defined(__amd64__) +MODULE_DEPEND(linprocfs, linux_common, 1, 1, 1); +#else MODULE_DEPEND(linprocfs, linux, 1, 1, 1); +#endif MODULE_DEPEND(linprocfs, procfs, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvmsg, 1, 1, 1); MODULE_DEPEND(linprocfs, sysvsem, 1, 1, 1); |