chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
job: timeout every job independently of the unit
[elogind.git]
/
src
/
device.c
diff --git
a/src/device.c
b/src/device.c
index aeafd5e9f377af7fcb5f440339a4917cdbfb9eaf..39ab29110374058a125e94d064f7991219cf91d0 100644
(file)
--- a/
src/device.c
+++ b/
src/device.c
@@
-32,9
+32,18
@@
static const UnitActiveState state_translation_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = UNIT_INACTIVE,
static const UnitActiveState state_translation_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = UNIT_INACTIVE,
- [DEVICE_
AVAILABLE
] = UNIT_ACTIVE
+ [DEVICE_
PLUGGED
] = UNIT_ACTIVE
};
};
+static void device_init(Unit *u) {
+ Device *d = DEVICE(u);
+
+ assert(d);
+ assert(d->meta.load_state == UNIT_STUB);
+
+ d->meta.job_timeout = DEFAULT_TIMEOUT_USEC;
+}
+
static void device_done(Unit *u) {
Device *d = DEVICE(u);
static void device_done(Unit *u) {
Device *d = DEVICE(u);
@@
-67,7
+76,7
@@
static int device_coldplug(Unit *u) {
assert(d->state == DEVICE_DEAD);
if (d->sysfs)
assert(d->state == DEVICE_DEAD);
if (d->sysfs)
- device_set_state(d, DEVICE_
AVAILABLE
);
+ device_set_state(d, DEVICE_
PLUGGED
);
return 0;
}
return 0;
}
@@
-262,7
+271,7
@@
static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
if (update_state) {
manager_dispatch_load_queue(u->meta.manager);
if (update_state) {
manager_dispatch_load_queue(u->meta.manager);
- device_set_state(DEVICE(u), DEVICE_
AVAILABLE
);
+ device_set_state(DEVICE(u), DEVICE_
PLUGGED
);
}
unit_add_to_dbus_queue(u);
}
unit_add_to_dbus_queue(u);
@@
-443,7
+452,7
@@
fail:
static const char* const device_state_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = "dead",
static const char* const device_state_table[_DEVICE_STATE_MAX] = {
[DEVICE_DEAD] = "dead",
- [DEVICE_
AVAILABLE] = "available
"
+ [DEVICE_
PLUGGED] = "plugged
"
};
DEFINE_STRING_TABLE_LOOKUP(device_state, DeviceState);
};
DEFINE_STRING_TABLE_LOOKUP(device_state, DeviceState);
@@
-456,6
+465,8
@@
const UnitVTable device_vtable = {
.no_snapshots = true,
.no_isolate = true,
.no_snapshots = true,
.no_isolate = true,
+ .init = device_init,
+
.load = unit_load_fragment_and_dropin_optional,
.done = device_done,
.coldplug = device_coldplug,
.load = unit_load_fragment_and_dropin_optional,
.done = device_done,
.coldplug = device_coldplug,