]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
Move no_alias information to shared/
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sat, 30 Apr 2016 20:21:41 +0000 (16:21 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 1 May 2016 23:40:51 +0000 (19:40 -0400)
This way it can be used in install.c in subsequent commit.

src/core/automount.c
src/core/busname.c
src/core/load-fragment.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 7c55d7bc49d9064eda035e546dd93466b0b6ddd5..7374d50ae8a0ba23c910d15ff57290421b1a4495 100644 (file)
@@ -1050,7 +1050,6 @@ const UnitVTable automount_vtable = {
                 "Automount\0"
                 "Install\0",
 
-        .no_alias = true,
         .no_instances = true,
 
         .init = automount_init,
index f4f433340c7b9f40cee50ee0d67be10df99f8921..4d43bd21e6d6bd95a19ef70b80ed869f423a06d5 100644 (file)
@@ -1028,7 +1028,6 @@ const UnitVTable busname_vtable = {
                 "Install\0",
         .private_section = "BusName",
 
-        .no_alias = true,
         .no_instances = true,
 
         .init = busname_init,
index 31b995aa6a6723929f96b48da0e4f9f3aba695fe..1a8c03904cd1d799bca119b3ebf4d36ecd3d0c90 100644 (file)
@@ -3612,7 +3612,7 @@ static int load_from_path(Unit *u, const char *path) {
                 /* Hmm, no suitable file found? */
                 return 0;
 
-        if (UNIT_VTABLE(u)->no_alias && set_size(symlink_names) > 1) {
+        if (!unit_type_may_alias(u->type) && set_size(symlink_names) > 1) {
                 log_unit_warning(u, "Unit type of %s does not support alias names, refusing loading via symlink.", u->id);
                 return -ELOOP;
         }
index cc07873b24bffc000ece43db61a55b3dcdee37f3..adc74c3bea09e9217ff5f37525d963131e6585eb 100644 (file)
@@ -1839,7 +1839,6 @@ const UnitVTable mount_vtable = {
                 "Install\0",
         .private_section = "Mount",
 
-        .no_alias = true,
         .no_instances = true,
 
         .init = mount_init,
index 7078d1f7e90b623c2425d96d72c63b22a3b7a60a..3915e5c88c62b3b20bc4ace5dc6c4975a9772caa 100644 (file)
@@ -569,7 +569,6 @@ const UnitVTable scope_vtable = {
                 "Install\0",
         .private_section = "Scope",
 
-        .no_alias = true,
         .no_instances = true,
         .can_transient = true,
 
index 63a77c9bca74507c2c6633a767966d594ae33677..96c7c745984a209394f1942061ec335dabadc2f2 100644 (file)
@@ -309,7 +309,6 @@ const UnitVTable slice_vtable = {
                 "Install\0",
         .private_section = "Slice",
 
-        .no_alias = true,
         .no_instances = true,
         .can_transient = true,
 
index d8802470d262cd8f465671f0d3d435ce909d07e1..f486a44cf5630ec757aeab9836de4749c8f24399 100644 (file)
@@ -1465,7 +1465,6 @@ const UnitVTable swap_vtable = {
                 "Install\0",
         .private_section = "Swap",
 
-        .no_alias = true,
         .no_instances = true,
 
         .init = swap_init,
index 4a129ffd5e92b37373fe636635199bf8c5d5fa4a..0313ee2ad3ff77c11c6199a3e761bed6bf42d119 100644 (file)
@@ -202,7 +202,7 @@ int unit_add_name(Unit *u, const char *text) {
         if (u->type != _UNIT_TYPE_INVALID && !u->instance != !i)
                 return -EINVAL;
 
-        if (unit_vtable[t]->no_alias && !set_isempty(u->names))
+        if (!unit_type_may_alias(t) && !set_isempty(u->names))
                 return -EEXIST;
 
         if (hashmap_size(u->manager->units) >= MANAGER_MAX_NAMES)
@@ -720,7 +720,7 @@ int unit_merge(Unit *u, Unit *other) {
         if (!u->instance != !other->instance)
                 return -EINVAL;
 
-        if (UNIT_VTABLE(u)->no_alias) /* Merging only applies to unit names that support aliases */
+        if (!unit_type_may_alias(u->type)) /* Merging only applies to unit names that support aliases */
                 return -EEXIST;
 
         if (other->load_state != UNIT_STUB &&
index 5909652976a13d114b3a22556c09ad3a10405928..6ac925a185109357bde644b18abf991c84c6d310 100644 (file)
@@ -416,9 +416,6 @@ struct UnitVTable {
         /* The strings to print in status messages */
         UnitStatusMessageFormats status_message_formats;
 
-        /* Can units of this type have multiple names? */
-        bool no_alias:1;
-
         /* Instances make no sense for this type */
         bool no_instances:1;
 
index 931d3e29078f9e075e381f942af349e21c69d74e..b92afbc971fc9925bfbf761bd0edfe214a919ed9 100644 (file)
@@ -68,6 +68,16 @@ typedef struct {
 
 static int unit_file_lookup_state(UnitFileScope scope, const LookupPaths *paths, const char *name, UnitFileState *ret);
 
+bool unit_type_may_alias(UnitType type) {
+        return IN_SET(type,
+                      UNIT_SERVICE,
+                      UNIT_SOCKET,
+                      UNIT_TARGET,
+                      UNIT_DEVICE,
+                      UNIT_TIMER,
+                      UNIT_PATH);
+}
+
 static int in_search_path(const LookupPaths *p, const char *path) {
         _cleanup_free_ char *parent = NULL;
         char **i;
index 4ffc5a21f2914818a30268c01fc590aab06e83a4..8a8bd09c7c3558ea4fcd79fe1dbee0f18c94ced6 100644 (file)
@@ -138,6 +138,8 @@ static inline bool UNIT_FILE_INSTALL_INFO_HAS_ALSO(UnitFileInstallInfo *i) {
         return !strv_isempty(i->also);
 }
 
+bool unit_type_may_alias(UnitType type) _const_;
+
 int unit_file_enable(
                 UnitFileScope scope,
                 bool runtime,