Commit 969eb98d authored by Thomas Haller's avatar Thomas Haller

core: extend nm_match_spec_device_by_pllink() with the device-type

nm_match_spec_device_by_pllink() does not support matching on all parameters,
unlike nm_match_spec_device(). The reason is that certain parameters are
only available when having a NMDevice instance.

Add an argument "match_device_type", so that the caller can inject the
device type to be used. Note that for NMDevice, the device-type is
nm_device_get_type_description(), which usually depends on the device
class only. The only caller of nm_match_spec_device_by_pllink() is the
wifi factory, and it already knows that it wants to create a device of
type NMDeviceWifi. Hence, it knows and can specify "wifi" as
match_device_type.
parent bbea0656
......@@ -938,6 +938,7 @@ nm_utils_g_value_set_object_path_array (GValue *value,
int
nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
const char *match_device_type,
const GSList *specs,
int no_match_value)
{
......@@ -950,7 +951,7 @@ nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
* which match even in that case. */
m = nm_match_spec_device (specs,
pllink ? pllink->name : NULL,
NULL,
match_device_type,
pllink ? pllink->driver : NULL,
NULL,
NULL,
......
......@@ -65,6 +65,7 @@ void nm_utils_g_value_set_object_path_array (GValue *value,
gpointer user_data);
int nm_match_spec_device_by_pllink (const NMPlatformLink *pllink,
const char *match_device_type,
const GSList *specs,
int no_match_value);
......
......@@ -107,6 +107,7 @@ create_device (NMDeviceFactory *factory,
backend = nm_config_data_get_device_config_by_pllink (NM_CONFIG_GET_DATA,
NM_CONFIG_KEYFILE_KEY_DEVICE_WIFI_BACKEND,
plink,
"wifi",
NULL);
nm_strstrip (backend);
......
......@@ -1197,6 +1197,7 @@ _match_section_infos_lookup (const MatchSectionInfo *match_section_infos,
const char *property,
NMDevice *device,
const NMPlatformLink *pllink,
const char *match_device_type,
char **out_value)
{
if (!match_section_infos)
......@@ -1221,7 +1222,7 @@ _match_section_infos_lookup (const MatchSectionInfo *match_section_infos,
if (device)
match = nm_device_spec_match_list (device, match_section_infos->match_device.spec);
else if (pllink)
match = nm_match_spec_device_by_pllink (pllink, match_section_infos->match_device.spec, FALSE);
match = nm_match_spec_device_by_pllink (pllink, match_device_type, match_section_infos->match_device.spec, FALSE);
else
match = FALSE;
} else
......@@ -1256,6 +1257,7 @@ nm_config_data_get_device_config (const NMConfigData *self,
property,
device,
NULL,
NULL,
&value);
NM_SET_OUT (has_match, !!connection_info);
return value;
......@@ -1265,6 +1267,7 @@ char *
nm_config_data_get_device_config_by_pllink (const NMConfigData *self,
const char *property,
const NMPlatformLink *pllink,
const char *match_device_type,
gboolean *has_match)
{
const NMConfigDataPrivate *priv;
......@@ -1281,6 +1284,7 @@ nm_config_data_get_device_config_by_pllink (const NMConfigData *self,
property,
NULL,
pllink,
match_device_type,
&value);
NM_SET_OUT (has_match, !!connection_info);
return value;
......@@ -1321,6 +1325,7 @@ nm_config_data_get_connection_default (const NMConfigData *self,
property,
device,
NULL,
NULL,
&value);
return value;
}
......
......@@ -191,6 +191,7 @@ char *nm_config_data_get_device_config (const NMConfigData *self,
char *nm_config_data_get_device_config_by_pllink (const NMConfigData *self,
const char *property,
const NMPlatformLink *pllink,
const char *match_device_type,
gboolean *has_match);
gboolean nm_config_data_get_device_config_boolean (const NMConfigData *self,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment