return bus_append_parse_cpu_set(m, field, eq);
}
+static int bus_append_numa_mask(sd_bus_message *m, const char *field, const char *eq) {
+ _cleanup_(cpu_set_done) CPUSet nodes = {};
+ _cleanup_free_ uint8_t *array = NULL;
+ size_t allocated;
+ int r;
+
+ if (eq && streq(eq, "all")) {
+ r = numa_mask_add_all(&nodes);
+ if (r < 0)
+ return log_error_errno(r, "Failed to create NUMA mask representing \"all\" NUMA nodes: %m");
+ } else {
+ r = parse_cpu_set(eq, &nodes);
+ if (r < 0)
+ return log_error_errno(r, "Failed to parse %s value: %s", field, eq);
+ }
+
+ r = cpu_set_to_dbus(&nodes, &array, &allocated);
+ if (r < 0)
+ return log_error_errno(r, "Failed to serialize %s: %m", field);
+
+ return bus_append_byte_array(m, field, array, allocated);
+}
+
static int bus_append_cgroup_property(sd_bus_message *m, const char *field, const char *eq) {
if (STR_IN_SET(field, "DevicePolicy",
"Slice",
if (streq(field, "NUMAPolicy"))
return bus_append_mpol_from_string(m, field, eq);
- if (streq(field, "NUMAMask")) {
- _cleanup_(cpu_set_done) CPUSet nodes = {};
- _cleanup_free_ uint8_t *array = NULL;
- size_t allocated;
-
- if (eq && streq(eq, "all")) {
- r = numa_mask_add_all(&nodes);
- if (r < 0)
- return log_error_errno(r, "Failed to create NUMA mask representing \"all\" NUMA nodes: %m");
- } else {
- r = parse_cpu_set(eq, &nodes);
- if (r < 0)
- return log_error_errno(r, "Failed to parse %s value: %s", field, eq);
- }
-
- r = cpu_set_to_dbus(&nodes, &array, &allocated);
- if (r < 0)
- return log_error_errno(r, "Failed to serialize NUMAMask: %m");
-
- return bus_append_byte_array(m, field, array, allocated);
- }
+ if (streq(field, "NUMAMask"))
+ return bus_append_numa_mask(m, field, eq);
if (STR_IN_SET(field, "RestrictAddressFamilies",
"RestrictFileSystems",