core: add nm_device_spec_match_list_full()

This gives a third return value: whether the device did not
match.
This commit is contained in:
Thomas Haller 2017-06-01 22:32:12 +02:00
parent f2f9a635ff
commit c3aa52530c
2 changed files with 18 additions and 1 deletions

View file

@ -13463,6 +13463,12 @@ nm_device_get_initial_hw_address (NMDevice *self)
*/
gboolean
nm_device_spec_match_list (NMDevice *self, const GSList *specs)
{
return nm_device_spec_match_list_full (self, specs, FALSE);
}
int
nm_device_spec_match_list_full (NMDevice *self, const GSList *specs, int no_match_value)
{
NMDeviceClass *klass;
NMMatchSpecMatchType m;
@ -13478,7 +13484,17 @@ nm_device_spec_match_list (NMDevice *self, const GSList *specs)
nm_device_get_driver_version (self),
nm_device_get_permanent_hw_address (self),
klass->get_s390_subchannels ? klass->get_s390_subchannels (self) : NULL);
return m == NM_MATCH_SPEC_MATCH;
switch (m) {
case NM_MATCH_SPEC_MATCH:
return TRUE;
case NM_MATCH_SPEC_NEG_MATCH:
return FALSE;
case NM_MATCH_SPEC_NO_MATCH:
return no_match_value;
}
nm_assert_not_reached ();
return no_match_value;
}
guint

View file

@ -507,6 +507,7 @@ gboolean nm_device_check_slave_connection_compatible (NMDevice *device, NMConnec
gboolean nm_device_unmanage_on_quit (NMDevice *self);
gboolean nm_device_spec_match_list (NMDevice *device, const GSList *specs);
int nm_device_spec_match_list_full (NMDevice *self, const GSList *specs, int no_match_value);
gboolean nm_device_is_activating (NMDevice *dev);
gboolean nm_device_autoconnect_allowed (NMDevice *self);