Lines Matching refs:lp

103 static int in_search_path(const LookupPaths *lp, const char *path) {  in in_search_path()  argument
112 return path_strv_contains(lp->search_path, parent); in in_search_path()
136 static int path_is_generator(const LookupPaths *lp, const char *path) { in path_is_generator() argument
139 assert(lp); in path_is_generator()
146 return path_equal_ptr(parent, lp->generator) || in path_is_generator()
147 path_equal_ptr(parent, lp->generator_early) || in path_is_generator()
148 path_equal_ptr(parent, lp->generator_late); in path_is_generator()
151 static int path_is_transient(const LookupPaths *lp, const char *path) { in path_is_transient() argument
154 assert(lp); in path_is_transient()
161 return path_equal_ptr(parent, lp->transient); in path_is_transient()
164 static int path_is_control(const LookupPaths *lp, const char *path) { in path_is_control() argument
167 assert(lp); in path_is_control()
174 return path_equal_ptr(parent, lp->persistent_control) || in path_is_control()
175 path_equal_ptr(parent, lp->runtime_control); in path_is_control()
178 static int path_is_config(const LookupPaths *lp, const char *path, bool check_parent) { in path_is_config() argument
181 assert(lp); in path_is_config()
195 return path_equal_ptr(path, lp->persistent_config) || in path_is_config()
196 path_equal_ptr(path, lp->runtime_config); in path_is_config()
199 static int path_is_runtime(const LookupPaths *lp, const char *path, bool check_parent) { in path_is_runtime() argument
203 assert(lp); in path_is_runtime()
209 rpath = skip_root(lp->root_dir, path); in path_is_runtime()
221 return path_equal_ptr(path, lp->runtime_config) || in path_is_runtime()
222 path_equal_ptr(path, lp->generator) || in path_is_runtime()
223 path_equal_ptr(path, lp->generator_early) || in path_is_runtime()
224 path_equal_ptr(path, lp->generator_late) || in path_is_runtime()
225 path_equal_ptr(path, lp->transient) || in path_is_runtime()
226 path_equal_ptr(path, lp->runtime_control); in path_is_runtime()
229 static int path_is_vendor_or_generator(const LookupPaths *lp, const char *path) { in path_is_vendor_or_generator() argument
232 assert(lp); in path_is_vendor_or_generator()
235 rpath = skip_root(lp->root_dir, path); in path_is_vendor_or_generator()
247 if (path_is_generator(lp, rpath)) in path_is_vendor_or_generator()
253 static const char* config_path_from_flags(const LookupPaths *lp, UnitFileFlags flags) { in config_path_from_flags() argument
254 assert(lp); in config_path_from_flags()
257 … return FLAGS_SET(flags, UNIT_FILE_RUNTIME) ? lp->runtime_attached : lp->persistent_attached; in config_path_from_flags()
259 … return FLAGS_SET(flags, UNIT_FILE_RUNTIME) ? lp->runtime_config : lp->persistent_config; in config_path_from_flags()
431 const LookupPaths *lp, in chroot_unit_symlinks_equivalent() argument
436 assert(lp); in chroot_unit_symlinks_equivalent()
444 const char *root = lp->root_dir ?: "/"; in chroot_unit_symlinks_equivalent()
472 path_startswith_strv(a, lp->search_path) && in chroot_unit_symlinks_equivalent()
473 path_startswith_strv(b, lp->search_path); in chroot_unit_symlinks_equivalent()
477 const LookupPaths *lp, in create_symlink() argument
491 rp = skip_root(lp->root_dir, old_path); in create_symlink()
524 if (chroot_unit_symlinks_equivalent(lp, new_path, dest, old_path)) { in create_symlink()
579 const LookupPaths *lp, in remove_marked_symlinks_fd() argument
592 assert(lp); in remove_marked_symlinks_fd()
626 …q = remove_marked_symlinks_fd(remove_symlinks_to, nfd, p, config_path, lp, dry_run, restart, chang… in remove_marked_symlinks_fd()
662 q = chase_symlinks(p, lp->root_dir, CHASE_NONEXISTENT, &dest, NULL); in remove_marked_symlinks_fd()
699 const char *rp = skip_root(lp->root_dir, p); in remove_marked_symlinks_fd()
713 const LookupPaths *lp, in remove_marked_symlinks() argument
723 assert(lp); in remove_marked_symlinks()
741 …q = remove_marked_symlinks_fd(remove_symlinks_to, cfd, config_path, config_path, lp, dry_run, &res… in remove_marked_symlinks()
944 const LookupPaths *lp, in find_symlinks_in_scope() argument
954 assert(lp); in find_symlinks_in_scope()
961 STRV_FOREACH(p, lp->search_path) { in find_symlinks_in_scope()
964 … r = find_symlinks(lp->root_dir, info, match_name, ignore_same_name, *p, &same_name_link); in find_symlinks_in_scope()
970 if (path_equal_ptr(*p, lp->persistent_config)) { in find_symlinks_in_scope()
982 r = path_is_runtime(lp, *p, false); in find_symlinks_in_scope()
991 if (path_equal_ptr(*p, lp->persistent_config)) in find_symlinks_in_scope()
994 r = path_is_runtime(lp, *p, false); in find_symlinks_in_scope()
1071 const LookupPaths *lp, in install_info_may_process() argument
1075 assert(lp); in install_info_may_process()
1084 if (path_is_generator(lp, i->path) || in install_info_may_process()
1085 path_is_transient(lp, i->path)) { in install_info_may_process()
1421 const LookupPaths *lp, in unit_file_load_or_readlink() argument
1425 r = unit_file_load(ctx, info, path, lp->root_dir, flags); in unit_file_load_or_readlink()
1430 r = unit_file_resolve_symlink(lp->root_dir, lp->search_path, in unit_file_load_or_readlink()
1437 r = null_or_empty_path_with_root(info->symlink_target, lp->root_dir); in unit_file_load_or_readlink()
1453 const LookupPaths *lp, in unit_file_search() argument
1463 assert(lp); in unit_file_search()
1470 return unit_file_load_or_readlink(ctx, info, info->path, lp, flags); in unit_file_search()
1480 STRV_FOREACH(p, lp->search_path) { in unit_file_search()
1487 r = unit_file_load_or_readlink(ctx, info, path, lp, flags); in unit_file_search()
1503 STRV_FOREACH(p, lp->search_path) { in unit_file_search()
1510 r = unit_file_load_or_readlink(ctx, info, path, lp, flags); in unit_file_search()
1532 STRV_FOREACH(p, lp->search_path) { in unit_file_search()
1546 STRV_FOREACH(p, lp->search_path) { in unit_file_search()
1566 r = unit_file_load_or_readlink(ctx, info, *p, lp, flags | SEARCH_DROPIN); in unit_file_search()
1577 const LookupPaths *lp, in install_info_follow() argument
1597 return unit_file_load_or_readlink(ctx, info, info->path, lp, flags); in install_info_follow()
1606 const LookupPaths *lp, in install_info_traverse() argument
1615 assert(lp); in install_info_traverse()
1619 r = unit_file_search(ctx, start, lp, flags); in install_info_traverse()
1631 r = path_is_config(lp, i->path, true); in install_info_traverse()
1638 r = install_info_follow(ctx, i, lp, flags, in install_info_traverse()
1667 r = install_info_follow(ctx, i, lp, flags, true); in install_info_traverse()
1677 … r = install_info_add(ctx, bn, NULL, lp->root_dir, /* auxiliary= */ false, &i); in install_info_traverse()
1682 r = unit_file_search(ctx, i, lp, flags); in install_info_traverse()
1704 const LookupPaths *lp, in install_info_add_auto() argument
1714 pp = prefix_roota(lp->root_dir, name_or_path); in install_info_add_auto()
1716 return install_info_add(ctx, NULL, pp, lp->root_dir, /* auxiliary= */ false, ret); in install_info_add_auto()
1718 … return install_info_add(ctx, name_or_path, NULL, lp->root_dir, /* auxiliary= */ false, ret); in install_info_add_auto()
1723 const LookupPaths *lp, in install_info_discover() argument
1734 assert(lp); in install_info_discover()
1737 r = install_info_add_auto(ctx, lp, name, &info); in install_info_discover()
1739 r = install_info_traverse(ctx, lp, info, flags, ret); in install_info_discover()
1748 const LookupPaths *lp, in install_info_discover_and_check() argument
1757 r = install_info_discover(ctx, lp, name, flags, ret, changes, n_changes); in install_info_discover_and_check()
1761 return install_info_may_process(ret ? *ret : NULL, lp, changes, n_changes); in install_info_discover_and_check()
1868 const LookupPaths *lp, in install_info_symlink_alias() argument
1877 assert(lp); in install_info_symlink_alias()
1902 q = create_symlink(lp, info->path, alias_path, force, changes, n_changes); in install_info_symlink_alias()
1913 const LookupPaths *lp, in install_info_symlink_wants() argument
1926 assert(lp); in install_info_symlink_wants()
1949 r = unit_file_search(NULL, &instance, lp, SEARCH_FOLLOW_CONFIG_SYMLINKS); in install_info_symlink_wants()
2005 q = create_symlink(lp, info->path, path, true, changes, n_changes); in install_info_symlink_wants()
2009 if (unit_file_exists(scope, lp, dst) == 0) in install_info_symlink_wants()
2018 const LookupPaths *lp, in install_info_symlink_link() argument
2028 assert(lp); in install_info_symlink_link()
2032 r = in_search_path(lp, info->path); in install_info_symlink_link()
2042 return create_symlink(lp, info->path, path, force, changes, n_changes); in install_info_symlink_link()
2049 const LookupPaths *lp, in install_info_apply() argument
2057 assert(lp); in install_info_apply()
2065 r = install_info_symlink_link(info, lp, config_path, force, changes, n_changes); in install_info_apply()
2072 r = install_info_symlink_alias(scope, info, lp, config_path, force, changes, n_changes); in install_info_apply()
2074 …q = install_info_symlink_wants(scope, file_flags, info, lp, config_path, info->wanted_by, ".wants/… in install_info_apply()
2078 …q = install_info_symlink_wants(scope, file_flags, info, lp, config_path, info->required_by, ".requ… in install_info_apply()
2087 const LookupPaths *lp, in install_context_apply() argument
2098 assert(lp); in install_context_apply()
2116 q = install_info_traverse(ctx, lp, i, flags, NULL); in install_context_apply()
2143 … q = install_info_apply(ctx->scope, file_flags, i, lp, config_path, changes, n_changes); in install_context_apply()
2157 const LookupPaths *lp, in install_context_mark_for_removal() argument
2167 assert(lp); in install_context_mark_for_removal()
2185 … r = install_info_traverse(ctx, lp, i, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, NULL); in install_context_mark_for_removal()
2226 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_mask()
2233 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_mask()
2237 config_path = (flags & UNIT_FILE_RUNTIME) ? lp.runtime_config : lp.persistent_config; in unit_file_mask()
2255 … q = create_symlink(&lp, "/dev/null", path, flags & UNIT_FILE_FORCE, changes, n_changes); in unit_file_mask()
2271 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_unmask()
2281 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_unmask()
2285 config_path = (flags & UNIT_FILE_RUNTIME) ? lp.runtime_config : lp.persistent_config; in unit_file_unmask()
2342 rp = skip_root(lp.root_dir, path); in unit_file_unmask()
2348 … q = remove_marked_symlinks(remove_symlinks_to, config_path, &lp, dry_run, changes, n_changes); in unit_file_unmask()
2363 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_link()
2372 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_link()
2376 config_path = (flags & UNIT_FILE_RUNTIME) ? lp.runtime_config : lp.persistent_config; in unit_file_link()
2392 full = path_join(lp.root_dir, *i); in unit_file_link()
2402 q = in_search_path(&lp, *i); in unit_file_link()
2428 q = create_symlink(&lp, *i, new_path, flags & UNIT_FILE_FORCE, changes, n_changes); in unit_file_link()
2436 static int path_shall_revert(const LookupPaths *lp, const char *path) { in path_shall_revert() argument
2439 assert(lp); in path_shall_revert()
2444 r = path_is_config(lp, path, true); in path_shall_revert()
2448 r = path_is_control(lp, path); in path_shall_revert()
2452 return path_is_transient(lp, path); in path_shall_revert()
2463 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_revert()
2479 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_revert()
2489 STRV_FOREACH(p, lp.search_path) { in unit_file_revert()
2503 r = path_is_vendor_or_generator(&lp, path); in unit_file_revert()
2520 r = path_shall_revert(&lp, dropin); in unit_file_revert()
2536 STRV_FOREACH(p, lp.search_path) { in unit_file_revert()
2549 r = path_is_config(&lp, path, true); in unit_file_revert()
2589 rp = skip_root(lp.root_dir, *i); in unit_file_revert()
2595 … q = remove_marked_symlinks(remove_symlinks_to, lp.runtime_config, &lp, false, changes, n_changes); in unit_file_revert()
2599 …q = remove_marked_symlinks(remove_symlinks_to, lp.persistent_config, &lp, false, changes, n_change… in unit_file_revert()
2616 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_add_dependency()
2632 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_add_dependency()
2636 config_path = (file_flags & UNIT_FILE_RUNTIME) ? lp.runtime_config : lp.persistent_config; in unit_file_add_dependency()
2640 r = install_info_discover_and_check(&ctx, &lp, target, SEARCH_FOLLOW_CONFIG_SYMLINKS, in unit_file_add_dependency()
2650 r = install_info_discover_and_check(&ctx, &lp, *f, SEARCH_FOLLOW_CONFIG_SYMLINKS, in unit_file_add_dependency()
2672 return install_context_apply(&ctx, &lp, file_flags, config_path, in unit_file_add_dependency()
2677 const LookupPaths *lp, in do_unit_file_enable() argument
2690 … r = install_info_discover_and_check(&ctx, lp, *f, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, in do_unit_file_enable()
2703 return install_context_apply(&ctx, lp, flags, config_path, in do_unit_file_enable()
2715 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_enable()
2721 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_enable()
2725 const char *config_path = config_path_from_flags(&lp, flags); in unit_file_enable()
2729 return do_unit_file_enable(&lp, scope, flags, config_path, files, changes, n_changes); in unit_file_enable()
2733 const LookupPaths *lp, in do_unit_file_disable() argument
2749 r = install_info_add(&ctx, *i, NULL, lp->root_dir, /* auxiliary= */ false, NULL); in do_unit_file_disable()
2754 …r = install_context_mark_for_removal(&ctx, lp, &remove_symlinks_to, config_path, changes, n_change… in do_unit_file_disable()
2758 …return remove_marked_symlinks(remove_symlinks_to, config_path, lp, flags & UNIT_FILE_DRY_RUN, chan… in do_unit_file_disable()
2770 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_disable()
2776 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_disable()
2780 const char *config_path = config_path_from_flags(&lp, flags); in unit_file_disable()
2784 return do_unit_file_disable(&lp, scope, flags, config_path, files, changes, n_changes); in unit_file_disable()
2789 const LookupPaths *lp, in normalize_linked_files() argument
2814 … r = install_info_discover(&ctx, lp, n, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, &i, NULL, NULL); in normalize_linked_files()
2853 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_reenable()
2860 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_reenable()
2864 const char *config_path = config_path_from_flags(&lp, flags); in unit_file_reenable()
2868 r = normalize_linked_files(scope, &lp, names_or_paths, &names, &files); in unit_file_reenable()
2873 r = do_unit_file_disable(&lp, scope, flags, config_path, names, changes, n_changes); in unit_file_reenable()
2878 return do_unit_file_enable(&lp, scope, flags, config_path, files, changes, n_changes); in unit_file_reenable()
2889 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_set_default()
2904 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_set_default()
2908 r = install_info_discover_and_check(&ctx, &lp, name, 0, &info, changes, n_changes); in unit_file_set_default()
2912 new_path = strjoina(lp.persistent_config, "/" SPECIAL_DEFAULT_TARGET); in unit_file_set_default()
2913 … return create_symlink(&lp, info->path, new_path, flags & UNIT_FILE_FORCE, changes, n_changes); in unit_file_set_default()
2921 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_get_default()
2931 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_get_default()
2935 r = install_info_discover(&ctx, &lp, SPECIAL_DEFAULT_TARGET, SEARCH_FOLLOW_CONFIG_SYMLINKS, in unit_file_get_default()
2939 r = install_info_may_process(info, &lp, NULL, 0); in unit_file_get_default()
2953 const LookupPaths *lp, in unit_file_lookup_state() argument
2962 assert(lp); in unit_file_lookup_state()
2968 r = install_info_discover(&ctx, lp, name, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, in unit_file_lookup_state()
2984 r = path_is_runtime(lp, info->path, true); in unit_file_lookup_state()
2998 r = path_is_generator(lp, info->path); in unit_file_lookup_state()
3006 r = path_is_transient(lp, info->path); in unit_file_lookup_state()
3017 r = find_symlinks_in_scope(scope, lp, info, true, &state); in unit_file_lookup_state()
3025 r = find_symlinks_in_scope(scope, lp, info, false, &state); in unit_file_lookup_state()
3055 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_get_state()
3062 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_get_state()
3066 return unit_file_lookup_state(scope, &lp, name, ret); in unit_file_get_state()
3069 int unit_file_exists(LookupScope scope, const LookupPaths *lp, const char *name) { in unit_file_exists() argument
3073 assert(lp); in unit_file_exists()
3079 r = install_info_discover(&c, lp, name, 0, NULL, NULL, NULL); in unit_file_exists()
3338 const LookupPaths *lp, in execute_preset() argument
3349 assert(lp); in execute_preset()
3355 …r = install_context_mark_for_removal(minus, lp, &remove_symlinks_to, config_path, changes, n_chang… in execute_preset()
3359 … r = remove_marked_symlinks(remove_symlinks_to, config_path, lp, false, changes, n_changes); in execute_preset()
3367 q = install_context_apply(plus, lp, in execute_preset()
3386 LookupPaths *lp, in preset_prepare_one() argument
3400 r = install_info_discover(&tmp, lp, name, SEARCH_FOLLOW_CONFIG_SYMLINKS, in preset_prepare_one()
3416 … r = install_info_discover_and_check(plus, lp, *s, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, in preset_prepare_one()
3422 … r = install_info_discover_and_check(plus, lp, name, SEARCH_LOAD|SEARCH_FOLLOW_CONFIG_SYMLINKS, in preset_prepare_one()
3429 r = install_info_discover(minus, lp, name, SEARCH_FOLLOW_CONFIG_SYMLINKS, in preset_prepare_one()
3445 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_preset()
3454 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_preset()
3458 config_path = (file_flags & UNIT_FILE_RUNTIME) ? lp.runtime_config : lp.persistent_config; in unit_file_preset()
3467 r = preset_prepare_one(scope, &plus, &minus, &lp, *i, &presets, changes, n_changes); in unit_file_preset()
3472 …return execute_preset(file_flags, &plus, &minus, &lp, config_path, files, mode, changes, n_changes… in unit_file_preset()
3484 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_preset_all()
3493 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_preset_all()
3497 config_path = (file_flags & UNIT_FILE_RUNTIME) ? lp.runtime_config : lp.persistent_config; in unit_file_preset_all()
3505 STRV_FOREACH(i, lp.search_path) { in unit_file_preset_all()
3524 … r = preset_prepare_one(scope, &plus, &minus, &lp, de->d_name, &presets, changes, n_changes); in unit_file_preset_all()
3533 …return execute_preset(file_flags, &plus, &minus, &lp, config_path, NULL, mode, changes, n_changes); in unit_file_preset_all()
3557 _cleanup_(lookup_paths_free) LookupPaths lp = {}; in unit_file_get_list()
3564 r = lookup_paths_init(&lp, scope, 0, root_dir); in unit_file_get_list()
3568 STRV_FOREACH(dirname, lp.search_path) { in unit_file_get_list()
3606 r = unit_file_lookup_state(scope, &lp, de->d_name, &f->state); in unit_file_get_list()