4 This file is part of systemd.
6 Copyright 2010 Lennart Poettering
8 systemd is free software; you can redistribute it and/or modify it
9 under the terms of the GNU Lesser General Public License as published by
10 the Free Software Foundation; either version 2.1 of the License, or
11 (at your option) any later version.
13 systemd is distributed in the hope that it will be useful, but
14 WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 Lesser General Public License for more details.
18 You should have received a copy of the GNU Lesser General Public License
19 along with systemd; If not, see <http://www.gnu.org/licenses/>.
26 typedef enum UnitType
{
39 _UNIT_TYPE_INVALID
= -1
42 typedef enum UnitLoadState
{
50 _UNIT_LOAD_STATE_INVALID
= -1
53 typedef enum UnitActiveState
{
60 _UNIT_ACTIVE_STATE_MAX
,
61 _UNIT_ACTIVE_STATE_INVALID
= -1
64 typedef enum AutomountState
{
70 _AUTOMOUNT_STATE_INVALID
= -1
73 /* We simply watch devices, we cannot plug/unplug them. That
74 * simplifies the state engine greatly */
75 typedef enum DeviceState
{
77 DEVICE_TENTATIVE
, /* mounted or swapped, but not (yet) announced by udev */
78 DEVICE_PLUGGED
, /* announced by udev */
80 _DEVICE_STATE_INVALID
= -1
83 typedef enum MountState
{
85 MOUNT_MOUNTING
, /* /usr/bin/mount is running, but the mount is not done yet. */
86 MOUNT_MOUNTING_DONE
, /* /usr/bin/mount is running, and the mount is done. */
90 MOUNT_REMOUNTING_SIGTERM
,
91 MOUNT_REMOUNTING_SIGKILL
,
92 MOUNT_UNMOUNTING_SIGTERM
,
93 MOUNT_UNMOUNTING_SIGKILL
,
96 _MOUNT_STATE_INVALID
= -1
99 typedef enum PathState
{
105 _PATH_STATE_INVALID
= -1
108 typedef enum ScopeState
{
116 _SCOPE_STATE_INVALID
= -1
119 typedef enum ServiceState
{
125 SERVICE_EXITED
, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
127 SERVICE_STOP
, /* No STOP_PRE state, instead just register multiple STOP executables */
128 SERVICE_STOP_SIGABRT
, /* Watchdog timeout */
129 SERVICE_STOP_SIGTERM
,
130 SERVICE_STOP_SIGKILL
,
132 SERVICE_FINAL_SIGTERM
, /* In case the STOP_POST executable hangs, we shoot that down, too */
133 SERVICE_FINAL_SIGKILL
,
135 SERVICE_AUTO_RESTART
,
137 _SERVICE_STATE_INVALID
= -1
140 typedef enum SliceState
{
144 _SLICE_STATE_INVALID
= -1
147 typedef enum SocketState
{
155 SOCKET_STOP_PRE_SIGTERM
,
156 SOCKET_STOP_PRE_SIGKILL
,
158 SOCKET_FINAL_SIGTERM
,
159 SOCKET_FINAL_SIGKILL
,
162 _SOCKET_STATE_INVALID
= -1
165 typedef enum SwapState
{
167 SWAP_ACTIVATING
, /* /sbin/swapon is running, but the swap not yet enabled. */
168 SWAP_ACTIVATING_DONE
, /* /sbin/swapon is running, and the swap is done. */
171 SWAP_DEACTIVATING_SIGTERM
,
172 SWAP_DEACTIVATING_SIGKILL
,
175 _SWAP_STATE_INVALID
= -1
178 typedef enum TargetState
{
182 _TARGET_STATE_INVALID
= -1
185 typedef enum TimerState
{
192 _TIMER_STATE_INVALID
= -1
195 typedef enum UnitDependency
{
196 /* Positive dependencies */
203 /* Inverse of the above */
204 UNIT_REQUIRED_BY
, /* inverse of 'requires' is 'required_by' */
205 UNIT_REQUISITE_OF
, /* inverse of 'requisite' is 'requisite_of' */
206 UNIT_WANTED_BY
, /* inverse of 'wants' */
207 UNIT_BOUND_BY
, /* inverse of 'binds_to' */
208 UNIT_CONSISTS_OF
, /* inverse of 'part_of' */
210 /* Negative dependencies */
211 UNIT_CONFLICTS
, /* inverse of 'conflicts' is 'conflicted_by' */
215 UNIT_BEFORE
, /* inverse of 'before' is 'after' and vice versa */
221 /* Triggers (i.e. a socket triggers a service) */
225 /* Propagate reloads */
226 UNIT_PROPAGATES_RELOAD_TO
,
227 UNIT_RELOAD_PROPAGATED_FROM
,
229 /* Joins namespace of */
230 UNIT_JOINS_NAMESPACE_OF
,
232 /* Reference information for GC logic */
233 UNIT_REFERENCES
, /* Inverse of 'references' is 'referenced_by' */
236 _UNIT_DEPENDENCY_MAX
,
237 _UNIT_DEPENDENCY_INVALID
= -1
240 typedef enum NotifyAccess
{
246 _NOTIFY_ACCESS_INVALID
= -1
249 char *unit_dbus_path_from_name(const char *name
);
250 int unit_name_from_dbus_path(const char *path
, char **name
);
252 const char* unit_dbus_interface_from_type(UnitType t
);
253 const char *unit_dbus_interface_from_name(const char *name
);
255 const char *unit_type_to_string(UnitType i
) _const_
;
256 UnitType
unit_type_from_string(const char *s
) _pure_
;
258 const char *unit_load_state_to_string(UnitLoadState i
) _const_
;
259 UnitLoadState
unit_load_state_from_string(const char *s
) _pure_
;
261 const char *unit_active_state_to_string(UnitActiveState i
) _const_
;
262 UnitActiveState
unit_active_state_from_string(const char *s
) _pure_
;
264 const char* automount_state_to_string(AutomountState i
) _const_
;
265 AutomountState
automount_state_from_string(const char *s
) _pure_
;
267 const char* device_state_to_string(DeviceState i
) _const_
;
268 DeviceState
device_state_from_string(const char *s
) _pure_
;
270 const char* mount_state_to_string(MountState i
) _const_
;
271 MountState
mount_state_from_string(const char *s
) _pure_
;
273 const char* path_state_to_string(PathState i
) _const_
;
274 PathState
path_state_from_string(const char *s
) _pure_
;
276 const char* scope_state_to_string(ScopeState i
) _const_
;
277 ScopeState
scope_state_from_string(const char *s
) _pure_
;
279 const char* service_state_to_string(ServiceState i
) _const_
;
280 ServiceState
service_state_from_string(const char *s
) _pure_
;
282 const char* slice_state_to_string(SliceState i
) _const_
;
283 SliceState
slice_state_from_string(const char *s
) _pure_
;
285 const char* socket_state_to_string(SocketState i
) _const_
;
286 SocketState
socket_state_from_string(const char *s
) _pure_
;
288 const char* swap_state_to_string(SwapState i
) _const_
;
289 SwapState
swap_state_from_string(const char *s
) _pure_
;
291 const char* target_state_to_string(TargetState i
) _const_
;
292 TargetState
target_state_from_string(const char *s
) _pure_
;
294 const char *timer_state_to_string(TimerState i
) _const_
;
295 TimerState
timer_state_from_string(const char *s
) _pure_
;
297 const char *unit_dependency_to_string(UnitDependency i
) _const_
;
298 UnitDependency
unit_dependency_from_string(const char *s
) _pure_
;
300 const char* notify_access_to_string(NotifyAccess i
) _const_
;
301 NotifyAccess
notify_access_from_string(const char *s
) _pure_
;