NetworkManager r4163 - in trunk: . system-settings/plugins/ifupdown
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: NetworkManager r4163 - in trunk: . system-settings/plugins/ifupdown
- Date: Fri, 10 Oct 2008 11:13:27 +0000 (UTC)
Author: dcbw
Date: Fri Oct 10 11:13:26 2008
New Revision: 4163
URL: http://svn.gnome.org/viewvc/NetworkManager?rev=4163&view=rev
Log:
2008-10-10 Alexander Sack <asac ubuntu com>
Implement unmanaged mode that will prevent all devices in the
well_known_udis set from being touched by NetworkManager
* system-settings/plugins/ifupdown/plugin.c
- (typedef struct SCPluginIfupdownPrivate): add gboolean
unmanage_well_known field used to turn on/off unmanaged
mode
- (hal_device_added_cb,hal_device_remove_cb): emit |unmanaged-devices-changed|
signal when well_known_udis get added/removed
- (SCPluginIfupdown_get_unmanaged_devices): return all well_known_udis
if we are in unmanaged mode
Modified:
trunk/ChangeLog
trunk/system-settings/plugins/ifupdown/plugin.c
Modified: trunk/system-settings/plugins/ifupdown/plugin.c
==============================================================================
--- trunk/system-settings/plugins/ifupdown/plugin.c (original)
+++ trunk/system-settings/plugins/ifupdown/plugin.c Fri Oct 10 11:13:26 2008
@@ -52,6 +52,11 @@
#define IFUPDOWN_PLUGIN_INFO "(C) 2008 Canonical Ltd. To report bugs please use the NetworkManager mailing list."
#define IFUPDOWN_SYSTEM_HOSTNAME_FILE "/etc/hostname"
+/* #define ALWAYS_UNMANAGE TRUE */
+#ifndef ALWAYS_UNMANAGE
+# define ALWAYS_UNMANAGE FALSE
+#endif
+
typedef struct {
DBusGConnection *g_connection;
@@ -61,6 +66,7 @@
gchar* hostname;
GHashTable *well_known_udis;
+ gboolean unmanage_well_known;
gulong inotify_event_id;
int inotify_system_hostname_wd;
@@ -222,6 +228,9 @@
return;
g_hash_table_insert (priv->well_known_udis, (gpointer)udi, "nothing");
+
+ if (ALWAYS_UNMANAGE || priv->unmanage_well_known)
+ g_signal_emit_by_name (G_OBJECT(config), "unmanaged-devices-changed");
}
static void
@@ -235,7 +244,11 @@
PLUGIN_PRINT("SCPlugin-Ifupdown",
"devices removed (udi: %s)", udi);
- g_hash_table_remove (priv->well_known_udis, udi);
+ if(!g_hash_table_remove (priv->well_known_udis, udi))
+ return;
+
+ if (ALWAYS_UNMANAGE || priv->unmanage_well_known)
+ g_signal_emit_by_name (G_OBJECT(config), "unmanaged-devices-changed");
}
static void
@@ -393,8 +406,20 @@
static GSList*
SCPluginIfupdown_get_unmanaged_devices (NMSystemConfigInterface *config)
{
- // XXX implement this.
- return NULL;
+ SCPluginIfupdownPrivate *priv = SC_PLUGIN_IFUPDOWN_GET_PRIVATE (config);
+ GList *keys;
+ GSList *udis = NULL;
+
+ if (!ALWAYS_UNMANAGE && !priv->unmanage_well_known)
+ return NULL;
+
+ keys = g_hash_table_get_keys (priv->well_known_udis);
+ PLUGIN_PRINT("Ifupdown", "get unmanaged devices count: %d", g_list_length(keys));
+ while(keys) {
+ udis = g_slist_append(udis, g_strdup(keys->data));
+ keys = g_list_next(keys);
+ }
+ return udis;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]