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/netatm | |
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/netatm')
-rw-r--r-- | sys/netatm/atm_if.c | 13 | ||||
-rw-r--r-- | sys/netatm/atm_if.h | 2 | ||||
-rw-r--r-- | sys/netatm/atm_socket.c | 2 | ||||
-rw-r--r-- | sys/netatm/atm_usrreq.c | 2 | ||||
-rw-r--r-- | sys/netatm/atm_var.h | 2 | ||||
-rw-r--r-- | sys/netatm/ipatm/ipatm_usrreq.c | 7 | ||||
-rw-r--r-- | sys/netatm/spans/spans_arp.c | 8 | ||||
-rw-r--r-- | sys/netatm/uni/uniarp.c | 16 |
8 files changed, 22 insertions, 30 deletions
diff --git a/sys/netatm/atm_if.c b/sys/netatm/atm_if.c index ea2d2ce..81edae1 100644 --- a/sys/netatm/atm_if.c +++ b/sys/netatm/atm_if.c @@ -96,7 +96,7 @@ static int (*atm_ifouttbl[AF_MAX+1]) int atm_physif_register(cup, name, sdp) Cmn_unit *cup; - char *name; + const char *name; struct stack_defn *sdp; { struct atm_pif *pip; @@ -341,7 +341,7 @@ atm_physif_ioctl(code, data, arg) "%s%d", pip->pif_name, pip->pif_unit ); if ( pip->pif_nif ) { - strcpy(apr.anp_nif_pref, pip->pif_nif->nif_if.if_name); + strcpy(apr.anp_nif_pref, pip->pif_nif->nif_if.if_dname); nip = pip->pif_nif; while ( nip ) { @@ -392,7 +392,7 @@ atm_physif_ioctl(code, data, arg) */ bzero((caddr_t)&anr, sizeof(anr)); (void) snprintf(anr.anp_intf, sizeof(anr.anp_intf), - "%s%d", ifp->if_name, ifp->if_unit); + "%s%d", ifp->if_dname, ifp->if_dunit); IFP_TO_IA(ifp, ia); if (ia) { anr.anp_proto_addr = *ia->ia_ifa.ifa_addr; @@ -508,8 +508,7 @@ atm_physif_ioctl(code, data, arg) strcpy ( nip->nif_name, asr->asr_nif_pref ); nip->nif_sel = count; - ifp->if_name = nip->nif_name; - ifp->if_unit = count; + if_initname(ifp, nip->nif_name, count); ifp->if_mtu = ATM_NIF_MTU; ifp->if_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING; ifp->if_output = atm_ifoutput; @@ -1128,8 +1127,8 @@ atm_nifname(name) */ for (nip = pip->pif_nif; nip; nip = nip->nif_pnext) { struct ifnet *ifp = (struct ifnet *)nip; - if ((ifp->if_unit == unit) && - (strcmp(ifp->if_name, n) == 0)) + if ((ifp->if_dunit == unit) && + (strcmp(ifp->if_dname, n) == 0)) return (nip); } } diff --git a/sys/netatm/atm_if.h b/sys/netatm/atm_if.h index d1ea8e1..73c40d2 100644 --- a/sys/netatm/atm_if.h +++ b/sys/netatm/atm_if.h @@ -180,7 +180,7 @@ typedef struct atm_config Atm_config; */ struct atm_pif { struct atm_pif *pif_next; /* Next registered atm interface */ - char *pif_name; /* Device name */ + const char *pif_name; /* Device name */ short pif_unit; /* Device unit number */ u_char pif_flags; /* Interface flags (see below) */ struct sigmgr *pif_sigmgr; /* Signalling Manager for interface */ diff --git a/sys/netatm/atm_socket.c b/sys/netatm/atm_socket.c index c0f5435..1c98961 100644 --- a/sys/netatm/atm_socket.c +++ b/sys/netatm/atm_socket.c @@ -1218,7 +1218,7 @@ atm_sock_getopt(so, sopt, atp) ifp = &ap->nif->nif_if; (void) snprintf(netif.net_intf, sizeof(netif.net_intf), - "%s%d", ifp->if_name, ifp->if_unit); + "%s", ifp->if_xname); return (sooptcopyout(sopt, &netif, sizeof netif)); } else { diff --git a/sys/netatm/atm_usrreq.c b/sys/netatm/atm_usrreq.c index ffb9a94..4cc78b7 100644 --- a/sys/netatm/atm_usrreq.c +++ b/sys/netatm/atm_usrreq.c @@ -390,7 +390,7 @@ atm_dgram_control(so, cmd, data, ifp, td) */ IFNET_RLOCK(); TAILQ_FOREACH(ifp2, &ifnet, if_link) { - if (!strcmp(ifp2->if_name, asp->asr_nif_pref)) { + if (!strcmp(ifp2->if_dname, asp->asr_nif_pref)) { /* * If this is for the interface we're * (re-)defining, let it through diff --git a/sys/netatm/atm_var.h b/sys/netatm/atm_var.h index 6085275..141a737 100644 --- a/sys/netatm/atm_var.h +++ b/sys/netatm/atm_var.h @@ -113,7 +113,7 @@ void atm_dev_pdu_print(const Cmn_unit *, const Cmn_vcc *, const KBuffer *, const char *); /* atm_if.c */ -int atm_physif_register(Cmn_unit *, char *, +int atm_physif_register(Cmn_unit *, const char *, struct stack_defn *); int atm_physif_deregister(Cmn_unit *); void atm_physif_freenifs(struct atm_pif *, uma_zone_t); diff --git a/sys/netatm/ipatm/ipatm_usrreq.c b/sys/netatm/ipatm/ipatm_usrreq.c index b22c2b6..99d1575 100644 --- a/sys/netatm/ipatm/ipatm_usrreq.c +++ b/sys/netatm/ipatm/ipatm_usrreq.c @@ -446,10 +446,9 @@ ipatm_ioctl(code, data, arg1) AF_INET; SATOSIN(&aivr.aip_dst_addr)->sin_addr.s_addr = ivp->iv_dst.s_addr; - (void) snprintf(aivr.aip_intf, - sizeof(aivr.aip_intf), "%s%d", - inp->inf_nif->nif_if.if_name, - inp->inf_nif->nif_if.if_unit); + strlcpy(aivr.aip_intf, + inp->inf_nif->nif_if.if_xname, + sizeof(aivr.aip_intf)); if ((ivp->iv_conn) && (ivp->iv_conn->co_connvc) && (vcp = ivp->iv_conn->co_connvc->cvc_vcc)) { diff --git a/sys/netatm/spans/spans_arp.c b/sys/netatm/spans/spans_arp.c index 06b73fe..63f7245 100644 --- a/sys/netatm/spans/spans_arp.c +++ b/sys/netatm/spans/spans_arp.c @@ -1117,11 +1117,9 @@ spansarp_ioctl(code, data, arg1) AF_INET; SATOSIN(&aar.aap_arp_addr)->sin_addr.s_addr = sap->sa_dstip.s_addr; - (void) snprintf(aar.aap_intf, - sizeof(aar.aap_intf), "%s%d", - clp->cls_ipnif->inf_nif->nif_if.if_name, - clp->cls_ipnif->inf_nif->nif_if.if_unit - ); + strlcpy(aar.aap_intf, + clp->cls_ipnif->inf_nif->nif_if.if_xname, + sizeof(aar.aap_intf)); aar.aap_flags = sap->sa_flags; aar.aap_origin = sap->sa_origin; if (sap->sa_flags & SAF_VALID) diff --git a/sys/netatm/uni/uniarp.c b/sys/netatm/uni/uniarp.c index b593199..ff6819f 100644 --- a/sys/netatm/uni/uniarp.c +++ b/sys/netatm/uni/uniarp.c @@ -1054,10 +1054,8 @@ uniarp_ioctl(code, data, arg1) AF_INET; SATOSIN(&aar.aap_arp_addr)->sin_addr.s_addr = uap->ua_dstip.s_addr; - (void) snprintf(aar.aap_intf, - sizeof(aar.aap_intf), "%s%d", - nip->nif_if.if_name, - nip->nif_if.if_unit); + strlcpy(aar.aap_intf, nip->nif_if.if_xname, + sizeof(aar.aap_intf)); aar.aap_flags = uap->ua_flags; aar.aap_origin = uap->ua_origin; if (uap->ua_flags & UAF_VALID) @@ -1109,9 +1107,8 @@ uniarp_ioctl(code, data, arg1) */ SATOSIN(&aar.aap_arp_addr)->sin_family = AF_INET; SATOSIN(&aar.aap_arp_addr)->sin_addr.s_addr = 0; - (void) snprintf(aar.aap_intf, - sizeof(aar.aap_intf), "%s%d", - nip->nif_if.if_name, nip->nif_if.if_unit); + strlcpy(aar.aap_intf, nip->nif_if.if_xname, + sizeof(aar.aap_intf)); aar.aap_flags = 0; aar.aap_origin = uap->ua_origin; aar.aap_age = 0; @@ -1190,9 +1187,8 @@ updbuf: /* * Fill in info to be returned */ - (void) snprintf(asr.asp_intf, - sizeof(asr.asp_intf), "%s%d", - nip->nif_if.if_name, nip->nif_if.if_unit); + strlcpy(asr.asp_intf, nip->nif_if.if_xname, + sizeof(asr.asp_intf)); asr.asp_state = uip->uip_arpstate; if (uip->uip_arpstate == UIAS_SERVER_ACTIVE) { asr.asp_addr.address_format = T_ATM_ABSENT; |