1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-22 06:50:18 +03:00

network/netdev: move config_parse_netdev_kind() at the end

This commit is contained in:
Yu Watanabe 2021-11-28 11:23:42 +09:00
parent 788e720181
commit 5dcc5b1a11

View File

@ -128,41 +128,6 @@ static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = {
DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind);
int config_parse_netdev_kind(
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) {
NetDevKind k, *kind = data;
assert(rvalue);
assert(data);
k = netdev_kind_from_string(rvalue);
if (k < 0) {
log_syntax(unit, LOG_WARNING, filename, line, k, "Failed to parse netdev kind, ignoring assignment: %s", rvalue);
return 0;
}
if (*kind != _NETDEV_KIND_INVALID && *kind != k) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified netdev kind is different from the previous value '%s', ignoring assignment: %s",
netdev_kind_to_string(*kind), rvalue);
return 0;
}
*kind = k;
return 0;
}
bool netdev_is_managed(NetDev *netdev) {
if (!netdev || !netdev->manager || !netdev->ifname)
return false;
@ -886,3 +851,39 @@ int netdev_load(Manager *manager, bool reload) {
return 0;
}
int config_parse_netdev_kind(
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) {
NetDevKind k, *kind = data;
assert(filename);
assert(rvalue);
assert(data);
k = netdev_kind_from_string(rvalue);
if (k < 0) {
log_syntax(unit, LOG_WARNING, filename, line, k, "Failed to parse netdev kind, ignoring assignment: %s", rvalue);
return 0;
}
if (*kind != _NETDEV_KIND_INVALID && *kind != k) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Specified netdev kind is different from the previous value '%s', ignoring assignment: %s",
netdev_kind_to_string(*kind), rvalue);
return 0;
}
*kind = k;
return 0;
}