diff options
Diffstat (limited to 'src/settings/plugins/ifnet/net_parser.c')
-rw-r--r-- | src/settings/plugins/ifnet/net_parser.c | 39 |
1 files changed, 16 insertions, 23 deletions
diff --git a/src/settings/plugins/ifnet/net_parser.c b/src/settings/plugins/ifnet/net_parser.c index 9e39925274..95add14fc2 100644 --- a/src/settings/plugins/ifnet/net_parser.c +++ b/src/settings/plugins/ifnet/net_parser.c @@ -20,12 +20,13 @@ */ #include <string.h> -#include <nm-system-config-interface.h> #include <stdio.h> - #include <sys/ioctl.h> #include <unistd.h> +#include <nm-system-config-interface.h> +#include <nm-logging.h> + #include "plugin.h" #include "nm-platform.h" @@ -70,7 +71,7 @@ ifnet_add_network (const char *name, const char *type) if (ifnet_has_network (name)) return TRUE; if (add_new_connection_config (type, name)) { - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Adding network for %s", name); + nm_log_info (LOGD_SETTINGS, "Adding network for %s", name); net_parser_data_changed = TRUE; return TRUE; } @@ -141,8 +142,7 @@ init_block_by_line (gchar * buf) key_value = g_strsplit (buf, "=", 2); if (g_strv_length (key_value) != 2) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, "Can't handle this line: %s\n", - buf); + nm_log_warn (LOGD_SETTINGS, "Can't handle this line: %s\n", buf); g_strfreev (key_value); return; } @@ -152,7 +152,7 @@ init_block_by_line (gchar * buf) data = g_strdup (key_value[1]); tmp = strip_string (data, '"'); strip_string (tmp, '\''); - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "global:%s-%s\n", key_value[0], tmp); + nm_log_info (LOGD_SETTINGS, "global:%s-%s\n", key_value[0], tmp); g_hash_table_insert (global_settings_table, g_strdup (key_value[0]), g_strdup (tmp)); g_strfreev (key_value); g_free (data); @@ -264,8 +264,7 @@ is_function (gchar * line) for (i = 0; func_names[i]; i++) { if (g_str_has_prefix (line, func_names[i])) { - PLUGIN_PRINT (IFNET_PLUGIN_NAME, - "Ignoring function: %s", func_names[i]); + nm_log_info (LOGD_SETTINGS, "Ignoring function: %s", func_names[i]); return TRUE; } } @@ -309,8 +308,7 @@ ifnet_init (gchar * config_file) if (g_file_test (config_file, G_FILE_TEST_IS_REGULAR)) channel = g_io_channel_new_file (config_file, "r", NULL); if (channel == NULL) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, - "Error: Can't open %s\n", config_file); + nm_log_warn (LOGD_SETTINGS, "Can't open %s", config_file); return FALSE; } @@ -439,7 +437,7 @@ ifnet_set_data (const char *conn_name, const char *key, const char *value) gchar * stripped = NULL; if (!conn) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, "%s does not exsit!", conn_name); + nm_log_warn (LOGD_SETTINGS, "%s does not exist!", conn_name); return; } if (value){ @@ -567,13 +565,12 @@ ifnet_flush_to_file (const char *config_file, gchar **out_backup) channel = g_io_channel_new_file (config_file, "w", NULL); if (!channel) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, - "Can't open file %s for writing", config_file); + nm_log_warn (LOGD_SETTINGS, "Can't open file %s for writing", config_file); g_free (backup); return FALSE; } g_hash_table_iter_init (&iter, global_settings_table); - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Writing to %s", config_file); + nm_log_info (LOGD_SETTINGS, "Writing to %s", config_file); g_io_channel_write_chars (channel, "#Generated by NetworkManager\n" "###### Global Configuration ######\n", @@ -589,8 +586,7 @@ ifnet_flush_to_file (const char *config_file, gchar **out_backup) g_free (out_line); } if (error && *error) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, - "Found error: %s", (*error)->message); + nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message); goto done; } @@ -636,8 +632,7 @@ ifnet_flush_to_file (const char *config_file, gchar **out_backup) } } if (error && *error) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, - "Found error: %s", (*error)->message); + nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message); goto done; } @@ -658,16 +653,14 @@ ifnet_flush_to_file (const char *config_file, gchar **out_backup) g_free (out_line); } if (error && *error) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, - "Found error: %s", (*error)->message); + nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message); goto done; } } g_io_channel_flush (channel, error); if (error && *error) { - PLUGIN_WARN (IFNET_PLUGIN_NAME, - "Found error: %s", (*error)->message); + nm_log_warn (LOGD_SETTINGS, "Found error: %s", (*error)->message); goto done; } result = TRUE; @@ -690,7 +683,7 @@ ifnet_delete_network (const char *conn_name) GHashTable *network = NULL; g_return_val_if_fail (conn_table != NULL && conn_name != NULL, FALSE); - PLUGIN_PRINT (IFNET_PLUGIN_NAME, "Deleting network for %s", conn_name); + nm_log_info (LOGD_SETTINGS, "Deleting network for %s", conn_name); network = g_hash_table_lookup (conn_table, conn_name); if (!network) return FALSE; |