mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 08:58:03 +02:00
core: add nm_config_data_get_device_config() helper to lookup by match-data
(cherry picked from commit 97d6b7e92a)
This commit is contained in:
parent
af41e2a41b
commit
91c23e2a3d
2 changed files with 35 additions and 6 deletions
|
|
@ -1546,11 +1546,12 @@ out:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
static const char *
|
||||||
nm_config_data_get_device_config_by_device(const NMConfigData *self,
|
_config_data_get_device_config(const NMConfigData *self,
|
||||||
const char *property,
|
const char *property,
|
||||||
NMDevice *device,
|
const NMMatchSpecDeviceData *match_data,
|
||||||
gboolean *has_match)
|
NMDevice *device,
|
||||||
|
gboolean *has_match)
|
||||||
{
|
{
|
||||||
const NMConfigDataPrivate *priv;
|
const NMConfigDataPrivate *priv;
|
||||||
const MatchSectionInfo *connection_info;
|
const MatchSectionInfo *connection_info;
|
||||||
|
|
@ -1561,18 +1562,39 @@ nm_config_data_get_device_config_by_device(const NMConfigData *self,
|
||||||
g_return_val_if_fail(self, NULL);
|
g_return_val_if_fail(self, NULL);
|
||||||
g_return_val_if_fail(property && *property, NULL);
|
g_return_val_if_fail(property && *property, NULL);
|
||||||
|
|
||||||
|
nm_assert(!match_data || !device);
|
||||||
|
nm_assert(!device || NM_IS_DEVICE(device));
|
||||||
|
|
||||||
priv = NM_CONFIG_DATA_GET_PRIVATE(self);
|
priv = NM_CONFIG_DATA_GET_PRIVATE(self);
|
||||||
|
|
||||||
connection_info = _match_section_infos_lookup(&priv->device_infos[0],
|
connection_info = _match_section_infos_lookup(&priv->device_infos[0],
|
||||||
priv->keyfile,
|
priv->keyfile,
|
||||||
property,
|
property,
|
||||||
NULL,
|
match_data,
|
||||||
device,
|
device,
|
||||||
&value);
|
&value);
|
||||||
NM_SET_OUT(has_match, !!connection_info);
|
NM_SET_OUT(has_match, !!connection_info);
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
nm_config_data_get_device_config(const NMConfigData *self,
|
||||||
|
const char *property,
|
||||||
|
const NMMatchSpecDeviceData *match_data,
|
||||||
|
gboolean *has_match)
|
||||||
|
{
|
||||||
|
return _config_data_get_device_config(self, property, match_data, NULL, has_match);
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *
|
||||||
|
nm_config_data_get_device_config_by_device(const NMConfigData *self,
|
||||||
|
const char *property,
|
||||||
|
NMDevice *device,
|
||||||
|
gboolean *has_match)
|
||||||
|
{
|
||||||
|
return _config_data_get_device_config(self, property, NULL, device, has_match);
|
||||||
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
nm_config_data_get_device_config_by_pllink(const NMConfigData *self,
|
nm_config_data_get_device_config_by_pllink(const NMConfigData *self,
|
||||||
const char *property,
|
const char *property,
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,13 @@ gint64 nm_config_data_get_connection_default_int64(const NMConfigData *self,
|
||||||
gint64 max,
|
gint64 max,
|
||||||
gint64 fallback);
|
gint64 fallback);
|
||||||
|
|
||||||
|
struct _NMMatchSpecDeviceData;
|
||||||
|
|
||||||
|
const char *nm_config_data_get_device_config(const NMConfigData *self,
|
||||||
|
const char *property,
|
||||||
|
const struct _NMMatchSpecDeviceData *match_data,
|
||||||
|
gboolean *has_match);
|
||||||
|
|
||||||
const char *nm_config_data_get_device_config_by_device(const NMConfigData *self,
|
const char *nm_config_data_get_device_config_by_device(const NMConfigData *self,
|
||||||
const char *property,
|
const char *property,
|
||||||
NMDevice *device,
|
NMDevice *device,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue