From 8922f9aabe5fa31f9da4e13ac87f63887d79887f Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 3 Mar 2017 12:03:26 +0100 Subject: [PATCH] device: internally export nm_device_hash_check_invalid_keys() --- src/devices/nm-device-private.h | 5 +++++ src/devices/nm-device.c | 32 ++++++++++++++++---------------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h index 2023feb577..a4067f9c26 100644 --- a/src/devices/nm-device-private.h +++ b/src/devices/nm-device-private.h @@ -134,4 +134,9 @@ guint32 nm_device_get_configured_mtu_for_wired (NMDevice *self, gboolean *out_is NM_DEVICE_CLASS (klass)->link_types = link_types; \ } +gboolean _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, + GError **error, const char **argv); +#define nm_device_hash_check_invalid_keys(hash, setting_name, error, ...) \ + _nm_device_hash_check_invalid_keys (hash, setting_name, error, ((const char *[]) { __VA_ARGS__, NULL })) + #endif /* NM_DEVICE_PRIVATE_H */ diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index ef96243b2f..070cc2234c 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -8331,8 +8331,9 @@ _cleanup_ip6_pre (NMDevice *self, CleanupType cleanup_type) addrconf6_cleanup (self); } -static gboolean -_hash_check_invalid_keys_impl (GHashTable *hash, const char *setting_name, GError **error, const char **argv) +gboolean +_nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, + GError **error, const char **argv) { guint found_keys = 0; guint i; @@ -8395,7 +8396,6 @@ _hash_check_invalid_keys_impl (GHashTable *hash, const char *setting_name, GErro return TRUE; } -#define _hash_check_invalid_keys(hash, setting_name, error, ...) _hash_check_invalid_keys_impl (hash, setting_name, error, ((const char *[]) { __VA_ARGS__, NULL })) void nm_device_reactivate_ip4_config (NMDevice *self, @@ -8517,10 +8517,10 @@ reapply_connection (NMDevice *self, /************************************************************************** * check for unsupported changes and reject to reapply *************************************************************************/ - if (!_hash_check_invalid_keys (diffs, NULL, error, - NM_SETTING_IP4_CONFIG_SETTING_NAME, - NM_SETTING_IP6_CONFIG_SETTING_NAME, - NM_SETTING_CONNECTION_SETTING_NAME)) + if (!nm_device_hash_check_invalid_keys (diffs, NULL, error, + NM_SETTING_IP4_CONFIG_SETTING_NAME, + NM_SETTING_IP6_CONFIG_SETTING_NAME, + NM_SETTING_CONNECTION_SETTING_NAME)) return FALSE; /* whitelist allowed properties from "connection" setting which are allowed to differ. @@ -8528,15 +8528,15 @@ reapply_connection (NMDevice *self, * This includes UUID, there is no principal problem with reapplying a connection * and changing it's UUID. In fact, disallowing it makes it cumbersome for the user * to reapply any connection but the original settings-connection. */ - if (!_hash_check_invalid_keys (diffs ? g_hash_table_lookup (diffs, NM_SETTING_CONNECTION_SETTING_NAME) : NULL, - NM_SETTING_CONNECTION_SETTING_NAME, - error, - NM_SETTING_CONNECTION_ID, - NM_SETTING_CONNECTION_UUID, - NM_SETTING_CONNECTION_STABLE_ID, - NM_SETTING_CONNECTION_AUTOCONNECT, - NM_SETTING_CONNECTION_ZONE, - NM_SETTING_CONNECTION_METERED)) + if (!nm_device_hash_check_invalid_keys (diffs ? g_hash_table_lookup (diffs, NM_SETTING_CONNECTION_SETTING_NAME) : NULL, + NM_SETTING_CONNECTION_SETTING_NAME, + error, + NM_SETTING_CONNECTION_ID, + NM_SETTING_CONNECTION_UUID, + NM_SETTING_CONNECTION_STABLE_ID, + NM_SETTING_CONNECTION_AUTOCONNECT, + NM_SETTING_CONNECTION_ZONE, + NM_SETTING_CONNECTION_METERED)) return FALSE; if ( version_id != 0