-
Thomas Haller authored
Previously, we would have different functions like - nm_match_spec_device_type() - nm_match_spec_hwaddr() - nm_match_spec_s390_subchannels() - nm_match_spec_interface_name() which all would handle one type of match-spec. So, to get the overall result whether the arguments match or not, nm_device_spec_match_list() had to stich them together and iterate the list multiple times. Refactor the code to have one nm_match_spec_device() function that gets all relevant paramters. The upside is: - the logic how to evaluate the match-spec is all at one place (match_device_eval()) instead of spread over multiple functions. - It requires iterating the list at most twice. Twice, because we do a fast pre-search for "*". One downside could be, that we have to pass all 4 arguments for the evaluation, even if the might no be needed. That is, because "nm-core-utils.c" shall be independend from NMDevice, it cannot receive a device instance to get the parameters as needed. As we would add new match-types, the argument list would grow. However, all arguments are cached and fetching them from the device's private data is very cheap. (cherry picked from commit b957403e)
ba1cc6a2