diff options
author | Dan Winship <danw@gnome.org> | 2014-09-22 12:28:06 -0400 |
---|---|---|
committer | Dan Winship <danw@gnome.org> | 2014-10-22 08:29:08 -0400 |
commit | fd7b9df47d6598af91b76af64584039ddc5037dc (patch) | |
tree | b258df16c89a1356400379db6b4caf909285c799 /src | |
parent | 4f75ff92b4d5a52d453b77b050f38f8c3e421256 (diff) | |
download | NetworkManager-fd7b9df47d6598af91b76af64584039ddc5037dc.tar.gz |
devices: drop device-type-specific error domains
Most NMDevice types defined their own error domain but then never used
it. A few did use their errors, but some of those errors are redundant
with NMDeviceError, and others can be added to it.
Diffstat (limited to 'src')
23 files changed, 54 insertions, 295 deletions
diff --git a/src/devices/bluetooth/nm-device-bt.c b/src/devices/bluetooth/nm-device-bt.c index f8039ae6a1..0a1f591540 100644 --- a/src/devices/bluetooth/nm-device-bt.c +++ b/src/devices/bluetooth/nm-device-bt.c @@ -1227,6 +1227,4 @@ nm_device_bt_class_init (NMDeviceBtClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_bt_object_info); - - dbus_g_error_domain_register (NM_BT_ERROR, NULL, NM_TYPE_BT_ERROR); } diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 68375d81f5..e029aafa06 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -47,8 +47,6 @@ G_DEFINE_TYPE (NMDeviceBond, nm_device_bond, NM_TYPE_DEVICE) #define NM_DEVICE_BOND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BOND, NMDeviceBondPrivate)) -#define NM_BOND_ERROR (nm_bond_error_quark ()) - typedef struct { int dummy; } NMDeviceBondPrivate; @@ -62,17 +60,6 @@ enum { /******************************************************************/ -static GQuark -nm_bond_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-bond-error"); - return quark; -} - -/******************************************************************/ - static guint32 get_generic_capabilities (NMDevice *dev) { @@ -536,8 +523,6 @@ nm_device_bond_class_init (NMDeviceBondClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_bond_object_info); - - dbus_g_error_domain_register (NM_BOND_ERROR, NULL, NM_TYPE_BOND_ERROR); } /*************************************************************/ diff --git a/src/devices/nm-device-bond.h b/src/devices/nm-device-bond.h index ed1c023434..17217a57c4 100644 --- a/src/devices/nm-device-bond.h +++ b/src/devices/nm-device-bond.h @@ -34,12 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_BOND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BOND)) #define NM_DEVICE_BOND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BOND, NMDeviceBondClass)) -typedef enum { - NM_BOND_ERROR_CONNECTION_NOT_BOND = 0, /*< nick=ConnectionNotBond >*/ - NM_BOND_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_BOND_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMBondError; - #define NM_DEVICE_BOND_SLAVES "slaves" typedef NMDevice NMDeviceBond; diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index 191cbdd366..7a3c373c47 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -46,8 +46,6 @@ G_DEFINE_TYPE (NMDeviceBridge, nm_device_bridge, NM_TYPE_DEVICE) #define NM_DEVICE_BRIDGE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgePrivate)) -#define NM_BRIDGE_ERROR (nm_bridge_error_quark ()) - typedef struct { int dummy; } NMDeviceBridgePrivate; @@ -61,17 +59,6 @@ enum { /******************************************************************/ -static GQuark -nm_bridge_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-bridge-error"); - return quark; -} - -/******************************************************************/ - static guint32 get_generic_capabilities (NMDevice *dev) { @@ -481,8 +468,6 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_bridge_object_info); - - dbus_g_error_domain_register (NM_BRIDGE_ERROR, NULL, NM_TYPE_BRIDGE_ERROR); } /*************************************************************/ diff --git a/src/devices/nm-device-bridge.h b/src/devices/nm-device-bridge.h index 7c6d7c53af..c11a2c40f7 100644 --- a/src/devices/nm-device-bridge.h +++ b/src/devices/nm-device-bridge.h @@ -34,12 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_BRIDGE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_BRIDGE)) #define NM_DEVICE_BRIDGE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_BRIDGE, NMDeviceBridgeClass)) -typedef enum { - NM_BRIDGE_ERROR_CONNECTION_NOT_BRIDGE = 0, /*< nick=ConnectionNotBridge >*/ - NM_BRIDGE_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_BRIDGE_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMBridgeError; - #define NM_DEVICE_BRIDGE_SLAVES "slaves" typedef NMDevice NMDeviceBridge; diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 10637d6145..e4b726a221 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -73,8 +73,6 @@ G_DEFINE_TYPE (NMDeviceEthernet, nm_device_ethernet, NM_TYPE_DEVICE) #define PPPOE_RECONNECT_DELAY 7 -#define NM_ETHERNET_ERROR (nm_ethernet_error_quark ()) - static NMSetting *device_get_setting (NMDevice *device, GType setting_type); typedef struct Supplicant { @@ -142,15 +140,6 @@ enum { }; -static GQuark -nm_ethernet_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-ethernet-error"); - return quark; -} - static char * get_link_basename (const char *parent_path, const char *name, GError **error) { @@ -1744,8 +1733,6 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_ethernet_object_info); - - dbus_g_error_domain_register (NM_ETHERNET_ERROR, NULL, NM_TYPE_ETHERNET_ERROR); } /*************************************************************/ diff --git a/src/devices/nm-device-ethernet.h b/src/devices/nm-device-ethernet.h index ff21bcad99..ad9ce85669 100644 --- a/src/devices/nm-device-ethernet.h +++ b/src/devices/nm-device-ethernet.h @@ -35,13 +35,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_ETHERNET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_ETHERNET)) #define NM_DEVICE_ETHERNET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_ETHERNET, NMDeviceEthernetClass)) -typedef enum -{ - NM_ETHERNET_ERROR_CONNECTION_NOT_WIRED = 0, /*< nick=ConnectionNotWired >*/ - NM_ETHERNET_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_ETHERNET_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMEthernetError; - #define NM_DEVICE_ETHERNET_PERMANENT_HW_ADDRESS "perm-hw-address" #define NM_DEVICE_ETHERNET_SPEED "speed" diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c index af262f7733..c5aadb8f20 100644 --- a/src/devices/nm-device-generic.c +++ b/src/devices/nm-device-generic.c @@ -45,19 +45,6 @@ enum { LAST_PROP }; -#define NM_DEVICE_GENERIC_ERROR (nm_device_generic_error_quark ()) - -static GQuark -nm_device_generic_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-device-generic-error"); - return quark; -} - -/**************************************************************/ - static guint32 get_generic_capabilities (NMDevice *dev) { @@ -211,6 +198,4 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_generic_object_info); - - dbus_g_error_domain_register (NM_DEVICE_GENERIC_ERROR, NULL, NM_TYPE_DEVICE_GENERIC_ERROR); } diff --git a/src/devices/nm-device-generic.h b/src/devices/nm-device-generic.h index 1decc2eb6c..c889b1ddc7 100644 --- a/src/devices/nm-device-generic.h +++ b/src/devices/nm-device-generic.h @@ -34,13 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_GENERIC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_GENERIC)) #define NM_DEVICE_GENERIC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_GENERIC, NMDeviceGenericClass)) -typedef enum -{ - NM_DEVICE_GENERIC_ERROR_CONNECTION_NOT_GENERIC = 0, /*< nick=ConnectionNotGeneric >*/ - NM_DEVICE_GENERIC_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_DEVICE_GENERIC_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMDeviceGenericError; - #define NM_DEVICE_GENERIC_TYPE_DESCRIPTION "type-description" typedef struct { diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 6d7ce34b59..69cdc6715e 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -44,8 +44,6 @@ G_DEFINE_TYPE (NMDeviceInfiniband, nm_device_infiniband, NM_TYPE_DEVICE) #define NM_DEVICE_INFINIBAND_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandPrivate)) -#define NM_INFINIBAND_ERROR (nm_infiniband_error_quark ()) - typedef struct { int dummy; } NMDeviceInfinibandPrivate; @@ -56,15 +54,6 @@ enum { LAST_PROP }; -static GQuark -nm_infiniband_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-infiniband-error"); - return quark; -} - static void nm_device_infiniband_init (NMDeviceInfiniband * self) { @@ -296,8 +285,6 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_infiniband_object_info); - - dbus_g_error_domain_register (NM_INFINIBAND_ERROR, NULL, NM_TYPE_INFINIBAND_ERROR); } /*************************************************************/ diff --git a/src/devices/nm-device-infiniband.h b/src/devices/nm-device-infiniband.h index e9b5be92ba..b81b762ad2 100644 --- a/src/devices/nm-device-infiniband.h +++ b/src/devices/nm-device-infiniband.h @@ -34,12 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_INFINIBAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_INFINIBAND)) #define NM_DEVICE_INFINIBAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_INFINIBAND, NMDeviceInfinibandClass)) -typedef enum { - NM_INFINIBAND_ERROR_CONNECTION_NOT_INFINIBAND = 0, /*< nick=ConnectionNotInfiniband >*/ - NM_INFINIBAND_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_INFINIBAND_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMInfinibandError; - typedef NMDevice NMDeviceInfiniband; typedef NMDeviceClass NMDeviceInfinibandClass; diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index 8ca39be64b..1c78dd1ea2 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -50,8 +50,6 @@ G_DEFINE_TYPE (NMDeviceVlan, nm_device_vlan, NM_TYPE_DEVICE) #define NM_DEVICE_VLAN_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_VLAN, NMDeviceVlanPrivate)) -#define NM_VLAN_ERROR (nm_vlan_error_quark ()) - typedef struct { char *initial_hw_addr; @@ -74,17 +72,6 @@ enum { /******************************************************************/ -static GQuark -nm_vlan_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-vlan-error"); - return quark; -} - -/******************************************************************/ - static void update_initial_hw_address (NMDevice *dev) { @@ -232,7 +219,7 @@ complete_connection (NMDevice *device, s_vlan = nm_connection_get_setting_vlan (connection); if (!s_vlan) { - g_set_error_literal (error, NM_VLAN_ERROR, NM_VLAN_ERROR_CONNECTION_INVALID, + g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'vlan' setting is required."); return FALSE; } @@ -242,7 +229,7 @@ complete_connection (NMDevice *device, */ if ( !nm_setting_vlan_get_parent (s_vlan) && !match_hwaddr (device, connection, TRUE)) { - g_set_error_literal (error, NM_VLAN_ERROR, NM_VLAN_ERROR_CONNECTION_INVALID, + g_set_error_literal (error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_INVALID_CONNECTION, "The 'vlan' setting had no interface name, parent, or hardware address."); return FALSE; } @@ -591,8 +578,6 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_vlan_object_info); - - dbus_g_error_domain_register (NM_VLAN_ERROR, NULL, NM_TYPE_VLAN_ERROR); } /*************************************************************/ diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 40055961bd..6778d46dc6 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -51,8 +51,6 @@ G_DEFINE_TYPE (NMDeviceTeam, nm_device_team, NM_TYPE_DEVICE) #define NM_DEVICE_TEAM_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NM_TYPE_DEVICE_TEAM, NMDeviceTeamPrivate)) -#define NM_DEVICE_TEAM_ERROR (nm_device_team_error_quark ()) - static gboolean teamd_start (NMDevice *device, NMSettingTeam *s_team); typedef struct { @@ -72,17 +70,6 @@ enum { /******************************************************************/ -static GQuark -nm_device_team_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-team-error"); - return quark; -} - -/******************************************************************/ - static guint32 get_generic_capabilities (NMDevice *device) { @@ -224,8 +211,8 @@ master_update_slave_connection (NMDevice *self, tdc = teamdctl_alloc (); if (!tdc) { g_set_error (error, - NM_DEVICE_TEAM_ERROR, - NM_DEVICE_TEAM_ERROR_TEAMCTL_FAILURE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_FAILED, "update slave connection for slave '%s' failed to connect to teamd for master %s (out of memory?)", iface_slave, iface); g_return_val_if_reached (FALSE); @@ -235,8 +222,8 @@ master_update_slave_connection (NMDevice *self, if (err) { teamdctl_free (tdc); g_set_error (error, - NM_DEVICE_TEAM_ERROR, - NM_DEVICE_TEAM_ERROR_TEAMCTL_FAILURE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_FAILED, "update slave connection for slave '%s' failed to connect to teamd for master %s (err=%d)", iface_slave, iface, err); return FALSE; @@ -247,8 +234,8 @@ master_update_slave_connection (NMDevice *self, teamdctl_free (tdc); if (err) { g_set_error (error, - NM_DEVICE_TEAM_ERROR, - NM_DEVICE_TEAM_ERROR_TEAMCTL_FAILURE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_FAILED, "update slave connection for slave '%s' failed to get configuration from teamd master %s (err=%d)", iface_slave, iface, err); g_free (port_config); @@ -678,8 +665,8 @@ nm_device_team_new_for_connection (NMConnection *connection, GError **error) if ( !nm_platform_team_add (iface) && nm_platform_get_error () != NM_PLATFORM_ERROR_EXISTS) { g_set_error (error, - NM_DEVICE_TEAM_ERROR, - NM_DEVICE_TEAM_ERROR_PLATFORM_FAILURE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_CREATION_FAILED, "failed to create team master interface '%s' for connection '%s': %s", iface, nm_connection_get_id (connection), nm_platform_get_error_msg ()); @@ -781,6 +768,4 @@ nm_device_team_class_init (NMDeviceTeamClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_team_object_info); - - dbus_g_error_domain_register (NM_DEVICE_TEAM_ERROR, NULL, NM_TYPE_TEAM_ERROR); } diff --git a/src/devices/team/nm-device-team.h b/src/devices/team/nm-device-team.h index 57f3aeffc8..26ba573721 100644 --- a/src/devices/team/nm-device-team.h +++ b/src/devices/team/nm-device-team.h @@ -34,15 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_TEAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_TEAM)) #define NM_DEVICE_TEAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_TEAM, NMDeviceTeamClass)) -typedef enum { - NM_DEVICE_TEAM_ERROR_CONNECTION_NOT_TEAM = 0, /*< nick=ConnectionNotTeam >*/ - NM_DEVICE_TEAM_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_DEVICE_TEAM_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ - NM_DEVICE_TEAM_ERROR_TEAMCTL_FAILURE, /*< nick=TeamCtlFailure >*/ - NM_DEVICE_TEAM_ERROR_NO_SUPPORT, /*< nick=NoSupport >*/ - NM_DEVICE_TEAM_ERROR_PLATFORM_FAILURE, /*< nick=PlatformFailure >*/ -} NMTeamError; - #define NM_DEVICE_TEAM_SLAVES "slaves" typedef struct { diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index 2306155019..d801795985 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -81,19 +81,6 @@ struct _NMDeviceOlpcMeshPrivate { /*******************************************************************/ -static GQuark -nm_olpc_mesh_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-mesh-error"); - return quark; -} - -#define NM_OLPC_MESH_ERROR (nm_olpc_mesh_error_quark ()) - -/*******************************************************************/ - static gboolean check_connection_compatible (NMDevice *device, NMConnection *connection) { @@ -566,7 +553,5 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_olpc_mesh_object_info); - - dbus_g_error_domain_register (NM_OLPC_MESH_ERROR, NULL, NM_TYPE_OLPC_MESH_ERROR); } diff --git a/src/devices/wifi/nm-device-olpc-mesh.h b/src/devices/wifi/nm-device-olpc-mesh.h index 8f8060ba87..67d83fb059 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.h +++ b/src/devices/wifi/nm-device-olpc-mesh.h @@ -41,13 +41,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_OLPC_MESH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_OLPC_MESH)) #define NM_DEVICE_OLPC_MESH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_OLPC_MESH, NMDeviceOlpcMeshClass)) -typedef enum -{ - NM_OLPC_MESH_ERROR_CONNECTION_NOT_MESH = 0, /*< nick=ConnectionNotMesh >*/ - NM_OLPC_MESH_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_OLPC_MESH_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ -} NMOlpcMeshError; - #define NM_DEVICE_OLPC_MESH_COMPANION "companion" #define NM_DEVICE_OLPC_MESH_BITRATE "bitrate" #define NM_DEVICE_OLPC_MESH_ACTIVE_CHANNEL "active-channel" diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 3441ae3a76..6617f4a69e 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -193,19 +193,6 @@ static void remove_supplicant_interface_error_handler (NMDeviceWifi *self); /*****************************************************************/ -#define NM_WIFI_ERROR (nm_wifi_error_quark ()) - -static GQuark -nm_wifi_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-wifi-error"); - return quark; -} - -/*****************************************************************/ - static GObject* constructor (GType type, guint n_construct_params, @@ -998,8 +985,8 @@ complete_connection (NMDevice *device, /* If not given a specific object, we need at minimum an SSID */ if (!s_wifi) { g_set_error_literal (error, - NM_WIFI_ERROR, - NM_WIFI_ERROR_CONNECTION_INVALID, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'wireless' setting is required if no AP path was given."); return FALSE; } @@ -1007,8 +994,8 @@ complete_connection (NMDevice *device, setting_ssid = nm_setting_wireless_get_ssid (s_wifi); if (!setting_ssid || g_bytes_get_size (setting_ssid) == 0) { g_set_error_literal (error, - NM_WIFI_ERROR, - NM_WIFI_ERROR_CONNECTION_INVALID, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'wireless' setting with a valid SSID is required if no AP path was given."); return FALSE; } @@ -1045,8 +1032,8 @@ complete_connection (NMDevice *device, ap = get_ap_by_path (self, specific_object); if (!ap) { g_set_error (error, - NM_WIFI_ERROR, - NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_SPECIFIC_OBJECT_NOT_FOUND, "The access point %s was not in the scan list.", specific_object); return FALSE; @@ -1082,8 +1069,8 @@ complete_connection (NMDevice *device, * connection data, then we cannot connect at all. Return an error. */ g_set_error_literal (error, - NM_WIFI_ERROR, - NM_WIFI_ERROR_CONNECTION_INVALID, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'wireless' setting with a valid SSID is required for hidden access points."); return FALSE; } @@ -1294,8 +1281,8 @@ request_scan_cb (NMDevice *device, } if (!check_scanning_allowed (self)) { - local = g_error_new_literal (NM_WIFI_ERROR, - NM_WIFI_ERROR_SCAN_NOT_ALLOWED, + local = g_error_new_literal (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_NOT_ALLOWED, "Scanning not allowed at this time"); dbus_g_method_return_error (context, local); g_error_free (local); @@ -1321,23 +1308,23 @@ impl_device_request_scan (NMDeviceWifi *self, || !priv->sup_iface || nm_device_get_state (device) < NM_DEVICE_STATE_DISCONNECTED || nm_device_is_activating (device)) { - error = g_error_new_literal (NM_WIFI_ERROR, - NM_WIFI_ERROR_SCAN_NOT_ALLOWED, + error = g_error_new_literal (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_NOT_ALLOWED, "Scanning not allowed while unavailable or activating"); goto error; } if (nm_supplicant_interface_get_scanning (priv->sup_iface)) { - error = g_error_new_literal (NM_WIFI_ERROR, - NM_WIFI_ERROR_SCAN_NOT_ALLOWED, + error = g_error_new_literal (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_NOT_ALLOWED, "Scanning not allowed while already scanning"); goto error; } last_scan = nm_supplicant_interface_get_last_scan_time (priv->sup_iface); if (last_scan && (nm_utils_get_monotonic_timestamp_s () - last_scan) < 10) { - error = g_error_new_literal (NM_WIFI_ERROR, - NM_WIFI_ERROR_SCAN_NOT_ALLOWED, + error = g_error_new_literal (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_NOT_ALLOWED, "Scanning not allowed immediately following previous scan"); goto error; } @@ -3456,8 +3443,6 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_wifi_object_info); - - dbus_g_error_domain_register (NM_WIFI_ERROR, NULL, NM_TYPE_WIFI_ERROR); } diff --git a/src/devices/wifi/nm-device-wifi.h b/src/devices/wifi/nm-device-wifi.h index 538aef0820..bcba91da2f 100644 --- a/src/devices/wifi/nm-device-wifi.h +++ b/src/devices/wifi/nm-device-wifi.h @@ -38,16 +38,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_WIFI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIFI)) #define NM_DEVICE_WIFI_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIFI, NMDeviceWifiClass)) -typedef enum { - NM_WIFI_ERROR_CONNECTION_NOT_WIRELESS = 0, /*< nick=ConnectionNotWireless >*/ - NM_WIFI_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_WIFI_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ - NM_WIFI_ERROR_ACCESS_POINT_NOT_FOUND, /*< nick=AccessPointNotFound >*/ - NM_WIFI_ERROR_SCAN_NOT_ALLOWED, /*< nick=ScanNotAllowed >*/ - NM_WIFI_ERROR_AP_MODE_UNSUPPORTED, /*< nick=ApModeUnsupported >*/ - NM_WIFI_ERROR_ADHOC_MODE_UNSUPPORTED, /*< nick=AdhocModeUnsupported >*/ -} NMWifiError; - #define NM_DEVICE_WIFI_PERMANENT_HW_ADDRESS "perm-hw-address" #define NM_DEVICE_WIFI_MODE "mode" #define NM_DEVICE_WIFI_BITRATE "bitrate" diff --git a/src/devices/wimax/nm-device-wimax.c b/src/devices/wimax/nm-device-wimax.c index daa4f970f5..ec892b68ff 100644 --- a/src/devices/wimax/nm-device-wimax.c +++ b/src/devices/wimax/nm-device-wimax.c @@ -110,19 +110,6 @@ typedef struct { /***********************************************************/ -#define NM_WIMAX_ERROR (nm_wimax_error_quark ()) - -static GQuark -nm_wimax_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-wimax-error"); - return quark; -} - -/***********************************************************/ - static gboolean impl_device_get_nsp_list (NMDeviceWimax *self, GPtrArray **nsps, GError **error) { @@ -384,8 +371,8 @@ complete_connection (NMDevice *device, /* If not given a specific object, we need at minimum an NSP name */ if (!s_wimax) { g_set_error_literal (error, - NM_WIMAX_ERROR, - NM_WIMAX_ERROR_CONNECTION_INVALID, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'wimax' setting is required if no NSP path was given."); return FALSE; } @@ -393,8 +380,8 @@ complete_connection (NMDevice *device, nsp_name = nm_setting_wimax_get_network_name (s_wimax); if (!nsp_name || !strlen (nsp_name)) { g_set_error_literal (error, - NM_WIMAX_ERROR, - NM_WIMAX_ERROR_CONNECTION_INVALID, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "A 'wimax' setting with a valid network name is required if no NSP path was given."); return FALSE; } @@ -421,8 +408,8 @@ complete_connection (NMDevice *device, if (!nsp) { g_set_error (error, - NM_WIMAX_ERROR, - NM_WIMAX_ERROR_NSP_NOT_FOUND, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_SPECIFIC_OBJECT_NOT_FOUND, "The NSP %s was not in the scan list.", specific_object); return FALSE; @@ -1426,6 +1413,4 @@ nm_device_wimax_class_init (NMDeviceWimaxClass *klass) nm_dbus_manager_register_exported_type (nm_dbus_manager_get (), G_TYPE_FROM_CLASS (klass), &dbus_glib_nm_device_wimax_object_info); - - dbus_g_error_domain_register (NM_WIMAX_ERROR, NULL, NM_TYPE_WIMAX_ERROR); } diff --git a/src/devices/wimax/nm-device-wimax.h b/src/devices/wimax/nm-device-wimax.h index b70c3f88bb..30b2481ffc 100644 --- a/src/devices/wimax/nm-device-wimax.h +++ b/src/devices/wimax/nm-device-wimax.h @@ -34,14 +34,6 @@ G_BEGIN_DECLS #define NM_IS_DEVICE_WIMAX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_WIMAX)) #define NM_DEVICE_WIMAX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_WIMAX, NMDeviceWimaxClass)) -typedef enum -{ - NM_WIMAX_ERROR_CONNECTION_NOT_WIMAX = 0, /*< nick=ConnectionNotWimax >*/ - NM_WIMAX_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_WIMAX_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ - NM_WIMAX_ERROR_NSP_NOT_FOUND, /*< nick=NspNotFound >*/ -} NMWimaxError; - #define NM_DEVICE_WIMAX_NSPS "nsps" #define NM_DEVICE_WIMAX_ACTIVE_NSP "active-nsp" #define NM_DEVICE_WIMAX_CENTER_FREQUENCY "center-frequency" diff --git a/src/devices/wwan/nm-modem-broadband.c b/src/devices/wwan/nm-modem-broadband.c index ac0f54f500..a9ed5d5a82 100644 --- a/src/devices/wwan/nm-modem-broadband.c +++ b/src/devices/wwan/nm-modem-broadband.c @@ -224,8 +224,8 @@ connect_ready (MMModemSimple *simple_iface, nm_log_warn (LOGD_MB, "(%s) failed to connect modem: invalid bearer IP configuration", nm_modem_get_uid (NM_MODEM (self))); - error = g_error_new_literal (NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INVALID, + error = g_error_new_literal (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "invalid bearer IP configuration"); g_signal_emit_by_name (self, NM_MODEM_PREPARE_RESULT, FALSE, error); g_error_free (error); @@ -512,8 +512,8 @@ complete_connection (NMModem *_self, } g_set_error (error, - NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INCOMPATIBLE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, "Device is not a mobile broadband modem"); return FALSE; } @@ -675,8 +675,8 @@ static_stage3_ip4_done (NMModemBroadband *self) /* Fully fail if invalid IP address retrieved */ address_string = mm_bearer_ip_config_get_address (self->priv->ipv4_config); if (!ip4_string_to_num (address_string, &address_network)) { - error = g_error_new (NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INVALID, + error = g_error_new (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "(%s) retrieving IP4 configuration failed: invalid address given '%s'", nm_modem_get_uid (NM_MODEM (self)), address_string); @@ -756,8 +756,8 @@ stage3_ip6_done (NMModemBroadband *self) if (!address_string) { /* DHCP/SLAAC is allowed to skip addresses; other methods require it */ if (ip_method != NM_MODEM_IP_METHOD_AUTO) { - error = g_error_new (NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INVALID, + error = g_error_new (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "(%s) retrieving IPv6 configuration failed: no address given", nm_modem_get_uid (NM_MODEM (self))); } @@ -766,8 +766,8 @@ stage3_ip6_done (NMModemBroadband *self) /* Fail if invalid IP address retrieved */ if (!inet_pton (AF_INET6, address_string, (void *) &(address.address))) { - error = g_error_new (NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INVALID, + error = g_error_new (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "(%s) retrieving IPv6 configuration failed: invalid address given '%s'", nm_modem_get_uid (NM_MODEM (self)), address_string); @@ -787,8 +787,8 @@ stage3_ip6_done (NMModemBroadband *self) address_string = mm_bearer_ip_config_get_gateway (self->priv->ipv6_config); if (address_string) { if (!inet_pton (AF_INET6, address_string, (void *) &(address.address))) { - error = g_error_new (NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INVALID, + error = g_error_new (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "(%s) retrieving IPv6 configuration failed: invalid gateway given '%s'", nm_modem_get_uid (NM_MODEM (self)), address_string); @@ -798,8 +798,8 @@ stage3_ip6_done (NMModemBroadband *self) nm_ip6_config_set_gateway (config, &address.address); } else if (ip_method == NM_MODEM_IP_METHOD_STATIC) { /* Gateway required for the 'static' method */ - error = g_error_new (NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INVALID, + error = g_error_new (NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INVALID_CONNECTION, "(%s) retrieving IPv6 configuration failed: missing gateway", nm_modem_get_uid (NM_MODEM (self))); goto out; diff --git a/src/devices/wwan/nm-modem.c b/src/devices/wwan/nm-modem.c index 3860979902..431dc05c0b 100644 --- a/src/devices/wwan/nm-modem.c +++ b/src/devices/wwan/nm-modem.c @@ -100,17 +100,6 @@ static guint signals[LAST_SIGNAL] = { 0 }; /*****************************************************************************/ - -GQuark -nm_modem_error_quark (void) -{ - static GQuark quark = 0; - if (!quark) - quark = g_quark_from_static_string ("nm-modem-error"); - return quark; -} - -/*****************************************************************************/ /* State/enabled/connected */ static const char *state_table[] = { @@ -271,8 +260,8 @@ nm_modem_get_connection_ip_type (NMModem *self, if (ip4 && !ip6) { if (!(priv->ip_types & NM_MODEM_IP_TYPE_IPV4)) { g_set_error_literal (error, - NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INCOMPATIBLE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, "Connection requested IPv4 but IPv4 is " "unsuported by the modem."); return NM_MODEM_IP_TYPE_UNKNOWN; @@ -283,8 +272,8 @@ nm_modem_get_connection_ip_type (NMModem *self, if (ip6 && !ip4) { if (!(priv->ip_types & NM_MODEM_IP_TYPE_IPV6)) { g_set_error_literal (error, - NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INCOMPATIBLE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, "Connection requested IPv6 but IPv6 is " "unsuported by the modem."); return NM_MODEM_IP_TYPE_UNKNOWN; @@ -306,8 +295,8 @@ nm_modem_get_connection_ip_type (NMModem *self, return NM_MODEM_IP_TYPE_IPV6; g_set_error_literal (error, - NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INCOMPATIBLE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, "Connection requested both IPv4 and IPv6 " "but dual-stack addressing is unsupported " "by the modem."); @@ -315,8 +304,8 @@ nm_modem_get_connection_ip_type (NMModem *self, } g_set_error_literal (error, - NM_MODEM_ERROR, - NM_MODEM_ERROR_CONNECTION_INCOMPATIBLE, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_INCOMPATIBLE_CONNECTION, "Connection specified no IP configuration!"); return NM_MODEM_IP_TYPE_UNKNOWN; } @@ -1400,8 +1389,4 @@ nm_modem_class_init (NMModemClass *klass) G_STRUCT_OFFSET (NMModemClass, state_changed), NULL, NULL, NULL, G_TYPE_NONE, 2, NM_TYPE_MODEM_STATE, NM_TYPE_MODEM_STATE); - - dbus_g_error_domain_register (NM_MODEM_ERROR, - NM_DBUS_INTERFACE_DEVICE_MODEM, - NM_TYPE_MODEM_ERROR); } diff --git a/src/devices/wwan/nm-modem.h b/src/devices/wwan/nm-modem.h index dba368d37d..2a4d917332 100644 --- a/src/devices/wwan/nm-modem.h +++ b/src/devices/wwan/nm-modem.h @@ -86,15 +86,6 @@ typedef enum { NM_MODEM_IP_TYPE_IPV4V6 = 0x4 } NMModemIPType; -typedef enum { - NM_MODEM_ERROR_CONNECTION_NOT_GSM, /*< nick=ConnectionNotGsm >*/ - NM_MODEM_ERROR_CONNECTION_NOT_CDMA, /*< nick=ConnectionNotCdma >*/ - NM_MODEM_ERROR_CONNECTION_INVALID, /*< nick=ConnectionInvalid >*/ - NM_MODEM_ERROR_CONNECTION_INCOMPATIBLE, /*< nick=ConnectionIncompatible >*/ - NM_MODEM_ERROR_INITIALIZATION_FAILED, /*< nick=InitializationFailed >*/ - NM_MODEM_ERROR_IP_CONFIG_INVALID, /*< nick=IpConfigInvalid >*/ -} NMModemError; - typedef enum { /*< underscore_name=nm_modem_state >*/ NM_MODEM_STATE_UNKNOWN = 0, NM_MODEM_STATE_FAILED = 1, @@ -111,9 +102,6 @@ typedef enum { /*< underscore_name=nm_modem_state >*/ NM_MODEM_STATE_CONNECTED = 12, } NMModemState; -#define NM_MODEM_ERROR (nm_modem_error_quark ()) -GQuark nm_modem_error_quark (void); - typedef struct { GObject parent; |