]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
install: include full type name in special UnitFilePresetMode values 25002/head
authorLennart Poettering <lennart@poettering.net>
Fri, 14 Oct 2022 09:12:19 +0000 (11:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Fri, 14 Oct 2022 09:41:32 +0000 (11:41 +0200)
Typically the _MAX and _INVALID special enum values use the full type as
prefix, even if the actual values of the enum might not. Let's follow
this rule here too.

src/shared/install.c
src/shared/install.h
src/systemctl/systemctl.c
src/test/test-tables.c

index 43aa865b0eab1644c51621c687087ef9d7dd9103..53b5aefbe6ccb8638df2d28f2376b65b989dcf77 100644 (file)
@@ -3471,7 +3471,7 @@ int unit_file_preset(
 
         assert(scope >= 0);
         assert(scope < _LOOKUP_SCOPE_MAX);
-        assert(mode < _UNIT_FILE_PRESET_MAX);
+        assert(mode < _UNIT_FILE_PRESET_MODE_MAX);
 
         r = lookup_paths_init(&lp, scope, 0, root_dir);
         if (r < 0)
@@ -3510,7 +3510,7 @@ int unit_file_preset_all(
 
         assert(scope >= 0);
         assert(scope < _LOOKUP_SCOPE_MAX);
-        assert(mode < _UNIT_FILE_PRESET_MAX);
+        assert(mode < _UNIT_FILE_PRESET_MODE_MAX);
 
         r = lookup_paths_init(&lp, scope, 0, root_dir);
         if (r < 0)
@@ -3674,7 +3674,7 @@ static const char* const install_change_type_table[_INSTALL_CHANGE_TYPE_MAX] = {
 
 DEFINE_STRING_TABLE_LOOKUP(install_change_type, InstallChangeType);
 
-static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MAX] = {
+static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MODE_MAX] = {
         [UNIT_FILE_PRESET_FULL]         = "full",
         [UNIT_FILE_PRESET_ENABLE_ONLY]  = "enable-only",
         [UNIT_FILE_PRESET_DISABLE_ONLY] = "disable-only",
index 302b52733a4a950934edd9ecae399df2dcac3e7f..d13b143e4eb3abd0426444a7ba3727c393a45744 100644 (file)
@@ -22,8 +22,8 @@ enum UnitFilePresetMode {
         UNIT_FILE_PRESET_FULL,
         UNIT_FILE_PRESET_ENABLE_ONLY,
         UNIT_FILE_PRESET_DISABLE_ONLY,
-        _UNIT_FILE_PRESET_MAX,
-        _UNIT_FILE_PRESET_INVALID = -EINVAL,
+        _UNIT_FILE_PRESET_MODE_MAX,
+        _UNIT_FILE_PRESET_MODE_INVALID = -EINVAL,
 };
 
 enum InstallChangeType {
index 430f59d4963180fee27054ee9fa81301805bfbf0..5858c3f6d34d9fb6c85bd92cc043a8ef8b52626a 100644 (file)
@@ -838,7 +838,7 @@ static int systemctl_parse_argv(int argc, char *argv[]) {
 
                 case ARG_PRESET_MODE:
                         if (streq(optarg, "help")) {
-                                DUMP_STRING_TABLE(unit_file_preset_mode, UnitFilePresetMode, _UNIT_FILE_PRESET_MAX);
+                                DUMP_STRING_TABLE(unit_file_preset_mode, UnitFilePresetMode, _UNIT_FILE_PRESET_MODE_MAX);
                                 return 0;
                         }
 
index 36965b334b59f8206c72cbe1abd0ca2f939c4ed8..30ca1871cb95635b856bfe8c86ddee621e850c81 100644 (file)
@@ -117,7 +117,7 @@ int main(int argc, char **argv) {
         test_table(unit_active_state, UNIT_ACTIVE_STATE);
         test_table(unit_dependency, UNIT_DEPENDENCY);
         test_table(install_change_type, INSTALL_CHANGE_TYPE);
-        test_table(unit_file_preset_mode, UNIT_FILE_PRESET);
+        test_table(unit_file_preset_mode, UNIT_FILE_PRESET_MODE);
         test_table(unit_file_state, UNIT_FILE_STATE);
         test_table(unit_load_state, UNIT_LOAD_STATE);
         test_table(unit_type, UNIT_TYPE);