From: mvs Date: Mon, 1 Feb 2021 07:43:33 +0000 (+0000) Subject: ifunit() was fully replaced by if_unit(9) and should go away. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=8ea6f4e4c1a75ca77f56f385c9ebaf57677c84d1;p=openbsd ifunit() was fully replaced by if_unit(9) and should go away. ok bluhm@ dlg@ --- diff --git a/sys/net/if.c b/sys/net/if.c index 50d1e1d2a6b..4be2af461df 100644 --- a/sys/net/if.c +++ b/sys/net/if.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if.c,v 1.625 2021/01/18 09:55:43 mvs Exp $ */ +/* $OpenBSD: if.c,v 1.626 2021/02/01 07:43:33 mvs Exp $ */ /* $NetBSD: if.c,v 1.35 1996/05/07 05:26:04 thorpej Exp $ */ /* @@ -1654,34 +1654,23 @@ if_watchdog_task(void *xifidx) } /* - * Map interface name to interface structure pointer (legacy). + * Map interface name to interface structure pointer. */ struct ifnet * -ifunit(const char *name) +if_unit(const char *name) { struct ifnet *ifp; KERNEL_ASSERT_LOCKED(); TAILQ_FOREACH(ifp, &ifnet, if_list) { - if (strcmp(ifp->if_xname, name) == 0) + if (strcmp(ifp->if_xname, name) == 0) { + if_ref(ifp); return (ifp); + } } - return (NULL); -} - -/* - * Map interface name to interface structure pointer. - */ -struct ifnet * -if_unit(const char *name) -{ - struct ifnet *ifp; - - if ((ifp = ifunit(name)) != NULL) - if_ref(ifp); - return (ifp); + return (NULL); } /* diff --git a/sys/net/if.h b/sys/net/if.h index 48a7417955f..0a53f788eed 100644 --- a/sys/net/if.h +++ b/sys/net/if.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if.h,v 1.205 2021/01/18 09:55:43 mvs Exp $ */ +/* $OpenBSD: if.h,v 1.206 2021/02/01 07:43:33 mvs Exp $ */ /* $NetBSD: if.h,v 1.23 1996/05/07 02:40:27 thorpej Exp $ */ /* @@ -545,7 +545,6 @@ struct ifg_group *if_creategroup(const char *); int if_addgroup(struct ifnet *, const char *); int if_delgroup(struct ifnet *, const char *); void if_group_routechange(struct sockaddr *, struct sockaddr *); -struct ifnet *ifunit(const char *); struct ifnet *if_unit(const char *); struct ifnet *if_get(unsigned int); void if_put(struct ifnet *);