MCPcopy Create free account
hub / github.com/F-Stack/f-stack / tuntapmodevent

Function tuntapmodevent

freebsd/net/if_tuntap.c:747–776  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

745}
746
747static int
748tuntapmodevent(module_t mod, int type, void *data)
749{
750 struct tuntap_driver *drv;
751 int i;
752
753 switch (type) {
754 case MOD_LOAD:
755 mtx_init(&tunmtx, "tunmtx", NULL, MTX_DEF);
756 for (i = 0; i < nitems(tuntap_drivers); ++i) {
757 drv = &tuntap_drivers[i];
758 clone_setup(&drv->clones);
759 drv->unrhdr = new_unrhdr(0, IF_MAXUNIT, &tunmtx);
760 }
761 arrival_tag = EVENTHANDLER_REGISTER(ifnet_arrival_event,
762 tunrename, 0, 1000);
763 if (arrival_tag == NULL)
764 return (ENOMEM);
765 clone_tag = EVENTHANDLER_REGISTER(dev_clone, tunclone, 0, 1000);
766 if (clone_tag == NULL)
767 return (ENOMEM);
768 break;
769 case MOD_UNLOAD:
770 /* See tun_uninit, so it's done after the vnet_sysuninit() */
771 break;
772 default:
773 return EOPNOTSUPP;
774 }
775 return 0;
776}
777
778static moduledata_t tuntap_mod = {
779 "if_tuntap",

Callers

nothing calls this directly

Calls 3

mtx_initFunction · 0.85
clone_setupFunction · 0.85
new_unrhdrFunction · 0.85

Tested by

no test coverage detected