]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/unit-file.h
pid1: use a cache for all unit aliases
[thirdparty/systemd.git] / src / shared / unit-file.h
CommitLineData
5cfa33e0
ZJS
1/* SPDX-License-Identifier: LGPL-2.1+ */
2#pragma once
3
4#include <stdbool.h>
5
e8630e69 6#include "hashmap.h"
5cfa33e0
ZJS
7#include "unit-name.h"
8
9typedef enum UnitFileState UnitFileState;
10typedef enum UnitFileScope UnitFileScope;
e8630e69 11typedef struct LookupPaths LookupPaths;
5cfa33e0
ZJS
12
13enum UnitFileState {
14 UNIT_FILE_ENABLED,
15 UNIT_FILE_ENABLED_RUNTIME,
16 UNIT_FILE_LINKED,
17 UNIT_FILE_LINKED_RUNTIME,
18 UNIT_FILE_MASKED,
19 UNIT_FILE_MASKED_RUNTIME,
20 UNIT_FILE_STATIC,
21 UNIT_FILE_DISABLED,
22 UNIT_FILE_INDIRECT,
23 UNIT_FILE_GENERATED,
24 UNIT_FILE_TRANSIENT,
25 UNIT_FILE_BAD,
26 _UNIT_FILE_STATE_MAX,
27 _UNIT_FILE_STATE_INVALID = -1
28};
29
30enum UnitFileScope {
31 UNIT_FILE_SYSTEM,
32 UNIT_FILE_GLOBAL,
33 UNIT_FILE_USER,
34 _UNIT_FILE_SCOPE_MAX,
35 _UNIT_FILE_SCOPE_INVALID = -1
36};
37
38bool unit_type_may_alias(UnitType type) _const_;
39bool unit_type_may_template(UnitType type) _const_;
7d1e91d1
ZJS
40
41int unit_validate_alias_symlink_and_warn(const char *filename, const char *target);
e8630e69
ZJS
42
43int unit_file_build_name_map(
44 const LookupPaths *lp,
45 Hashmap **ret_unit_ids_map,
46 Hashmap **ret_unit_names_map,
47 Set **ret_path_cache);
48
49int unit_file_find_fragment(
50 Hashmap *unit_ids_map,
51 Hashmap *unit_name_map,
52 const char *unit_name,
53 const char **ret_fragment_path,
54 Set **names);