unit: drop the Names= option

Names= is a source of errors, simply because alias names specified like
this only become relevant after a unit has been loaded but cannot be
used to load a unit.

Let's get rid of the confusion and drop this field. To establish alias
names peope should use symlinks, which have the the benefit of being
useful as key to load a unit, even though they are not taken into
account if unit names are listed but they haven't been explicitly
referenced before.
This commit is contained in:
Lennart Poettering
2012-06-22 16:24:57 +02:00
parent a3a3e5b6ae
commit 8ff290af3b
5 changed files with 1 additions and 101 deletions
-1
View File
@@ -90,7 +90,6 @@ $1.UtmpIdentifier, config_parse_unit_string_printf, 0,
$1.ControlGroupModify, config_parse_bool, 0, offsetof($1, exec_context.control_group_modify)
$1.ControlGroupPersistent, config_parse_tristate, 0, offsetof($1, exec_context.control_group_persistent)'
)m4_dnl
Unit.Names, config_parse_unit_names, 0, 0
Unit.Description, config_parse_unit_string_printf, 0, offsetof(Unit, description)
Unit.Documentation, config_parse_documentation, 0, offsetof(Unit, documentation)
Unit.SourcePath, config_parse_path, 0, offsetof(Unit, source_path)
-44
View File
@@ -105,49 +105,6 @@ int config_parse_unit_deps(
return 0;
}
int config_parse_unit_names(
const char *filename,
unsigned line,
const char *section,
const char *lvalue,
int ltype,
const char *rvalue,
void *data,
void *userdata) {
Unit *u = userdata;
char *w;
size_t l;
char *state;
assert(filename);
assert(lvalue);
assert(rvalue);
assert(data);
FOREACH_WORD_QUOTED(w, l, rvalue, state) {
char *t, *k;
int r;
t = strndup(w, l);
if (!t)
return -ENOMEM;
k = unit_name_printf(u, t);
free(t);
if (!k)
return -ENOMEM;
r = unit_merge_by_name(u, k);
if (r < 0)
log_error("Failed to add name %s, ignoring: %s", k, strerror(-r));
free(k);
}
return 0;
}
int config_parse_unit_string_printf(
const char *filename,
unsigned line,
@@ -2395,7 +2352,6 @@ void unit_dump_config_items(FILE *f) {
{ config_parse_limit, "LIMIT" },
{ config_parse_unit_cgroup, "CGROUP [...]" },
{ config_parse_unit_deps, "UNIT [...]" },
{ config_parse_unit_names, "UNIT [...]" },
{ config_parse_exec, "PATH [ARGUMENT [...]]" },
{ config_parse_service_type, "SERVICETYPE" },
{ config_parse_service_restart, "SERVICERESTART" },
-1
View File
@@ -32,7 +32,6 @@ void unit_dump_config_items(FILE *f);
int config_parse_warn_compat(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_unit_deps(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_unit_names(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_unit_string_printf(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_unit_strv_printf(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);
int config_parse_unit_path_printf(const char *filename, unsigned line, const char *section, const char *lvalue, int ltype, const char *rvalue, void *data, void *userdata);