udev: move config_parse_ifalias()

This commit is contained in:
Yu Watanabe
2020-10-29 14:23:49 +09:00
parent 796aa313b3
commit fc27088ae7
4 changed files with 44 additions and 43 deletions
-42
View File
@@ -24,7 +24,6 @@
#include "string-table.h"
#include "string-util.h"
#include "strv.h"
#include "utf8.h"
#include "util.h"
const char *net_get_name_persistent(sd_device *device) {
@@ -486,47 +485,6 @@ int config_parse_match_property(
}
}
int config_parse_ifalias(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) {
char **s = data;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
if (!isempty(rvalue)) {
*s = mfree(*s);
return 0;
}
if (!ascii_is_valid(rvalue)) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Interface alias is not ASCII clean, ignoring assignment: %s", rvalue);
return 0;
}
if (strlen(rvalue) >= IFALIASZ) {
log_syntax(unit, LOG_WARNING, filename, line, 0,
"Interface alias is too long, ignoring assignment: %s", rvalue);
return 0;
}
if (free_and_strdup(s, rvalue) < 0)
return log_oom();
return 0;
}
int config_parse_hwaddr(const char *unit,
const char *filename,
unsigned line,
@@ -39,7 +39,6 @@ CONFIG_PARSER_PROTOTYPE(config_parse_hwaddrs);
CONFIG_PARSER_PROTOTYPE(config_parse_match_strv);
CONFIG_PARSER_PROTOTYPE(config_parse_match_ifnames);
CONFIG_PARSER_PROTOTYPE(config_parse_match_property);
CONFIG_PARSER_PROTOTYPE(config_parse_ifalias);
int net_get_unique_predictable_data(sd_device *device, bool use_sysname, uint64_t *result);
const char *net_get_name_persistent(sd_device *device);