diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-09-18 18:00:41 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2022-10-13 19:44:47 +0200 |
commit | 1308f72e831dcb634e7798c125611808f8b76cff (patch) | |
tree | cbbe805b07a6a3dfde473043a592855fd0124e87 | |
parent | shared/install: rename UnitFileInstallInfo.type to .install_mode (diff) | |
download | systemd-1308f72e831dcb634e7798c125611808f8b76cff.tar.xz systemd-1308f72e831dcb634e7798c125611808f8b76cff.zip |
shared/install: rename 'unit_file_change_type' to 'install_change' + followups
We had an anonymous enum with values called UNIT_FILE_…, which could easily be
confused with UNIT_FILE_… from UnitFileFlags enum. This commit renames the enum
values and also the variables which refer to them.
-rw-r--r-- | src/core/dbus-manager.c | 14 | ||||
-rw-r--r-- | src/shared/bus-unit-util.c | 2 | ||||
-rw-r--r-- | src/shared/install.c | 94 | ||||
-rw-r--r-- | src/shared/install.h | 28 | ||||
-rw-r--r-- | src/systemctl/systemctl-is-enabled.c | 2 | ||||
-rw-r--r-- | src/test/test-install-root.c | 98 | ||||
-rw-r--r-- | src/test/test-install.c | 4 | ||||
-rw-r--r-- | src/test/test-tables.c | 2 |
8 files changed, 123 insertions, 121 deletions
diff --git a/src/core/dbus-manager.c b/src/core/dbus-manager.c index 73810833ca..240408f342 100644 --- a/src/core/dbus-manager.c +++ b/src/core/dbus-manager.c @@ -2134,9 +2134,9 @@ static int install_error( for (size_t i = 0; i < n_changes; i++) - switch (changes[i].type_or_errno) { + switch (changes[i].change_or_errno) { - case 0 ... _UNIT_FILE_CHANGE_TYPE_MAX: /* not errors */ + case 0 ... _INSTALL_CHANGE_MAX: /* not errors */ continue; case -EEXIST: @@ -2178,8 +2178,8 @@ static int install_error( goto found; default: - assert(changes[i].type_or_errno < 0); /* other errors */ - r = sd_bus_error_set_errnof(error, changes[i].type_or_errno, "File %s: %m", changes[i].path); + assert(changes[i].change_or_errno < 0); /* other errors */ + r = sd_bus_error_set_errnof(error, changes[i].change_or_errno, "File %s: %m", changes[i].path); goto found; } @@ -2224,14 +2224,14 @@ static int reply_install_changes_and_free( for (size_t i = 0; i < n_changes; i++) { - if (changes[i].type_or_errno < 0) { + if (changes[i].change_or_errno < 0) { bad = true; continue; } r = sd_bus_message_append( reply, "(sss)", - unit_file_change_type_to_string(changes[i].type_or_errno), + install_change_to_string(changes[i].change_or_errno), changes[i].path, changes[i].source); if (r < 0) @@ -2610,7 +2610,7 @@ static int method_get_unit_file_links(sd_bus_message *message, void *userdata, s return log_error_errno(r, "Failed to get file links for %s: %m", name); for (i = 0; i < n_changes; i++) - if (changes[i].type_or_errno == UNIT_FILE_UNLINK) { + if (changes[i].change_or_errno == INSTALL_CHANGE_UNLINK) { r = sd_bus_message_append(reply, "s", changes[i].path); if (r < 0) return r; diff --git a/src/shared/bus-unit-util.c b/src/shared/bus-unit-util.c index 9b46b732ff..2962126b0f 100644 --- a/src/shared/bus-unit-util.c +++ b/src/shared/bus-unit-util.c @@ -2684,7 +2684,7 @@ int bus_deserialize_and_dump_unit_file_changes(sd_bus_message *m, bool quiet, In while ((r = sd_bus_message_read(m, "(sss)", &type, &path, &source)) > 0) { /* We expect only "success" changes to be sent over the bus. Hence, reject anything negative. */ - int ch = unit_file_change_type_from_string(type); + int ch = install_change_from_string(type); if (ch < 0) { log_notice_errno(ch, "Manager reported unknown change type \"%s\" for path \"%s\", ignoring.", type, path); diff --git a/src/shared/install.c b/src/shared/install.c index 31894b882e..6dd8fc7d84 100644 --- a/src/shared/install.c +++ b/src/shared/install.c @@ -268,7 +268,7 @@ static const char* config_path_from_flags(const LookupPaths *lp, UnitFileFlags f int install_changes_add( InstallChange **changes, size_t *n_changes, - int type_or_errno, /* UNIT_FILE_SYMLINK, _UNLINK, _IS_MASKED, _IS_DANGLING if positive or errno if negative */ + int change_or_errno, /* INSTALL_CHANGE_SYMLINK, _UNLINK, _IS_MASKED, _IS_DANGLING, … if positive or errno if negative */ const char *path, const char *source) { @@ -277,10 +277,10 @@ int install_changes_add( assert(!changes == !n_changes); - if (type_or_errno >= 0) - assert(type_or_errno < _UNIT_FILE_CHANGE_TYPE_MAX); + if (change_or_errno >= 0) + assert(change_or_errno < _INSTALL_CHANGE_MAX); else - assert(type_or_errno >= -ERRNO_MAX); + assert(change_or_errno >= -ERRNO_MAX); if (!changes) return 0; @@ -307,7 +307,7 @@ int install_changes_add( } c[(*n_changes)++] = (InstallChange) { - .type_or_errno = type_or_errno, + .change_or_errno = change_or_errno, .path = TAKE_PTR(p), .source = TAKE_PTR(s), }; @@ -334,92 +334,92 @@ void install_changes_dump(int r, const char *verb, const InstallChange *changes, assert(verb || r >= 0); for (size_t i = 0; i < n_changes; i++) { - assert(verb || changes[i].type_or_errno >= 0); + assert(verb || changes[i].change_or_errno >= 0); - switch (changes[i].type_or_errno) { - case UNIT_FILE_SYMLINK: + switch (changes[i].change_or_errno) { + case INSTALL_CHANGE_SYMLINK: if (!quiet) log_info("Created symlink %s %s %s.", changes[i].path, special_glyph(SPECIAL_GLYPH_ARROW_RIGHT), changes[i].source); break; - case UNIT_FILE_UNLINK: + case INSTALL_CHANGE_UNLINK: if (!quiet) log_info("Removed \"%s\".", changes[i].path); break; - case UNIT_FILE_IS_MASKED: + case INSTALL_CHANGE_IS_MASKED: if (!quiet) log_info("Unit %s is masked, ignoring.", changes[i].path); break; - case UNIT_FILE_IS_DANGLING: + case INSTALL_CHANGE_IS_DANGLING: if (!quiet) log_info("Unit %s is an alias to a unit that is not present, ignoring.", changes[i].path); break; - case UNIT_FILE_DESTINATION_NOT_PRESENT: + case INSTALL_CHANGE_DESTINATION_NOT_PRESENT: if (!quiet) log_warning("Unit %s is added as a dependency to a non-existent unit %s.", changes[i].source, changes[i].path); break; - case UNIT_FILE_AUXILIARY_FAILED: + case INSTALL_CHANGE_AUXILIARY_FAILED: if (!quiet) log_warning("Failed to enable auxiliary unit %s, ignoring.", changes[i].source); break; case -EEXIST: if (changes[i].source) - err = log_error_errno(changes[i].type_or_errno, + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, file \"%s\" already exists and is a symlink to \"%s\".", verb, changes[i].path, changes[i].source); else - err = log_error_errno(changes[i].type_or_errno, + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, file \"%s\" already exists.", verb, changes[i].path); break; case -ERFKILL: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, unit %s is masked.", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, unit %s is masked.", verb, changes[i].path); break; case -EADDRNOTAVAIL: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, unit %s is transient or generated.", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, unit %s is transient or generated.", verb, changes[i].path); break; case -EBADSLT: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, invalid specifier in \"%s\".", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, invalid specifier in \"%s\".", verb, changes[i].path); break; case -EIDRM: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s %s, destination unit %s is a non-template unit.", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s %s, destination unit %s is a non-template unit.", verb, changes[i].source, changes[i].path); break; case -EUCLEAN: - err = log_error_errno(changes[i].type_or_errno, + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, \"%s\" is not a valid unit name.", verb, changes[i].path); break; case -ELOOP: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, refusing to operate on linked unit file %s.", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, refusing to operate on linked unit file %s.", verb, changes[i].path); break; case -EXDEV: if (changes[i].source) - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, cannot alias %s as %s.", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, cannot alias %s as %s.", verb, changes[i].source, changes[i].path); else - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, invalid unit reference \"%s\".", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, invalid unit reference \"%s\".", verb, changes[i].path); break; case -ENOENT: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, unit %s does not exist.", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, unit %s does not exist.", verb, changes[i].path); break; case -EUNATCH: - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, cannot resolve specifiers in \"%s\".", + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, cannot resolve specifiers in \"%s\".", verb, changes[i].path); break; default: - assert(changes[i].type_or_errno < 0); - err = log_error_errno(changes[i].type_or_errno, "Failed to %s unit, file \"%s\": %m", + assert(changes[i].change_or_errno < 0); + err = log_error_errno(changes[i].change_or_errno, "Failed to %s unit, file \"%s\": %m", verb, changes[i].path); } } @@ -508,7 +508,7 @@ static int create_symlink( (void) mkdir_parents_label(new_path, 0755); if (symlink(old_path, new_path) >= 0) { - install_changes_add(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path); + install_changes_add(changes, n_changes, INSTALL_CHANGE_SYMLINK, new_path, old_path); return 1; } @@ -544,8 +544,8 @@ static int create_symlink( return r; } - install_changes_add(changes, n_changes, UNIT_FILE_UNLINK, new_path, NULL); - install_changes_add(changes, n_changes, UNIT_FILE_SYMLINK, new_path, old_path); + install_changes_add(changes, n_changes, INSTALL_CHANGE_UNLINK, new_path, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_SYMLINK, new_path, old_path); return 1; } @@ -698,7 +698,7 @@ static int remove_marked_symlinks_fd( (void) rmdir_parents(p, config_path); } - install_changes_add(changes, n_changes, UNIT_FILE_UNLINK, p, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_UNLINK, p, NULL); /* Now, remember the full path (but with the root prefix removed) of * the symlink we just removed, and remove any symlinks to it, too. */ @@ -2014,7 +2014,7 @@ static int install_info_symlink_wants( r = q; if (unit_file_exists(scope, lp, dst) == 0) - install_changes_add(changes, n_changes, UNIT_FILE_DESTINATION_NOT_PRESENT, dst, info->path); + install_changes_add(changes, n_changes, INSTALL_CHANGE_DESTINATION_NOT_PRESENT, dst, info->path); } return r; @@ -2123,7 +2123,7 @@ static int install_context_apply( q = install_info_traverse(ctx, lp, i, flags, NULL); if (q < 0) { if (i->auxiliary) { - q = install_changes_add(changes, n_changes, UNIT_FILE_AUXILIARY_FAILED, NULL, i->name); + q = install_changes_add(changes, n_changes, INSTALL_CHANGE_AUXILIARY_FAILED, NULL, i->name); if (q < 0) return q; continue; @@ -2136,7 +2136,7 @@ static int install_context_apply( /* We can attempt to process a masked unit when a different unit * that we were processing specifies it in Also=. */ if (i->install_mode == INSTALL_MODE_MASKED) { - install_changes_add(changes, n_changes, UNIT_FILE_IS_MASKED, i->path, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_IS_MASKED, i->path, NULL); if (r >= 0) /* Assume that something *could* have been enabled here, * avoid "empty [Install] section" warning. */ @@ -2192,7 +2192,7 @@ static int install_context_mark_for_removal( r = install_info_traverse(ctx, lp, i, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, NULL); if (r == -ENOLINK) { log_debug_errno(r, "Name %s leads to a dangling symlink, removing name.", i->name); - install_changes_add(changes, n_changes, UNIT_FILE_IS_DANGLING, i->path ?: i->name, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_IS_DANGLING, i->path ?: i->name, NULL); } else if (r == -ENOENT) { if (i->auxiliary) /* some unit specified in Also= or similar is missing */ @@ -2207,7 +2207,7 @@ static int install_context_mark_for_removal( install_changes_add(changes, n_changes, r, i->path ?: i->name, NULL); } else if (i->install_mode == INSTALL_MODE_MASKED) { log_debug("Unit file %s is masked, ignoring.", i->name); - install_changes_add(changes, n_changes, UNIT_FILE_IS_MASKED, i->path ?: i->name, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_IS_MASKED, i->path ?: i->name, NULL); continue; } else if (i->install_mode != INSTALL_MODE_REGULAR) { log_debug("Unit %s has install mode %s, ignoring.", @@ -2345,7 +2345,7 @@ int unit_file_unmask( continue; } - install_changes_add(changes, n_changes, UNIT_FILE_UNLINK, path, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_UNLINK, path, NULL); rp = skip_root(lp.root_dir, path); q = mark_symlink_for_removal(&remove_symlinks_to, rp ?: path); @@ -2590,10 +2590,10 @@ int unit_file_revert( if (!t) return -ENOMEM; - install_changes_add(changes, n_changes, UNIT_FILE_UNLINK, t, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_UNLINK, t, NULL); } - install_changes_add(changes, n_changes, UNIT_FILE_UNLINK, *i, NULL); + install_changes_add(changes, n_changes, INSTALL_CHANGE_UNLINK, *i, NULL); rp = skip_root(lp.root_dir, *i); q = mark_symlink_for_removal(&remove_symlinks_to, rp ?: *i); @@ -3651,16 +3651,16 @@ static const char* const unit_file_state_table[_UNIT_FILE_STATE_MAX] = { DEFINE_STRING_TABLE_LOOKUP(unit_file_state, UnitFileState); -static const char* const unit_file_change_type_table[_UNIT_FILE_CHANGE_TYPE_MAX] = { - [UNIT_FILE_SYMLINK] = "symlink", - [UNIT_FILE_UNLINK] = "unlink", - [UNIT_FILE_IS_MASKED] = "masked", - [UNIT_FILE_IS_DANGLING] = "dangling", - [UNIT_FILE_DESTINATION_NOT_PRESENT] = "destination not present", - [UNIT_FILE_AUXILIARY_FAILED] = "auxiliary unit failed", +static const char* const install_change_table[_INSTALL_CHANGE_MAX] = { + [INSTALL_CHANGE_SYMLINK] = "symlink", + [INSTALL_CHANGE_UNLINK] = "unlink", + [INSTALL_CHANGE_IS_MASKED] = "masked", + [INSTALL_CHANGE_IS_DANGLING] = "dangling", + [INSTALL_CHANGE_DESTINATION_NOT_PRESENT] = "destination not present", + [INSTALL_CHANGE_AUXILIARY_FAILED] = "auxiliary unit failed", }; -DEFINE_STRING_TABLE_LOOKUP(unit_file_change_type, int); +DEFINE_STRING_TABLE_LOOKUP(install_change, int); static const char* const unit_file_preset_mode_table[_UNIT_FILE_PRESET_MAX] = { [UNIT_FILE_PRESET_FULL] = "full", diff --git a/src/shared/install.h b/src/shared/install.h index af8e460b53..dfc92d5623 100644 --- a/src/shared/install.h +++ b/src/shared/install.h @@ -29,14 +29,14 @@ enum UnitFilePresetMode { /* This enum type is anonymous, since we usually store it in an 'int', as we overload it with negative errno * values. */ enum { - UNIT_FILE_SYMLINK, - UNIT_FILE_UNLINK, - UNIT_FILE_IS_MASKED, - UNIT_FILE_IS_DANGLING, - UNIT_FILE_DESTINATION_NOT_PRESENT, - UNIT_FILE_AUXILIARY_FAILED, - _UNIT_FILE_CHANGE_TYPE_MAX, - _UNIT_FILE_CHANGE_TYPE_INVALID = -EINVAL, + INSTALL_CHANGE_SYMLINK, + INSTALL_CHANGE_UNLINK, + INSTALL_CHANGE_IS_MASKED, + INSTALL_CHANGE_IS_DANGLING, + INSTALL_CHANGE_DESTINATION_NOT_PRESENT, + INSTALL_CHANGE_AUXILIARY_FAILED, + _INSTALL_CHANGE_MAX, + _INSTALL_CHANGE_INVALID = -EINVAL, }; enum UnitFileFlags { @@ -48,18 +48,20 @@ enum UnitFileFlags { _UNIT_FILE_FLAGS_MASK_PUBLIC = UNIT_FILE_RUNTIME|UNIT_FILE_PORTABLE|UNIT_FILE_FORCE, }; -/* type can either one of the UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK, … listed above, or a negative errno value. +/* change_or_errno can be either one of the INSTALL_CHANGE_SYMLINK, INSTALL_CHANGE_UNLINK, … listed above, or + * a negative errno value. + * * If source is specified, it should be the contents of the path symlink. In case of an error, source should * be the existing symlink contents or NULL. */ struct InstallChange { - int type_or_errno; /* UNIT_FILE_SYMLINK, … if positive, errno if negative */ + int change_or_errno; /* INSTALL_CHANGE_SYMLINK, … if positive, errno if negative */ char *path; char *source; }; static inline bool install_changes_have_modification(const InstallChange* changes, size_t n_changes) { for (size_t i = 0; i < n_changes; i++) - if (IN_SET(changes[i].type_or_errno, UNIT_FILE_SYMLINK, UNIT_FILE_UNLINK)) + if (IN_SET(changes[i].change_or_errno, INSTALL_CHANGE_SYMLINK, INSTALL_CHANGE_UNLINK)) return true; return false; } @@ -217,8 +219,8 @@ const char *unit_file_state_to_string(UnitFileState s) _const_; UnitFileState unit_file_state_from_string(const char *s) _pure_; /* from_string conversion is unreliable because of the overlap between -EPERM and -1 for error. */ -const char *unit_file_change_type_to_string(int s) _const_; -int unit_file_change_type_from_string(const char *s) _pure_; +const char *install_change_to_string(int s) _const_; +int install_change_from_string(const char *s) _pure_; const char *unit_file_preset_mode_to_string(UnitFilePresetMode m) _const_; UnitFilePresetMode unit_file_preset_mode_from_string(const char *s) _pure_; diff --git a/src/systemctl/systemctl-is-enabled.c b/src/systemctl/systemctl-is-enabled.c index 074d5084f2..91231fa9d9 100644 --- a/src/systemctl/systemctl-is-enabled.c +++ b/src/systemctl/systemctl-is-enabled.c @@ -23,7 +23,7 @@ static int show_installation_targets_client_side(const char *name) { return log_error_errno(r, "Failed to get file links for %s: %m", name); for (size_t i = 0; i < n_changes; i++) - if (changes[i].type_or_errno == UNIT_FILE_UNLINK) + if (changes[i].change_or_errno == INSTALL_CHANGE_UNLINK) printf(" %s\n", changes[i].path); return 0; diff --git a/src/test/test-install-root.c b/src/test/test-install-root.c index 897061519f..cf9c7f4cd9 100644 --- a/src/test/test-install-root.c +++ b/src/test/test-install-root.c @@ -59,7 +59,7 @@ TEST(basic_mask_and_enable) { assert_se(unit_file_mask(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/dev/null")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service"); assert_se(streq(changes[0].path, p)); @@ -79,7 +79,7 @@ TEST(basic_mask_and_enable) { assert_se(unit_file_unmask(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/a.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); @@ -87,7 +87,7 @@ TEST(basic_mask_and_enable) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) == 1); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service"); assert_se(streq(changes[0].path, p)); @@ -107,7 +107,7 @@ TEST(basic_mask_and_enable) { assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("a.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); @@ -127,7 +127,7 @@ TEST(basic_mask_and_enable) { /* Let's enable this indirectly via a symlink */ assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("d.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/a.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service"); assert_se(streq(changes[0].path, p)); @@ -143,10 +143,10 @@ TEST(basic_mask_and_enable) { assert_se(unit_file_reenable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("b.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/a.service"); assert_se(streq(changes[0].path, p)); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[1].source, "/usr/lib/systemd/system/a.service")); assert_se(streq(changes[1].path, p)); install_changes_free(changes, n_changes); @@ -185,11 +185,11 @@ TEST(basic_mask_and_enable) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("f.service"), &changes, &n_changes) == 1); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/f.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/x.target.wants/f.service"); assert_se(streq(changes[0].path, p)); - assert_se(changes[1].type_or_errno == UNIT_FILE_DESTINATION_NOT_PRESENT); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_DESTINATION_NOT_PRESENT); p = strjoina(root, "/usr/lib/systemd/system/f.service"); assert_se(streq(changes[1].source, p)); assert_se(streq(changes[1].path, "x.target")); @@ -253,7 +253,7 @@ TEST(linked_units) { /* First, let's link the unit into the search path */ assert_se(unit_file_link(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("/opt/linked.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/opt/linked.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); assert_se(streq(changes[0].path, p)); @@ -265,7 +265,7 @@ TEST(linked_units) { /* Let's unlink it from the search path again */ assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); @@ -279,7 +279,7 @@ TEST(linked_units) { p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service"); q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); for (i = 0 ; i < n_changes; i++) { - assert_se(changes[i].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[i].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[i].source, "/opt/linked.service")); if (p && streq(changes[i].path, p)) @@ -301,7 +301,7 @@ TEST(linked_units) { p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked.service"); q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked.service"); for (i = 0; i < n_changes; i++) { - assert_se(changes[i].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[i].change_or_errno == INSTALL_CHANGE_UNLINK); if (p && streq(changes[i].path, p)) p = NULL; @@ -321,7 +321,7 @@ TEST(linked_units) { p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/linked2.service"); q = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/linked2.service"); for (i = 0 ; i < n_changes; i++) { - assert_se(changes[i].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[i].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[i].source, "/opt/linked2.service")); if (p && streq(changes[i].path, p)) @@ -337,7 +337,7 @@ TEST(linked_units) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("linked3.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(startswith(changes[0].path, root)); assert_se(endswith(changes[0].path, "linked3.service")); assert_se(streq(changes[0].source, "/opt/linked3.service")); @@ -361,7 +361,7 @@ TEST(default) { assert_se(unit_file_set_default(LOOKUP_SCOPE_SYSTEM, 0, root, "idontexist.target", &changes, &n_changes) == -ENOENT); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == -ENOENT); + assert_se(changes[0].change_or_errno == -ENOENT); assert_se(streq_ptr(changes[0].path, "idontexist.target")); install_changes_free(changes, n_changes); changes = NULL; n_changes = 0; @@ -370,7 +370,7 @@ TEST(default) { assert_se(unit_file_set_default(LOOKUP_SCOPE_SYSTEM, 0, root, "test-default.target", &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/test-default-real.target")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR "/" SPECIAL_DEFAULT_TARGET); assert_se(streq(changes[0].path, p)); @@ -400,7 +400,7 @@ TEST(add_dependency) { assert_se(unit_file_add_dependency(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("add-dependency-test-service.service"), "add-dependency-test-target.target", UNIT_WANTS, &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/real-add-dependency-test-service.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/real-add-dependency-test-target.target.wants/real-add-dependency-test-service.service"); assert_se(streq(changes[0].path, p)); @@ -441,7 +441,7 @@ TEST(template_enable) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@def.service"); assert_se(streq(changes[0].path, p)); @@ -457,7 +457,7 @@ TEST(template_enable) { assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); changes = NULL; n_changes = 0; @@ -472,7 +472,7 @@ TEST(template_enable) { log_info("== %s with template@foo.service enabled ==", __func__); assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@foo.service"); assert_se(streq(changes[0].path, p)); @@ -488,7 +488,7 @@ TEST(template_enable) { assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template@foo.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); changes = NULL; n_changes = 0; @@ -505,7 +505,7 @@ TEST(template_enable) { log_info("== %s with template-symlink@quux.service enabled ==", __func__); assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("template-symlink@quux.service"), &changes, &n_changes) >= 0); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/template@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/template@quux.service"); assert_se(streq(changes[0].path, p)); @@ -551,7 +551,7 @@ TEST(indirect) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/indirectb.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service"); assert_se(streq(changes[0].path, p)); @@ -564,7 +564,7 @@ TEST(indirect) { assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("indirectc.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/indirectb.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); @@ -603,7 +603,7 @@ TEST(preset_and_list) { assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/preset-yes.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service"); assert_se(streq(changes[0].path, p)); @@ -615,7 +615,7 @@ TEST(preset_and_list) { assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("preset-yes.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/preset-yes.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); @@ -640,11 +640,11 @@ TEST(preset_and_list) { for (i = 0; i < n_changes; i++) { - if (changes[i].type_or_errno == UNIT_FILE_SYMLINK) { + if (changes[i].change_or_errno == INSTALL_CHANGE_SYMLINK) { assert_se(streq(changes[i].source, "/usr/lib/systemd/system/preset-yes.service")); assert_se(streq(changes[i].path, p)); } else - assert_se(changes[i].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[i].change_or_errno == INSTALL_CHANGE_UNLINK); } install_changes_free(changes, n_changes); @@ -705,7 +705,7 @@ TEST(revert) { /* Revert the override file */ assert_se(unit_file_revert(LOOKUP_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); changes = NULL; n_changes = 0; @@ -716,11 +716,11 @@ TEST(revert) { /* Revert the dropin file */ assert_se(unit_file_revert(LOOKUP_SCOPE_SYSTEM, root, STRV_MAKE("xx.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); assert_se(streq(changes[0].path, p)); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/xx.service.d"); - assert_se(changes[1].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_UNLINK); assert_se(streq(changes[1].path, p)); install_changes_free(changes, n_changes); changes = NULL; n_changes = 0; @@ -756,7 +756,7 @@ TEST(preset_order) { assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("prefix-1.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/prefix-1.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/prefix-1.service"); assert_se(streq(changes[0].path, p)); @@ -864,8 +864,8 @@ TEST(with_dropin) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-1.service"), &changes, &n_changes) == 1); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1.service")); assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1.service"); @@ -878,8 +878,8 @@ TEST(with_dropin) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2.service"), &changes, &n_changes) == 1); assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-2.service", &state) >= 0 && state == UNIT_FILE_ENABLED); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service")); assert_se(streq(changes[1].source, SYSTEM_CONFIG_UNIT_DIR"/with-dropin-2.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2.service"); @@ -892,8 +892,8 @@ TEST(with_dropin) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3.service"), &changes, &n_changes) == 1); assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3.service")); assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-3.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3.service"); @@ -906,8 +906,8 @@ TEST(with_dropin) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-4a.service"), &changes, &n_changes) == 2); assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "with-dropin-3.service", &state) >= 0 && state == UNIT_FILE_ENABLED); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-4a.service")); assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-4b.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-4a.service"); @@ -973,8 +973,8 @@ TEST(with_dropin_template) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-1@instance-1.service"), &changes, &n_changes) == 1); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-1@.service")); assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-1@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-1@instance-1.service"); @@ -986,8 +986,8 @@ TEST(with_dropin_template) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-1.service"), &changes, &n_changes) == 1); assert_se(n_changes == 2); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); - assert_se(changes[1].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); + assert_se(changes[1].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service")); assert_se(streq(changes[1].source, "/usr/lib/systemd/system/with-dropin-2@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-1.service"); @@ -999,7 +999,7 @@ TEST(with_dropin_template) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-2@instance-2.service"), &changes, &n_changes) == 1); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-2@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-2@instance-2.service"); assert_se(streq(changes[0].path, p)); @@ -1008,7 +1008,7 @@ TEST(with_dropin_template) { assert_se(unit_file_enable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("with-dropin-3@.service"), &changes, &n_changes) == 1); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); assert_se(streq(changes[0].source, "/usr/lib/systemd/system/with-dropin-3@.service")); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/with-dropin-3@instance-2.service"); assert_se(streq(changes[0].path, p)); @@ -1049,7 +1049,7 @@ TEST(preset_multiple_instances) { assert_se(unit_file_preset(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), UNIT_FILE_PRESET_FULL, &changes, &n_changes) >= 0); assert_se(unit_file_get_state(LOOKUP_SCOPE_SYSTEM, root, "foo@bar0.service", &state) >= 0 && state == UNIT_FILE_ENABLED); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_SYMLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_SYMLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); @@ -1057,7 +1057,7 @@ TEST(preset_multiple_instances) { assert_se(unit_file_disable(LOOKUP_SCOPE_SYSTEM, 0, root, STRV_MAKE("foo@bar0.service"), &changes, &n_changes) >= 0); assert_se(n_changes == 1); - assert_se(changes[0].type_or_errno == UNIT_FILE_UNLINK); + assert_se(changes[0].change_or_errno == INSTALL_CHANGE_UNLINK); p = strjoina(root, SYSTEM_CONFIG_UNIT_DIR"/multi-user.target.wants/foo@bar0.service"); assert_se(streq(changes[0].path, p)); install_changes_free(changes, n_changes); diff --git a/src/test/test-install.c b/src/test/test-install.c index 95aeb77183..309b18c535 100644 --- a/src/test/test-install.c +++ b/src/test/test-install.c @@ -12,9 +12,9 @@ static void dump_changes(InstallChange *c, unsigned n) { assert_se(n == 0 || c); for (i = 0; i < n; i++) { - if (c[i].type_or_errno == UNIT_FILE_UNLINK) + if (c[i].change_or_errno == INSTALL_CHANGE_UNLINK) printf("rm '%s'\n", c[i].path); - else if (c[i].type_or_errno == UNIT_FILE_SYMLINK) + else if (c[i].change_or_errno == INSTALL_CHANGE_SYMLINK) printf("ln -s '%s' '%s'\n", c[i].source, c[i].path); } } diff --git a/src/test/test-tables.c b/src/test/test-tables.c index ed409701b9..cac21f3984 100644 --- a/src/test/test-tables.c +++ b/src/test/test-tables.c @@ -116,7 +116,7 @@ int main(int argc, char **argv) { test_table(timer_state, TIMER_STATE); test_table(unit_active_state, UNIT_ACTIVE_STATE); test_table(unit_dependency, UNIT_DEPENDENCY); - test_table(unit_file_change_type, UNIT_FILE_CHANGE_TYPE); + test_table(install_change, INSTALL_CHANGE); test_table(unit_file_preset_mode, UNIT_FILE_PRESET); test_table(unit_file_state, UNIT_FILE_STATE); test_table(unit_load_state, UNIT_LOAD_STATE); |