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/netgraph/ng_iface.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/netgraph/ng_iface.c')
-rw-r--r-- | sys/netgraph/ng_iface.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/sys/netgraph/ng_iface.c b/sys/netgraph/ng_iface.c index 3aa34f2..ca637e7 100644 --- a/sys/netgraph/ng_iface.c +++ b/sys/netgraph/ng_iface.c @@ -449,8 +449,8 @@ ng_iface_output(struct ifnet *ifp, struct mbuf *m, /* Check address family to determine hook (if known) */ if (iffam == NULL) { m_freem(m); - log(LOG_WARNING, "%s%d: can't handle af%d\n", - ifp->if_name, ifp->if_unit, (int)dst->sa_family); + log(LOG_WARNING, "%s: can't handle af%d\n", + ifp->if_xname, (int)dst->sa_family); return (EAFNOSUPPORT); } @@ -524,8 +524,8 @@ ng_iface_print_ioctl(struct ifnet *ifp, int command, caddr_t data) default: str = "IO??"; } - log(LOG_DEBUG, "%s%d: %s('%c', %d, char[%d])\n", - ifp->if_name, ifp->if_unit, + log(LOG_DEBUG, "%s: %s('%c', %d, char[%d])\n", + ifp->if_xname, str, IOCGROUP(command), command & 0xff, @@ -574,8 +574,7 @@ ng_iface_constructor(node_p node) priv->node = node; /* Initialize interface structure */ - ifp->if_name = NG_IFACE_IFACE_NAME; - ifp->if_unit = priv->unit; + if_initname(ifp, NG_IFACE_IFACE_NAME, priv->unit); ifp->if_output = ng_iface_output; ifp->if_start = ng_iface_start; ifp->if_ioctl = ng_iface_ioctl; @@ -591,7 +590,7 @@ ng_iface_constructor(node_p node) /* Give this node the same name as the interface (if possible) */ bzero(ifname, sizeof(ifname)); - snprintf(ifname, sizeof(ifname), "%s%d", ifp->if_name, ifp->if_unit); + strlcpy(ifname, ifp->if_xname, sizeof(ifname)); if (ng_name_node(node, ifname) != 0) log(LOG_WARNING, "%s: can't acquire netgraph name\n", ifname); @@ -647,8 +646,8 @@ ng_iface_rcvmsg(node_p node, item_p item, hook_p lasthook) break; } arg = (struct ng_iface_ifname *)resp->data; - snprintf(arg->ngif_name, sizeof(arg->ngif_name), - "%s%d", ifp->if_name, ifp->if_unit); + strlcpy(arg->ngif_name, ifp->if_xname, + sizeof(arg->ngif_name)); break; } |