1 /* SPDX-License-Identifier: LGPL-2.1+ */
5 This file is part of systemd.
7 Copyright 2010 Lennart Poettering
14 typedef enum UnitType {
27 _UNIT_TYPE_INVALID = -1
30 typedef enum UnitLoadState {
38 _UNIT_LOAD_STATE_INVALID = -1
41 typedef enum UnitActiveState {
48 _UNIT_ACTIVE_STATE_MAX,
49 _UNIT_ACTIVE_STATE_INVALID = -1
52 typedef enum AutomountState {
58 _AUTOMOUNT_STATE_INVALID = -1
61 /* We simply watch devices, we cannot plug/unplug them. That
62 * simplifies the state engine greatly */
63 typedef enum DeviceState {
65 DEVICE_TENTATIVE, /* mounted or swapped, but not (yet) announced by udev */
66 DEVICE_PLUGGED, /* announced by udev */
68 _DEVICE_STATE_INVALID = -1
71 typedef enum MountState {
73 MOUNT_MOUNTING, /* /usr/bin/mount is running, but the mount is not done yet. */
74 MOUNT_MOUNTING_DONE, /* /usr/bin/mount is running, and the mount is done. */
78 MOUNT_REMOUNTING_SIGTERM,
79 MOUNT_REMOUNTING_SIGKILL,
80 MOUNT_UNMOUNTING_SIGTERM,
81 MOUNT_UNMOUNTING_SIGKILL,
84 _MOUNT_STATE_INVALID = -1
87 typedef enum PathState {
93 _PATH_STATE_INVALID = -1
96 typedef enum ScopeState {
104 _SCOPE_STATE_INVALID = -1
107 typedef enum ServiceState {
113 SERVICE_EXITED, /* Nothing is running anymore, but RemainAfterExit is true hence this is OK */
115 SERVICE_STOP, /* No STOP_PRE state, instead just register multiple STOP executables */
116 SERVICE_STOP_SIGABRT, /* Watchdog timeout */
117 SERVICE_STOP_SIGTERM,
118 SERVICE_STOP_SIGKILL,
120 SERVICE_FINAL_SIGTERM, /* In case the STOP_POST executable hangs, we shoot that down, too */
121 SERVICE_FINAL_SIGKILL,
123 SERVICE_AUTO_RESTART,
125 _SERVICE_STATE_INVALID = -1
128 typedef enum SliceState {
132 _SLICE_STATE_INVALID = -1
135 typedef enum SocketState {
143 SOCKET_STOP_PRE_SIGTERM,
144 SOCKET_STOP_PRE_SIGKILL,
146 SOCKET_FINAL_SIGTERM,
147 SOCKET_FINAL_SIGKILL,
150 _SOCKET_STATE_INVALID = -1
153 typedef enum SwapState {
155 SWAP_ACTIVATING, /* /sbin/swapon is running, but the swap not yet enabled. */
156 SWAP_ACTIVATING_DONE, /* /sbin/swapon is running, and the swap is done. */
159 SWAP_DEACTIVATING_SIGTERM,
160 SWAP_DEACTIVATING_SIGKILL,
163 _SWAP_STATE_INVALID = -1
166 typedef enum TargetState {
170 _TARGET_STATE_INVALID = -1
173 typedef enum TimerState {
180 _TIMER_STATE_INVALID = -1
183 typedef enum UnitDependency {
184 /* Positive dependencies */
191 /* Inverse of the above */
192 UNIT_REQUIRED_BY, /* inverse of 'requires' is 'required_by' */
193 UNIT_REQUISITE_OF, /* inverse of 'requisite' is 'requisite_of' */
194 UNIT_WANTED_BY, /* inverse of 'wants' */
195 UNIT_BOUND_BY, /* inverse of 'binds_to' */
196 UNIT_CONSISTS_OF, /* inverse of 'part_of' */
198 /* Negative dependencies */
199 UNIT_CONFLICTS, /* inverse of 'conflicts' is 'conflicted_by' */
203 UNIT_BEFORE, /* inverse of 'before' is 'after' and vice versa */
209 /* Triggers (i.e. a socket triggers a service) */
213 /* Propagate reloads */
214 UNIT_PROPAGATES_RELOAD_TO,
215 UNIT_RELOAD_PROPAGATED_FROM,
217 /* Joins namespace of */
218 UNIT_JOINS_NAMESPACE_OF,
220 /* Reference information for GC logic */
221 UNIT_REFERENCES, /* Inverse of 'references' is 'referenced_by' */
224 _UNIT_DEPENDENCY_MAX,
225 _UNIT_DEPENDENCY_INVALID = -1
228 typedef enum NotifyAccess {
234 _NOTIFY_ACCESS_INVALID = -1
237 char *unit_dbus_path_from_name(const char *name);
238 int unit_name_from_dbus_path(const char *path, char **name);
240 const char* unit_dbus_interface_from_type(UnitType t);
241 const char *unit_dbus_interface_from_name(const char *name);
243 const char *unit_type_to_string(UnitType i) _const_;
244 UnitType unit_type_from_string(const char *s) _pure_;
246 const char *unit_load_state_to_string(UnitLoadState i) _const_;
247 UnitLoadState unit_load_state_from_string(const char *s) _pure_;
249 const char *unit_active_state_to_string(UnitActiveState i) _const_;
250 UnitActiveState unit_active_state_from_string(const char *s) _pure_;
252 const char* automount_state_to_string(AutomountState i) _const_;
253 AutomountState automount_state_from_string(const char *s) _pure_;
255 const char* device_state_to_string(DeviceState i) _const_;
256 DeviceState device_state_from_string(const char *s) _pure_;
258 const char* mount_state_to_string(MountState i) _const_;
259 MountState mount_state_from_string(const char *s) _pure_;
261 const char* path_state_to_string(PathState i) _const_;
262 PathState path_state_from_string(const char *s) _pure_;
264 const char* scope_state_to_string(ScopeState i) _const_;
265 ScopeState scope_state_from_string(const char *s) _pure_;
267 const char* service_state_to_string(ServiceState i) _const_;
268 ServiceState service_state_from_string(const char *s) _pure_;
270 const char* slice_state_to_string(SliceState i) _const_;
271 SliceState slice_state_from_string(const char *s) _pure_;
273 const char* socket_state_to_string(SocketState i) _const_;
274 SocketState socket_state_from_string(const char *s) _pure_;
276 const char* swap_state_to_string(SwapState i) _const_;
277 SwapState swap_state_from_string(const char *s) _pure_;
279 const char* target_state_to_string(TargetState i) _const_;
280 TargetState target_state_from_string(const char *s) _pure_;
282 const char *timer_state_to_string(TimerState i) _const_;
283 TimerState timer_state_from_string(const char *s) _pure_;
285 const char *unit_dependency_to_string(UnitDependency i) _const_;
286 UnitDependency unit_dependency_from_string(const char *s) _pure_;
288 const char* notify_access_to_string(NotifyAccess i) _const_;
289 NotifyAccess notify_access_from_string(const char *s) _pure_;