]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/install.h
update TODO
[thirdparty/systemd.git] / src / shared / install.h
CommitLineData
83096483
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
c2f1db8f 3#pragma once
83096483
LP
4
5/***
6 This file is part of systemd.
7
8 Copyright 2011 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
5430f7f2
LP
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
83096483
LP
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
5430f7f2 18 Lesser General Public License for more details.
83096483 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
83096483
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22***/
23
24#include "hashmap.h"
e94937df 25#include "unit-name.h"
83096483
LP
26
27typedef enum UnitFileScope {
28 UNIT_FILE_SYSTEM,
29 UNIT_FILE_GLOBAL,
30 UNIT_FILE_USER,
31 _UNIT_FILE_SCOPE_MAX,
32 _UNIT_FILE_SCOPE_INVALID = -1
33} UnitFileScope;
34
35typedef enum UnitFileState {
36 UNIT_FILE_ENABLED,
37 UNIT_FILE_ENABLED_RUNTIME,
38 UNIT_FILE_LINKED,
39 UNIT_FILE_LINKED_RUNTIME,
40 UNIT_FILE_MASKED,
41 UNIT_FILE_MASKED_RUNTIME,
42 UNIT_FILE_STATIC,
43 UNIT_FILE_DISABLED,
b5b46d59 44 UNIT_FILE_INVALID,
83096483
LP
45 _UNIT_FILE_STATE_MAX,
46 _UNIT_FILE_STATE_INVALID = -1
47} UnitFileState;
48
d309c1c3
LP
49typedef enum UnitFilePresetMode {
50 UNIT_FILE_PRESET_FULL,
51 UNIT_FILE_PRESET_ENABLE_ONLY,
52 UNIT_FILE_PRESET_DISABLE_ONLY,
86bbe5bf 53 _UNIT_FILE_PRESET_MAX,
d309c1c3
LP
54 _UNIT_FILE_PRESET_INVALID = -1
55} UnitFilePresetMode;
56
83096483
LP
57typedef enum UnitFileChangeType {
58 UNIT_FILE_SYMLINK,
59 UNIT_FILE_UNLINK,
60 _UNIT_FILE_CHANGE_TYPE_MAX,
61 _UNIT_FILE_CHANGE_TYPE_INVALID = -1
62} UnitFileChangeType;
63
64typedef struct UnitFileChange {
65 UnitFileChangeType type;
66 char *path;
67 char *source;
68} UnitFileChange;
69
70typedef struct UnitFileList {
71 char *path;
72 UnitFileState state;
73} UnitFileList;
74
7584d236
ZJS
75typedef struct {
76 char *name;
77 char *path;
3f0b2f0f 78 char *user;
7584d236
ZJS
79
80 char **aliases;
81 char **wanted_by;
82 char **required_by;
d54c4993
LP
83
84 char *default_instance;
7584d236
ZJS
85} InstallInfo;
86
7195aa42
ZJS
87int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
88int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
89int unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
90int unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
d309c1c3
LP
91int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFilePresetMode mode, bool force, UnitFileChange **changes, unsigned *n_changes);
92int unit_file_preset_all(UnitFileScope scope, bool runtime, const char *root_dir, UnitFilePresetMode mode, bool force, UnitFileChange **changes, unsigned *n_changes);
7195aa42
ZJS
93int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
94int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
718db961 95int unit_file_set_default(UnitFileScope scope, const char *root_dir, const char *file, bool force, UnitFileChange **changes, unsigned *n_changes);
99504dd4 96int unit_file_get_default(UnitFileScope scope, const char *root_dir, char **name);
e94937df 97int unit_file_add_dependency(UnitFileScope scope, bool runtime, const char *root_dir, char **files, char *target, UnitDependency dep, bool force, UnitFileChange **changes, unsigned *n_changes);
83096483
LP
98
99UnitFileState unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename);
100
101int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h);
102
103void unit_file_list_free(Hashmap *h);
104void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes);
105
c2a8d7b0 106int unit_file_query_preset(UnitFileScope scope, const char *root_dir, const char *name);
83096483 107
44a6b1b6
ZJS
108const char *unit_file_state_to_string(UnitFileState s) _const_;
109UnitFileState unit_file_state_from_string(const char *s) _pure_;
83096483 110
44a6b1b6
ZJS
111const char *unit_file_change_type_to_string(UnitFileChangeType s) _const_;
112UnitFileChangeType unit_file_change_type_from_string(const char *s) _pure_;
d309c1c3
LP
113
114const char *unit_file_preset_mode_to_string(UnitFilePresetMode m) _const_;
115UnitFilePresetMode unit_file_preset_mode_from_string(const char *s) _pure_;