diff --git a/cli/src/devices.c b/cli/src/devices.c index e263a88596..991bf3b9bb 100644 --- a/cli/src/devices.c +++ b/cli/src/devices.c @@ -411,8 +411,8 @@ ip6_address_as_string (const struct in6_addr *ip) g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]); for (j = 1; j < 16; j++) g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]); - nm_warning ("%s: error converting IP6 address %s", - __func__, ip6_str->str); + g_warning ("%s: error converting IP6 address %s", + __func__, ip6_str->str); g_string_free (ip6_str, TRUE); return NULL; } diff --git a/libnm-glib/libnm-glib-test.c b/libnm-glib/libnm-glib-test.c index 6284fecab1..16e6fad648 100644 --- a/libnm-glib/libnm-glib-test.c +++ b/libnm-glib/libnm-glib-test.c @@ -80,8 +80,8 @@ ip4_address_as_string (guint32 ip) if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) { return g_strdup (buf); } else { - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (tmp_addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (tmp_addr.s_addr)); return NULL; } } diff --git a/libnm-glib/nm-client.c b/libnm-glib/nm-client.c index bab86a9ba1..e8a13d44a4 100644 --- a/libnm-glib/nm-client.c +++ b/libnm-glib/nm-client.c @@ -1142,7 +1142,7 @@ activate_cb (DBusGProxy *proxy, if (info->act_fn) info->act_fn (info->client, path, error, info->user_data); else if (error) - nm_warning ("Device activation failed: (%d) %s", error->code, error->message); + g_warning ("Device activation failed: (%d) %s", error->code, error->message); g_slice_free (ActivateDeviceInfo, info); } @@ -1199,7 +1199,7 @@ add_activate_cb (DBusGProxy *proxy, if (info->add_act_fn) info->add_act_fn (info->client, connection_path, active_path, error, info->user_data); else if (error) - nm_warning ("Connection add and activate failed: (%d) %s", error->code, error->message); + g_warning ("Connection add and activate failed: (%d) %s", error->code, error->message); g_slice_free (ActivateDeviceInfo, info); } diff --git a/libnm-glib/nm-vpn-plugin.c b/libnm-glib/nm-vpn-plugin.c index fe7a2b635a..4c3813e34b 100644 --- a/libnm-glib/nm-vpn-plugin.c +++ b/libnm-glib/nm-vpn-plugin.c @@ -259,10 +259,10 @@ connect_timer_expired (gpointer data) NMVPNPlugin *plugin = NM_VPN_PLUGIN (data); GError *err = NULL; - nm_info ("Connect timer expired, disconnecting."); + g_message ("Connect timer expired, disconnecting."); nm_vpn_plugin_disconnect (plugin, &err); if (err) { - nm_warning ("Disconnect failed: %s", err->message); + g_warning ("Disconnect failed: %s", err->message); g_error_free (err); } @@ -367,11 +367,11 @@ impl_vpn_plugin_connect (NMVPNPlugin *plugin, connection = nm_connection_new_from_hash (properties, error); if (!connection) { - nm_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d", - __func__, - g_type_name (nm_connection_lookup_setting_type_by_quark ((*error)->domain)), - (*error)->message, - (*error)->code); + g_warning ("%s: Invalid connection: '%s' / '%s' invalid: %d", + __func__, + g_type_name (nm_connection_lookup_setting_type_by_quark ((*error)->domain)), + (*error)->message, + (*error)->code); } else { success = nm_vpn_plugin_connect (plugin, connection, error); g_object_unref (connection); @@ -558,7 +558,7 @@ constructor (GType type, err: if (err) { - nm_warning ("%s", err->message); + g_warning ("Failed to initialize VPN plugin: %s", err->message); g_error_free (err); } @@ -633,7 +633,7 @@ dispose (GObject *object) nm_vpn_plugin_disconnect (plugin, &err); if (err) { - nm_warning ("%s", err->message); + g_warning ("Error disconnecting VPN connection: %s", err->message); g_error_free (err); } diff --git a/libnm-util/nm-setting.c b/libnm-util/nm-setting.c index f134754b18..b623767aaf 100644 --- a/libnm-util/nm-setting.c +++ b/libnm-util/nm-setting.c @@ -191,7 +191,7 @@ one_property_cb (gpointer key, gpointer val, gpointer user_data) param_spec = g_object_class_find_property (info->class, prop_name); if (!param_spec || !(param_spec->flags & NM_SETTING_PARAM_SERIALIZE)) { /* Oh, we're so nice and only warn, maybe it should be a fatal error? */ - nm_warning ("Ignoring invalid property '%s'", prop_name); + g_warning ("Ignoring invalid property '%s'", prop_name); return; } @@ -200,8 +200,8 @@ one_property_cb (gpointer key, gpointer val, gpointer user_data) info->params[info->n_params].name = prop_name; info->n_params++; } else { - nm_warning ("Ignoring property '%s' with invalid type (%s)", - prop_name, G_VALUE_TYPE_NAME (src_value)); + g_warning ("Ignoring property '%s' with invalid type (%s)", + prop_name, G_VALUE_TYPE_NAME (src_value)); g_value_unset (dst_value); } } @@ -908,7 +908,7 @@ constructor (GType type, priv = NM_SETTING_GET_PRIVATE (object); if (!priv->name) { - nm_warning ("Setting name is not set."); + g_warning ("Setting name is not set."); g_object_unref (object); object = NULL; } diff --git a/libnm-util/nm-utils.c b/libnm-util/nm-utils.c index 0e02a31ee6..9bfaf65922 100644 --- a/libnm-util/nm-utils.c +++ b/libnm-util/nm-utils.c @@ -642,8 +642,8 @@ nm_utils_convert_uint_array_to_string (const GValue *src_value, GValue *dest_val memset (buf, 0, sizeof (buf)); addr.s_addr = g_array_index (array, guint32, i++); if (!inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN)) - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (addr.s_addr)); g_string_append_printf (printable, "%u (%s)", addr.s_addr, buf); } g_string_append_c (printable, ']'); @@ -684,8 +684,8 @@ nm_utils_convert_ip4_addr_route_struct_array_to_string (const GValue *src_value, memset (buf, 0, sizeof (buf)); addr.s_addr = g_array_index (array, guint32, 0); if (!inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN)) - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (addr.s_addr)); if (is_addr) g_string_append_printf (printable, "ip = %s", buf); else @@ -702,8 +702,8 @@ nm_utils_convert_ip4_addr_route_struct_array_to_string (const GValue *src_value, memset (buf, 0, sizeof (buf)); addr.s_addr = g_array_index (array, guint32, 2); if (!inet_ntop (AF_INET, &addr, buf, INET_ADDRSTRLEN)) - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (addr.s_addr)); if (is_addr) g_string_append_printf (printable, "gw = %s", buf); else @@ -819,8 +819,8 @@ nm_utils_inet6_ntop (struct in6_addr *addr, char *buf) g_string_append_printf (ip6_str, "%02X", addr->s6_addr[0]); for (i = 1; i < 16; i++) g_string_append_printf (ip6_str, " %02X", addr->s6_addr[i]); - nm_warning ("%s: error converting IP6 address %s", - __func__, ip6_str->str); + g_warning ("%s: error converting IP6 address %s", + __func__, ip6_str->str); g_string_free (ip6_str, TRUE); return FALSE; } @@ -1357,7 +1357,7 @@ nm_utils_ip4_addresses_from_gvalue (const GValue *value) NMIP4Address *addr; if (array->len < 3) { - nm_warning ("Ignoring invalid IP4 address"); + g_warning ("Ignoring invalid IP4 address"); continue; } @@ -1439,7 +1439,7 @@ nm_utils_ip4_routes_from_gvalue (const GValue *value) NMIP4Route *route; if (array->len < 4) { - nm_warning ("Ignoring invalid IP4 route"); + g_warning ("Ignoring invalid IP4 route"); continue; } @@ -1607,27 +1607,27 @@ nm_utils_ip6_addresses_from_gvalue (const GValue *value) guint32 prefix; if (elements->n_values < 2 || elements->n_values > 3) { - nm_warning ("%s: ignoring invalid IP6 address structure", __func__); + g_warning ("%s: ignoring invalid IP6 address structure", __func__); continue; } if ( (G_VALUE_TYPE (g_value_array_get_nth (elements, 0)) != DBUS_TYPE_G_UCHAR_ARRAY) || (G_VALUE_TYPE (g_value_array_get_nth (elements, 1)) != G_TYPE_UINT)) { - nm_warning ("%s: ignoring invalid IP6 address structure", __func__); + g_warning ("%s: ignoring invalid IP6 address structure", __func__); continue; } /* Check optional 3rd element (gateway) */ if ( elements->n_values == 3 && (G_VALUE_TYPE (g_value_array_get_nth (elements, 2)) != DBUS_TYPE_G_UCHAR_ARRAY)) { - nm_warning ("%s: ignoring invalid IP6 address structure", __func__); + g_warning ("%s: ignoring invalid IP6 address structure", __func__); continue; } tmp = g_value_array_get_nth (elements, 0); ba_addr = g_value_get_boxed (tmp); if (ba_addr->len != 16) { - nm_warning ("%s: ignoring invalid IP6 address of length %d", + g_warning ("%s: ignoring invalid IP6 address of length %d", __func__, ba_addr->len); continue; } @@ -1635,7 +1635,7 @@ nm_utils_ip6_addresses_from_gvalue (const GValue *value) tmp = g_value_array_get_nth (elements, 1); prefix = g_value_get_uint (tmp); if (prefix > 128) { - nm_warning ("%s: ignoring invalid IP6 prefix %d", + g_warning ("%s: ignoring invalid IP6 prefix %d", __func__, prefix); continue; } @@ -1644,7 +1644,7 @@ nm_utils_ip6_addresses_from_gvalue (const GValue *value) tmp = g_value_array_get_nth (elements, 2); ba_gw = g_value_get_boxed (tmp); if (ba_gw->len != 16) { - nm_warning ("%s: ignoring invalid IP6 gateway address of length %d", + g_warning ("%s: ignoring invalid IP6 gateway address of length %d", __func__, ba_gw->len); continue; } @@ -1751,13 +1751,13 @@ nm_utils_ip6_routes_from_gvalue (const GValue *value) || (G_VALUE_TYPE (g_value_array_get_nth (route_values, 1)) != G_TYPE_UINT) || (G_VALUE_TYPE (g_value_array_get_nth (route_values, 2)) != DBUS_TYPE_G_UCHAR_ARRAY) || (G_VALUE_TYPE (g_value_array_get_nth (route_values, 3)) != G_TYPE_UINT)) { - nm_warning ("Ignoring invalid IP6 route"); + g_warning ("Ignoring invalid IP6 route"); continue; } dest = g_value_get_boxed (g_value_array_get_nth (route_values, 0)); if (dest->len != 16) { - nm_warning ("%s: ignoring invalid IP6 dest address of length %d", + g_warning ("%s: ignoring invalid IP6 dest address of length %d", __func__, dest->len); continue; } @@ -1766,7 +1766,7 @@ nm_utils_ip6_routes_from_gvalue (const GValue *value) next_hop = g_value_get_boxed (g_value_array_get_nth (route_values, 2)); if (next_hop->len != 16) { - nm_warning ("%s: ignoring invalid IP6 next_hop address of length %d", + g_warning ("%s: ignoring invalid IP6 next_hop address of length %d", __func__, next_hop->len); continue; } @@ -1871,8 +1871,8 @@ nm_utils_ip6_dns_from_gvalue (const GValue *value) struct in6_addr *addr; if (bytearray->len != 16) { - nm_warning ("%s: ignoring invalid IP6 address of length %d", - __func__, bytearray->len); + g_warning ("%s: ignoring invalid IP6 address of length %d", + __func__, bytearray->len); continue; } @@ -1939,9 +1939,9 @@ nm_utils_uuid_generate_from_string (const char *s) char *buf = NULL; if (!nm_utils_init (&error)) { - nm_warning ("error initializing crypto: (%d) %s", - error ? error->code : 0, - error ? error->message : "unknown"); + g_warning ("error initializing crypto: (%d) %s", + error ? error->code : 0, + error ? error->message : "unknown"); if (error) g_error_free (error); return NULL; @@ -1949,9 +1949,9 @@ nm_utils_uuid_generate_from_string (const char *s) uuid = g_malloc0 (sizeof (*uuid)); if (!crypto_md5_hash (NULL, 0, s, strlen (s), (char *) uuid, sizeof (*uuid), &error)) { - nm_warning ("error generating UUID: (%d) %s", - error ? error->code : 0, - error ? error->message : "unknown"); + g_warning ("error generating UUID: (%d) %s", + error ? error->code : 0, + error ? error->message : "unknown"); if (error) g_error_free (error); goto out; diff --git a/libnm-util/nm-utils.h b/libnm-util/nm-utils.h index 71300ab3c4..c3eb29bc78 100644 --- a/libnm-util/nm-utils.h +++ b/libnm-util/nm-utils.h @@ -20,7 +20,7 @@ * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * - * (C) Copyright 2005 - 2010 Red Hat, Inc. + * (C) Copyright 2005 - 2011 Red Hat, Inc. */ #ifndef NM_UTILS_H @@ -33,121 +33,6 @@ G_BEGIN_DECLS -/*********************************************************/ -/* The API defined here is _NOT_ guaranteed in any way!! */ -/*********************************************************/ - -/** - * nm_print_backtrace: - * - * Prints a backtrace of the calling process to the logging location. - */ -#define nm_print_backtrace() \ -G_STMT_START \ -{ \ - void *_call_stack[512]; \ - int _call_stack_size; \ - char **_symbols; \ - _call_stack_size = backtrace (_call_stack, \ - G_N_ELEMENTS (_call_stack)); \ - _symbols = backtrace_symbols (_call_stack, _call_stack_size); \ - if (_symbols != NULL) \ - { \ - int _i; \ - _i = 0; \ - g_critical ("traceback:\n"); \ - while (_i < _call_stack_size) \ - { \ - g_critical ("\t%s\n", _symbols[_i]); \ - _i++; \ - } \ - free (_symbols); \ - } \ -} \ -G_STMT_END - -/** - * nm_get_timestamp: - * @timestamp: location in which to place the current timestamp - * - * For debugging only. - */ -#define nm_get_timestamp(timestamp) \ -G_STMT_START \ -{ \ - GTimeVal _tv; \ - g_get_current_time (&_tv); \ - *timestamp = (_tv.tv_sec * (1.0 * G_USEC_PER_SEC) + \ - _tv.tv_usec) / G_USEC_PER_SEC; \ -} \ -G_STMT_END - -#define nm_info(fmt, args...) \ -G_STMT_START \ -{ \ - g_message (" " fmt "\n", ##args); \ -} G_STMT_END - -#define nm_info_str(fmt_str, args...) \ -G_STMT_START \ -{ \ - g_message (" %s\n", fmt_str, ##args); \ -} G_STMT_END - -#define nm_debug(fmt, args...) \ -G_STMT_START \ -{ \ - gdouble _timestamp; \ - nm_get_timestamp (&_timestamp); \ - g_debug (" [%f] %s(): " fmt "\n", _timestamp, \ - G_STRFUNC, ##args); \ -} G_STMT_END - -#define nm_debug_str(fmt_str, args...) \ -G_STMT_START \ -{ \ - gdouble _timestamp; \ - nm_get_timestamp (&_timestamp); \ - g_debug (" [%f] %s(): %s\n", _timestamp, \ - G_STRFUNC, fmt_str, ##args); \ -} G_STMT_END - -#define nm_warning(fmt, args...) \ -G_STMT_START \ -{ \ - g_warning (" %s(): " fmt "\n", \ - G_STRFUNC, ##args); \ -} G_STMT_END - -#define nm_warning_str(fmt_str, args...) \ -G_STMT_START \ -{ \ - g_warning (" %s(): %s\n", \ - G_STRFUNC, fmt_str, ##args); \ -} G_STMT_END - -#define nm_error(fmt, args...) \ -G_STMT_START \ -{ \ - gdouble _timestamp; \ - nm_get_timestamp (&_timestamp); \ - g_critical ("\t[%f] %s (): " fmt "\n", _timestamp, \ - G_STRFUNC, ##args); \ - nm_print_backtrace (); \ - G_BREAKPOINT (); \ -} G_STMT_END - -#define nm_error_str(fmt_str, args...) \ -G_STMT_START \ -{ \ - gdouble _timestamp; \ - nm_get_timestamp (&_timestamp); \ - g_critical ("\t[%f] %s (): %s\n", _timestamp, \ - G_STRFUNC, fmt_str, ##args); \ - nm_print_backtrace (); \ - G_BREAKPOINT (); \ -} G_STMT_END - /* init, deinit nm_utils */ gboolean nm_utils_init (GError **error); void nm_utils_deinit (void); diff --git a/src/settings/plugins/keyfile/writer.c b/src/settings/plugins/keyfile/writer.c index 0887730a3e..a88308b2fc 100644 --- a/src/settings/plugins/keyfile/writer.c +++ b/src/settings/plugins/keyfile/writer.c @@ -89,8 +89,8 @@ ip4_dns_writer (GKeyFile *file, addr.s_addr = g_array_index (array, guint32, i); if (!inet_ntop (AF_INET, &addr, buf, sizeof (buf))) { - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (addr.s_addr)); } else list[num++] = g_strdup (buf); } @@ -129,8 +129,8 @@ write_ip4_values (GKeyFile *file, /* IP addresses */ addr.s_addr = g_array_index (tuple, guint32, k); if (!inet_ntop (AF_INET, &addr, buf, sizeof (buf))) { - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (addr.s_addr)); success = FALSE; break; } else { @@ -215,8 +215,8 @@ ip6_dns_writer (GKeyFile *file, g_string_append_printf (ip6_str, "%02X", byte_array->data[0]); for (j = 1; j < 16; j++) g_string_append_printf (ip6_str, " %02X", byte_array->data[j]); - nm_warning ("%s: error converting IP6 address %s", - __func__, ip6_str->str); + g_warning ("%s: error converting IP6 address %s", + __func__, ip6_str->str); g_string_free (ip6_str, TRUE); } else list[num++] = g_strdup (buf); @@ -254,8 +254,8 @@ ip6_array_to_addr (GValueArray *values, g_string_append_printf (ip6_str, "%02X", byte_array->data[0]); for (idx = 1; idx < 16; idx++) g_string_append_printf (ip6_str, " %02X", byte_array->data[idx]); - nm_warning ("%s: error %d converting IP6 address %s", - __func__, errno, ip6_str->str); + g_warning ("%s: error %d converting IP6 address %s", + __func__, errno, ip6_str->str); g_string_free (ip6_str, TRUE); return FALSE; } @@ -315,9 +315,9 @@ ip6_addr_writer (GKeyFile *file, char *key_name, *ip6_addr; if (values->n_values != 3) { - nm_warning ("%s: error writing IP6 address %d (address array length " - "%d is not 3)", - __func__, i, values->n_values); + g_warning ("%s: error writing IP6 address %d (address array length " + "%d is not 3)", + __func__, i, values->n_values); continue; } @@ -405,8 +405,8 @@ mac_address_writer (GKeyFile *file, return; if (array->len != ETH_ALEN) { - nm_warning ("%s: invalid %s / %s MAC address length %d", - __func__, setting_name, key, array->len); + g_warning ("%s: invalid %s / %s MAC address length %d", + __func__, setting_name, key, array->len); return; } diff --git a/src/wimax/nm-wimax-nsp.c b/src/wimax/nm-wimax-nsp.c index d9e905b1fc..e1c9bb885a 100644 --- a/src/wimax/nm-wimax-nsp.c +++ b/src/wimax/nm-wimax-nsp.c @@ -84,10 +84,7 @@ nm_wimax_nsp_export_to_dbus (NMWimaxNsp *self) priv = GET_PRIVATE (self); - if (priv->dbus_path) { - nm_warning ("NSP already exported."); - return; - } + g_return_if_fail (priv->dbus_path == NULL); mgr = nm_dbus_manager_get (); g_assert (mgr); diff --git a/test/nm-tool.c b/test/nm-tool.c index cff7a51571..5286aca734 100644 --- a/test/nm-tool.c +++ b/test/nm-tool.c @@ -253,8 +253,8 @@ ip4_address_as_string (guint32 ip) if (inet_ntop (AF_INET, &tmp_addr, buf, INET_ADDRSTRLEN)) { return g_strdup (buf); } else { - nm_warning ("%s: error converting IP4 address 0x%X", - __func__, ntohl (tmp_addr.s_addr)); + g_warning ("%s: error converting IP4 address 0x%X", + __func__, ntohl (tmp_addr.s_addr)); return NULL; } } @@ -274,8 +274,8 @@ ip6_address_as_string (const struct in6_addr *ip) g_string_append_printf (ip6_str, "%02X", ip->s6_addr[0]); for (j = 1; j < 16; j++) g_string_append_printf (ip6_str, " %02X", ip->s6_addr[j]); - nm_warning ("%s: error converting IP6 address %s", - __func__, ip6_str->str); + g_warning ("%s: error converting IP6 address %s", + __func__, ip6_str->str); g_string_free (ip6_str, TRUE); return NULL; } @@ -696,7 +696,7 @@ get_one_connection (DBusGConnection *bus, G_TYPE_INVALID, DBUS_TYPE_G_MAP_OF_MAP_OF_VARIANT, &settings, G_TYPE_INVALID)) { - nm_warning ("error: cannot retrieve connection: %s", error ? error->message : "(unknown)"); + g_warning ("error: cannot retrieve connection: %s", error ? error->message : "(unknown)"); goto out; } @@ -704,10 +704,10 @@ get_one_connection (DBusGConnection *bus, g_hash_table_destroy (settings); if (!connection) { - nm_warning ("error: invalid connection: '%s' / '%s' invalid: %d", - error ? g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)) : "(unknown)", - error ? error->message : "(unknown)", - error ? error->code : -1); + g_warning ("error: invalid connection: '%s' / '%s' invalid: %d", + error ? g_type_name (nm_connection_lookup_setting_type_by_quark (error->domain)) : "(unknown)", + error ? error->message : "(unknown)", + error ? error->code : -1); goto out; }