mirror of
https://github.com/systemd/systemd.git
synced 2025-02-09 13:57:42 +03:00
Move no_instances information to shared/
This way it can be used in install.c in subsequent commit.
This commit is contained in:
parent
a772458901
commit
ce99c68a33
@ -1050,8 +1050,6 @@ const UnitVTable automount_vtable = {
|
||||
"Automount\0"
|
||||
"Install\0",
|
||||
|
||||
.no_instances = true,
|
||||
|
||||
.init = automount_init,
|
||||
.load = automount_load,
|
||||
.done = automount_done,
|
||||
|
@ -1028,8 +1028,6 @@ const UnitVTable busname_vtable = {
|
||||
"Install\0",
|
||||
.private_section = "BusName",
|
||||
|
||||
.no_instances = true,
|
||||
|
||||
.init = busname_init,
|
||||
.done = busname_done,
|
||||
.load = busname_load,
|
||||
|
@ -841,8 +841,6 @@ const UnitVTable device_vtable = {
|
||||
"Device\0"
|
||||
"Install\0",
|
||||
|
||||
.no_instances = true,
|
||||
|
||||
.init = device_init,
|
||||
.done = device_done,
|
||||
.load = unit_load_fragment_and_dropin_optional,
|
||||
|
@ -1839,8 +1839,6 @@ const UnitVTable mount_vtable = {
|
||||
"Install\0",
|
||||
.private_section = "Mount",
|
||||
|
||||
.no_instances = true,
|
||||
|
||||
.init = mount_init,
|
||||
.load = mount_load,
|
||||
.done = mount_done,
|
||||
|
@ -569,7 +569,6 @@ const UnitVTable scope_vtable = {
|
||||
"Install\0",
|
||||
.private_section = "Scope",
|
||||
|
||||
.no_instances = true,
|
||||
.can_transient = true,
|
||||
|
||||
.init = scope_init,
|
||||
|
@ -309,7 +309,6 @@ const UnitVTable slice_vtable = {
|
||||
"Install\0",
|
||||
.private_section = "Slice",
|
||||
|
||||
.no_instances = true,
|
||||
.can_transient = true,
|
||||
|
||||
.init = slice_init,
|
||||
|
@ -1465,8 +1465,6 @@ const UnitVTable swap_vtable = {
|
||||
"Install\0",
|
||||
.private_section = "Swap",
|
||||
|
||||
.no_instances = true,
|
||||
|
||||
.init = swap_init,
|
||||
.load = swap_load,
|
||||
.done = swap_done,
|
||||
|
@ -193,7 +193,7 @@ int unit_add_name(Unit *u, const char *text) {
|
||||
if (r < 0)
|
||||
return r;
|
||||
|
||||
if (i && unit_vtable[t]->no_instances)
|
||||
if (i && !unit_type_may_template(t))
|
||||
return -EINVAL;
|
||||
|
||||
/* Ensure that this unit is either instanced or not instanced,
|
||||
|
@ -416,9 +416,6 @@ struct UnitVTable {
|
||||
/* The strings to print in status messages */
|
||||
UnitStatusMessageFormats status_message_formats;
|
||||
|
||||
/* Instances make no sense for this type */
|
||||
bool no_instances:1;
|
||||
|
||||
/* True if transient units of this type are OK */
|
||||
bool can_transient:1;
|
||||
};
|
||||
|
@ -78,6 +78,15 @@ bool unit_type_may_alias(UnitType type) {
|
||||
UNIT_PATH);
|
||||
}
|
||||
|
||||
bool unit_type_may_template(UnitType type) {
|
||||
return IN_SET(type,
|
||||
UNIT_SERVICE,
|
||||
UNIT_SOCKET,
|
||||
UNIT_TARGET,
|
||||
UNIT_TIMER,
|
||||
UNIT_PATH);
|
||||
}
|
||||
|
||||
static int in_search_path(const LookupPaths *p, const char *path) {
|
||||
_cleanup_free_ char *parent = NULL;
|
||||
char **i;
|
||||
|
@ -139,6 +139,7 @@ static inline bool UNIT_FILE_INSTALL_INFO_HAS_ALSO(UnitFileInstallInfo *i) {
|
||||
}
|
||||
|
||||
bool unit_type_may_alias(UnitType type) _const_;
|
||||
bool unit_type_may_template(UnitType type) _const_;
|
||||
|
||||
int unit_file_enable(
|
||||
UnitFileScope scope,
|
||||
|
Loading…
x
Reference in New Issue
Block a user