diff options
| author | Marcel Moolenaar <marcel@FreeBSD.org> | 2002-01-15 03:10:33 +0000 |
|---|---|---|
| committer | Marcel Moolenaar <marcel@FreeBSD.org> | 2002-01-15 03:10:33 +0000 |
| commit | bea90c29cf61f871298e846b38edfc19ae441f01 (patch) | |
| tree | 840e05d7911acb30ed3a4f80e62f794e6a68e72d /sys/compat | |
| parent | 74aac58b524043ad385dd0cf073589368b1fccfe (diff) | |
Notes
Diffstat (limited to 'sys/compat')
| -rw-r--r-- | sys/compat/linux/linux_ioctl.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index acf71d920e3e..4e72f85e4911 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -1818,6 +1818,33 @@ linux_ioctl_console(struct thread *td, struct linux_ioctl_args *args) #define IFP_IS_ETH(ifp) (ifp->if_type == IFT_ETHER) /* + * Interface function used by linprocfs (at the time of writing). It's not + * used by the Linuxulator itself. + */ +int +linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen) +{ + struct ifnet *ifscan; + int ethno; + + /* Short-circuit non ethernet interfaces */ + if (!IFP_IS_ETH(ifp)) + return (snprintf(buffer, buflen, "%s%d", ifp->if_name, + ifp->if_unit)); + + /* Determine the (relative) unit number for ethernet interfaces */ + ethno = 0; + TAILQ_FOREACH(ifscan, &ifnet, if_link) { + if (ifscan == ifp) + return (snprintf(buffer, buflen, "eth%d", ethno)); + if (IFP_IS_ETH(ifscan)) + ethno++; + } + + return (0); +} + +/* * Translate a Linux interface name to a FreeBSD interface name, * and return the associated ifnet structure * bsdname and lxname need to be least IFNAMSIZ bytes long, but |
