Debian Codegraph @

src/shared/unit-file.h

raw
1 /* SPDX-License-Identifier: LGPL-2.1-or-later */
2 #pragma once
3
4 #include "shared-forward.h"
5 #include "unit-def.h"
6
7 typedef enum UnitFileState {
8 UNIT_FILE_ENABLED,
9 UNIT_FILE_ENABLED_RUNTIME,
10 UNIT_FILE_LINKED,
11 UNIT_FILE_LINKED_RUNTIME,
12 UNIT_FILE_ALIAS,
13 UNIT_FILE_MASKED,
14 UNIT_FILE_MASKED_RUNTIME,
15 UNIT_FILE_STATIC,
16 UNIT_FILE_DISABLED,
17 UNIT_FILE_INDIRECT,
18 UNIT_FILE_GENERATED,
19 UNIT_FILE_TRANSIENT,
20 UNIT_FILE_BAD,
21 _UNIT_FILE_STATE_MAX,
22 _UNIT_FILE_STATE_INVALID = -EINVAL,
23 } UnitFileState;
24
25 static inline bool unit_type_may_alias(UnitType type) {
26 return IN_SET(type,
27 UNIT_SERVICE,
28 UNIT_SOCKET,
29 UNIT_TARGET,
30 UNIT_DEVICE,
31 UNIT_TIMER,
32 UNIT_PATH);
33 }
34
35 static inline bool unit_type_may_template(UnitType type) {
36 return IN_SET(type,
37 UNIT_SERVICE,
38 UNIT_SOCKET,
39 UNIT_TARGET,
40 UNIT_TIMER,
41 UNIT_PATH);
42 }
43
44 int unit_symlink_name_compatible(const char *symlink, const char *target, bool instance_propagation);
45 int unit_validate_alias_symlink_or_warn(int log_level, const char *filename, const char *target);
46
47 bool lookup_paths_timestamp_hash_same(const LookupPaths *lp, uint64_t timestamp_hash, uint64_t *ret_new);
48
49 int unit_file_resolve_symlink(
50 const char *root_dir,
51 char **search_path,
52 const char *dir,
53 int dirfd,
54 const char *filename,
55 bool resolve_destination_target,
56 char **ret_destination);
57
58 int unit_file_build_name_map(
59 const LookupPaths *lp,
60 uint64_t *cache_timestamp_hash,
61 Hashmap **unit_ids_map,
62 Hashmap **unit_names_map,
63 Set **path_cache);
64
65 int unit_file_remove_from_name_map(
66 const LookupPaths *lp,
67 uint64_t *cache_timestamp_hash,
68 Hashmap **unit_ids_map,
69 Hashmap **unit_names_map,
70 Set **path_cache,
71 const char *path);
72
73 int unit_file_find_fragment(
74 Hashmap *unit_ids_map,
75 Hashmap *unit_name_map,
76 const char *unit_name,
77 const char **ret_fragment_path,
78 Set **ret_names);
79
80 const char* runlevel_to_target(const char *word);