]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/shared/path-lookup.h
path-lookup: split out logic for mkdir/rmdir of generator dirs in their own functions
[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 struct LookupPaths {
30 char **search_path;
31
32 /* Where we shall create or remove our installation symlinks, aka "configuration". */
33 char *persistent_config;
34 char *runtime_config;
35
36 /* Where to place generated unit files */
37 char *generator;
38 char *generator_early;
39 char *generator_late;
40
41 /* Where to place transient unit files */
42 char *transient;
43
44 /* The root directory prepended to all items above, or NULL */
45 char *root_dir;
46 };
47
48 int user_config_home(char **config_home);
49 int user_runtime_dir(char **runtime_dir);
50
51 char **generator_paths(UnitFileScope scope);
52
53 int lookup_paths_init(LookupPaths *p, UnitFileScope scope, const char *root_dir);
54
55 int lookup_paths_mkdir_generator(LookupPaths *p);
56 void lookup_paths_trim_generator(LookupPaths *p);
57
58 void lookup_paths_free(LookupPaths *p);
59 #define _cleanup_lookup_paths_free_ _cleanup_(lookup_paths_free)