/************************************************************************/
-#define _NMLOG_DOMAIN LOGD_CORE
#define _NMLOG_PREFIX_NAME "manager"
-#define _NMLOG(level, ...) \
+#define _NMLOG(level, domain, ...) \
G_STMT_START { \
- char __sbuf[32]; \
- const void *const __self = (self); \
+ const NMLogLevel __level = (level); \
+ const NMLogDomain __domain = (domain); \
\
- nm_log ((level), _NMLOG_DOMAIN, \
- "%s%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
- _NMLOG_PREFIX_NAME, \
- (__self && __self != singleton_instance \
- ? (__self ? nm_sprintf_buf (__sbuf, "[%p]", __self) : "[]") \
- : "") \
- _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
+ if (nm_logging_enabled (__level, __domain)) { \
+ const NMManager *const __self = (self); \
+ char __sbuf[32]; \
+ \
+ _nm_log (__level, __domain, 0, \
+ "%s%s: " _NM_UTILS_MACRO_FIRST (__VA_ARGS__), \
+ _NMLOG_PREFIX_NAME, \
+ (__self && __self != singleton_instance) \
+ ? nm_sprintf_buf (__sbuf, "[%p]", __self) \
+ : "" \
+ _NM_UTILS_MACRO_REST (__VA_ARGS__)); \
+ } \
} G_STMT_END
/************************************************************************/
if ( connection
&& nm_settings_has_connection (priv->settings, connection)) {
- nm_log_dbg (LOGD_DEVICE, "Assumed connection disconnected. Deleting generated connection '%s' (%s)",
- nm_settings_connection_get_id (connection), nm_settings_connection_get_uuid (connection));
+ _LOGD (LOGD_DEVICE, "assumed connection disconnected. Deleting generated connection '%s' (%s)",
+ nm_settings_connection_get_id (connection), nm_settings_connection_get_uuid (connection));
nm_settings_connection_delete (NM_SETTINGS_CONNECTION (connection), NULL, NULL);
g_object_unref (connection);
}
}
static void
-set_state (NMManager *manager, NMState state)
+set_state (NMManager *self, NMState state)
{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
if (priv->state == state)
return;
priv->state = state;
- nm_log_info (LOGD_CORE, "NetworkManager state is now %s", _nm_state_to_string (state));
+ _LOGI (LOGD_CORE, "NetworkManager state is now %s", _nm_state_to_string (state));
- g_object_notify (G_OBJECT (manager), NM_MANAGER_STATE);
- g_signal_emit (manager, signals[STATE_CHANGED], 0, priv->state);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_STATE);
+ g_signal_emit (self, signals[STATE_CHANGED], 0, priv->state);
}
static void
}
static void
-nm_manager_update_metered (NMManager *manager)
+nm_manager_update_metered (NMManager *self)
{
NMManagerPrivate *priv;
NMDevice *device;
NMMetered value = NM_METERED_UNKNOWN;
- g_return_if_fail (NM_IS_MANAGER (manager));
- priv = NM_MANAGER_GET_PRIVATE (manager);
+ g_return_if_fail (NM_IS_MANAGER (self));
+ priv = NM_MANAGER_GET_PRIVATE (self);
if (priv->primary_connection) {
device = nm_active_connection_get_device (priv->primary_connection);
if (value != priv->metered) {
priv->metered = value;
- nm_log_dbg (LOGD_CORE, "New manager metered value: %d",
- (int) priv->metered);
- g_object_notify (G_OBJECT (manager), NM_MANAGER_METERED);
+ _LOGD (LOGD_CORE, "new metered value: %d", (int) priv->metered);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_METERED);
}
}
return;
if (!nm_settings_get_startup_complete (priv->settings)) {
- nm_log_dbg (LOGD_CORE, "check_if_startup_complete returns FALSE because of NMSettings");
+ _LOGD (LOGD_CORE, "check_if_startup_complete returns FALSE because of NMSettings");
return;
}
NMDevice *dev = iter->data;
if (nm_device_has_pending_action (dev)) {
- nm_log_dbg (LOGD_CORE, "check_if_startup_complete returns FALSE because of %s",
- nm_device_get_iface (dev));
+ _LOGD (LOGD_CORE, "check_if_startup_complete returns FALSE because of %s",
+ nm_device_get_iface (dev));
return;
}
}
- nm_log_info (LOGD_CORE, "startup complete");
+ _LOGI (LOGD_CORE, "startup complete");
priv->startup = FALSE;
g_object_notify (G_OBJECT (self), "startup");
}
static void
-remove_device (NMManager *manager,
+remove_device (NMManager *self,
NMDevice *device,
gboolean quitting,
gboolean allow_unmanage)
{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
- nm_log_dbg (LOGD_DEVICE, "(%s): removing device (allow_unmanage %d, managed %d)",
- nm_device_get_iface (device), allow_unmanage, nm_device_get_managed (device, FALSE));
+ _LOGD (LOGD_DEVICE, "(%s): removing device (allow_unmanage %d, managed %d)",
+ nm_device_get_iface (device), allow_unmanage, nm_device_get_managed (device, FALSE));
if (allow_unmanage && nm_device_get_managed (device, FALSE)) {
NMActRequest *req = nm_device_get_act_request (device);
}
}
- g_signal_handlers_disconnect_matched (device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, manager);
+ g_signal_handlers_disconnect_matched (device, G_SIGNAL_MATCH_DATA, 0, 0, NULL, NULL, self);
nm_settings_device_removed (priv->settings, device, quitting);
priv->devices = g_slist_remove (priv->devices, device);
if (nm_device_is_real (device)) {
- g_signal_emit (manager, signals[DEVICE_REMOVED], 0, device);
- g_object_notify (G_OBJECT (manager), NM_MANAGER_DEVICES);
+ g_signal_emit (self, signals[DEVICE_REMOVED], 0, device);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_DEVICES);
nm_device_removed (device);
}
- g_signal_emit (manager, signals[INTERNAL_DEVICE_REMOVED], 0, device);
- g_object_notify (G_OBJECT (manager), NM_MANAGER_ALL_DEVICES);
+ g_signal_emit (self, signals[INTERNAL_DEVICE_REMOVED], 0, device);
+ g_object_notify (G_OBJECT (self), NM_MANAGER_ALL_DEVICES);
nm_exported_object_clear_and_unexport (&device);
- check_if_startup_complete (manager);
+ check_if_startup_complete (self);
}
static void
iface = nm_manager_get_connection_iface (self, connection, &parent, &error);
if (!iface) {
- nm_log_warn (LOGD_DEVICE, "(%s) can't get a name of a virtual device: %s",
- nm_connection_get_id (connection), error->message);
+ _LOGW (LOGD_DEVICE, "(%s) can't get a name of a virtual device: %s",
+ nm_connection_get_id (connection), error->message);
g_error_free (error);
return NULL;
}
if (nm_device_check_connection_compatible (candidate, connection)) {
if (nm_device_is_real (candidate)) {
- nm_log_dbg (LOGD_DEVICE, "(%s) already created virtual interface name %s",
- nm_connection_get_id (connection), iface);
+ _LOGD (LOGD_DEVICE, "(%s) already created virtual interface name %s",
+ nm_connection_get_id (connection), iface);
return NULL;
}
factory = nm_device_factory_manager_find_factory_for_connection (connection);
if (!factory) {
- nm_log_err (LOGD_DEVICE, "(%s:%s) NetworkManager plugin for '%s' unavailable",
- nm_connection_get_id (connection), iface,
- nm_connection_get_connection_type (connection));
+ _LOGE (LOGD_DEVICE, "(%s:%s) NetworkManager plugin for '%s' unavailable",
+ nm_connection_get_id (connection), iface,
+ nm_connection_get_connection_type (connection));
return NULL;
}
device = nm_device_factory_create_device (factory, iface, NULL, connection, NULL, &error);
if (!device) {
- nm_log_warn (LOGD_DEVICE, "(%s) factory can't create the device: %s",
- nm_connection_get_id (connection), error->message);
+ _LOGW (LOGD_DEVICE, "(%s) factory can't create the device: %s",
+ nm_connection_get_id (connection), error->message);
g_error_free (error);
return NULL;
}
if (!add_device (self, device, &error)) {
- nm_log_warn (LOGD_DEVICE, "(%s) can't register the device with manager: %s",
- nm_connection_get_id (connection), error->message);
+ _LOGW (LOGD_DEVICE, "(%s) can't register the device with manager: %s",
+ nm_connection_get_id (connection), error->message);
g_error_free (error);
g_object_unref (device);
return NULL;
/* Create any backing resources the device needs */
if (!nm_device_create_and_realize (device, connection, parent, &error)) {
- nm_log_warn (LOGD_DEVICE, "(%s) couldn't create the device: %s",
- nm_connection_get_id (connection), error->message);
+ _LOGW (LOGD_DEVICE, "(%s) couldn't create the device: %s",
+ nm_connection_get_id (connection), error->message);
g_error_free (error);
remove_device (self, device, FALSE, TRUE);
return NULL;
NMDevice *device = NM_DEVICE (iter->data);
if (nm_device_get_rfkill_type (device) == rstate->rtype) {
- nm_log_dbg (LOGD_RFKILL, "(%s): setting radio %s",
- nm_device_get_iface (device),
- enabled ? "enabled" : "disabled");
+ _LOGD (LOGD_RFKILL, "(%s): setting radio %s",
+ nm_device_get_iface (device),
+ enabled ? "enabled" : "disabled");
nm_device_set_enabled (device, enabled);
}
}
/* Print out all states affecting device enablement */
if (rstate->desc) {
- nm_log_dbg (LOGD_RFKILL, "%s hw-enabled %d sw-enabled %d",
- rstate->desc, rstate->hw_enabled, rstate->sw_enabled);
+ _LOGD (LOGD_RFKILL, "%s hw-enabled %d sw-enabled %d",
+ rstate->desc, rstate->hw_enabled, rstate->sw_enabled);
}
/* Log new killswitch state */
new_rfkilled = rstate->hw_enabled && rstate->sw_enabled;
if (old_rfkilled != new_rfkilled) {
- nm_log_info (LOGD_RFKILL, "%s now %s by radio killswitch",
- rstate->desc,
- new_rfkilled ? "enabled" : "disabled");
+ _LOGI (LOGD_RFKILL, "%s now %s by radio killswitch",
+ rstate->desc,
+ new_rfkilled ? "enabled" : "disabled");
}
/* Send out property changed signal for HW enabled */
if (auth_error) {
/* translate the auth error into a manager permission denied error */
- nm_log_dbg (LOGD_CORE, "%s request failed: %s", permission, auth_error->message);
+ _LOGD (LOGD_CORE, "%s request failed: %s", permission, auth_error->message);
error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"%s request failed: %s",
permission, auth_error->message);
} else if (result != NM_AUTH_CALL_RESULT_YES) {
- nm_log_dbg (LOGD_CORE, "%s request failed: not authorized", permission);
+ _LOGD (LOGD_CORE, "%s request failed: not authorized", permission);
error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"%s request failed: not authorized",
* the device does not support assuming existing connections.
*/
static NMSettingsConnection *
-get_existing_connection (NMManager *manager, NMDevice *device, gboolean *out_generated)
+get_existing_connection (NMManager *self, NMDevice *device, gboolean *out_generated)
{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
- gs_free_slist GSList *connections = nm_manager_get_activatable_connections (manager);
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
+ gs_free_slist GSList *connections = nm_manager_get_activatable_connections (self);
NMConnection *connection = NULL;
NMSettingsConnection *matched;
NMSettingsConnection *added = NULL;
int master_ifindex = nm_platform_link_get_master (NM_PLATFORM_GET, ifindex);
if (master_ifindex) {
- master = nm_manager_get_device_by_ifindex (manager, master_ifindex);
+ master = nm_manager_get_device_by_ifindex (self, master_ifindex);
if (!master) {
- nm_log_dbg (LOGD_DEVICE, "(%s): cannot generate connection for slave before its master (%s/%d)",
- nm_device_get_iface (device), nm_platform_link_get_name (NM_PLATFORM_GET, master_ifindex), master_ifindex);
+ _LOGD (LOGD_DEVICE, "(%s): cannot generate connection for slave before its master (%s/%d)",
+ nm_device_get_iface (device), nm_platform_link_get_name (NM_PLATFORM_GET, master_ifindex), master_ifindex);
return NULL;
}
if (!nm_device_get_act_request (master)) {
- nm_log_dbg (LOGD_DEVICE, "(%s): cannot generate connection for slave before master %s activates",
- nm_device_get_iface (device), nm_device_get_iface (master));
+ _LOGD (LOGD_DEVICE, "(%s): cannot generate connection for slave before master %s activates",
+ nm_device_get_iface (device), nm_device_get_iface (master));
return NULL;
}
}
match_connection_filter,
device));
if (matched) {
- nm_log_info (LOGD_DEVICE, "(%s): found matching connection '%s'",
- nm_device_get_iface (device),
- nm_settings_connection_get_id (matched));
+ _LOGI (LOGD_DEVICE, "(%s): found matching connection '%s'",
+ nm_device_get_iface (device),
+ nm_settings_connection_get_id (matched));
g_object_unref (connection);
return matched;
}
- nm_log_dbg (LOGD_DEVICE, "(%s): generated connection '%s'",
- nm_device_get_iface (device),
- nm_connection_get_id (connection));
+ _LOGD (LOGD_DEVICE, "(%s): generated connection '%s'",
+ nm_device_get_iface (device),
+ nm_connection_get_id (connection));
added = nm_settings_add_connection (priv->settings, connection, FALSE, &error);
if (added) {
if (out_generated)
*out_generated = TRUE;
} else {
- nm_log_warn (LOGD_SETTINGS, "(%s) Couldn't save generated connection '%s': %s",
- nm_device_get_iface (device),
- nm_connection_get_id (connection),
- (error && error->message) ? error->message : "(unknown)");
+ _LOGW (LOGD_SETTINGS, "(%s) Couldn't save generated connection '%s': %s",
+ nm_device_get_iface (device),
+ nm_connection_get_id (connection),
+ (error && error->message) ? error->message : "(unknown)");
g_clear_error (&error);
}
g_object_unref (connection);
NMAuthSubject *subject;
GError *error = NULL;
- nm_log_dbg (LOGD_DEVICE, "(%s): will attempt to assume connection",
- nm_device_get_iface (device));
+ _LOGD (LOGD_DEVICE, "(%s): will attempt to assume connection",
+ nm_device_get_iface (device));
/* Move device to DISCONNECTED to activate the connection */
if (nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE) {
g_object_unref (subject);
if (!active) {
- nm_log_warn (LOGD_DEVICE, "assumed connection %s failed to activate: (%d) %s",
- nm_connection_get_path (NM_CONNECTION (connection)),
- error ? error->code : -1,
- error && error->message ? error->message : "(unknown)");
+ _LOGW (LOGD_DEVICE, "assumed connection %s failed to activate: (%d) %s",
+ nm_connection_get_path (NM_CONNECTION (connection)),
+ error ? error->code : -1,
+ error && error->message ? error->message : "(unknown)");
g_error_free (error);
return FALSE;
}
connection = get_existing_connection (self, device, &generated);
if (!connection) {
- nm_log_dbg (LOGD_DEVICE, "(%s): can't assume; no connection",
- nm_device_get_iface (device));
+ _LOGD (LOGD_DEVICE, "(%s): can't assume; no connection",
+ nm_device_get_iface (device));
return FALSE;
}
}
if (generated) {
- nm_log_dbg (LOGD_DEVICE, "(%s): connection assumption failed. Deleting generated connection",
- nm_device_get_iface (device));
+ _LOGD (LOGD_DEVICE, "(%s): connection assumption failed. Deleting generated connection",
+ nm_device_get_iface (device));
nm_settings_connection_delete (connection, NULL, NULL);
}
manager_sleeping (self));
dbus_path = nm_exported_object_export (NM_EXPORTED_OBJECT (device));
- nm_log_info (LOGD_DEVICE, "(%s): new %s device (%s)", iface, type_desc, dbus_path);
+ _LOGI (LOGD_DEVICE, "(%s): new %s device (%s)", iface, type_desc, dbus_path);
nm_settings_device_added (priv->settings, device);
g_signal_emit (self, signals[INTERNAL_DEVICE_ADDED], 0, device);
add_device (self, device, NULL);
_device_realize_finish (self, device, NULL);
} else {
- nm_log_warn (LOGD_DEVICE, "(%s): failed to realize device: %s",
- nm_device_get_iface (device), error->message);
+ _LOGW (LOGD_DEVICE, "(%s): failed to realize device: %s",
+ nm_device_get_iface (device), error->message);
g_error_free (error);
}
}
return;
}
- nm_log_dbg (LOGD_DEVICE, "(%s): failed to realize from plink: '%s'",
- plink->name, error->message);
+ _LOGD (LOGD_DEVICE, "(%s): failed to realize from plink: '%s'",
+ plink->name, error->message);
g_clear_error (&error);
/* Try next unrealized device */
device = nm_device_factory_create_device (factory, plink->name, plink, NULL, &ignore, &error);
if (!device) {
if (!ignore) {
- nm_log_warn (LOGD_HW, "%s: factory failed to create device: %s",
- plink->name, error->message);
+ _LOGW (LOGD_HW, "%s: factory failed to create device: %s",
+ plink->name, error->message);
g_clear_error (&error);
}
return;
case NM_LINK_TYPE_OLPC_MESH:
case NM_LINK_TYPE_TEAM:
case NM_LINK_TYPE_WIFI:
- nm_log_info (LOGD_HW, "(%s): '%s' plugin not available; creating generic device",
- plink->name, nm_link_type_to_string (plink->type));
+ _LOGI (LOGD_HW, "(%s): '%s' plugin not available; creating generic device",
+ plink->name, nm_link_type_to_string (plink->type));
nm_plugin_missing = TRUE;
/* fall through */
default:
add_device (self, device, NULL);
_device_realize_finish (self, device, plink);
} else {
- nm_log_warn (LOGD_DEVICE, "%s: failed to realize device: %s",
- plink->name, error->message);
+ _LOGW (LOGD_DEVICE, "%s: failed to realize device: %s",
+ plink->name, error->message);
g_clear_error (&error);
}
g_object_unref (device);
if (nm_device_is_software (device)) {
/* Our software devices stick around until their connection is removed */
if (!nm_device_unrealize (device, FALSE, &error)) {
- nm_log_warn (LOGD_DEVICE, "(%s): failed to unrealize: %s",
- nm_device_get_iface (device),
- error->message);
+ _LOGW (LOGD_DEVICE, "(%s): failed to unrealize: %s",
+ nm_device_get_iface (device),
+ error->message);
g_clear_error (&error);
remove_device (self, device, FALSE, TRUE);
}
}
static gboolean
-autoconnect_slaves (NMManager *manager,
+autoconnect_slaves (NMManager *self,
NMSettingsConnection *master_connection,
NMDevice *master_device,
NMAuthSubject *subject)
if (should_connect_slaves (NM_CONNECTION (master_connection), master_device)) {
GSList *slaves, *iter;
- iter = slaves = find_slaves (manager, master_connection, master_device);
+ iter = slaves = find_slaves (self, master_connection, master_device);
ret = slaves != NULL;
while (iter) {
NMSettingsConnection *slave_connection = iter->data;
iter = iter->next;
- nm_log_dbg (LOGD_CORE, "will activate slave connection '%s' (%s) as a dependency for master '%s' (%s)",
- nm_settings_connection_get_id (slave_connection),
- nm_settings_connection_get_uuid (slave_connection),
- nm_settings_connection_get_id (master_connection),
- nm_settings_connection_get_uuid (master_connection));
+ _LOGD (LOGD_CORE, "will activate slave connection '%s' (%s) as a dependency for master '%s' (%s)",
+ nm_settings_connection_get_id (slave_connection),
+ nm_settings_connection_get_uuid (slave_connection),
+ nm_settings_connection_get_id (master_connection),
+ nm_settings_connection_get_uuid (master_connection));
/* Schedule slave activation */
- nm_manager_activate_connection (manager,
+ nm_manager_activate_connection (self,
slave_connection,
NULL,
- nm_manager_get_best_device_for_connection (manager, NM_CONNECTION (slave_connection), FALSE),
+ nm_manager_get_best_device_for_connection (self, NM_CONNECTION (slave_connection), FALSE),
subject,
&local_err);
if (local_err) {
- nm_log_warn (LOGD_CORE, "Slave connection activation failed: %s", local_err->message);
+ _LOGW (LOGD_CORE, "Slave connection activation failed: %s", local_err->message);
g_error_free (local_err);
}
}
*/
if (master_connection || master_device) {
if (master_connection) {
- nm_log_dbg (LOGD_CORE, "Activation of '%s' requires master connection '%s'",
- nm_settings_connection_get_id (connection),
- nm_settings_connection_get_id (master_connection));
+ _LOGD (LOGD_CORE, "Activation of '%s' requires master connection '%s'",
+ nm_settings_connection_get_id (connection),
+ nm_settings_connection_get_id (master_connection));
}
if (master_device) {
- nm_log_dbg (LOGD_CORE, "Activation of '%s' requires master device '%s'",
- nm_settings_connection_get_id (connection),
- nm_device_get_ip_iface (master_device));
+ _LOGD (LOGD_CORE, "Activation of '%s' requires master device '%s'",
+ nm_settings_connection_get_id (connection),
+ nm_device_get_ip_iface (master_device));
}
/* Ensure eg bond slave and the candidate master is a bond master */
}
nm_active_connection_set_master (active, master_ac);
- nm_log_dbg (LOGD_CORE, "Activation of '%s' depends on active connection %p %s",
- nm_settings_connection_get_id (connection),
- master_ac,
- str_if_set (nm_exported_object_get_path (NM_EXPORTED_OBJECT (master_ac)), ""));
+ _LOGD (LOGD_CORE, "Activation of '%s' depends on active connection %p %s",
+ nm_settings_connection_get_id (connection),
+ master_ac,
+ str_if_set (nm_exported_object_get_path (NM_EXPORTED_OBJECT (master_ac)), ""));
}
/* Check slaves for master connection and possibly activate them */
NMActiveConnection *active,
const char *error_desc)
{
- nm_log_dbg (LOGD_CORE, "Failed to activate '%s': %s",
- nm_active_connection_get_settings_connection_id (active),
- error_desc);
+ _LOGD (LOGD_CORE, "Failed to activate '%s': %s",
+ nm_active_connection_get_settings_connection_id (active),
+ error_desc);
if (nm_active_connection_get_state (active) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
nm_active_connection_set_state (active, NM_ACTIVE_CONNECTION_STATE_DEACTIVATING);
active = active_connection_get_by_path (self, path);
if (auth_error) {
- nm_log_dbg (LOGD_CORE, "Disconnect request failed: %s", auth_error->message);
+ _LOGD (LOGD_CORE, "Disconnect request failed: %s", auth_error->message);
error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Deactivate request failed: %s",
waking_from_suspend = sleeping_changed && !priv->sleeping;
if (manager_sleeping (self)) {
- nm_log_info (LOGD_SUSPEND, "%s...", suspending ? "sleeping" : "disabling");
+ _LOGI (LOGD_SUSPEND, "%s...", suspending ? "sleeping" : "disabling");
/* FIXME: are there still hardware devices that need to be disabled around
* suspend/resume?
nm_device_set_unmanaged_by_flags (device, NM_UNMANAGED_SLEEPING, TRUE, NM_DEVICE_STATE_REASON_SLEEPING);
}
} else {
- nm_log_info (LOGD_SUSPEND, "%s...", waking_from_suspend ? "waking up" : "re-enabling");
+ _LOGI (LOGD_SUSPEND, "%s...", waking_from_suspend ? "waking up" : "re-enabling");
if (waking_from_suspend) {
/* Belatedly take down Wake-on-LAN devices; ideally we wouldn't have to do this
gboolean enabled = radio_enabled_for_rstate (rstate, TRUE);
if (rstate->desc) {
- nm_log_dbg (LOGD_RFKILL, "%s %s devices (hw_enabled %d, sw_enabled %d, user_enabled %d)",
- enabled ? "enabling" : "disabling",
- rstate->desc, rstate->hw_enabled, rstate->sw_enabled, rstate->user_enabled);
+ _LOGD (LOGD_RFKILL, "%s %s devices (hw_enabled %d, sw_enabled %d, user_enabled %d)",
+ enabled ? "enabling" : "disabling",
+ rstate->desc, rstate->hw_enabled, rstate->sw_enabled, rstate->user_enabled);
}
if (nm_device_get_rfkill_type (device) == rstate->rtype)
if (priv->sleeping == do_sleep)
return;
- nm_log_info (LOGD_SUSPEND, "%s requested (sleeping: %s enabled: %s)",
- do_sleep ? "sleep" : "wake",
- priv->sleeping ? "yes" : "no",
- priv->net_enabled ? "yes" : "no");
+ _LOGI (LOGD_SUSPEND, "%s requested (sleeping: %s enabled: %s)",
+ do_sleep ? "sleep" : "wake",
+ priv->sleeping ? "yes" : "no",
+ priv->net_enabled ? "yes" : "no");
priv->sleeping = do_sleep;
result = nm_auth_chain_get_result (chain, NM_AUTH_PERMISSION_SLEEP_WAKE);
if (error) {
- nm_log_dbg (LOGD_SUSPEND, "Sleep/wake request failed: %s", error->message);
+ _LOGD (LOGD_SUSPEND, "Sleep/wake request failed: %s", error->message);
ret_error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Sleep/wake request failed: %s",
G_TYPE_BOOLEAN, (gpointer) &enable,
&err)) {
/* Not a hard error */
- nm_log_warn (LOGD_SUSPEND, "writing to state file %s failed: (%d) %s.",
- priv->state_file,
- err ? err->code : -1,
- (err && err->message) ? err->message : "unknown");
+ _LOGW (LOGD_SUSPEND, "writing to state file %s failed: (%d) %s.",
+ priv->state_file,
+ err ? err->code : -1,
+ (err && err->message) ? err->message : "unknown");
}
}
- nm_log_info (LOGD_SUSPEND, "%s requested (sleeping: %s enabled: %s)",
- enable ? "enable" : "disable",
- priv->sleeping ? "yes" : "no",
- priv->net_enabled ? "yes" : "no");
+ _LOGI (LOGD_SUSPEND, "%s requested (sleeping: %s enabled: %s)",
+ enable ? "enable" : "disable",
+ priv->sleeping ? "yes" : "no",
+ priv->net_enabled ? "yes" : "no");
priv->net_enabled = enable;
result = nm_auth_chain_get_result (chain, NM_AUTH_PERMISSION_ENABLE_DISABLE_NETWORK);
if (error) {
- nm_log_dbg (LOGD_CORE, "Enable request failed: %s", error->message);
+ _LOGD (LOGD_CORE, "Enable request failed: %s", error->message);
ret_error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Enable request failed: %s",
priv->auth_chains = g_slist_remove (priv->auth_chains, chain);
if (error) {
- nm_log_dbg (LOGD_CORE, "Permissions request failed: %s", error->message);
+ _LOGD (LOGD_CORE, "Permissions request failed: %s", error->message);
ret_error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Permissions request failed: %s",
}
if (nm_logging_setup (level, domains, NULL, &error)) {
- nm_log_info (LOGD_CORE, "logging: level '%s' domains '%s'",
- nm_logging_level_to_string (), nm_logging_domains_to_string ());
+ _LOGI (LOGD_CORE, "logging: level '%s' domains '%s'",
+ nm_logging_level_to_string (), nm_logging_domains_to_string ());
}
done:
result = nm_auth_chain_get_result (chain, NM_AUTH_PERMISSION_NETWORK_CONTROL);
if (auth_error) {
- nm_log_dbg (LOGD_CORE, "CheckConnectivity request failed: %s", auth_error->message);
+ _LOGD (LOGD_CORE, "CheckConnectivity request failed: %s", auth_error->message);
error = g_error_new (NM_MANAGER_ERROR,
NM_MANAGER_ERROR_PERMISSION_DENIED,
"Connectivity check request failed: %s",
update_rstate_from_rfkill (priv->rfkill_mgr, rstate);
if (rstate->desc) {
- nm_log_info (LOGD_RFKILL, "%s %s by radio killswitch; %s by state file",
- rstate->desc,
- (rstate->hw_enabled && rstate->sw_enabled) ? "enabled" : "disabled",
- rstate->user_enabled ? "enabled" : "disabled");
+ _LOGI (LOGD_RFKILL, "%s %s by radio killswitch; %s by state file",
+ rstate->desc,
+ (rstate->hw_enabled && rstate->sw_enabled) ? "enabled" : "disabled",
+ rstate->user_enabled ? "enabled" : "disabled");
}
enabled = radio_enabled_for_rstate (rstate, TRUE);
manager_update_radio_enabled (self, rstate, enabled);
}
/* Log overall networking status - enabled/disabled */
- nm_log_info (LOGD_CORE, "Networking is %s by state file",
- priv->net_enabled ? "enabled" : "disabled");
+ _LOGI (LOGD_CORE, "Networking is %s by state file",
+ priv->net_enabled ? "enabled" : "disabled");
system_unmanaged_devices_changed_cb (priv->settings, NULL, self);
system_hostname_changed_cb (priv->settings, NULL, self);
/* Connections added before the manager is started do not emit
* connection-added signals thus devices have to be created manually.
*/
- nm_log_dbg (LOGD_CORE, "creating virtual devices...");
+ _LOGD (LOGD_CORE, "creating virtual devices...");
connections = nm_settings_get_connections (priv->settings);
for (iter = connections; iter; iter = iter->next)
connection_changed (priv->settings, NM_CONNECTION (iter->data), self);
if ( nm_device_get_firmware_missing (candidate)
&& (state == NM_DEVICE_STATE_UNAVAILABLE)) {
- nm_log_info (LOGD_CORE, "(%s): firmware may now be available",
- nm_device_get_iface (candidate));
+ _LOGI (LOGD_CORE, "(%s): firmware may now be available",
+ nm_device_get_iface (candidate));
/* Re-set unavailable state to try bringing the device up again */
nm_device_state_changed (candidate,
{
NMManager *self = NM_MANAGER (user_data);
- nm_log_dbg (LOGD_CORE, "connectivity checking indicates %s",
- nm_connectivity_state_to_string (nm_connectivity_get_state (connectivity)));
+ _LOGD (LOGD_CORE, "connectivity checking indicates %s",
+ nm_connectivity_state_to_string (nm_connectivity_get_state (connectivity)));
nm_manager_update_state (self);
g_object_notify (G_OBJECT (self), NM_MANAGER_CONNECTIVITY);
case G_FILE_MONITOR_EVENT_CHANGES_DONE_HINT:
if (!priv->fw_changed_id) {
priv->fw_changed_id = g_timeout_add_seconds (4, handle_firmware_changed, self);
- nm_log_info (LOGD_CORE, "kernel firmware directory '%s' changed",
- KERNEL_FIRMWARE_DIR);
+ _LOGI (LOGD_CORE, "kernel firmware directory '%s' changed",
+ KERNEL_FIRMWARE_DIR);
}
break;
default:
g_signal_connect (priv->primary_connection, NM_ACTIVE_CONNECTION_DEVICE_METERED_CHANGED,
G_CALLBACK (connection_metered_changed), self);
}
- nm_log_dbg (LOGD_CORE, "PrimaryConnection now %s", ac ? nm_active_connection_get_settings_connection_id (ac) : "(none)");
+ _LOGD (LOGD_CORE, "PrimaryConnection now %s", ac ? nm_active_connection_get_settings_connection_id (ac) : "(none)");
g_object_notify (G_OBJECT (self), NM_MANAGER_PRIMARY_CONNECTION);
g_object_notify (G_OBJECT (self), NM_MANAGER_PRIMARY_CONNECTION_TYPE);
nm_manager_update_metered (self);
if (ac != priv->activating_connection) {
g_clear_object (&priv->activating_connection);
priv->activating_connection = ac ? g_object_ref (ac) : NULL;
- nm_log_dbg (LOGD_CORE, "ActivatingConnection now %s", ac ? nm_active_connection_get_settings_connection_id (ac) : "(none)");
+ _LOGD (LOGD_CORE, "ActivatingConnection now %s", ac ? nm_active_connection_get_settings_connection_id (ac) : "(none)");
g_object_notify (G_OBJECT (self), NM_MANAGER_ACTIVATING_CONNECTION);
}
}
return;
if (rstate->desc) {
- nm_log_dbg (LOGD_RFKILL, "(%s): setting radio %s by user",
- rstate->desc,
- enabled ? "enabled" : "disabled");
+ _LOGD (LOGD_RFKILL, "(%s): setting radio %s by user",
+ rstate->desc,
+ enabled ? "enabled" : "disabled");
}
/* Update enabled key in state file */
"main", rstate->key,
G_TYPE_BOOLEAN, (gpointer) &enabled,
&error)) {
- nm_log_warn (LOGD_CORE, "writing to state file %s failed: (%d) %s.",
- priv->state_file,
- error ? error->code : -1,
- (error && error->message) ? error->message : "unknown");
+ _LOGW (LOGD_CORE, "writing to state file %s failed: (%d) %s.",
+ priv->state_file,
+ error ? error->code : -1,
+ (error && error->message) ? error->message : "unknown");
g_clear_error (&error);
}
}
singleton_instance = self;
nm_singleton_instance_register ();
- nm_log_dbg (LOGD_CORE, "setup %s singleton (%p)", "NMManager", singleton_instance);
+ _LOGD (LOGD_CORE, "setup %s singleton (%p)", "NMManager", singleton_instance);
nm_exported_object_export ((NMExportedObject *) self);
}
static void
-nm_manager_init (NMManager *manager)
+nm_manager_init (NMManager *self)
{
- NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
+ NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (self);
guint i;
GFile *file;
g_signal_connect (priv->dbus_mgr,
NM_BUS_MANAGER_DBUS_CONNECTION_CHANGED,
G_CALLBACK (dbus_connection_changed_cb),
- manager);
+ self);
/* sleep/wake handling */
priv->sleep_monitor = g_object_ref (nm_sleep_monitor_get ());
g_signal_connect (priv->sleep_monitor, NM_SLEEP_MONITOR_SLEEPING,
- G_CALLBACK (sleeping_cb), manager);
+ G_CALLBACK (sleeping_cb), self);
g_signal_connect (priv->sleep_monitor, NM_SLEEP_MONITOR_RESUMING,
- G_CALLBACK (resuming_cb), manager);
+ G_CALLBACK (resuming_cb), self);
/* Listen for authorization changes */
g_signal_connect (nm_auth_manager_get (),
NM_AUTH_MANAGER_SIGNAL_CHANGED,
G_CALLBACK (authority_changed_cb),
- manager);
+ self);
/* Monitor the firmware directory */
if (priv->fw_monitor) {
g_signal_connect (priv->fw_monitor, "changed",
G_CALLBACK (firmware_dir_changed),
- manager);
- nm_log_info (LOGD_CORE, "monitoring kernel firmware directory '%s'.",
+ self);
+ _LOGI (LOGD_CORE, "monitoring kernel firmware directory '%s'.",
KERNEL_FIRMWARE_DIR);
} else {
- nm_log_warn (LOGD_CORE, "failed to monitor kernel firmware directory '%s'.",
- KERNEL_FIRMWARE_DIR);
+ _LOGW (LOGD_CORE, "failed to monitor kernel firmware directory '%s'.",
+ KERNEL_FIRMWARE_DIR);
}
/* Update timestamps in active connections */
- priv->timestamp_update_id = g_timeout_add_seconds (300, (GSourceFunc) periodic_update_active_connection_timestamps, manager);
+ priv->timestamp_update_id = g_timeout_add_seconds (300, (GSourceFunc) periodic_update_active_connection_timestamps, self);
priv->metered = NM_METERED_UNKNOWN;
}
nm_global_dns_config_free (dns_config);
if (error) {
- nm_log_dbg (LOGD_CORE, "set global DNS failed with error: %s", error->message);
+ _LOGD (LOGD_CORE, "set global DNS failed with error: %s", error->message);
g_error_free (error);
}
break;