Remove the unused softc from the lo(4) driver.
Now that the pseudo-interface cloner has an internal list of instances, there is no need to create a softc. The softc only contains a pointer to the ifp, which means there is no valid reason to keep it. While there, remove the corresponding malloc-pool. Approved by: philip (mentor)
This commit is contained in:
parent
0eb008c767
commit
67ff1e3090
@ -42,7 +42,6 @@
|
||||
#include <sys/param.h>
|
||||
#include <sys/systm.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/malloc.h>
|
||||
#include <sys/mbuf.h>
|
||||
#include <sys/module.h>
|
||||
#include <machine/bus.h>
|
||||
@ -89,12 +88,6 @@
|
||||
#define LOMTU 16384
|
||||
#endif
|
||||
|
||||
#define LONAME "lo"
|
||||
|
||||
struct lo_softc {
|
||||
struct ifnet *sc_ifp;
|
||||
};
|
||||
|
||||
int loioctl(struct ifnet *, u_long, caddr_t);
|
||||
static void lortrequest(int, struct rtentry *, struct rt_addrinfo *);
|
||||
int looutput(struct ifnet *ifp, struct mbuf *m,
|
||||
@ -104,16 +97,11 @@ static void lo_clone_destroy(struct ifnet *);
|
||||
|
||||
struct ifnet *loif = NULL; /* Used externally */
|
||||
|
||||
static MALLOC_DEFINE(M_LO, LONAME, "Loopback Interface");
|
||||
|
||||
IFC_SIMPLE_DECLARE(lo, 1);
|
||||
|
||||
static void
|
||||
lo_clone_destroy(struct ifnet *ifp)
|
||||
{
|
||||
struct lo_softc *sc;
|
||||
|
||||
sc = ifp->if_softc;
|
||||
|
||||
/* XXX: destroying lo0 will lead to panics. */
|
||||
KASSERT(loif != ifp, ("%s: destroying lo0", __func__));
|
||||
@ -121,21 +109,16 @@ lo_clone_destroy(struct ifnet *ifp)
|
||||
bpfdetach(ifp);
|
||||
if_detach(ifp);
|
||||
if_free(ifp);
|
||||
free(sc, M_LO);
|
||||
}
|
||||
|
||||
static int
|
||||
lo_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
{
|
||||
struct ifnet *ifp;
|
||||
struct lo_softc *sc;
|
||||
|
||||
MALLOC(sc, struct lo_softc *, sizeof(*sc), M_LO, M_WAITOK | M_ZERO);
|
||||
ifp = sc->sc_ifp = if_alloc(IFT_LOOP);
|
||||
if (ifp == NULL) {
|
||||
free(sc, M_LO);
|
||||
ifp = if_alloc(IFT_LOOP);
|
||||
if (ifp == NULL)
|
||||
return (ENOSPC);
|
||||
}
|
||||
|
||||
if_initname(ifp, ifc->ifc_name, unit);
|
||||
ifp->if_mtu = LOMTU;
|
||||
@ -143,7 +126,6 @@ lo_clone_create(struct if_clone *ifc, int unit, caddr_t params)
|
||||
ifp->if_ioctl = loioctl;
|
||||
ifp->if_output = looutput;
|
||||
ifp->if_snd.ifq_maxlen = ifqmaxlen;
|
||||
ifp->if_softc = sc;
|
||||
if_attach(ifp);
|
||||
bpfattach(ifp, DLT_NULL, sizeof(u_int32_t));
|
||||
if (loif == NULL)
|
||||
|
Loading…
Reference in New Issue
Block a user