1 /*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
7 This file is part of systemd.
9 Copyright 2011 Lennart Poettering
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.
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.
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/>.
27 typedef enum UnitFileScope
{
32 _UNIT_FILE_SCOPE_INVALID
= -1
35 typedef enum UnitFileState
{
37 UNIT_FILE_ENABLED_RUNTIME
,
39 UNIT_FILE_LINKED_RUNTIME
,
41 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
{
66 int unit_file_enable(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], bool force
, UnitFileChange
**changes
, unsigned *n_changes
);
67 int unit_file_disable(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], UnitFileChange
**changes
, unsigned *n_changes
);
68 int unit_file_reenable(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], bool force
, UnitFileChange
**changes
, unsigned *n_changes
);
69 int unit_file_link(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], bool force
, UnitFileChange
**changes
, unsigned *n_changes
);
70 int unit_file_preset(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], bool force
, UnitFileChange
**changes
, unsigned *n_changes
);
71 int unit_file_mask(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], bool force
, UnitFileChange
**changes
, unsigned *n_changes
);
72 int unit_file_unmask(UnitFileScope scope
, bool runtime
, const char *root_dir
, char *files
[], UnitFileChange
**changes
, unsigned *n_changes
);
74 UnitFileState
unit_file_get_state(UnitFileScope scope
, const char *root_dir
, const char *filename
);
76 int unit_file_get_list(UnitFileScope scope
, const char *root_dir
, Hashmap
*h
);
78 void unit_file_list_free(Hashmap
*h
);
79 void unit_file_changes_free(UnitFileChange
*changes
, unsigned n_changes
);
81 int unit_file_query_preset(UnitFileScope scope
, const char *name
);
83 const char *unit_file_state_to_string(UnitFileState s
);
84 UnitFileState
unit_file_state_from_string(const char *s
);
86 const char *unit_file_change_type_to_string(UnitFileChangeType s
);
87 UnitFileChangeType
unit_file_change_type_from_string(const char *s
);