]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/install.h
udev: check-keymaps.sh - fix source directory
[thirdparty/systemd.git] / src / install.h
CommitLineData
83096483
LP
1/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
2
3#ifndef fooinstallhfoo
4#define fooinstallhfoo
5
6/***
7 This file is part of systemd.
8
9 Copyright 2011 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23***/
24
25#include "hashmap.h"
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,
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
66int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
67int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes);
68int unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
69int unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
70int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
71int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], bool force, UnitFileChange **changes, unsigned *n_changes);
72int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char *files[], UnitFileChange **changes, unsigned *n_changes);
73
74UnitFileState unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename);
75
76int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h);
77
78void unit_file_list_free(Hashmap *h);
79void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes);
80
81int unit_file_query_preset(UnitFileScope scope, const char *name);
82
83const char *unit_file_state_to_string(UnitFileState s);
84UnitFileState unit_file_state_from_string(const char *s);
85
c0576cd6
LP
86const char *unit_file_change_type_to_string(UnitFileChangeType s);
87UnitFileChangeType unit_file_change_type_from_string(const char *s);
88
83096483 89#endif