cpu-set-util: introduce config_parse_cpu_set()

Then, make parse_cpu_set() as a tiny wrapper of it.

Note, previously when an invalid CPU range, e.g. "3-0", is specified,
we ignore the range but allocate an empty set. But, with this commit,
now the conf parser simply ignore it without no side effect.
This potentially changes behavior of a system with such invalid setting,
but the change should be favorable for consistency with other parsers.
This commit is contained in:
Yu Watanabe
2025-06-24 00:20:20 +09:00
parent 0b9ae2d303
commit fe3ada076e
10 changed files with 135 additions and 175 deletions
+1 -12
View File
@@ -1371,15 +1371,8 @@ int config_parse_rps_cpu_mask(
CPUSet *mask = ASSERT_PTR(data);
int r;
assert(filename);
assert(lvalue);
assert(rvalue);
if (isempty(rvalue)) {
cpu_set_done(mask);
return 0;
}
if (streq(rvalue, "disable")) {
_cleanup_(cpu_set_done) CPUSet c = {};
@@ -1403,11 +1396,7 @@ int config_parse_rps_cpu_mask(
return cpu_set_done_and_replace(*mask, c);
}
r = parse_cpu_set_extend(rvalue, mask, /* warn= */ true, unit, filename, line, lvalue);
if (r < 0)
return 0;
return 0;
return config_parse_cpu_set(unit, filename, line, section, section_line, lvalue, ltype, rvalue, data, userdata);
}
static const char* const mac_address_policy_table[_MAC_ADDRESS_POLICY_MAX] = {