summaryrefslogtreecommitdiffstats
path: root/sys/net/if_disc.c
diff options
context:
space:
mode:
authorglebius <glebius@FreeBSD.org>2012-10-16 13:37:54 +0000
committerglebius <glebius@FreeBSD.org>2012-10-16 13:37:54 +0000
commit05f24a6b77a43334f14f31cd33a4f3e34a418ea2 (patch)
tree0f54a9446bfe2083d3c0a3f744318b2be8a0db05 /sys/net/if_disc.c
parent745884b065065ffc8847d3ea463bf751ffcaf863 (diff)
downloadFreeBSD-src-05f24a6b77a43334f14f31cd33a4f3e34a418ea2.zip
FreeBSD-src-05f24a6b77a43334f14f31cd33a4f3e34a418ea2.tar.gz
Make the "struct if_clone" opaque to users of the cloning API. Users
now use function calls: if_clone_simple() if_clone_advanced() to initialize a cloner, instead of macros that initialize if_clone structure. Discussed with: brooks, bz, 1 year ago
Diffstat (limited to 'sys/net/if_disc.c')
-rw-r--r--sys/net/if_disc.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/net/if_disc.c b/sys/net/if_disc.c
index ca77899..f2f902e 100644
--- a/sys/net/if_disc.c
+++ b/sys/net/if_disc.c
@@ -59,8 +59,6 @@
#define DSMTU 65532
#endif
-#define DISCNAME "disc"
-
struct disc_softc {
struct ifnet *sc_ifp;
};
@@ -72,9 +70,10 @@ static int discioctl(struct ifnet *, u_long, caddr_t);
static int disc_clone_create(struct if_clone *, int, caddr_t);
static void disc_clone_destroy(struct ifnet *);
-static MALLOC_DEFINE(M_DISC, DISCNAME, "Discard interface");
+static const char discname[] = "disc";
+static MALLOC_DEFINE(M_DISC, discname, "Discard interface");
-IFC_SIMPLE_DECLARE(disc, 0);
+static struct if_clone *disc_cloner;
static int
disc_clone_create(struct if_clone *ifc, int unit, caddr_t params)
@@ -90,7 +89,7 @@ disc_clone_create(struct if_clone *ifc, int unit, caddr_t params)
}
ifp->if_softc = sc;
- if_initname(ifp, ifc->ifc_name, unit);
+ if_initname(ifp, discname, unit);
ifp->if_mtu = DSMTU;
/*
* IFF_LOOPBACK should not be removed from disc's flags because
@@ -135,10 +134,11 @@ disc_modevent(module_t mod, int type, void *data)
switch (type) {
case MOD_LOAD:
- if_clone_attach(&disc_cloner);
+ disc_cloner = if_clone_simple(discname, disc_clone_create,
+ disc_clone_destroy, 0);
break;
case MOD_UNLOAD:
- if_clone_detach(&disc_cloner);
+ if_clone_detach(disc_cloner);
break;
default:
return (EOPNOTSUPP);
OpenPOWER on IntegriCloud