From 280600f0be708c02aab55de720ce017e50264116 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 14 May 2020 09:16:34 +0200 Subject: libnm: remove redundant nm_setting_ethtool_*_coalesce() API Note that nm_setting_ethtool_set_coalesce() used to coerce "coalesce-adaptive-[rt]x" values to 0 or 1. The alternative API doesn't do that. But so does nm_setting_option_set() not tell you whether the value you set is valid. That is not the options of the setters, for that we have verify(). --- libnm-core/nm-setting-ethtool.c | 209 ---------------------------------------- libnm-core/nm-setting-ethtool.h | 34 ------- libnm/libnm.ver | 8 -- 3 files changed, 251 deletions(-) diff --git a/libnm-core/nm-setting-ethtool.c b/libnm-core/nm-setting-ethtool.c index 0057e10e0c..28307e4941 100644 --- a/libnm-core/nm-setting-ethtool.c +++ b/libnm-core/nm-setting-ethtool.c @@ -112,14 +112,6 @@ G_DEFINE_TYPE (NMSettingEthtool, nm_setting_ethtool, NM_TYPE_SETTING) /*****************************************************************************/ -static void -_notify_attributes (NMSettingEthtool *self) -{ - _nm_setting_option_notify (NM_SETTING (self), TRUE); -} - -/*****************************************************************************/ - /** * nm_setting_ethtool_get_feature: * @setting: the #NMSettingEthtool @@ -245,207 +237,6 @@ nm_setting_ethtool_init_features (NMSettingEthtool *setting, return n_req; } -/** - * nm_setting_ethtool_get_coalesce: - * @setting: the #NMSettingEthtool - * @optname: option name of the coalescing setting to get - * @out_value (out) (allow-none): value of the coalescing setting - * - * Gets the value of coalescing setting. - * - * Note that @optname must be a valid name for a setting, according to - * nm_ethtool_optname_is_coalesce(). - * - * - * Returns: %TRUE and places the coalesce setting value in @out_value or %FALSE if unset. - * - * Since: 1.26 - */ -gboolean -nm_setting_ethtool_get_coalesce (NMSettingEthtool *setting, - const char *optname, - guint32 *out_value) -{ - g_return_val_if_fail (NM_IS_SETTING_ETHTOOL (setting), FALSE); - g_return_val_if_fail (nm_ethtool_optname_is_coalesce (optname), FALSE); - - return nm_setting_option_get_uint32 (NM_SETTING (setting), - optname, - out_value); -} - -/** - * nm_setting_ethtool_set_coalesce: - * @setting: the #NMSettingEthtool - * @optname: option name of the coalesce setting - * @value: the new value to set. - * - * Sets a coalesce setting. - * - * Note that @optname must be a valid name for a coalesce setting, according to - * nm_ethtool_optname_is_coalesce(). - * - * Since: 1.26 - */ -void -nm_setting_ethtool_set_coalesce (NMSettingEthtool *setting, - const char *optname, - guint32 value) -{ - NMEthtoolID ethtool_id; - - g_return_if_fail (NM_IS_SETTING_ETHTOOL (setting)); - - ethtool_id = nm_ethtool_id_get_by_name (optname); - - g_return_if_fail (nm_ethtool_id_is_coalesce (ethtool_id)); - - if (NM_IN_SET (ethtool_id, - NM_ETHTOOL_ID_COALESCE_ADAPTIVE_RX, - NM_ETHTOOL_ID_COALESCE_ADAPTIVE_TX)) - value = !!value; - - nm_setting_option_set_uint32 (NM_SETTING (setting), - optname, - value); - _notify_attributes (setting); -} - -/** - * nm_setting_ethtool_clear_coalesce: - * @setting: the #NMSettingEthtool - * @optname: option name of the coalesce setting - * - * Clear a coalesce setting - * - * Since: 1.26 - */ -void -nm_setting_ethtool_clear_coalesce (NMSettingEthtool *setting, - const char *optname) -{ - g_return_if_fail (NM_IS_SETTING_ETHTOOL (setting)); - g_return_if_fail (nm_str_not_empty (optname)); - - if (_nm_setting_option_clear (NM_SETTING (setting), optname)) - _notify_attributes (setting); -} - -/** - * nm_setting_ethtool_clear_coalesce_all: - * @setting: the #NMSettingEthtool - * - * Clears all coalesce settings - * - * Since: 1.26 - */ -void -nm_setting_ethtool_clear_coalesce_all (NMSettingEthtool *setting) -{ - g_return_if_fail (NM_IS_SETTING_ETHTOOL (setting)); - - nm_setting_option_clear_by_name (NM_SETTING (setting), - nm_ethtool_optname_is_coalesce); -} - -/** - * nm_setting_ethtool_get_ring: - * @setting: the #NMSettingEthtool - * @optname: option name of the ring setting to get - * @out_value (out) (allow-none): value of the ring setting - * - * Gets the value of ring setting. - * - * Note that @optname must be a valid name for a setting, according to - * nm_ethtool_optname_is_ring(). - * - * - * Returns: %TRUE and places the ring setting value in @out_value or %FALSE if unset. - * - * Since: 1.26 - */ -gboolean -nm_setting_ethtool_get_ring (NMSettingEthtool *setting, - const char *optname, - guint32 *out_value) -{ - g_return_val_if_fail (NM_IS_SETTING_ETHTOOL (setting), FALSE); - g_return_val_if_fail (nm_ethtool_optname_is_ring (optname), FALSE); - - return nm_setting_option_get_uint32 (NM_SETTING (setting), - optname, - out_value); -} - -/** - * nm_setting_ethtool_set_ring: - * @setting: the #NMSettingEthtool - * @optname: option name of the ring setting - * @value: the new value to set. - * - * Sets a ring setting. - * - * Note that @optname must be a valid name for a ring setting, according to - * nm_ethtool_optname_is_ring(). - * - * Since: 1.26 - */ -void -nm_setting_ethtool_set_ring (NMSettingEthtool *setting, - const char *optname, - guint32 value) -{ - NMEthtoolID ethtool_id; - - g_return_if_fail (NM_IS_SETTING_ETHTOOL (setting)); - - ethtool_id = nm_ethtool_id_get_by_name (optname); - - g_return_if_fail (nm_ethtool_id_is_ring (ethtool_id)); - - nm_setting_option_set_uint32 (NM_SETTING (setting), - optname, - value); - _notify_attributes (setting); -} - -/** - * nm_setting_ethtool_clear_ring: - * @setting: the #NMSettingEthtool - * @optname: option name of the ring setting - * - * Clear a ring setting - * - * Since: 1.26 - */ -void -nm_setting_ethtool_clear_ring (NMSettingEthtool *setting, - const char *optname) -{ - g_return_if_fail (NM_IS_SETTING_ETHTOOL (setting)); - g_return_if_fail (nm_str_not_empty (optname)); - - if (_nm_setting_option_clear (NM_SETTING (setting), optname)) - _notify_attributes (setting); -} - -/** - * nm_setting_ethtool_clear_ring_all: - * @setting: the #NMSettingEthtool - * - * Clears all ring settings - * - * Since: 1.26 - */ -void -nm_setting_ethtool_clear_ring_all (NMSettingEthtool *setting) -{ - g_return_if_fail (NM_IS_SETTING_ETHTOOL (setting)); - - nm_setting_option_clear_by_name (NM_SETTING (setting), - nm_ethtool_optname_is_ring); -} - /*****************************************************************************/ /** diff --git a/libnm-core/nm-setting-ethtool.h b/libnm-core/nm-setting-ethtool.h index 6bb8edc87a..27cb965826 100644 --- a/libnm-core/nm-setting-ethtool.h +++ b/libnm-core/nm-setting-ethtool.h @@ -147,40 +147,6 @@ NM_AVAILABLE_IN_1_14 NM_DEPRECATED_IN_1_26 void nm_setting_ethtool_clear_features (NMSettingEthtool *setting); -NM_AVAILABLE_IN_1_26 -gboolean nm_setting_ethtool_get_coalesce (NMSettingEthtool *setting, - const char *optname, - guint32 *out_value); - -NM_AVAILABLE_IN_1_26 -void nm_setting_ethtool_set_coalesce (NMSettingEthtool *setting, - const char *optname, - guint32 value); - -NM_AVAILABLE_IN_1_26 -void nm_setting_ethtool_clear_coalesce (NMSettingEthtool *setting, - const char *optname); - -NM_AVAILABLE_IN_1_26 -void nm_setting_ethtool_clear_coalesce_all (NMSettingEthtool *setting); - -NM_AVAILABLE_IN_1_26 -gboolean nm_setting_ethtool_get_ring (NMSettingEthtool *setting, - const char *optname, - guint32 *out_value); - -NM_AVAILABLE_IN_1_26 -void nm_setting_ethtool_set_ring (NMSettingEthtool *setting, - const char *optname, - guint32 value); - -NM_AVAILABLE_IN_1_26 -void nm_setting_ethtool_clear_ring (NMSettingEthtool *setting, - const char *optname); - -NM_AVAILABLE_IN_1_26 -void nm_setting_ethtool_clear_ring_all (NMSettingEthtool *setting); - G_END_DECLS #endif /* __NM_SETTING_ETHTOOL_H__ */ diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 030a68c885..dac75f2f91 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1710,14 +1710,6 @@ global: nm_setting_bridge_get_multicast_startup_query_count; nm_setting_bridge_get_multicast_startup_query_interval; nm_setting_connection_get_mud_url; - nm_setting_ethtool_clear_coalesce; - nm_setting_ethtool_clear_coalesce_all; - nm_setting_ethtool_clear_ring; - nm_setting_ethtool_clear_ring_all; - nm_setting_ethtool_get_coalesce; - nm_setting_ethtool_get_ring; - nm_setting_ethtool_set_coalesce; - nm_setting_ethtool_set_ring; nm_setting_match_add_driver; nm_setting_match_add_kernel_command_line; nm_setting_match_clear_drivers; -- cgit v1.2.1