+static void dump_items(FILE *f, const ConfigItem *items) {
+ const ConfigItem *i;
+ const char *prev_section = NULL;
+ bool not_first = false;
+
+ struct {
+ ConfigParserCallback callback;
+ const char *rvalue;
+ } table[] = {
+ { config_parse_int, "INTEGER" },
+ { config_parse_unsigned, "UNSIGNED" },
+ { config_parse_size, "SIZE" },
+ { config_parse_bool, "BOOLEAN" },
+ { config_parse_string, "STRING" },
+ { config_parse_path, "PATH" },
+ { config_parse_strv, "STRING [...]" },
+ { config_parse_nice, "NICE" },
+ { config_parse_oom_adjust, "OOMADJUST" },
+ { config_parse_io_class, "IOCLASS" },
+ { config_parse_io_priority, "IOPRIORITY" },
+ { config_parse_cpu_sched_policy, "CPUSCHEDPOLICY" },
+ { config_parse_cpu_sched_prio, "CPUSCHEDPRIO" },
+ { config_parse_cpu_affinity, "CPUAFFINITY" },
+ { config_parse_mode, "MODE" },
+ { config_parse_output, "OUTPUT" },
+ { config_parse_input, "INPUT" },
+ { config_parse_facility, "FACILITY" },
+ { config_parse_level, "LEVEL" },
+ { config_parse_capabilities, "CAPABILITIES" },
+ { config_parse_secure_bits, "SECUREBITS" },
+ { config_parse_bounding_set, "BOUNDINGSET" },
+ { config_parse_timer_slack_ns, "TIMERSLACK" },
+ { config_parse_limit, "LIMIT" },
+ { config_parse_cgroup, "CGROUP [...]" },
+ { config_parse_deps, "UNIT [...]" },
+ { config_parse_names, "UNIT [...]" },
+ { config_parse_exec, "PATH [ARGUMENT [...]]" },
+ { config_parse_service_type, "SERVICETYPE" },
+ { config_parse_service_restart, "SERVICERESTART" },
+ { config_parse_sysv_priority, "SYSVPRIORITY" },
+ { config_parse_kill_mode, "KILLMODE" },
+ { config_parse_listen, "SOCKET [...]" },
+ { config_parse_socket_bind, "SOCKETBIND" },
+ { config_parse_bindtodevice, "NETWORKINTERFACE" }
+ };
+
+ assert(f);
+ assert(items);
+
+ for (i = items; i->lvalue; i++) {
+ unsigned j;
+ const char *rvalue = "OTHER";
+
+ if (!streq_ptr(i->section, prev_section)) {
+ if (!not_first)
+ not_first = true;
+ else
+ fputc('\n', f);
+
+ fprintf(f, "[%s]\n", i->section);
+ prev_section = i->section;
+ }
+
+ for (j = 0; j < ELEMENTSOF(table); j++)
+ if (i->parse == table[j].callback) {
+ rvalue = table[j].rvalue;
+ break;
+ }
+
+ fprintf(f, "%s=%s\n", i->lvalue, rvalue);
+ }
+}
+
+static int load_from_path(Unit *u, const char *path) {