chiark / gitweb /
unit: Move UnitType definitions from core/unit.c to shared/unit-name.c
[elogind.git] / src / shared / unit-name.c
index 4b52f7bc53a581a0944b92e24e27b6068494ee08..67a760ace68afef2d76a6595dce29f8f3f54b5d5 100644 (file)
         "ABCDEFGHIJKLMNOPQRSTUVWXYZ"            \
         ":-_.\\"
 
+static const char* const unit_type_table[_UNIT_TYPE_MAX] = {
+        [UNIT_SERVICE] = "service",
+        [UNIT_SOCKET] = "socket",
+        [UNIT_TARGET] = "target",
+        [UNIT_DEVICE] = "device",
+        [UNIT_MOUNT] = "mount",
+        [UNIT_AUTOMOUNT] = "automount",
+        [UNIT_SNAPSHOT] = "snapshot",
+        [UNIT_TIMER] = "timer",
+        [UNIT_SWAP] = "swap",
+        [UNIT_PATH] = "path",
+};
+
+DEFINE_STRING_TABLE_LOOKUP(unit_type, UnitType);
+
 bool unit_name_is_valid_no_type(const char *n, bool template_ok) {
         const char *e, *i, *at;