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