From 634dd2f5e865c9ec167e0ca4fb04802e06ebd5d0 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Sat, 21 Oct 2023 22:22:15 +0200 Subject: [PATCH] core: add "reason" argument to NMActiveConnection device_state_changed() NMActiveConnection implements method device_state_changed() that re-emits device state changes as convenience for subclasses. Add the reason for the state change to the handler, as it will be used in the next commit. --- src/core/nm-act-request.c | 3 ++- src/core/nm-active-connection.c | 3 ++- src/core/nm-active-connection.h | 3 ++- src/core/vpn/nm-vpn-connection.c | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/core/nm-act-request.c b/src/core/nm-act-request.c index dce18ba4ec..8fcff63f57 100644 --- a/src/core/nm-act-request.c +++ b/src/core/nm-act-request.c @@ -259,7 +259,8 @@ static void device_state_changed(NMActiveConnection *active, NMDevice *device, NMDeviceState new_state, - NMDeviceState old_state) + NMDeviceState old_state, + NMDeviceStateReason reason) { NMActiveConnectionState cur_ac_state = nm_active_connection_get_state(active); NMActiveConnectionState ac_state = NM_ACTIVE_CONNECTION_STATE_UNKNOWN; diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c index 36a11f7151..5feab966de 100644 --- a/src/core/nm-active-connection.c +++ b/src/core/nm-active-connection.c @@ -636,7 +636,8 @@ device_state_changed(NMDevice *device, NM_ACTIVE_CONNECTION_GET_CLASS(self)->device_state_changed(self, device, new_state, - old_state); + old_state, + reason); } static void diff --git a/src/core/nm-active-connection.h b/src/core/nm-active-connection.h index 15db68c369..8032294f3c 100644 --- a/src/core/nm-active-connection.h +++ b/src/core/nm-active-connection.h @@ -78,7 +78,8 @@ typedef struct { void (*device_state_changed)(NMActiveConnection *connection, NMDevice *device, NMDeviceState new_state, - NMDeviceState old_state); + NMDeviceState old_state, + NMDeviceStateReason reason); void (*master_failed)(NMActiveConnection *connection); void (*device_changed)(NMActiveConnection *connection, diff --git a/src/core/vpn/nm-vpn-connection.c b/src/core/vpn/nm-vpn-connection.c index d7102a12ef..3dba9ff6c8 100644 --- a/src/core/vpn/nm-vpn-connection.c +++ b/src/core/vpn/nm-vpn-connection.c @@ -1143,7 +1143,8 @@ static void device_state_changed(NMActiveConnection *active, NMDevice *device, NMDeviceState new_state, - NMDeviceState old_state) + NMDeviceState old_state, + NMDeviceStateReason reason) { if (_service_and_connection_can_persist(NM_VPN_CONNECTION(active))) { if (new_state <= NM_DEVICE_STATE_DISCONNECTED || new_state == NM_DEVICE_STATE_FAILED) {