1 /* SPDX-License-Identifier: LGPL-2.1-or-later */ 2 #pragma once 3 4 #include <stdbool.h> 5 6 #include "hashmap.h" 7 #include "path-lookup.h" 8 #include "time-util.h" 9 #include "unit-name.h" 10 11 typedef enum UnitFileState UnitFileState; 12 13 enum UnitFileState { 14 UNIT_FILE_ENABLED, 15 UNIT_FILE_ENABLED_RUNTIME, 16 UNIT_FILE_LINKED, 17 UNIT_FILE_LINKED_RUNTIME, 18 UNIT_FILE_ALIAS, 19 UNIT_FILE_MASKED, 20 UNIT_FILE_MASKED_RUNTIME, 21 UNIT_FILE_STATIC, 22 UNIT_FILE_DISABLED, 23 UNIT_FILE_INDIRECT, 24 UNIT_FILE_GENERATED, 25 UNIT_FILE_TRANSIENT, 26 UNIT_FILE_BAD, 27 _UNIT_FILE_STATE_MAX, 28 _UNIT_FILE_STATE_INVALID = -EINVAL, 29 }; 30 31 bool unit_type_may_alias(UnitType type) _const_; 32 bool unit_type_may_template(UnitType type) _const_; 33 34 int unit_symlink_name_compatible(const char *symlink, const char *target, bool instance_propagation); 35 int unit_validate_alias_symlink_or_warn(int log_level, const char *filename, const char *target); 36 37 bool lookup_paths_timestamp_hash_same(const LookupPaths *lp, uint64_t timestamp_hash, uint64_t *ret_new); 38 39 int unit_file_resolve_symlink( 40 const char *root_dir, 41 char **search_path, 42 const char *dir, 43 int dirfd, 44 const char *filename, 45 bool resolve_destination_target, 46 char **ret_destination); 47 48 int unit_file_build_name_map( 49 const LookupPaths *lp, 50 uint64_t *cache_timestamp_hash, 51 Hashmap **unit_ids_map, 52 Hashmap **unit_names_map, 53 Set **path_cache); 54 55 int unit_file_find_fragment( 56 Hashmap *unit_ids_map, 57 Hashmap *unit_name_map, 58 const char *unit_name, 59 const char **ret_fragment_path, 60 Set **ret_names); 61 62 const char* runlevel_to_target(const char *rl); 63