| |
| #pragma once |
| |
| #include "unit.h" |
| |
| typedef struct Device Device; |
| |
| |
| |
| |
| |
| typedef enum DeviceFound { |
| DEVICE_NOT_FOUND = 0, |
| DEVICE_FOUND_UDEV = 1U << 1, |
| DEVICE_FOUND_MOUNT = 1U << 2, |
| DEVICE_FOUND_SWAP = 1U << 3, |
| DEVICE_FOUND_MASK = DEVICE_FOUND_UDEV|DEVICE_FOUND_MOUNT|DEVICE_FOUND_SWAP, |
| } DeviceFound; |
| |
| struct Device { |
| Unit meta; |
| |
| char *sysfs; |
| |
| |
| |
| LIST_FIELDS(struct Device, same_sysfs); |
| |
| DeviceState state, deserialized_state; |
| DeviceFound found, deserialized_found, enumerated_found; |
| |
| bool bind_mounts; |
| |
| |
| char **wants_property; |
| }; |
| |
| extern const UnitVTable device_vtable; |
| |
| void device_found_node(Manager *m, const char *node, DeviceFound found, DeviceFound mask); |
| bool device_shall_be_bound_by(Unit *device, Unit *u); |
| |
| DEFINE_CAST(DEVICE, Device); |