[PATCH 3/6] Convert wpa_printf to wpa_msg for bss.c

Ben Greear greearb
Fri Dec 3 16:55:02 PST 2010


Signed-off-by: Ben Greear <greearb at candelatech.com>
---
:100644 100644 dc978af... 2231b85... M	wpa_supplicant/bss.c
 wpa_supplicant/bss.c |   50 ++++++++++++++++++++++++++------------------------
 1 files changed, 26 insertions(+), 24 deletions(-)

diff --git a/wpa_supplicant/bss.c b/wpa_supplicant/bss.c
index dc978af..2231b85 100644
--- a/wpa_supplicant/bss.c
+++ b/wpa_supplicant/bss.c
@@ -65,9 +65,9 @@ static void wpa_bss_remove(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 	dl_list_del(&bss->list);
 	dl_list_del(&bss->list_id);
 	wpa_s->num_bss--;
-	wpa_printf(MSG_DEBUG, "BSS: Remove id %u BSSID " MACSTR " SSID '%s'",
-		   bss->id, MAC2STR(bss->bssid),
-		   wpa_ssid_txt(bss->ssid, bss->ssid_len));
+	wpa_msg(wpa_s, MSG_DEBUG, "BSS: Remove id %u BSSID " MACSTR " SSID '%s'",
+		bss->id, MAC2STR(bss->bssid),
+		wpa_ssid_txt(bss->ssid, bss->ssid_len));
 	wpas_notify_bss_removed(wpa_s, bss->bssid, bss->id);
 	os_free(bss);
 }
@@ -133,8 +133,8 @@ static void wpa_bss_add(struct wpa_supplicant *wpa_s,
 	dl_list_add_tail(&wpa_s->bss, &bss->list);
 	dl_list_add_tail(&wpa_s->bss_id, &bss->list_id);
 	wpa_s->num_bss++;
-	wpa_printf(MSG_DEBUG, "BSS: Add new id %u BSSID " MACSTR " SSID '%s'",
-		   bss->id, MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len));
+	wpa_msg(wpa_s, MSG_DEBUG, "BSS: Add new id %u BSSID " MACSTR " SSID '%s'",
+		bss->id, MAC2STR(bss->bssid), wpa_ssid_txt(ssid, ssid_len));
 	wpas_notify_bss_added(wpa_s, bss->bssid, bss->id);
 	if (wpa_s->num_bss > wpa_s->conf->bss_max_count) {
 		/* Remove the oldest entry */
@@ -144,7 +144,8 @@ static void wpa_bss_add(struct wpa_supplicant *wpa_s,
 }
 
 
-static int are_ies_equal(const struct wpa_bss *old,
+static int are_ies_equal(struct wpa_supplicant *wpa_s,
+			 const struct wpa_bss *old,
 			 const struct wpa_scan_res *new, u32 ie)
 {
 	const u8 *old_ie, *new_ie;
@@ -171,7 +172,7 @@ static int are_ies_equal(const struct wpa_bss *old,
 		is_multi = 0;
 		break;
 	default:
-		wpa_printf(MSG_DEBUG, "bss: %s: cannot compare IEs", __func__);
+		wpa_msg(wpa_s, MSG_DEBUG, "bss: %s: cannot compare IEs", __func__);
 		return 0;
 	}
 
@@ -197,7 +198,8 @@ static int are_ies_equal(const struct wpa_bss *old,
 }
 
 
-static u32 wpa_bss_compare_res(const struct wpa_bss *old,
+static u32 wpa_bss_compare_res(struct wpa_supplicant *wpa_s,
+			       const struct wpa_bss *old,
 			       const struct wpa_scan_res *new)
 {
 	u32 changes = 0;
@@ -220,17 +222,17 @@ static u32 wpa_bss_compare_res(const struct wpa_bss *old,
 		return changes;
 	changes |= WPA_BSS_IES_CHANGED_FLAG;
 
-	if (!are_ies_equal(old, new, WPA_IE_VENDOR_TYPE))
+	if (!are_ies_equal(wpa_s, old, new, WPA_IE_VENDOR_TYPE))
 		changes |= WPA_BSS_WPAIE_CHANGED_FLAG;
 
-	if (!are_ies_equal(old, new, WLAN_EID_RSN))
+	if (!are_ies_equal(wpa_s, old, new, WLAN_EID_RSN))
 		changes |= WPA_BSS_RSNIE_CHANGED_FLAG;
 
-	if (!are_ies_equal(old, new, WPS_IE_VENDOR_TYPE))
+	if (!are_ies_equal(wpa_s, old, new, WPS_IE_VENDOR_TYPE))
 		changes |= WPA_BSS_WPS_CHANGED_FLAG;
 
-	if (!are_ies_equal(old, new, WLAN_EID_SUPP_RATES) ||
-	    !are_ies_equal(old, new, WLAN_EID_EXT_SUPP_RATES))
+	if (!are_ies_equal(wpa_s, old, new, WLAN_EID_SUPP_RATES) ||
+	    !are_ies_equal(wpa_s, old, new, WLAN_EID_EXT_SUPP_RATES))
 		changes |= WPA_BSS_RATES_CHANGED_FLAG;
 
 	return changes;
@@ -274,7 +276,7 @@ static void wpa_bss_update(struct wpa_supplicant *wpa_s, struct wpa_bss *bss,
 {
 	u32 changes;
 
-	changes = wpa_bss_compare_res(bss, res);
+	changes = wpa_bss_compare_res(wpa_s, bss, res);
 	bss->scan_miss_count = 0;
 	bss->last_update_idx = wpa_s->bss_update_idx;
 	wpa_bss_copy_res(bss, res);
@@ -317,8 +319,8 @@ static int wpa_bss_in_use(struct wpa_supplicant *wpa_s, struct wpa_bss *bss)
 void wpa_bss_update_start(struct wpa_supplicant *wpa_s)
 {
 	wpa_s->bss_update_idx++;
-	wpa_printf(MSG_DEBUG, "BSS: Start scan result update %u",
-		   wpa_s->bss_update_idx);
+	wpa_msg(wpa_s, MSG_DEBUG, "BSS: Start scan result update %u",
+		wpa_s->bss_update_idx);
 }
 
 
@@ -330,13 +332,13 @@ void wpa_bss_update_scan_res(struct wpa_supplicant *wpa_s,
 
 	ssid = wpa_scan_get_ie(res, WLAN_EID_SSID);
 	if (ssid == NULL) {
-		wpa_printf(MSG_DEBUG, "BSS: No SSID IE included for " MACSTR,
-			   MAC2STR(res->bssid));
+		wpa_msg(wpa_s, MSG_DEBUG, "BSS: No SSID IE included for " MACSTR,
+			MAC2STR(res->bssid));
 		return;
 	}
 	if (ssid[1] > 32) {
-		wpa_printf(MSG_DEBUG, "BSS: Too long SSID IE included for "
-			   MACSTR, MAC2STR(res->bssid));
+		wpa_msg(wpa_s, MSG_DEBUG, "BSS: Too long SSID IE included for "
+			MACSTR, MAC2STR(res->bssid));
 		return;
 	}
 
@@ -412,8 +414,8 @@ void wpa_bss_update_end(struct wpa_supplicant *wpa_s, struct scan_info *info,
 		if (bss->last_update_idx < wpa_s->bss_update_idx)
 			bss->scan_miss_count++;
 		if (bss->scan_miss_count >= WPA_BSS_EXPIRATION_SCAN_COUNT) {
-			wpa_printf(MSG_DEBUG, "BSS: Expire BSS %u due to no "
-				   "match in scan", bss->id);
+			wpa_msg(wpa_s, MSG_DEBUG, "BSS: Expire BSS %u due to no "
+				"match in scan", bss->id);
 			wpa_bss_remove(wpa_s, bss);
 		}
 	}
@@ -437,8 +439,8 @@ static void wpa_bss_timeout(void *eloop_ctx, void *timeout_ctx)
 			continue;
 
 		if (os_time_before(&bss->last_update, &t)) {
-			wpa_printf(MSG_DEBUG, "BSS: Expire BSS %u due to age",
-				   bss->id);
+			wpa_msg(wpa_s, MSG_DEBUG, "BSS: Expire BSS %u due to age",
+				bss->id);
 			wpa_bss_remove(wpa_s, bss);
 		} else
 			break;
-- 
1.7.2.3




More information about the Hostap mailing list