chiark / gitweb /
Make tables for DEFINE_STRING_TABLE_LOOKUP consistent
authorDaniel Mack <zonque@gmail.com>
Fri, 7 Mar 2014 20:38:48 +0000 (21:38 +0100)
committerDaniel Mack <zonque@gmail.com>
Fri, 7 Mar 2014 20:38:48 +0000 (21:38 +0100)
Bring some arrays that are used for DEFINE_STRING_TABLE_LOOKUP() in the
same order than the enums they reference.

Also, pass the corresponding _MAX value to the array initalizer where
appropriate.

src/core/job.c
src/core/path.c
src/core/unit.c
src/journal/journald-server.c
src/login/logind-session.c
src/network/networkd-netdev.c
src/shared/log.c
src/udev/net/ethtool-util.c
src/udev/net/link-config.c

index 9c099c6..8e98bd9 100644 (file)
@@ -1150,9 +1150,9 @@ static const char* const job_mode_table[_JOB_MODE_MAX] = {
         [JOB_REPLACE] = "replace",
         [JOB_REPLACE_IRREVERSIBLY] = "replace-irreversibly",
         [JOB_ISOLATE] = "isolate",
+        [JOB_FLUSH] = "flush",
         [JOB_IGNORE_DEPENDENCIES] = "ignore-dependencies",
         [JOB_IGNORE_REQUIREMENTS] = "ignore-requirements",
-        [JOB_FLUSH] = "flush",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(job_mode, JobMode);
index 1d6c6cc..93c51bb 100644 (file)
@@ -761,16 +761,16 @@ DEFINE_STRING_TABLE_LOOKUP(path_state, PathState);
 static const char* const path_type_table[_PATH_TYPE_MAX] = {
         [PATH_EXISTS] = "PathExists",
         [PATH_EXISTS_GLOB] = "PathExistsGlob",
+        [PATH_DIRECTORY_NOT_EMPTY] = "DirectoryNotEmpty",
         [PATH_CHANGED] = "PathChanged",
         [PATH_MODIFIED] = "PathModified",
-        [PATH_DIRECTORY_NOT_EMPTY] = "DirectoryNotEmpty"
 };
 
 DEFINE_STRING_TABLE_LOOKUP(path_type, PathType);
 
 static const char* const path_result_table[_PATH_RESULT_MAX] = {
         [PATH_SUCCESS] = "success",
-        [PATH_FAILURE_RESOURCES] = "resources"
+        [PATH_FAILURE_RESOURCES] = "resources",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(path_result, PathResult);
index 85250ca..aa723cb 100644 (file)
@@ -3278,9 +3278,9 @@ static const char* const unit_dependency_table[_UNIT_DEPENDENCY_MAX] = {
         [UNIT_TRIGGERED_BY] = "TriggeredBy",
         [UNIT_PROPAGATES_RELOAD_TO] = "PropagatesReloadTo",
         [UNIT_RELOAD_PROPAGATED_FROM] = "ReloadPropagatedFrom",
+        [UNIT_JOINS_NAMESPACE_OF] = "JoinsNamespaceOf",
         [UNIT_REFERENCES] = "References",
         [UNIT_REFERENCED_BY] = "ReferencedBy",
-        [UNIT_JOINS_NAMESPACE_OF] = "JoinsNamespaceOf",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(unit_dependency, UnitDependency);
index 2a90b44..8680650 100644 (file)
@@ -70,7 +70,7 @@
 
 #define RECHECK_AVAILABLE_SPACE_USEC (30*USEC_PER_SEC)
 
-static const char* const storage_table[] = {
+static const char* const storage_table[_STORAGE_MAX] = {
         [STORAGE_AUTO] = "auto",
         [STORAGE_VOLATILE] = "volatile",
         [STORAGE_PERSISTENT] = "persistent",
@@ -80,10 +80,10 @@ static const char* const storage_table[] = {
 DEFINE_STRING_TABLE_LOOKUP(storage, Storage);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_storage, storage, Storage, "Failed to parse storage setting");
 
-static const char* const split_mode_table[] = {
-        [SPLIT_NONE] = "none",
+static const char* const split_mode_table[_SPLIT_MAX] = {
+        [SPLIT_LOGIN] = "login",
         [SPLIT_UID] = "uid",
-        [SPLIT_LOGIN] = "login"
+        [SPLIT_NONE] = "none",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(split_mode, SplitMode);
index 3700522..33ab09e 100644 (file)
@@ -1115,10 +1115,10 @@ static const char* const session_state_table[_SESSION_STATE_MAX] = {
 DEFINE_STRING_TABLE_LOOKUP(session_state, SessionState);
 
 static const char* const session_type_table[_SESSION_TYPE_MAX] = {
+        [SESSION_UNSPECIFIED] = "unspecified",
         [SESSION_TTY] = "tty",
         [SESSION_X11] = "x11",
         [SESSION_WAYLAND] = "wayland",
-        [SESSION_UNSPECIFIED] = "unspecified",
 };
 
 DEFINE_STRING_TABLE_LOOKUP(session_type, SessionType);
index 9f580ae..5796032 100644 (file)
@@ -28,7 +28,7 @@
 
 #define VLANID_MAX 4094
 
-static const char* const netdev_kind_table[] = {
+static const char* const netdev_kind_table[_NETDEV_KIND_MAX] = {
         [NETDEV_KIND_BRIDGE] = "bridge",
         [NETDEV_KIND_BOND] = "bond",
         [NETDEV_KIND_VLAN] = "vlan",
@@ -38,7 +38,7 @@ static const char* const netdev_kind_table[] = {
 DEFINE_STRING_TABLE_LOOKUP(netdev_kind, NetDevKind);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_netdev_kind, netdev_kind, NetDevKind, "Failed to parse netdev kind");
 
-static const char* const macvlan_mode_table[] = {
+static const char* const macvlan_mode_table[_NETDEV_MACVLAN_MODE_MAX] = {
         [NETDEV_MACVLAN_MODE_PRIVATE] = "private",
         [NETDEV_MACVLAN_MODE_VEPA] = "vepa",
         [NETDEV_MACVLAN_MODE_BRIDGE] = "bridge",
index 8d1067c..5ea1e3a 100644 (file)
@@ -967,7 +967,7 @@ bool log_on_console(void) {
         return syslog_fd < 0 && kmsg_fd < 0 && journal_fd < 0;
 }
 
-static const char *const log_target_table[] = {
+static const char *const log_target_table[_LOG_TARGET_MAX] = {
         [LOG_TARGET_CONSOLE] = "console",
         [LOG_TARGET_KMSG] = "kmsg",
         [LOG_TARGET_JOURNAL] = "journal",
index 6346530..3ec245e 100644 (file)
@@ -31,7 +31,7 @@
 #include "log.h"
 #include "conf-parser.h"
 
-static const char* const duplex_table[] = {
+static const char* const duplex_table[_DUP_MAX] = {
         [DUP_FULL] = "full",
         [DUP_HALF] = "half"
 };
@@ -39,7 +39,7 @@ static const char* const duplex_table[] = {
 DEFINE_STRING_TABLE_LOOKUP(duplex, Duplex);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_duplex, duplex, Duplex, "Failed to parse duplex setting");
 
-static const char* const wol_table[] = {
+static const char* const wol_table[_WOL_MAX] = {
         [WOL_PHY] = "phy",
         [WOL_MAGIC] = "magic",
         [WOL_OFF] = "off"
index 05225e0..d3f1aff 100644 (file)
@@ -466,7 +466,7 @@ int link_get_driver(link_config_ctx *ctx, struct udev_device *device, char **ret
         return 0;
 }
 
-static const char* const mac_policy_table[] = {
+static const char* const mac_policy_table[_MACPOLICY_MAX] = {
         [MACPOLICY_PERSISTENT] = "persistent",
         [MACPOLICY_RANDOM] = "random"
 };
@@ -474,7 +474,7 @@ static const char* const mac_policy_table[] = {
 DEFINE_STRING_TABLE_LOOKUP(mac_policy, MACPolicy);
 DEFINE_CONFIG_PARSE_ENUM(config_parse_mac_policy, mac_policy, MACPolicy, "Failed to parse MAC address policy");
 
-static const char* const name_policy_table[] = {
+static const char* const name_policy_table[_NAMEPOLICY_MAX] = {
         [NAMEPOLICY_DATABASE] = "database",
         [NAMEPOLICY_ONBOARD] = "onboard",
         [NAMEPOLICY_SLOT] = "slot",