install: include full type name in special UnitFilePresetMode values

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.
This commit is contained in:
Lennart Poettering
2022-10-14 11:41:32 +02:00
parent f8662fee2f
commit b364c4de62
4 changed files with 7 additions and 7 deletions
+3 -3
View 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",
+2 -2
View 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 {
+1 -1
View 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;
}
+1 -1
View 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);