]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
c2f1db8f | 2 | #pragma once |
84e3543e | 3 | |
a8fbdf54 | 4 | #include <stdbool.h> |
a3c4eb07 LP |
5 | |
6 | typedef struct LookupPaths LookupPaths; | |
a3c4eb07 | 7 | |
b0c82192 | 8 | #include "def.h" |
5cfa33e0 | 9 | #include "unit-file.h" |
29686440 | 10 | #include "macro.h" |
a8ffe6fb | 11 | |
4943d143 | 12 | typedef enum LookupPathsFlags { |
ef31828d LP |
13 | LOOKUP_PATHS_EXCLUDE_GENERATED = 1 << 0, |
14 | LOOKUP_PATHS_TEMPORARY_GENERATED = 1 << 1, | |
15 | LOOKUP_PATHS_SPLIT_USR = 1 << 2, | |
4943d143 LP |
16 | } LookupPathsFlags; |
17 | ||
a3c4eb07 | 18 | struct LookupPaths { |
80b1ae32 LP |
19 | /* Where we look for unit files. This includes the individual special paths below, but also any vendor |
20 | * supplied, static unit file paths. */ | |
a3c4eb07 | 21 | char **search_path; |
a0f84a10 | 22 | |
80b1ae32 | 23 | /* Where we shall create or remove our installation symlinks, aka "configuration", and where the user/admin |
e8607daf | 24 | * shall place their own unit files. */ |
a0f84a10 LP |
25 | char *persistent_config; |
26 | char *runtime_config; | |
27 | ||
0cd4628d LP |
28 | /* Where units from a portable service image shall be placed. */ |
29 | char *persistent_attached; | |
30 | char *runtime_attached; | |
31 | ||
80b1ae32 LP |
32 | /* Where to place generated unit files (i.e. those a "generator" tool generated). Note the special semantics of |
33 | * this directory: the generators are flushed each time a "systemctl daemon-reload" is issued. The user should | |
34 | * not alter these directories directly. */ | |
a3c4eb07 LP |
35 | char *generator; |
36 | char *generator_early; | |
37 | char *generator_late; | |
e4bb56c7 | 38 | |
80b1ae32 LP |
39 | /* Where to place transient unit files (i.e. those created dynamically via the bus API). Note the special |
40 | * semantics of this directory: all units created transiently have their unit files removed as the transient | |
41 | * unit is unloaded. The user should not alter this directory directly. */ | |
39591351 LP |
42 | char *transient; |
43 | ||
80b1ae32 LP |
44 | /* Where the snippets created by "systemctl set-property" are placed. Note that for transient units, the |
45 | * snippets are placed in the transient directory though (see above). The user should not alter this directory | |
46 | * directly. */ | |
47 | char *persistent_control; | |
48 | char *runtime_control; | |
49 | ||
e4bb56c7 LP |
50 | /* The root directory prepended to all items above, or NULL */ |
51 | char *root_dir; | |
a1f31f47 ZJS |
52 | |
53 | /* A temporary directory when running in test mode, to be nuked */ | |
54 | char *temporary_dir; | |
a3c4eb07 | 55 | }; |
84e3543e | 56 | |
4943d143 | 57 | int lookup_paths_init(LookupPaths *p, UnitFileScope scope, LookupPathsFlags flags, const char *root_dir); |
0cd4628d | 58 | |
ca4adeb7 ZJS |
59 | int xdg_user_dirs(char ***ret_config_dirs, char ***ret_data_dirs); |
60 | int xdg_user_runtime_dir(char **ret, const char *suffix); | |
61 | int xdg_user_config_dir(char **ret, const char *suffix); | |
62 | int xdg_user_data_dir(char **ret, const char *suffix); | |
0cd4628d | 63 | |
d2561cfd ZJS |
64 | bool path_is_user_data_dir(const char *path); |
65 | bool path_is_user_config_dir(const char *path); | |
59ccf93d | 66 | |
581fef8d | 67 | void lookup_paths_log(LookupPaths *p); |
cab6235f | 68 | void lookup_paths_free(LookupPaths *p); |
a69b4fb0 LP |
69 | |
70 | char **generator_binary_paths(UnitFileScope scope); | |
cccf5703 | 71 | char **env_generator_binary_paths(bool is_system); |
b0c82192 ZJS |
72 | |
73 | #define NETWORK_DIRS ((const char* const*) CONF_PATHS_STRV("systemd/network")) | |
f1bb691a | 74 | #define NETWORK_DIRS_NULSTR CONF_PATHS_NULSTR("systemd/network") |