core: change top-level drop-in from -.service.d to service.d

Discussed in #13743, the -.service semantic conflicts with the
existing root mount and slice names, making this feature not
uniformly extensible to all types. Change the name to be
<type>.d instead.

Updating to this format also extends the top-level dropin to
unit types.
This commit is contained in:
Anita Zhang
2019-11-07 08:34:53 +01:00
committed by Zbigniew Jędrzejewski-Szmek
parent 8069017a0f
commit 3e1db806b0
11 changed files with 27 additions and 103 deletions
-4
View File
@@ -105,7 +105,3 @@
/* The root directory. */
#define SPECIAL_ROOT_MOUNT "-.mount"
/* Used to apply settings to all services through drop-ins.
* Should not exist as an actual service. */
#define SPECIAL_ROOT_SERVICE "-.service"
-30
View File
@@ -669,36 +669,6 @@ good:
return 0;
}
bool service_unit_name_is_valid(const char *name) {
_cleanup_free_ char *prefix = NULL, *s = NULL;
const char *e, *service_name = name;
if (!unit_name_is_valid(name, UNIT_NAME_ANY))
return false;
e = endswith(name, ".service");
if (!e)
return false;
/* If it's a template or instance, get the prefix as a service name. */
if (unit_name_is_valid(name, UNIT_NAME_INSTANCE|UNIT_NAME_TEMPLATE)) {
if (unit_name_to_prefix(name, &prefix) < 0)
return false;
s = strjoin(prefix, ".service");
if (!s)
return false;
service_name = s;
}
/* Reject reserved service name(s). */
if (streq(service_name, SPECIAL_ROOT_SERVICE))
return false;
return true;
}
int slice_build_parent_slice(const char *slice, char **ret) {
char *s, *dash;
int r;
-2
View File
@@ -58,8 +58,6 @@ static inline int unit_name_mangle(const char *name, UnitNameMangle flags, char
return unit_name_mangle_with_suffix(name, NULL, flags, ".service", ret);
}
bool service_unit_name_is_valid(const char *name);
int slice_build_parent_slice(const char *slice, char **ret);
int slice_build_subslice(const char *slice, const char *name, char **subslice);
bool slice_name_is_valid(const char *name);