summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Yuan <me@yhndnzj.com>2024-03-02 09:38:17 +0100
committerMike Yuan <me@yhndnzj.com>2024-03-06 19:01:57 +0100
commit7dfc71399d2286b37cd61975da196acfd29aca83 (patch)
tree2e56478b7950e61aa97e1813843b3011a3e8556a /src
parentresolved: decrease mdns/llmnr priority for the reverse mapping domains (diff)
downloadsystemd-7dfc71399d2286b37cd61975da196acfd29aca83.tar.xz
systemd-7dfc71399d2286b37cd61975da196acfd29aca83.zip
path-lookup: rename lookup_paths_free -> _done
This is stack-allocated, so update to match our usual rules.
Diffstat (limited to 'src')
-rw-r--r--src/analyze/analyze-unit-files.c2
-rw-r--r--src/analyze/analyze-unit-paths.c2
-rw-r--r--src/basic/path-lookup.c5
-rw-r--r--src/basic/path-lookup.h2
-rw-r--r--src/core/manager.c4
-rw-r--r--src/libsystemd/sd-path/sd-path.c2
-rw-r--r--src/portable/portable.c8
-rw-r--r--src/shared/install.c28
-rw-r--r--src/ssh-generator/ssh-generator.c2
-rw-r--r--src/systemctl/systemctl-edit.c4
-rw-r--r--src/systemctl/systemctl-enable.c2
-rw-r--r--src/systemctl/systemctl-sysv-compat.c2
-rw-r--r--src/sysv-generator/sysv-generator.c2
-rw-r--r--src/test/test-path-lookup.c6
-rw-r--r--src/test/test-unit-file.c2
15 files changed, 36 insertions, 37 deletions
diff --git a/src/analyze/analyze-unit-files.c b/src/analyze/analyze-unit-files.c
index d9b3313be4..e0c4867c78 100644
--- a/src/analyze/analyze-unit-files.c
+++ b/src/analyze/analyze-unit-files.c
@@ -15,7 +15,7 @@ static bool strv_fnmatch_strv_or_empty(char* const* patterns, char **strv, int f
int verb_unit_files(int argc, char *argv[], void *userdata) {
_cleanup_hashmap_free_ Hashmap *unit_ids = NULL, *unit_names = NULL;
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
char **patterns = strv_skip(argv, 1);
const char *k, *dst;
char **v;
diff --git a/src/analyze/analyze-unit-paths.c b/src/analyze/analyze-unit-paths.c
index bb00a4fcd2..17f18e0ab6 100644
--- a/src/analyze/analyze-unit-paths.c
+++ b/src/analyze/analyze-unit-paths.c
@@ -6,7 +6,7 @@
#include "strv.h"
int verb_unit_paths(int argc, char *argv[], void *userdata) {
- _cleanup_(lookup_paths_free) LookupPaths paths = {};
+ _cleanup_(lookup_paths_done) LookupPaths paths = {};
int r;
r = lookup_paths_init_or_warn(&paths, arg_runtime_scope, 0, NULL);
diff --git a/src/basic/path-lookup.c b/src/basic/path-lookup.c
index 1b31a4e23a..fbcb1edadc 100644
--- a/src/basic/path-lookup.c
+++ b/src/basic/path-lookup.c
@@ -776,9 +776,8 @@ int lookup_paths_init_or_warn(LookupPaths *lp, RuntimeScope scope, LookupPathsFl
return r;
}
-void lookup_paths_free(LookupPaths *lp) {
- if (!lp)
- return;
+void lookup_paths_done(LookupPaths *lp) {
+ assert(lp);
lp->search_path = strv_free(lp->search_path);
diff --git a/src/basic/path-lookup.h b/src/basic/path-lookup.h
index 11db264c01..0db2c5a98c 100644
--- a/src/basic/path-lookup.h
+++ b/src/basic/path-lookup.h
@@ -65,7 +65,7 @@ bool path_is_user_data_dir(const char *path);
bool path_is_user_config_dir(const char *path);
void lookup_paths_log(LookupPaths *p);
-void lookup_paths_free(LookupPaths *p);
+void lookup_paths_done(LookupPaths *p);
char **generator_binary_paths(RuntimeScope scope);
char **env_generator_binary_paths(RuntimeScope scope);
diff --git a/src/core/manager.c b/src/core/manager.c
index 7a7669f315..d307c07a62 100644
--- a/src/core/manager.c
+++ b/src/core/manager.c
@@ -1668,7 +1668,7 @@ Manager* manager_free(Manager *m) {
free(m->notify_socket);
- lookup_paths_free(&m->lookup_paths);
+ lookup_paths_done(&m->lookup_paths);
strv_free(m->transient_environment);
strv_free(m->client_environment);
@@ -3557,7 +3557,7 @@ int manager_reload(Manager *m) {
manager_clear_jobs_and_units(m);
lookup_paths_flush_generator(&m->lookup_paths);
- lookup_paths_free(&m->lookup_paths);
+ lookup_paths_done(&m->lookup_paths);
exec_shared_runtime_vacuum(m);
dynamic_user_vacuum(m, false);
m->uid_refs = hashmap_free(m->uid_refs);
diff --git a/src/libsystemd/sd-path/sd-path.c b/src/libsystemd/sd-path/sd-path.c
index 7290d1c40a..85bca9fd3b 100644
--- a/src/libsystemd/sd-path/sd-path.c
+++ b/src/libsystemd/sd-path/sd-path.c
@@ -596,7 +596,7 @@ static int get_search(uint64_t type, char ***list) {
case SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT:
case SD_PATH_SYSTEMD_SEARCH_USER_UNIT: {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
RuntimeScope scope = type == SD_PATH_SYSTEMD_SEARCH_SYSTEM_UNIT ?
RUNTIME_SCOPE_SYSTEM : RUNTIME_SCOPE_USER;
diff --git a/src/portable/portable.c b/src/portable/portable.c
index 2012dda835..a003ea0352 100644
--- a/src/portable/portable.c
+++ b/src/portable/portable.c
@@ -182,7 +182,7 @@ static int extract_now(
_cleanup_hashmap_free_ Hashmap *unit_files = NULL;
_cleanup_(portable_metadata_unrefp) PortableMetadata *os_release = NULL;
- _cleanup_(lookup_paths_free) LookupPaths paths = {};
+ _cleanup_(lookup_paths_done) LookupPaths paths = {};
_cleanup_close_ int os_release_fd = -EBADF;
_cleanup_free_ char *os_release_path = NULL;
const char *os_release_id;
@@ -1556,7 +1556,7 @@ int portable_attach(
_cleanup_ordered_hashmap_free_ OrderedHashmap *extension_images = NULL, *extension_releases = NULL;
_cleanup_(portable_metadata_unrefp) PortableMetadata *os_release = NULL;
_cleanup_hashmap_free_ Hashmap *unit_files = NULL;
- _cleanup_(lookup_paths_free) LookupPaths paths = {};
+ _cleanup_(lookup_paths_done) LookupPaths paths = {};
_cleanup_strv_free_ char **valid_prefixes = NULL;
_cleanup_(image_unrefp) Image *image = NULL;
PortableMetadata *item;
@@ -1817,7 +1817,7 @@ int portable_detach(
size_t *n_changes,
sd_bus_error *error) {
- _cleanup_(lookup_paths_free) LookupPaths paths = {};
+ _cleanup_(lookup_paths_done) LookupPaths paths = {};
_cleanup_set_free_ Set *unit_files = NULL, *markers = NULL;
_cleanup_free_ char *extensions = NULL;
_cleanup_closedir_ DIR *d = NULL;
@@ -2002,7 +2002,7 @@ static int portable_get_state_internal(
PortableState *ret,
sd_bus_error *error) {
- _cleanup_(lookup_paths_free) LookupPaths paths = {};
+ _cleanup_(lookup_paths_done) LookupPaths paths = {};
bool found_enabled = false, found_running = false;
_cleanup_set_free_ Set *unit_files = NULL;
_cleanup_closedir_ DIR *d = NULL;
diff --git a/src/shared/install.c b/src/shared/install.c
index c3a94d1912..32f504c327 100644
--- a/src/shared/install.c
+++ b/src/shared/install.c
@@ -2259,7 +2259,7 @@ int unit_file_mask(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
const char *config_path;
int r;
@@ -2302,7 +2302,7 @@ int unit_file_unmask(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
_cleanup_strv_free_ char **todo = NULL;
const char *config_path;
@@ -2414,7 +2414,7 @@ int unit_file_link(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_strv_free_ char **todo = NULL;
const char *config_path;
size_t n_todo = 0;
@@ -2522,7 +2522,7 @@ int unit_file_revert(
size_t *n_changes) {
_cleanup_set_free_free_ Set *remove_symlinks_to = NULL;
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_strv_free_ char **todo = NULL;
size_t n_todo = 0;
int r, q;
@@ -2680,7 +2680,7 @@ int unit_file_add_dependency(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_(install_context_done) InstallContext ctx = { .scope = scope };
InstallInfo *info, *target_info;
const char *config_path;
@@ -2781,7 +2781,7 @@ int unit_file_enable(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
int r;
assert(scope >= 0);
@@ -2849,7 +2849,7 @@ int unit_file_disable(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
int r;
assert(scope >= 0);
@@ -2932,7 +2932,7 @@ int unit_file_reenable(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_strv_free_ char **names = NULL, **files = NULL;
int r;
@@ -2968,7 +2968,7 @@ int unit_file_set_default(
InstallChange **changes,
size_t *n_changes) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_(install_context_done) InstallContext ctx = { .scope = scope };
InstallInfo *info;
const char *new_path;
@@ -3000,7 +3000,7 @@ int unit_file_get_default(
const char *root_dir,
char **name) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_(install_context_done) InstallContext ctx = { .scope = scope };
InstallInfo *info;
char *n;
@@ -3131,7 +3131,7 @@ int unit_file_get_state(
const char *name,
UnitFileState *ret) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
int r;
assert(scope >= 0);
@@ -3558,7 +3558,7 @@ int unit_file_preset(
size_t *n_changes) {
_cleanup_(install_context_done) InstallContext plus = {}, minus = {};
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_(unit_file_presets_done) UnitFilePresets presets = {};
const char *config_path;
int r;
@@ -3597,7 +3597,7 @@ int unit_file_preset_all(
size_t *n_changes) {
_cleanup_(install_context_done) InstallContext plus = {}, minus = {};
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_(unit_file_presets_done) UnitFilePresets presets = {};
const char *config_path = NULL;
int r;
@@ -3674,7 +3674,7 @@ int unit_file_get_list(
char **states,
char **patterns) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
int r;
assert(scope >= 0);
diff --git a/src/ssh-generator/ssh-generator.c b/src/ssh-generator/ssh-generator.c
index 6fdd4ec27f..08532690a9 100644
--- a/src/ssh-generator/ssh-generator.c
+++ b/src/ssh-generator/ssh-generator.c
@@ -458,7 +458,7 @@ static int run(const char *dest, const char *dest_early, const char *dest_late)
if (r < 0)
return log_error_errno(r, "Failed to determine if sshd is installed: %m");
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
r = lookup_paths_init_or_warn(&lp, RUNTIME_SCOPE_SYSTEM, LOOKUP_PATHS_EXCLUDE_GENERATED, /* root_dir= */ NULL);
if (r < 0)
return r;
diff --git a/src/systemctl/systemctl-edit.c b/src/systemctl/systemctl-edit.c
index c851c8546e..15398f8364 100644
--- a/src/systemctl/systemctl-edit.c
+++ b/src/systemctl/systemctl-edit.c
@@ -15,7 +15,7 @@
int verb_cat(int argc, char *argv[], void *userdata) {
_cleanup_hashmap_free_ Hashmap *cached_id_map = NULL, *cached_name_map = NULL;
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_strv_free_ char **names = NULL;
sd_bus *bus;
bool first = true;
@@ -198,7 +198,7 @@ static int find_paths_to_edit(
char **names) {
_cleanup_hashmap_free_ Hashmap *cached_id_map = NULL, *cached_name_map = NULL;
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_free_ char *drop_in_alloc = NULL, *suffix = NULL;
const char *drop_in;
int r;
diff --git a/src/systemctl/systemctl-enable.c b/src/systemctl/systemctl-enable.c
index 24a1b3d583..47a19cdd63 100644
--- a/src/systemctl/systemctl-enable.c
+++ b/src/systemctl/systemctl-enable.c
@@ -143,7 +143,7 @@ int verb_enable(int argc, char *argv[], void *userdata) {
bool warn_trigger_ignore_masked = true; /* suppress "used uninitialized" warning */
if (STR_IN_SET(verb, "mask", "unmask")) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
r = lookup_paths_init_or_warn(&lp, arg_runtime_scope, 0, arg_root);
if (r < 0)
diff --git a/src/systemctl/systemctl-sysv-compat.c b/src/systemctl/systemctl-sysv-compat.c
index 2aa1ec6d83..8ee16eb13f 100644
--- a/src/systemctl/systemctl-sysv-compat.c
+++ b/src/systemctl/systemctl-sysv-compat.c
@@ -111,7 +111,7 @@ int enable_sysv_units(const char *verb, char **args) {
int r = 0;
#if HAVE_SYSV_COMPAT
- _cleanup_(lookup_paths_free) LookupPaths paths = {};
+ _cleanup_(lookup_paths_done) LookupPaths paths = {};
unsigned f = 0;
SysVUnitEnableState enable_state = SYSV_UNIT_NOT_FOUND;
diff --git a/src/sysv-generator/sysv-generator.c b/src/sysv-generator/sysv-generator.c
index 5689a60d78..f3b447095a 100644
--- a/src/sysv-generator/sysv-generator.c
+++ b/src/sysv-generator/sysv-generator.c
@@ -894,7 +894,7 @@ finish:
static int run(const char *dest, const char *dest_early, const char *dest_late) {
_cleanup_(free_sysvstub_hashmapp) Hashmap *all_services = NULL;
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
SysvStub *service;
int r;
diff --git a/src/test/test-path-lookup.c b/src/test/test-path-lookup.c
index 431a85965d..cb13fad7c5 100644
--- a/src/test/test-path-lookup.c
+++ b/src/test/test-path-lookup.c
@@ -13,8 +13,8 @@
static void test_paths_one(RuntimeScope scope) {
_cleanup_(rm_rf_physical_and_freep) char *tmp = NULL;
- _cleanup_(lookup_paths_free) LookupPaths lp_without_env = {};
- _cleanup_(lookup_paths_free) LookupPaths lp_with_env = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp_without_env = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp_with_env = {};
char *systemd_unit_path;
assert_se(mkdtemp_malloc("/tmp/test-path-lookup.XXXXXXX", &tmp) >= 0);
@@ -40,7 +40,7 @@ TEST(paths) {
}
TEST(user_and_global_paths) {
- _cleanup_(lookup_paths_free) LookupPaths lp_global = {}, lp_user = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp_global = {}, lp_user = {};
char **u, **g;
unsigned k = 0;
diff --git a/src/test/test-unit-file.c b/src/test/test-unit-file.c
index 9f8787b492..220802e350 100644
--- a/src/test/test-unit-file.c
+++ b/src/test/test-unit-file.c
@@ -26,7 +26,7 @@ TEST(unit_validate_alias_symlink_and_warn) {
}
TEST(unit_file_build_name_map) {
- _cleanup_(lookup_paths_free) LookupPaths lp = {};
+ _cleanup_(lookup_paths_done) LookupPaths lp = {};
_cleanup_hashmap_free_ Hashmap *unit_ids = NULL;
_cleanup_hashmap_free_ Hashmap *unit_names = NULL;
const char *k, *dst;