core: expose and rename nm_policy_device_recheck_auto_activate_schedule()

Let's simplify this part of the code. This is the first step.
This commit is contained in:
Thomas Haller
2023-04-05 10:57:57 +02:00
parent 49c1e01519
commit f1c15f0ae7
2 changed files with 17 additions and 10 deletions

View File

@@ -136,7 +136,6 @@ _PRIV_TO_SELF(NMPolicyPrivate *priv)
static void update_system_hostname(NMPolicy *self, const char *msg);
static void schedule_activate_all(NMPolicy *self);
static void schedule_activate_check(NMPolicy *self, NMDevice *device);
static NMDevice *get_default_device(NMPolicy *self, int addr_family);
/*****************************************************************************/
@@ -1335,7 +1334,8 @@ pending_ac_state_changed(NMActiveConnection *ac, guint state, guint reason, NMPo
con,
NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED,
TRUE);
schedule_activate_check(self, nm_active_connection_get_device(ac));
nm_policy_device_recheck_auto_activate_schedule(self,
nm_active_connection_get_device(ac));
}
/* Cleanup */
@@ -1444,7 +1444,7 @@ auto_activate_device(NMPolicy *self, NMDevice *device)
best_connection,
NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_FAILED,
TRUE);
schedule_activate_check(self, device);
nm_policy_device_recheck_auto_activate_schedule(self, device);
return;
}
@@ -1669,14 +1669,19 @@ sleeping_changed(NMManager *manager, GParamSpec *pspec, gpointer user_data)
reset_autoconnect_all(self, NULL, FALSE);
}
static void
schedule_activate_check(NMPolicy *self, NMDevice *device)
void
nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device)
{
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
NMPolicyPrivate *priv;
ActivateData *data;
NMActiveConnection *ac;
const CList *tmp_list;
g_return_if_fail(NM_IS_POLICY(self));
g_return_if_fail(NM_IS_DEVICE(device));
priv = NM_POLICY_GET_PRIVATE(self);
if (nm_manager_get_state(priv->manager) == NM_STATE_ASLEEP)
return;
@@ -2138,7 +2143,7 @@ device_state_changed(NMDevice *device,
update_routing_and_dns(self, FALSE, device);
/* Device is now available for auto-activation */
schedule_activate_check(self, device);
nm_policy_device_recheck_auto_activate_schedule(self, device);
break;
case NM_DEVICE_STATE_PREPARE:
@@ -2262,7 +2267,7 @@ device_autoconnect_changed(NMDevice *device, GParamSpec *pspec, gpointer user_da
NMPolicyPrivate *priv = user_data;
NMPolicy *self = _PRIV_TO_SELF(priv);
schedule_activate_check(self, device);
nm_policy_device_recheck_auto_activate_schedule(self, device);
}
static void
@@ -2271,7 +2276,7 @@ device_recheck_auto_activate(NMDevice *device, gpointer user_data)
NMPolicyPrivate *priv = user_data;
NMPolicy *self = _PRIV_TO_SELF(priv);
schedule_activate_check(self, device);
nm_policy_device_recheck_auto_activate_schedule(self, device);
}
static void
@@ -2532,7 +2537,7 @@ schedule_activate_all_cb(gpointer user_data)
priv->schedule_activate_all_id = 0;
nm_manager_for_each_device (priv->manager, device, tmp_lst)
schedule_activate_check(self, device);
nm_policy_device_recheck_auto_activate_schedule(self, device);
return G_SOURCE_REMOVE;
}

View File

@@ -34,6 +34,8 @@ NMActiveConnection *nm_policy_get_activating_ip6_ac(NMPolicy *policy);
void nm_policy_unblock_failed_ovs_interfaces(NMPolicy *self);
void nm_policy_device_recheck_auto_activate_schedule(NMPolicy *self, NMDevice *device);
/**
* NMPolicyHostnameMode
* @NM_POLICY_HOSTNAME_MODE_NONE: never update the transient hostname.