diff options
author | brooks <brooks@FreeBSD.org> | 2003-10-31 18:32:15 +0000 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2003-10-31 18:32:15 +0000 |
commit | f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda (patch) | |
tree | 4d9e6671d486576767506230a4240131526fea49 /sys/compat/linux/linux_ioctl.c | |
parent | be546fdee455a96afdefee10d0bdba8547399f5b (diff) | |
download | FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.zip FreeBSD-src-f1e94c6f29b079e4ad9d9305ef3e90a719bcbbda.tar.gz |
Replace the if_name and if_unit members of struct ifnet with new members
if_xname, if_dname, and if_dunit. if_xname is the name of the interface
and if_dname/unit are the driver name and instance.
This change paves the way for interface renaming and enhanced pseudo
device creation and configuration symantics.
Approved By: re (in principle)
Reviewed By: njl, imp
Tested On: i386, amd64, sparc64
Obtained From: NetBSD (if_xname)
Diffstat (limited to 'sys/compat/linux/linux_ioctl.c')
-rw-r--r-- | sys/compat/linux/linux_ioctl.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/sys/compat/linux/linux_ioctl.c b/sys/compat/linux/linux_ioctl.c index 3bb0a6d..bc6f0d8 100644 --- a/sys/compat/linux/linux_ioctl.c +++ b/sys/compat/linux/linux_ioctl.c @@ -1881,8 +1881,7 @@ linux_ifname(struct ifnet *ifp, char *buffer, size_t buflen) /* Short-circuit non ethernet interfaces */ if (!IFP_IS_ETH(ifp)) - return (snprintf(buffer, buflen, "%s%d", ifp->if_name, - ifp->if_unit)); + return (strlcpy(buffer, ifp->if_xname, buflen)); /* Determine the (relative) unit number for ethernet interfaces */ ethno = 0; @@ -1932,15 +1931,14 @@ ifname_linux_to_bsd(const char *lxname, char *bsdname) * we never have an interface named "eth", so don't make * the test optional based on is_eth. */ - if (ifp->if_unit == unit && ifp->if_name[len] == '\0' && - strncmp(ifp->if_name, lxname, len) == 0) + if (strncmp(ifp->if_xname, lxname, LINUX_IFNAMSIZ) == 0) break; if (is_eth && IFP_IS_ETH(ifp) && unit == index++) break; } IFNET_RUNLOCK(); if (ifp != NULL) - snprintf(bsdname, IFNAMSIZ, "%s%d", ifp->if_name, ifp->if_unit); + strlcpy(bsdname, ifp->if_xname, IFNAMSIZ); return (ifp); } @@ -1988,8 +1986,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc) snprintf(ifr.ifr_name, LINUX_IFNAMSIZ, "eth%d", ethno++); else - snprintf(ifr.ifr_name, LINUX_IFNAMSIZ, "%s%d", - ifp->if_name, ifp->if_unit); + strlcpy(ifr.ifr_name, ifp->if_xname, LINUX_IFNAMSIZ); /* Walk the address list */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { |