network,udev: split static condition tests from net_match_config()
This commit is contained in:
@@ -34,11 +34,11 @@ struct ConfigPerfItem;
|
||||
%struct-type
|
||||
%includes
|
||||
%%
|
||||
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(NetDev, match_host)
|
||||
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(NetDev, match_virt)
|
||||
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(NetDev, match_kernel_cmdline)
|
||||
Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(NetDev, match_kernel_version)
|
||||
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(NetDev, match_arch)
|
||||
Match.Host, config_parse_net_condition, CONDITION_HOST, offsetof(NetDev, conditions)
|
||||
Match.Virtualization, config_parse_net_condition, CONDITION_VIRTUALIZATION, offsetof(NetDev, conditions)
|
||||
Match.KernelCommandLine, config_parse_net_condition, CONDITION_KERNEL_COMMAND_LINE, offsetof(NetDev, conditions)
|
||||
Match.KernelVersion, config_parse_net_condition, CONDITION_KERNEL_VERSION, offsetof(NetDev, conditions)
|
||||
Match.Architecture, config_parse_net_condition, CONDITION_ARCHITECTURE, offsetof(NetDev, conditions)
|
||||
NetDev.Description, config_parse_string, 0, offsetof(NetDev, description)
|
||||
NetDev.Name, config_parse_ifname, 0, offsetof(NetDev, ifname)
|
||||
NetDev.Kind, config_parse_netdev_kind, 0, offsetof(NetDev, kind)
|
||||
|
||||
@@ -174,12 +174,7 @@ static NetDev *netdev_free(NetDev *netdev) {
|
||||
free(netdev->description);
|
||||
free(netdev->ifname);
|
||||
free(netdev->mac);
|
||||
|
||||
condition_free_list(netdev->match_host);
|
||||
condition_free_list(netdev->match_virt);
|
||||
condition_free_list(netdev->match_kernel_cmdline);
|
||||
condition_free_list(netdev->match_kernel_version);
|
||||
condition_free_list(netdev->match_arch);
|
||||
condition_free_list(netdev->conditions);
|
||||
|
||||
/* Invoke the per-kind done() destructor, but only if the state field is initialized. We conditionalize that
|
||||
* because we parse .netdev files twice: once to determine the kind (with a short, minimal NetDev structure
|
||||
@@ -683,11 +678,7 @@ int netdev_load_one(Manager *manager, const char *filename) {
|
||||
return r;
|
||||
|
||||
/* skip out early if configuration does not match the environment */
|
||||
if (!net_match_config(NULL, NULL, NULL, NULL, NULL,
|
||||
netdev_raw->match_host, netdev_raw->match_virt,
|
||||
netdev_raw->match_kernel_cmdline, netdev_raw->match_kernel_version,
|
||||
netdev_raw->match_arch,
|
||||
NULL, NULL, NULL, NULL, NULL)) {
|
||||
if (!condition_test_list(netdev_raw->conditions, NULL, NULL, NULL)) {
|
||||
log_debug("%s: Conditions in the file do not match the system environment, skipping.", filename);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -81,11 +81,7 @@ typedef struct NetDev {
|
||||
|
||||
char *filename;
|
||||
|
||||
Condition *match_host;
|
||||
Condition *match_virt;
|
||||
Condition *match_kernel_cmdline;
|
||||
Condition *match_kernel_version;
|
||||
Condition *match_arch;
|
||||
Condition *conditions;
|
||||
|
||||
NetDevState state;
|
||||
NetDevKind kind;
|
||||
|
||||
Reference in New Issue
Block a user