diff options
author | glebius <glebius@FreeBSD.org> | 2012-10-16 13:37:54 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-10-16 13:37:54 +0000 |
commit | 05f24a6b77a43334f14f31cd33a4f3e34a418ea2 (patch) | |
tree | 0f54a9446bfe2083d3c0a3f744318b2be8a0db05 /sys/net/if_gre.c | |
parent | 745884b065065ffc8847d3ea463bf751ffcaf863 (diff) | |
download | FreeBSD-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_gre.c')
-rw-r--r-- | sys/net/if_gre.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/if_gre.c b/sys/net/if_gre.c index 8b250d7..59e1a2a 100644 --- a/sys/net/if_gre.c +++ b/sys/net/if_gre.c @@ -90,8 +90,6 @@ */ #define GREMTU 1476 -#define GRENAME "gre" - #define MTAG_COOKIE_GRE 1307983903 #define MTAG_GRE_NESTING 1 struct mtag_gre_nesting { @@ -105,18 +103,19 @@ struct mtag_gre_nesting { * XXX: gre_softc data not protected yet. */ struct mtx gre_mtx; -static MALLOC_DEFINE(M_GRE, GRENAME, "Generic Routing Encapsulation"); +static const char grename[] = "gre"; +static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation"); struct gre_softc_head gre_softc_list; static int gre_clone_create(struct if_clone *, int, caddr_t); static void gre_clone_destroy(struct ifnet *); +static struct if_clone *gre_cloner; + static int gre_ioctl(struct ifnet *, u_long, caddr_t); static int gre_output(struct ifnet *, struct mbuf *, struct sockaddr *, struct route *ro); -IFC_SIMPLE_DECLARE(gre, 0); - static int gre_compute_route(struct gre_softc *sc); static void greattach(void); @@ -172,7 +171,8 @@ greattach(void) mtx_init(&gre_mtx, "gre_mtx", NULL, MTX_DEF); LIST_INIT(&gre_softc_list); - if_clone_attach(&gre_cloner); + gre_cloner = if_clone_simple(grename, gre_clone_create, + gre_clone_destroy, 0); } static int @@ -192,7 +192,7 @@ gre_clone_create(ifc, unit, params) } GRE2IFP(sc)->if_softc = sc; - if_initname(GRE2IFP(sc), ifc->ifc_name, unit); + if_initname(GRE2IFP(sc), grename, unit); GRE2IFP(sc)->if_snd.ifq_maxlen = ifqmaxlen; GRE2IFP(sc)->if_addrlen = 0; @@ -961,7 +961,7 @@ gremodevent(module_t mod, int type, void *data) greattach(); break; case MOD_UNLOAD: - if_clone_detach(&gre_cloner); + if_clone_detach(gre_cloner); mtx_destroy(&gre_mtx); break; default: |