1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
6 This file is part of systemd.
8 Copyright 2011 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
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
13 (at your option) any later version.
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
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 typedef enum UnitFileScope {
31 _UNIT_FILE_SCOPE_INVALID = -1
34 typedef enum UnitFileState {
36 UNIT_FILE_ENABLED_RUNTIME,
38 UNIT_FILE_LINKED_RUNTIME,
40 UNIT_FILE_MASKED_RUNTIME,
45 _UNIT_FILE_STATE_INVALID = -1
48 typedef enum UnitFileChangeType {
51 _UNIT_FILE_CHANGE_TYPE_MAX,
52 _UNIT_FILE_CHANGE_TYPE_INVALID = -1
55 typedef struct UnitFileChange {
56 UnitFileChangeType type;
61 typedef struct UnitFileList {
76 int unit_file_enable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
77 int unit_file_disable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
78 int unit_file_reenable(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
79 int unit_file_link(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
80 int unit_file_preset(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
81 int unit_file_mask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, bool force, UnitFileChange **changes, unsigned *n_changes);
82 int unit_file_unmask(UnitFileScope scope, bool runtime, const char *root_dir, char **files, UnitFileChange **changes, unsigned *n_changes);
83 int unit_file_set_default(UnitFileScope scope, const char *root_dir, const char *file, bool force, UnitFileChange **changes, unsigned *n_changes);
84 int unit_file_get_default(UnitFileScope scope, const char *root_dir, char **name);
86 UnitFileState unit_file_get_state(UnitFileScope scope, const char *root_dir, const char *filename);
88 int unit_file_get_list(UnitFileScope scope, const char *root_dir, Hashmap *h);
90 void unit_file_list_free(Hashmap *h);
91 void unit_file_changes_free(UnitFileChange *changes, unsigned n_changes);
93 int unit_file_query_preset(UnitFileScope scope, const char *name);
95 const char *unit_file_state_to_string(UnitFileState s) _const_;
96 UnitFileState unit_file_state_from_string(const char *s) _pure_;
98 const char *unit_file_change_type_to_string(UnitFileChangeType s) _const_;
99 UnitFileChangeType unit_file_change_type_from_string(const char *s) _pure_;