NetworkManager r3371 - in trunk: . src



Author: dcbw
Date: Mon Mar  3 04:09:58 2008
New Revision: 3371
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=3371&view=rev

Log:
2008-03-02  Dan Williams  <dcbw redhat com>

	* src/nm-device.c
	  src/nm-device.h
	  src/nm-device-802-11-wireless.c
	  src/nm-device-802-3-ethernet.c
	  src/NetworkManagerPolicy.c
		- s/link_active/carrier
		- nm_device_set_active_link() -> nm_device_set_carrier()
		- nm_device_has_active_link() -> nm_device_get_carrier()



Modified:
   trunk/ChangeLog
   trunk/src/NetworkManagerPolicy.c
   trunk/src/nm-device-802-11-wireless.c
   trunk/src/nm-device-802-3-ethernet.c
   trunk/src/nm-device.c
   trunk/src/nm-device.h

Modified: trunk/src/NetworkManagerPolicy.c
==============================================================================
--- trunk/src/NetworkManagerPolicy.c	(original)
+++ trunk/src/NetworkManagerPolicy.c	Mon Mar  3 04:09:58 2008
@@ -117,12 +117,12 @@
 	for (elt = nm_manager_get_devices (policy->manager); elt; elt = elt->next) {
 		NMConnection *tmp_con = NULL;
 		char *tmp_obj = NULL;
-		gboolean link_active;
+		gboolean carrier;
 		guint prio = 0;
 		NMDevice * dev = (NMDevice *)(elt->data);
 		guint32 caps;
 
-		link_active = nm_device_has_active_link (dev);
+		carrier = nm_device_get_carrier (dev);
 		caps = nm_device_get_capabilities (dev);
 
 		tmp_con = nm_device_get_best_connection (dev, connections, &tmp_obj);
@@ -140,10 +140,10 @@
 		}
 
 		if (NM_IS_DEVICE_802_3_ETHERNET (dev)) {
-			if (link_active)
+			if (carrier)
 				prio += 1;
 
-			if (nm_device_get_act_request (dev) && link_active)
+			if (nm_device_get_act_request (dev) && carrier)
 				prio += 1;
 
 			if (prio > best_wired_prio) {
@@ -157,10 +157,10 @@
 			/* Bump by 1 so that _something_ gets chosen every time */
 			prio += 1;
 
-			if (link_active)
+			if (carrier)
 				prio += 1;
 
-			if (nm_device_get_act_request (dev) && link_active)
+			if (nm_device_get_act_request (dev) && carrier)
 				prio += 3;
 
 			if (prio > best_wireless_prio) {
@@ -314,7 +314,7 @@
 		do_switch = TRUE;
 	} else if (old_dev && new_dev) {
 		gboolean old_user_requested = nm_act_request_get_user_requested (old_act_req);
-		gboolean old_has_link = nm_device_has_active_link (old_dev);
+		gboolean old_carrier = nm_device_get_carrier (old_dev);
 
 		/* If an old device is active or being activated (and has an active link),
 		 * and its connection is a system connection, and the best connection is
@@ -323,7 +323,7 @@
 		if (   old_connection
 		    && (nm_connection_get_scope (old_connection) == NM_CONNECTION_SCOPE_SYSTEM)
 		    && (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_USER)
-		    && nm_device_has_active_link (old_dev))
+		    && old_carrier)
 			goto out;
 
 		if (   (nm_connection_get_scope (connection) == NM_CONNECTION_SCOPE_SYSTEM)
@@ -343,7 +343,7 @@
 			 * a new device.  Note that new_dev will never be wireless since automatic device picking
 			 * above will prefer a wired device to a wireless device.
 			 */
-			if ((!old_user_requested || !old_has_link) && (new_dev != old_dev)) {
+			if ((!old_user_requested || !old_carrier) && (new_dev != old_dev)) {
 				nm_info ("SWITCH: found better connection '%s (%s)' than "
 				         " current connection '%s (%s)'.",
 				         connection ? get_connection_id (connection) : "(none)",
@@ -365,7 +365,7 @@
 				if (old_dev == new_dev && nm_device_is_activating (new_dev))
 					same_activating = TRUE;
 
-				if (!same_activating && !old_has_link && (old_mode != IW_MODE_ADHOC)) {
+				if (!same_activating && !old_carrier && (old_mode != IW_MODE_ADHOC)) {
 					NMSettingConnection * new_sc = (NMSettingConnection *) nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION);
 					NMSettingConnection * old_sc = (NMSettingConnection *) nm_connection_get_setting (old_connection, NM_TYPE_SETTING_CONNECTION);
 
@@ -376,7 +376,7 @@
 					         new_sc->id,
 					         nm_device_get_iface (old_dev),
 					         old_sc->id,
-					         old_has_link);
+					         old_carrier);
 					do_switch = TRUE;
 				}
 			} else if (NM_IS_DEVICE_802_3_ETHERNET (new_dev)) {

Modified: trunk/src/nm-device-802-11-wireless.c
==============================================================================
--- trunk/src/nm-device-802-11-wireless.c	(original)
+++ trunk/src/nm-device-802-11-wireless.c	Mon Mar  3 04:09:58 2008
@@ -545,7 +545,7 @@
 		new_link = TRUE;
 
 out:
-	nm_device_set_active_link (NM_DEVICE (self), new_link);
+	nm_device_set_carrier (NM_DEVICE (self), new_link);
 }
 
 static NMAccessPoint *
@@ -1877,7 +1877,7 @@
 	ap = nm_device_802_11_wireless_get_activation_ap (self);
 	if (req == NULL || ap == NULL) {
 		nm_warning ("couldn't get activation request or activation AP.");
-		nm_device_set_active_link (dev, FALSE);
+		nm_device_set_carrier (dev, FALSE);
 		if (nm_device_is_activating (dev)) {
 			cleanup_association_attempt (self, TRUE);
 			nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED);
@@ -1928,7 +1928,7 @@
 
 time_out:
 	nm_info ("%s: link timed out.", nm_device_get_iface (dev));
-	nm_device_set_active_link (dev, FALSE);
+	nm_device_set_carrier (dev, FALSE);
 	return FALSE;
 }
 
@@ -1996,7 +1996,7 @@
 		cancel_pending_scan (self);
 		cleanup_association_attempt (self, FALSE);
 		cleanup_supplicant_interface (self);
-		nm_device_set_active_link (NM_DEVICE (self), FALSE);
+		nm_device_set_carrier (NM_DEVICE (self), FALSE);
 	}
 	
 	g_slice_free (struct state_cb_data, cb_data);
@@ -2045,7 +2045,7 @@
 	if (new_state == NM_SUPPLICANT_INTERFACE_CON_STATE_COMPLETED) {
 		remove_supplicant_interface_connection_error_handler (self);
 		remove_supplicant_timeouts (self);
-		nm_device_set_active_link (dev, TRUE);
+		nm_device_set_carrier (dev, TRUE);
 
 		/* If this is the initial association during device activation,
 		 * schedule the next activation stage.
@@ -2066,7 +2066,7 @@
 			if (!self->priv->link_timeout_id)
 				self->priv->link_timeout_id = g_timeout_add (15000, link_timeout_cb, self);
 		} else {
-			nm_device_set_active_link (dev, FALSE);
+			nm_device_set_carrier (dev, FALSE);
 		}
 	}
 
@@ -2164,7 +2164,7 @@
 			cleanup_association_attempt (self, FALSE);
 			cleanup_supplicant_interface (self);
 
-			nm_device_set_active_link (NM_DEVICE (self), FALSE);
+			nm_device_set_carrier (NM_DEVICE (self), FALSE);
 
 			if (nm_device_is_activating (dev)) {
 				nm_device_state_changed (dev, NM_DEVICE_STATE_FAILED);

Modified: trunk/src/nm-device-802-3-ethernet.c
==============================================================================
--- trunk/src/nm-device-802-3-ethernet.c	(original)
+++ trunk/src/nm-device-802-3-ethernet.c	Mon Mar  3 04:09:58 2008
@@ -94,7 +94,7 @@
 		if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
 			return;
 
-		nm_device_set_active_link (dev, TRUE);
+		nm_device_set_carrier (dev, TRUE);
 	}
 }
 
@@ -113,7 +113,7 @@
 		if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT))
 			return;
 
-		nm_device_set_active_link (dev, FALSE);
+		nm_device_set_carrier (dev, FALSE);
 	}
 }
 
@@ -155,7 +155,7 @@
 	} else {
 		priv->link_connected_id = 0;
 		priv->link_disconnected_id = 0;
-		nm_device_set_active_link (dev, TRUE);
+		nm_device_set_carrier (dev, TRUE);
 	}
 
 	return object;
@@ -177,7 +177,7 @@
 real_update_link (NMDevice *dev)
 {
 	NMDevice8023EthernetPrivate *priv = NM_DEVICE_802_3_ETHERNET_GET_PRIVATE (dev);
-	gboolean have_link = FALSE;
+	gboolean carrier = FALSE;
 	guint32 caps;
 	gchar * contents;
 	gsize length;
@@ -187,17 +187,17 @@
 	 */
 	caps = nm_device_get_capabilities (dev);
 	if (!(caps & NM_DEVICE_CAP_CARRIER_DETECT)) {
-		have_link = TRUE;
+		carrier = TRUE;
 		goto out;
 	}
 
 	if (g_file_get_contents (priv->carrier_file_path, &contents, &length, NULL)) {
-		have_link = atoi (contents) > 0 ? TRUE : FALSE;
+		carrier = atoi (contents) > 0 ? TRUE : FALSE;
 		g_free (contents);
 	}
 
 out:
-	nm_device_set_active_link (dev, have_link);
+	nm_device_set_carrier (dev, carrier);
 }
 
 
@@ -342,7 +342,7 @@
 	 * if the link becomes inactive.
 	 */
 	if (nm_device_get_capabilities (dev) & NM_DEVICE_CAP_CARRIER_DETECT) {
-		if (nm_device_has_active_link (dev) == FALSE) {
+		if (nm_device_get_carrier (dev) == FALSE) {
 			interrupt = TRUE;
 		}
 	}

Modified: trunk/src/nm-device.c
==============================================================================
--- trunk/src/nm-device.c	(original)
+++ trunk/src/nm-device.c	Mon Mar  3 04:09:58 2008
@@ -66,7 +66,7 @@
 	guint32			capabilities;
 	char *			driver;
 
-	gboolean			link_active;
+	gboolean			carrier;
 	guint32			ip4_address;
 	struct in6_addr	ip6_address;
 
@@ -123,7 +123,7 @@
 	self->priv->capabilities = NM_DEVICE_CAP_NONE;
 	self->priv->driver = NULL;
 
-	self->priv->link_active = FALSE;
+	self->priv->carrier = FALSE;
 	self->priv->ip4_address = 0;
 	memset (&self->priv->ip6_address, 0, sizeof (struct in6_addr));
 
@@ -347,28 +347,28 @@
 
 
 /*
- * Get/set functions for link_active
+ * Get/set functions for carrier
  */
 gboolean
-nm_device_has_active_link (NMDevice *self)
+nm_device_get_carrier (NMDevice *self)
 {
 	g_return_val_if_fail (self != NULL, FALSE);
 
-	return self->priv->link_active;
+	return self->priv->carrier;
 }
 
 void
-nm_device_set_active_link (NMDevice *self,
-                           const gboolean link_active)
+nm_device_set_carrier (NMDevice *self,
+                       const gboolean carrier)
 {
 	NMDevicePrivate *priv;
 
 	g_return_if_fail (NM_IS_DEVICE (self));
 
 	priv = NM_DEVICE_GET_PRIVATE (self);
-	if (priv->link_active != link_active) {
-		priv->link_active = link_active;
-		g_signal_emit_by_name (self, "carrier-changed", link_active);
+	if (priv->carrier != carrier) {
+		priv->carrier = carrier;
+		g_signal_emit_by_name (self, "carrier-changed", carrier);
 	}
 }
 
@@ -1667,7 +1667,7 @@
 		g_value_set_uint (value, priv->type);
 		break;
 	case NM_DEVICE_INTERFACE_PROP_CARRIER:
-		g_value_set_boolean (value, priv->link_active);
+		g_value_set_boolean (value, priv->carrier);
 		break;
 	default:
 		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);

Modified: trunk/src/nm-device.h
==============================================================================
--- trunk/src/nm-device.h	(original)
+++ trunk/src/nm-device.h	Mon Mar  3 04:09:58 2008
@@ -128,7 +128,9 @@
 guint32		nm_device_get_capabilities	(NMDevice *dev);
 guint32		nm_device_get_type_capabilities	(NMDevice *dev);
 
-gboolean		nm_device_has_active_link	(NMDevice *dev);
+gboolean		nm_device_get_carrier	(NMDevice *dev);
+void			nm_device_set_carrier	(NMDevice *dev, const gboolean carrier);
+
 guint32			nm_device_get_ip4_address	(NMDevice *dev);
 void				nm_device_update_ip4_address	(NMDevice *dev);
 struct in6_addr *	nm_device_get_ip6_address	(NMDevice *dev);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]