]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Move no_instances information to shared/
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 Apr 2016 22:34:13 +0000 (18:34 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 1 May 2016 23:58:59 +0000 (19:58 -0400)
This way it can be used in install.c in subsequent commit.

src/core/automount.c
src/core/busname.c
src/core/device.c
src/core/mount.c
src/core/scope.c
src/core/slice.c
src/core/swap.c
src/core/unit.c
src/core/unit.h
src/shared/install.c
src/shared/install.h

index 7374d50ae8a0ba23c910d15ff57290421b1a4495..1239a0efc692bac530bf9f82f45d038a63a2ba10 100644 (file)
@@ -1050,8 +1050,6 @@ const UnitVTable automount_vtable = {
                 "Automount\0"
                 "Install\0",
 
-        .no_instances = true,
-
         .init = automount_init,
         .load = automount_load,
         .done = automount_done,
index 4d43bd21e6d6bd95a19ef70b80ed869f423a06d5..e7b7b5c0125c75fecca501d0e40fca1bfd9ddee4 100644 (file)
@@ -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,
index d01bec53d8d362c60c898d608d822aa2395d9734..16e56efcc3373c58a7ffb4255f0080a077287663 100644 (file)
@@ -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,
index adc74c3bea09e9217ff5f37525d963131e6585eb..c8a898e4dcd6f486ebdc5410d349bd511c4aecb9 100644 (file)
@@ -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,
index 3915e5c88c62b3b20bc4ace5dc6c4975a9772caa..238f63a7299c0030f18b8116e535beb8b5c0cba1 100644 (file)
@@ -569,7 +569,6 @@ const UnitVTable scope_vtable = {
                 "Install\0",
         .private_section = "Scope",
 
-        .no_instances = true,
         .can_transient = true,
 
         .init = scope_init,
index 96c7c745984a209394f1942061ec335dabadc2f2..c7700b8857da8f48f22cfde61dc399fc39a90a76 100644 (file)
@@ -309,7 +309,6 @@ const UnitVTable slice_vtable = {
                 "Install\0",
         .private_section = "Slice",
 
-        .no_instances = true,
         .can_transient = true,
 
         .init = slice_init,
index f486a44cf5630ec757aeab9836de4749c8f24399..c018648d87b07e5030c683e0b1812b7ee495f073 100644 (file)
@@ -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,
index 0313ee2ad3ff77c11c6199a3e761bed6bf42d119..a2726f10a60a04b4e39f90837a0f76ce2eb2f2a8 100644 (file)
@@ -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,
index 6ac925a185109357bde644b18abf991c84c6d310..be62e88421fff04514bb21239c46cfcc2fe8e63a 100644 (file)
@@ -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;
 };
index 1635f50fdb00a64f7d2550a277bd805b02d3cf08..cc39aaf6773f30e1b533730cc5f72c51228f5147 100644 (file)
@@ -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;
index 8a8bd09c7c3558ea4fcd79fe1dbee0f18c94ced6..5812447c5ba4a306bbd123f4899b2e34d3a09817 100644 (file)
@@ -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,