]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/path-lookup.h
Add SPDX license identifiers to source files under the LGPL
[thirdparty/systemd.git] / src / shared / path-lookup.h
CommitLineData
53e1b683 1/* SPDX-License-Identifier: LGPL-2.1+ */
c2f1db8f 2#pragma once
84e3543e
LP
3
4/***
5 This file is part of systemd.
6
7 Copyright 2010 Lennart Poettering
8
9 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
10 under the terms of the GNU Lesser General Public License as published by
11 the Free Software Foundation; either version 2.1 of the License, or
84e3543e
LP
12 (at your option) any later version.
13
14 systemd is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 17 Lesser General Public License for more details.
84e3543e 18
5430f7f2 19 You should have received a copy of the GNU Lesser General Public License
84e3543e
LP
20 along with systemd; If not, see <http://www.gnu.org/licenses/>.
21***/
22
a8fbdf54 23#include <stdbool.h>
a3c4eb07
LP
24
25typedef struct LookupPaths LookupPaths;
a3c4eb07
LP
26
27#include "install.h"
29686440 28#include "macro.h"
a8ffe6fb 29
4943d143
LP
30typedef enum LookupPathsFlags {
31 LOOKUP_PATHS_EXCLUDE_GENERATED = 1,
a1f31f47 32 LOOKUP_PATHS_TEMPORARY_GENERATED,
4943d143
LP
33} LookupPathsFlags;
34
a3c4eb07 35struct LookupPaths {
80b1ae32
LP
36 /* Where we look for unit files. This includes the individual special paths below, but also any vendor
37 * supplied, static unit file paths. */
a3c4eb07 38 char **search_path;
a0f84a10 39
80b1ae32
LP
40 /* Where we shall create or remove our installation symlinks, aka "configuration", and where the user/admin
41 * shall place his own unit files. */
a0f84a10
LP
42 char *persistent_config;
43 char *runtime_config;
44
80b1ae32
LP
45 /* Where to place generated unit files (i.e. those a "generator" tool generated). Note the special semantics of
46 * this directory: the generators are flushed each time a "systemctl daemon-reload" is issued. The user should
47 * not alter these directories directly. */
a3c4eb07
LP
48 char *generator;
49 char *generator_early;
50 char *generator_late;
e4bb56c7 51
80b1ae32
LP
52 /* Where to place transient unit files (i.e. those created dynamically via the bus API). Note the special
53 * semantics of this directory: all units created transiently have their unit files removed as the transient
54 * unit is unloaded. The user should not alter this directory directly. */
39591351
LP
55 char *transient;
56
80b1ae32
LP
57 /* Where the snippets created by "systemctl set-property" are placed. Note that for transient units, the
58 * snippets are placed in the transient directory though (see above). The user should not alter this directory
59 * directly. */
60 char *persistent_control;
61 char *runtime_control;
62
e4bb56c7
LP
63 /* The root directory prepended to all items above, or NULL */
64 char *root_dir;
a1f31f47
ZJS
65
66 /* A temporary directory when running in test mode, to be nuked */
67 char *temporary_dir;
a3c4eb07 68};
84e3543e 69
4943d143 70int lookup_paths_init(LookupPaths *p, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir);
d2561cfd
ZJS
71bool path_is_user_data_dir(const char *path);
72bool path_is_user_config_dir(const char *path);
59ccf93d 73
a1453343
LP
74int lookup_paths_reduce(LookupPaths *p);
75
cd64fd56
LP
76int lookup_paths_mkdir_generator(LookupPaths *p);
77void lookup_paths_trim_generator(LookupPaths *p);
07a78643 78void lookup_paths_flush_generator(LookupPaths *p);
cd64fd56 79
cab6235f 80void lookup_paths_free(LookupPaths *p);
59ccf93d 81#define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)
a69b4fb0
LP
82
83char **generator_binary_paths(UnitFileScope scope);