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/net/if_ef.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/net/if_ef.c')
-rw-r--r-- | sys/net/if_ef.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/sys/net/if_ef.c b/sys/net/if_ef.c index cb7bc64..8b5aee0 100644 --- a/sys/net/if_ef.c +++ b/sys/net/if_ef.c @@ -79,6 +79,7 @@ struct efnet { struct arpcom ef_ac; struct ifnet * ef_ifp; + int ef_frametype; }; struct ef_link { @@ -138,7 +139,7 @@ ef_attach(struct efnet *sc) bcopy(LLADDR(sdl2), sc->ef_ac.ac_enaddr, ETHER_ADDR_LEN); - EFDEBUG("%s%d: attached\n", ifp->if_name, ifp->if_unit); + EFDEBUG("%s: attached\n", ifp->if_xname); return 1; } @@ -178,11 +179,11 @@ ef_init(void *foo) { static int ef_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) { -/* struct ef_link *sc = (struct ef_link*)ifp->if_softc;*/ + struct efnet *sc = ifp->if_softc; struct ifaddr *ifa = (struct ifaddr*)data; int s, error; - EFDEBUG("IOCTL %ld for %s%d\n", cmd, ifp->if_name, ifp->if_unit); + EFDEBUG("IOCTL %ld for %s\n", cmd, ifp->if_xname); error = 0; s = splimp(); switch (cmd) { @@ -190,7 +191,7 @@ ef_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) error = 0; break; case SIOCSIFADDR: - if (ifp->if_unit == ETHER_FT_8023 && + if (sc->ef_frametype == ETHER_FT_8023 && ifa->ifa_addr->sa_family != AF_IPX) { error = EAFNOSUPPORT; break; @@ -406,13 +407,14 @@ static int ef_output(struct ifnet *ifp, struct mbuf **mp, struct sockaddr *dst, short *tp, int *hlen) { + struct efnet *sc = (struct efnet*)ifp->if_softc; struct mbuf *m = *mp; u_char *cp; short type; if (ifp->if_type != IFT_XETHER) return ENETDOWN; - switch (ifp->if_unit) { + switch (sc->ef_frametype) { case ETHER_FT_EII: #ifdef IPX type = htons(ETHERTYPE_IPX); @@ -474,20 +476,18 @@ ef_clone(struct ef_link *efl, int ft) struct efnet *efp; struct ifnet *eifp; struct ifnet *ifp = efl->el_ifp; - char cbuf[IFNAMSIZ], *ifname; - int ifnlen; efp = (struct efnet*)malloc(sizeof(struct efnet), M_IFADDR, M_WAITOK | M_ZERO); if (efp == NULL) return ENOMEM; efp->ef_ifp = ifp; + efp->ef_frametype = ft; eifp = &efp->ef_ac.ac_if; - ifnlen = 1 + snprintf(cbuf, sizeof(cbuf), "%s%df", ifp->if_name, - ifp->if_unit); - ifname = (char*)malloc(ifnlen, M_IFADDR, M_WAITOK); - eifp->if_name = strcpy(ifname, cbuf); - eifp->if_unit = ft; + snprintf(eifp->if_xname, IFNAMSIZ, + "%sf%d", ifp->if_xname, efp->ef_frametype); + eifp->if_dname = "ef"; + eifp->if_dunit = IF_DUNIT_NONE; eifp->if_softc = efp; if (ifp->if_ioctl) eifp->if_ioctl = ef_ioctl; @@ -506,7 +506,7 @@ ef_load(void) IFNET_RLOCK(); TAILQ_FOREACH(ifp, &ifnet, if_link) { if (ifp->if_type != IFT_ETHER) continue; - EFDEBUG("Found interface %s%d\n", ifp->if_name, ifp->if_unit); + EFDEBUG("Found interface %s\n", ifp->if_xname); efl = (struct ef_link*)malloc(sizeof(struct ef_link), M_IFADDR, M_WAITOK | M_ZERO); if (efl == NULL) { |