]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/shared/install.h
hashmap.h: fix coding style issue
[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"
25
26typedef enum UnitFileScope {
27 UNIT_FILE_SYSTEM,
28 UNIT_FILE_GLOBAL,
29 UNIT_FILE_USER,
30 _UNIT_FILE_SCOPE_MAX,
31 _UNIT_FILE_SCOPE_INVALID = -1
32} UnitFileScope;
33
34typedef enum UnitFileState {
35 UNIT_FILE_ENABLED,
36 UNIT_FILE_ENABLED_RUNTIME,
37 UNIT_FILE_LINKED,
38 UNIT_FILE_LINKED_RUNTIME,
39 UNIT_FILE_MASKED,
40 UNIT_FILE_MASKED_RUNTIME,
41 UNIT_FILE_STATIC,
42 UNIT_FILE_DISABLED,
b5b46d59 43 UNIT_FILE_INVALID,
83096483
LP
44 _UNIT_FILE_STATE_MAX,
45 _UNIT_FILE_STATE_INVALID = -1
46} UnitFileState;
47
48typedef enum UnitFileChangeType {
49 UNIT_FILE_SYMLINK,
50 UNIT_FILE_UNLINK,
51 _UNIT_FILE_CHANGE_TYPE_MAX,
52 _UNIT_FILE_CHANGE_TYPE_INVALID = -1
53} UnitFileChangeType;
54
55typedef struct UnitFileChange {
56 UnitFileChangeType type;
57 char *path;
58 char *source;
59} UnitFileChange;
60
61typedef struct UnitFileList {
62 char *path;
63 UnitFileState state;
64} UnitFileList;
65
7584d236
ZJS
66typedef struct {
67 char *name;
68 char *path;
3f0b2f0f 69 char *user;
7584d236
ZJS
70
71 char **aliases;
72 char **wanted_by;
73 char **required_by;
74} InstallInfo;
75
83096483
LP
76int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
77int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes);
78int unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
79int unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
80int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
81int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
82int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes);
83
84UnitFileState unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename);
85
86int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h);
87
88void unit_file_list_free(Hashmap *h);
89void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes);
90
91int unit_file_query_preset(UnitFileScope scope, const char *name);
92
93const char *unit_file_state_to_string(UnitFileState s);
94UnitFileState unit_file_state_from_string(const char *s);
95
c0576cd6
LP
96const char *unit_file_change_type_to_string(UnitFileChangeType s);
97UnitFileChangeType unit_file_change_type_from_string(const char *s);