summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2021-06-16 09:17:41 +0200
committerThomas Haller <thaller@redhat.com>2021-06-21 17:23:53 +0200
commitb929caa95cfc6f2bcf0dfd22a0743abdbcd9838c (patch)
tree75f81fad4075bcd3859f893d33ac0ea3b1ba77f3
parenta6c9f2518ec16b6e5343d36d57b32a048f65575b (diff)
core: use nm_config_data_get_device_config_int64() for getting integer setting
-rw-r--r--src/core/devices/nm-device.c34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index 269418df40..f43646845a 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -5874,16 +5874,19 @@ sriov_op_queue(NMDevice * self,
static void
device_init_static_sriov_num_vfs(NMDevice *self)
{
- NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
- gs_free char * value = NULL;
- int num_vfs;
+ NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self);
if (priv->ifindex > 0 && nm_device_has_capability(self, NM_DEVICE_CAP_SRIOV)) {
- value = nm_config_data_get_device_config(NM_CONFIG_GET_DATA,
- NM_CONFIG_KEYFILE_KEY_DEVICE_SRIOV_NUM_VFS,
- self,
- NULL);
- num_vfs = _nm_utils_ascii_str_to_int64(value, 10, 0, G_MAXINT32, -1);
+ int num_vfs;
+
+ num_vfs = nm_config_data_get_device_config_int64(NM_CONFIG_GET_DATA,
+ NM_CONFIG_KEYFILE_KEY_DEVICE_SRIOV_NUM_VFS,
+ self,
+ 10,
+ 0,
+ G_MAXINT32,
+ -1,
+ -1);
if (num_vfs >= 0)
sriov_op_queue(self, num_vfs, NM_OPTION_BOOL_DEFAULT, NULL, NULL);
}
@@ -14043,13 +14046,14 @@ nm_device_is_up(NMDevice *self)
static gint64
_get_carrier_wait_ms(NMDevice *self)
{
- gs_free char *value = NULL;
-
- value = nm_config_data_get_device_config(NM_CONFIG_GET_DATA,
- NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT,
- self,
- NULL);
- return _nm_utils_ascii_str_to_int64(value, 10, 0, G_MAXINT32, CARRIER_WAIT_TIME_MS);
+ return nm_config_data_get_device_config_int64(NM_CONFIG_GET_DATA,
+ NM_CONFIG_KEYFILE_KEY_DEVICE_CARRIER_WAIT_TIMEOUT,
+ self,
+ 10,
+ 0,
+ G_MAXINT32,
+ CARRIER_WAIT_TIME_MS,
+ CARRIER_WAIT_TIME_MS);
}
gboolean