From 78e9bb837c258ac0ec7712b3d612cc2f407e731e Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 05:50:42 +0200 Subject: Merging upstream version 256. Signed-off-by: Daniel Baumann --- src/shared/install.h | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) (limited to 'src/shared/install.h') diff --git a/src/shared/install.h b/src/shared/install.h index bc0c6db..13d1630 100644 --- a/src/shared/install.h +++ b/src/shared/install.h @@ -63,9 +63,9 @@ struct InstallChange { 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, INSTALL_CHANGE_SYMLINK, INSTALL_CHANGE_UNLINK)) +static inline bool install_changes_have_modification(const InstallChange *changes, size_t n_changes) { + FOREACH_ARRAY(i, changes, n_changes) + if (IN_SET(i->type, INSTALL_CHANGE_SYMLINK, INSTALL_CHANGE_UNLINK)) return true; return false; } @@ -175,7 +175,7 @@ int unit_file_set_default( int unit_file_get_default( RuntimeScope scope, const char *root_dir, - char **name); + char **ret); int unit_file_add_dependency( RuntimeScope scope, UnitFileFlags flags, @@ -193,7 +193,11 @@ int unit_file_lookup_state( UnitFileState *ret); int unit_file_get_state(RuntimeScope scope, const char *root_dir, const char *filename, UnitFileState *ret); -int unit_file_exists(RuntimeScope scope, const LookupPaths *paths, const char *name); + +int unit_file_exists_full(RuntimeScope scope, const LookupPaths *paths, const char *name, char **ret_path); +static inline int unit_file_exists(RuntimeScope scope, const LookupPaths *paths, const char *name) { + return unit_file_exists_full(scope, paths, name, NULL); +} int unit_file_get_list(RuntimeScope scope, const char *root_dir, Hashmap *h, char **states, char **patterns); @@ -201,7 +205,14 @@ extern const struct hash_ops unit_file_list_hash_ops_free; InstallChangeType install_changes_add(InstallChange **changes, size_t *n_changes, InstallChangeType type, const char *path, const char *source); void install_changes_free(InstallChange *changes, size_t n_changes); -void install_changes_dump(int r, const char *verb, const InstallChange *changes, size_t n_changes, bool quiet); + +int install_change_dump_error(const InstallChange *change, char **ret_errmsg, const char **ret_bus_error); +void install_changes_dump( + int error, + const char *verb, + const InstallChange *changes, + size_t n_changes, + bool quiet); int unit_file_verify_alias( const InstallInfo *info, -- cgit v1.2.3