utils: inject platform into nm_utils_complete_generic()
authorThomas Haller <thaller@redhat.com>
Tue, 8 Mar 2016 12:57:20 +0000 (13:57 +0100)
committerThomas Haller <thaller@redhat.com>
Tue, 15 Mar 2016 11:56:58 +0000 (12:56 +0100)
18 files changed:
src/NetworkManagerUtils.c
src/NetworkManagerUtils.h
src/devices/adsl/nm-device-adsl.c
src/devices/bluetooth/nm-device-bt.c
src/devices/nm-device-bond.c
src/devices/nm-device-bridge.c
src/devices/nm-device-ethernet.c
src/devices/nm-device-infiniband.c
src/devices/nm-device-ip-tunnel.c
src/devices/nm-device-macvlan.c
src/devices/nm-device-tun.c
src/devices/nm-device-vlan.c
src/devices/nm-device-vxlan.c
src/devices/team/nm-device-team.c
src/devices/wifi/nm-device-olpc-mesh.c
src/devices/wifi/nm-device-wifi.c
src/devices/wwan/nm-modem-broadband.c
src/nm-manager.c

index 50fe4ef..09ed25c 100644 (file)
@@ -127,7 +127,8 @@ get_new_connection_name (const GSList *existing,
 }
 
 static char *
-get_new_connection_ifname (const GSList *existing,
+get_new_connection_ifname (NMPlatform *platform,
+                           const GSList *existing,
                            const char *prefix)
 {
        int i;
@@ -138,7 +139,7 @@ get_new_connection_ifname (const GSList *existing,
        for (i = 0; i < 500; i++) {
                name = g_strdup_printf ("%s%d", prefix, i);
 
-               if (nm_platform_link_get_by_ifname (NM_PLATFORM_GET, name))
+               if (nm_platform_link_get_by_ifname (platform, name))
                        goto next;
 
                for (iter = existing, found = FALSE; iter; iter = g_slist_next (iter)) {
@@ -205,7 +206,8 @@ nm_utils_get_ip_config_method (NMConnection *connection,
 }
 
 void
-nm_utils_complete_generic (NMConnection *connection,
+nm_utils_complete_generic (NMPlatform *platform,
+                           NMConnection *connection,
                            const char *ctype,
                            const GSList *existing,
                            const char *preferred_id,
@@ -241,7 +243,7 @@ nm_utils_complete_generic (NMConnection *connection,
 
        /* Add an interface name, if requested */
        if (ifname_prefix && !nm_setting_connection_get_interface_name (s_con)) {
-               ifname = get_new_connection_ifname (existing, ifname_prefix);
+               ifname = get_new_connection_ifname (platform, existing, ifname_prefix);
                g_object_set (G_OBJECT (s_con), NM_SETTING_CONNECTION_INTERFACE_NAME, ifname, NULL);
                g_free (ifname);
        }
index b3c384d..9b5b910 100644 (file)
@@ -28,7 +28,8 @@
 
 const char *nm_utils_get_shared_wifi_permission (NMConnection *connection);
 
-void nm_utils_complete_generic (NMConnection *connection,
+void nm_utils_complete_generic (NMPlatform *platform,
+                                NMConnection *connection,
                                 const char *ctype,
                                 const GSList *existing,
                                 const char *preferred_id,
index 86abaf8..ebb7a31 100644 (file)
@@ -125,7 +125,8 @@ complete_connection (NMDevice *device,
        if (s_adsl && !nm_setting_verify (NM_SETTING (s_adsl), NULL, error))
                return FALSE;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_ADSL_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index 4ecb56e..eef4ed0 100644 (file)
 
 #include "nm-default.h"
 
+#include "nm-device-bt.h"
+
 #include <stdio.h>
 #include <string.h>
 
 #include "nm-bluez-common.h"
 #include "nm-bluez-device.h"
-#include "nm-device-bt.h"
 #include "nm-device-private.h"
 #include "ppp-manager/nm-ppp-manager.h"
 #include "nm-setting-connection.h"
@@ -39,6 +40,7 @@
 #include "nm-utils.h"
 #include "nm-bt-error.h"
 #include "nm-bt-enum-types.h"
+#include "nm-platform.h"
 
 #include "nmdbus-device-bt.h"
 
@@ -315,7 +317,8 @@ complete_connection (NMDevice *device,
                return FALSE;
        }
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_BLUETOOTH_SETTING_NAME,
                                   existing_connections,
                                   preferred,
index cef104e..b88b251 100644 (file)
@@ -97,7 +97,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingBond *s_bond;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_BOND_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index cc72b00..c35d286 100644 (file)
@@ -103,7 +103,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingBridge *s_bridge;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_BRIDGE_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index db6b434..11356d4 100644 (file)
@@ -1388,7 +1388,8 @@ complete_connection (NMDevice *device,
        /* Default to an ethernet-only connection, but if a PPPoE setting was given
         * then PPPoE should be our connection type.
         */
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   s_pppoe ? NM_SETTING_PPPOE_SETTING_NAME : NM_SETTING_WIRED_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index e899752..a27af31 100644 (file)
@@ -166,7 +166,8 @@ complete_connection (NMDevice *device,
        const char *setting_mac;
        const char *hw_address;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_INFINIBAND_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index f95f30e..089b103 100644 (file)
@@ -338,7 +338,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingIPTunnel *s_ip_tunnel;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_IP_TUNNEL_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index 2dc9d4f..cd02cb8 100644 (file)
@@ -420,7 +420,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingMacvlan *s_macvlan;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_MACVLAN_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index a8ae3ed..eac2fb8 100644 (file)
@@ -121,7 +121,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingTun *s_tun;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_TUN_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index e6e3708..4d606e9 100644 (file)
@@ -439,7 +439,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingVlan *s_vlan;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_VLAN_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index 7994245..d308d47 100644 (file)
@@ -365,7 +365,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingVxlan *s_vxlan;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_VXLAN_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index c3d48b4..60842c1 100644 (file)
@@ -107,7 +107,8 @@ complete_connection (NMDevice *device,
 {
        NMSettingTeam *s_team;
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_TEAM_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index 11da011..6fbc63a 100644 (file)
@@ -138,7 +138,8 @@ complete_connection (NMDevice *device,
 
        }
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_OLPC_MESH_SETTING_NAME,
                                   existing_connections,
                                   NULL,
index 2bf3b56..95a89ea 100644 (file)
@@ -845,7 +845,8 @@ complete_connection (NMDevice *device,
 
        str_ssid = nm_utils_ssid_to_utf8 (ssid->data, ssid->len);
 
-       nm_utils_complete_generic (connection,
+       nm_utils_complete_generic (NM_PLATFORM_GET,
+                                  connection,
                                   NM_SETTING_WIRELESS_SETTING_NAME,
                                   existing_connections,
                                   str_ssid,
index 363a878..769e6a2 100644 (file)
@@ -647,7 +647,8 @@ complete_connection (NMModem *_self,
                if (!nm_setting_gsm_get_number (s_gsm))
                        g_object_set (G_OBJECT (s_gsm), NM_SETTING_GSM_NUMBER, "*99#", NULL);
 
-               nm_utils_complete_generic (connection,
+               nm_utils_complete_generic (NM_PLATFORM_GET,
+                                          connection,
                                           NM_SETTING_GSM_SETTING_NAME,
                                           existing_connections,
                                           NULL,
@@ -670,7 +671,8 @@ complete_connection (NMModem *_self,
                if (!nm_setting_cdma_get_number (s_cdma))
                        g_object_set (G_OBJECT (s_cdma), NM_SETTING_CDMA_NUMBER, "#777", NULL);
 
-               nm_utils_complete_generic (connection,
+               nm_utils_complete_generic (NM_PLATFORM_GET,
+                                          connection,
                                           NM_SETTING_CDMA_SETTING_NAME,
                                           existing_connections,
                                           NULL,
index 409079a..0ccb987 100644 (file)
@@ -3569,7 +3569,8 @@ impl_manager_add_and_activate_connection (NMManager *self,
                        goto error;
                }
 
-               nm_utils_complete_generic (connection,
+               nm_utils_complete_generic (NM_PLATFORM_GET,
+                                          connection,
                                           NM_SETTING_VPN_SETTING_NAME,
                                           all_connections,
                                           NULL,