Change the network interface cloning API so the destroy function returns
an int errorcode instead of void in preperation for merging cloning of the loopback device. Submitted by: mux MFC after: 2 weeks
This commit is contained in:
parent
a7336f1ad6
commit
50d3be4c82
@ -636,8 +636,7 @@ if_clone_destroy(name)
|
||||
if (ifc->ifc_destroy == NULL)
|
||||
return (EOPNOTSUPP);
|
||||
|
||||
(*ifc->ifc_destroy)(ifp);
|
||||
return (0);
|
||||
return ((*ifc->ifc_destroy)(ifp));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -65,7 +65,7 @@ struct if_clone {
|
||||
size_t ifc_namelen; /* length of name */
|
||||
|
||||
int (*ifc_create)(struct if_clone *, int *);
|
||||
void (*ifc_destroy)(struct ifnet *);
|
||||
int (*ifc_destroy)(struct ifnet *);
|
||||
};
|
||||
|
||||
#define IF_CLONE_INITIALIZER(name, create, destroy) \
|
||||
|
@ -108,7 +108,7 @@ static struct rman faithunits[1];
|
||||
static LIST_HEAD(, faith_softc) faith_softc_list;
|
||||
|
||||
int faith_clone_create __P((struct if_clone *, int *));
|
||||
void faith_clone_destroy __P((struct ifnet *));
|
||||
int faith_clone_destroy __P((struct ifnet *));
|
||||
|
||||
struct if_clone faith_cloner =
|
||||
IF_CLONE_INITIALIZER(FAITHNAME, faith_clone_create, faith_clone_destroy);
|
||||
@ -221,7 +221,7 @@ faith_clone_create(ifc, unit)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
faith_clone_destroy(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
@ -236,6 +236,7 @@ faith_clone_destroy(ifp)
|
||||
KASSERT(err == 0, ("Unexpected error freeing resource"));
|
||||
|
||||
free(sc, M_FAITH);
|
||||
return (0);
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -94,7 +94,7 @@ void (*ng_gif_attach_p)(struct ifnet *ifp);
|
||||
void (*ng_gif_detach_p)(struct ifnet *ifp);
|
||||
|
||||
int gif_clone_create __P((struct if_clone *, int *));
|
||||
void gif_clone_destroy __P((struct ifnet *));
|
||||
int gif_clone_destroy __P((struct ifnet *));
|
||||
|
||||
struct if_clone gif_cloner =
|
||||
IF_CLONE_INITIALIZER("gif", gif_clone_create, gif_clone_destroy);
|
||||
@ -229,7 +229,7 @@ gif_clone_create(ifc, unit)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
gif_clone_destroy(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
@ -256,6 +256,7 @@ gif_clone_destroy(ifp)
|
||||
KASSERT(err == 0, ("Unexpected error freeing resource"));
|
||||
|
||||
free(sc, M_GIF);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -163,7 +163,7 @@ static void stf_rtrequest __P((int, struct rtentry *, struct rt_addrinfo *));
|
||||
static int stf_ioctl __P((struct ifnet *, u_long, caddr_t));
|
||||
|
||||
int stf_clone_create __P((struct if_clone *, int *));
|
||||
void stf_clone_destroy __P((struct ifnet *));
|
||||
int stf_clone_destroy __P((struct ifnet *));
|
||||
|
||||
struct if_clone stf_cloner =
|
||||
IF_CLONE_INITIALIZER(STFNAME, stf_clone_create, stf_clone_destroy);
|
||||
@ -216,7 +216,7 @@ stf_clone_create(ifc, unit)
|
||||
return (0);
|
||||
}
|
||||
|
||||
void
|
||||
int
|
||||
stf_clone_destroy(ifp)
|
||||
struct ifnet *ifp;
|
||||
{
|
||||
@ -233,6 +233,7 @@ stf_clone_destroy(ifp)
|
||||
KASSERT(err == 0, ("Unexpected error freeing resource"));
|
||||
|
||||
free(sc, M_STF);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static int
|
||||
|
@ -94,7 +94,7 @@ static struct rman vlanunits[1];
|
||||
static LIST_HEAD(, ifvlan) ifv_list;
|
||||
|
||||
static int vlan_clone_create(struct if_clone *, int *);
|
||||
static void vlan_clone_destroy(struct ifnet *);
|
||||
static int vlan_clone_destroy(struct ifnet *);
|
||||
static void vlan_start(struct ifnet *ifp);
|
||||
static void vlan_ifinit(void *foo);
|
||||
static int vlan_input(struct ether_header *eh, struct mbuf *m);
|
||||
@ -274,7 +274,7 @@ vlan_clone_create(struct if_clone *ifc, int *unit)
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
static int
|
||||
vlan_clone_destroy(struct ifnet *ifp)
|
||||
{
|
||||
struct ifvlan *ifv = ifp->if_softc;
|
||||
@ -291,6 +291,7 @@ vlan_clone_destroy(struct ifnet *ifp)
|
||||
err = rman_release_resource(ifv->r_unit);
|
||||
KASSERT(err == 0, ("Unexpected error freeing resource"));
|
||||
free(ifv, M_VLAN);
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
|
Loading…
Reference in New Issue
Block a user