X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fudev%2Fnet%2Flink-config.h;h=5f3d4ad142e2dc24d964e3828680bad27374b1c6;hp=849e481520e3aa068204296e69f7714cd9e34c87;hb=04b67d49254d956d31bcfe80340fb9df7ed332d3;hpb=43b3a5ef61859f06cdbaf26765cab8e1adac4296 diff --git a/src/udev/net/link-config.h b/src/udev/net/link-config.h index 849e48152..5f3d4ad14 100644 --- a/src/udev/net/link-config.h +++ b/src/udev/net/link-config.h @@ -21,29 +21,56 @@ #pragma once +#include "ethtool-util.h" + +#include "condition-util.h" #include "libudev.h" #include "util.h" #include "list.h" - typedef struct link_config_ctx link_config_ctx; typedef struct link_config link_config; +typedef enum MACPolicy { + MACPOLICY_PERSISTENT, + MACPOLICY_RANDOM, + _MACPOLICY_MAX, + _MACPOLICY_INVALID = -1 +} MACPolicy; + +typedef enum NamePolicy { + NAMEPOLICY_KERNEL, + NAMEPOLICY_DATABASE, + NAMEPOLICY_ONBOARD, + NAMEPOLICY_SLOT, + NAMEPOLICY_PATH, + NAMEPOLICY_MAC, + _NAMEPOLICY_MAX, + _NAMEPOLICY_INVALID = -1 +} NamePolicy; + struct link_config { char *filename; - char *match_mac; + struct ether_addr *match_mac; char *match_path; char *match_driver; char *match_type; + Condition *match_host; + Condition *match_virt; + Condition *match_kernel; + Condition *match_arch; char *description; - char *mac; + struct ether_addr *mac; + MACPolicy mac_policy; + NamePolicy *name_policy; char *name; + char *alias; unsigned int mtu; unsigned int speed; - char *duplex; - char *wol; + Duplex duplex; + WakeOnLan wol; LIST_FIELDS(link_config, links); }; @@ -55,7 +82,18 @@ int link_config_load(link_config_ctx *ctx); bool link_config_should_reload(link_config_ctx *ctx); int link_config_get(link_config_ctx *ctx, struct udev_device *device, struct link_config **ret); -int link_config_apply(link_config_ctx *ctx, struct link_config *config, struct udev_device *device); +int link_config_apply(link_config_ctx *ctx, struct link_config *config, struct udev_device *device, const char **name); + +int link_get_driver(link_config_ctx *ctx, struct udev_device *device, char **ret); + +const char *name_policy_to_string(NamePolicy p) _const_; +NamePolicy name_policy_from_string(const char *p) _pure_; + +const char *mac_policy_to_string(MACPolicy p) _const_; +MACPolicy mac_policy_from_string(const char *p) _pure_; /* gperf lookup function */ const struct ConfigPerfItem* link_config_gperf_lookup(const char *key, unsigned length); + +int config_parse_mac_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata); +int config_parse_name_policy(const char *unit, const char *filename, unsigned line, const char *section, unsigned section_line, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);