From owner-p4-projects@FreeBSD.ORG Sat Feb 24 00:06:14 2007 Return-Path: X-Original-To: p4-projects@freebsd.org Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id AAFED16A402; Sat, 24 Feb 2007 00:06:14 +0000 (UTC) X-Original-To: perforce@freebsd.org Delivered-To: perforce@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 66D1016A401 for ; Sat, 24 Feb 2007 00:06:14 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (repoman.freebsd.org [69.147.83.41]) by mx1.freebsd.org (Postfix) with ESMTP id 5795313C441 for ; Sat, 24 Feb 2007 00:06:14 +0000 (UTC) (envelope-from sam@freebsd.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.13.6/8.13.6) with ESMTP id l1O06E5k040793 for ; Sat, 24 Feb 2007 00:06:14 GMT (envelope-from sam@freebsd.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.13.6/8.13.4/Submit) id l1O06DOq040790 for perforce@freebsd.org; Sat, 24 Feb 2007 00:06:13 GMT (envelope-from sam@freebsd.org) Date: Sat, 24 Feb 2007 00:06:13 GMT Message-Id: <200702240006.l1O06DOq040790@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to sam@freebsd.org using -f From: Sam Leffler To: Perforce Change Reviews Cc: Subject: PERFORCE change 114936 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Feb 2007 00:06:15 -0000 http://perforce.freebsd.org/chv.cgi?CH=114936 Change 114936 by sam@sam_ebb on 2007/02/24 00:06:02 add portability shim for crypto modules to improve portability Affected files ... .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_ccmp.c#11 edit .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_tkip.c#14 edit .. //depot/projects/wifi/sys/net80211/ieee80211_crypto_wep.c#11 edit .. //depot/projects/wifi/sys/net80211/ieee80211_freebsd.h#22 edit Differences ... ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_ccmp.c#11 (text+ko) ==== @@ -635,32 +635,4 @@ /* * Module glue. */ -static int -ccmp_modevent(module_t mod, int type, void *unused) -{ - switch (type) { - case MOD_LOAD: - ieee80211_crypto_register(&ccmp); - return 0; - case MOD_UNLOAD: - case MOD_QUIESCE: - if (nrefs) { - printf("wlan_ccmp: still in use (%u dynamic refs)\n", - nrefs); - return EBUSY; - } - if (type == MOD_UNLOAD) - ieee80211_crypto_unregister(&ccmp); - return 0; - } - return EINVAL; -} - -static moduledata_t ccmp_mod = { - "wlan_ccmp", - ccmp_modevent, - 0 -}; -DECLARE_MODULE(wlan_ccmp, ccmp_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); -MODULE_VERSION(wlan_ccmp, 1); -MODULE_DEPEND(wlan_ccmp, wlan, 1, 1, 1); +IEEE80211_CRYPTO_MODULE(ccmp, 1); ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_tkip.c#14 (text+ko) ==== @@ -976,32 +976,4 @@ /* * Module glue. */ -static int -tkip_modevent(module_t mod, int type, void *unused) -{ - switch (type) { - case MOD_LOAD: - ieee80211_crypto_register(&tkip); - return 0; - case MOD_UNLOAD: - case MOD_QUIESCE: - if (nrefs) { - printf("wlan_tkip: still in use (%u dynamic refs)\n", - nrefs); - return EBUSY; - } - if (type == MOD_UNLOAD) - ieee80211_crypto_unregister(&tkip); - return 0; - } - return EINVAL; -} - -static moduledata_t tkip_mod = { - "wlan_tkip", - tkip_modevent, - 0 -}; -DECLARE_MODULE(wlan_tkip, tkip_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); -MODULE_VERSION(wlan_tkip, 1); -MODULE_DEPEND(wlan_tkip, wlan, 1, 1, 1); +IEEE80211_CRYPTO_MODULE(tkip, 1); ==== //depot/projects/wifi/sys/net80211/ieee80211_crypto_wep.c#11 (text+ko) ==== @@ -479,32 +479,4 @@ /* * Module glue. */ -static int -wep_modevent(module_t mod, int type, void *unused) -{ - switch (type) { - case MOD_LOAD: - ieee80211_crypto_register(&wep); - return 0; - case MOD_UNLOAD: - case MOD_QUIESCE: - if (nrefs) { - printf("wlan_wep: still in use (%u dynamic refs)\n", - nrefs); - return EBUSY; - } - if (type == MOD_UNLOAD) - ieee80211_crypto_unregister(&wep); - return 0; - } - return EINVAL; -} - -static moduledata_t wep_mod = { - "wlan_wep", - wep_modevent, - 0 -}; -DECLARE_MODULE(wlan_wep, wep_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST); -MODULE_VERSION(wlan_wep, 1); -MODULE_DEPEND(wlan_wep, wlan, 1, 1, 1); +IEEE80211_CRYPTO_MODULE(wep, 1); ==== //depot/projects/wifi/sys/net80211/ieee80211_freebsd.h#22 (text+ko) ==== @@ -219,6 +219,36 @@ void ieee80211_sysctl_detach(struct ieee80211com *); void ieee80211_load_module(const char *); + +#define IEEE80211_CRYPTO_MODULE(name, version) \ +static int \ +name##_modevent(module_t mod, int type, void *unused) \ +{ \ + switch (type) { \ + case MOD_LOAD: \ + ieee80211_crypto_register(&name); \ + return 0; \ + case MOD_UNLOAD: \ + case MOD_QUIESCE: \ + if (nrefs) { \ + printf("wlan_##name: still in use (%u dynamic refs)\n",\ + nrefs); \ + return EBUSY; \ + } \ + if (type == MOD_UNLOAD) \ + ieee80211_crypto_unregister(&name); \ + return 0; \ + } \ + return EINVAL; \ +} \ +static moduledata_t name##_mod = { \ + "wlan_##name", \ + name##_modevent, \ + 0 \ +}; \ +DECLARE_MODULE(wlan_##name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_FIRST);\ +MODULE_VERSION(wlan_##name, version); \ +MODULE_DEPEND(wlan_##name, wlan, 1, 1, 1) #endif /* _KERNEL */ /* XXX this stuff belongs elsewhere */