1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
9 typedef union Name Name;
10 typedef struct Meta Meta;
11 typedef struct Service Service;
12 typedef struct Timer Timer;
13 typedef struct Socket Socket;
14 typedef struct Milestone Milestone;
15 typedef struct Device Device;
16 typedef struct Mount Mount;
17 typedef struct Automount Automount;
18 typedef struct Snapshot Snapshot;
26 typedef enum NameType {
36 _NAME_TYPE_INVALID = -1,
39 typedef enum NameState {
52 /* Positive dependencies */
53 Set *requires, *soft_requires, *wants, *requisite, *soft_requisite;
54 Set *required_by; /* inverse of 'requires', 'soft_requires', 'requisite' and 'soft_requisite' is 'required_by' */
56 /* Negative dependencies */
57 Set *conflicts; /* inverse of 'conflicts' is 'conflicts' */
60 Set *before, *after; /* inverse of before is after and vice versa */
65 /* If there is something to do with this name, then this is
75 typedef enum ServiceState {
94 typedef enum ServiceMode {
106 typedef enum TimerState {
130 typedef enum SocketState {
154 typedef enum MilestoneState {
163 MilestoneState state;
166 typedef enum DeviceState {
179 typedef enum MountState {
192 typedef enum AutomountState {
197 AUTOMOUNT_START_POST,
203 AUTOMOUNT_MAINTAINANCE
209 AutomountState state;
214 typedef enum SnapshotState {
239 /* For casting a name into the various name types */
241 #define DEFINE_CAST(UPPERCASE, MixedCase, lowercase) \
242 static inline MixedCase* UPPERCASE(Name *name) { \
243 if (name->meta.type != NAME_##UPPERCASE) \
246 return &name->lowercase; \
249 DEFINE_CAST(SERVICE, Service, service);
250 DEFINE_CAST(TIMER, Timer, timer);
251 DEFINE_CAST(SOCKET, Socket, socket);
252 DEFINE_CAST(MILESTONE, Milestone, milestone);
253 DEFINE_CAST(DEVICE, Device, device);
254 DEFINE_CAST(MOUNT, Mount, mount);
255 DEFINE_CAST(AUTOMOUNT, Automount, automount);
256 DEFINE_CAST(SNAPSHOT, Snapshot, snapshot);
258 /* For casting the various name types into a name */
259 #define NAME(o) ((Name*) (o))
261 bool name_is_ready(Name *name);
262 NameType name_type_from_string(const char *n);
264 Name *name_new(Manager *m);
265 void name_free(Name *name);
266 int name_link(Name *name);
268 int name_augment(Name *n);