X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fmount.c;h=a0cea1e7d492ee1bf50a5a6f8eec2dd608f79051;hb=151b9b9662a90455262ce575a8a8ae74bf4ff336;hp=bce50548bf3cef11577fc7a8e5984dc4c49a8d8f;hpb=057d9ab8f016edfe692b7b3e84fdf6e0e000bacd;p=elogind.git diff --git a/src/core/mount.c b/src/core/mount.c index bce50548b..a0cea1e7d 100644 --- a/src/core/mount.c +++ b/src/core/mount.c @@ -181,7 +181,7 @@ static int mount_arm_timer(Mount *m) { return sd_event_source_set_enabled(m->timer_event_source, SD_EVENT_ONESHOT); } - return sd_event_add_monotonic(UNIT(m)->manager->event, now(CLOCK_MONOTONIC) + m->timeout_usec, 0, mount_dispatch_timer, m, &m->timer_event_source); + return sd_event_add_monotonic(UNIT(m)->manager->event, &m->timer_event_source, now(CLOCK_MONOTONIC) + m->timeout_usec, 0, mount_dispatch_timer, m); } static void mount_unwatch_control_pid(Mount *m) { @@ -854,8 +854,14 @@ static void mount_enter_signal(Mount *m, MountState state, MountResult f) { goto fail; mount_set_state(m, state); - } else if (state == MOUNT_REMOUNTING_SIGTERM || state == MOUNT_REMOUNTING_SIGKILL) + } else if (state == MOUNT_REMOUNTING_SIGTERM) + mount_enter_signal(m, MOUNT_REMOUNTING_SIGKILL, MOUNT_SUCCESS); + else if (state == MOUNT_REMOUNTING_SIGKILL) mount_enter_mounted(m, MOUNT_SUCCESS); + else if (state == MOUNT_MOUNTING_SIGTERM) + mount_enter_signal(m, MOUNT_MOUNTING_SIGKILL, MOUNT_SUCCESS); + else if (state == MOUNT_UNMOUNTING_SIGTERM) + mount_enter_signal(m, MOUNT_UNMOUNTING_SIGKILL, MOUNT_SUCCESS); else mount_enter_dead(m, MOUNT_SUCCESS); @@ -1583,6 +1589,20 @@ static void mount_shutdown(Manager *m) { } } +static int mount_get_timeout(Unit *u, uint64_t *timeout) { + Mount *m = MOUNT(u); + int r; + + if (!m->timer_event_source) + return 0; + + r = sd_event_source_get_time(m->timer_event_source, timeout); + if (r < 0) + return r; + + return 1; +} + static int mount_enumerate(Manager *m) { int r; assert(m); @@ -1592,7 +1612,7 @@ static int mount_enumerate(Manager *m) { if (!m->proc_self_mountinfo) return -errno; - r = sd_event_add_io(m->event, fileno(m->proc_self_mountinfo), EPOLLPRI, mount_dispatch_io, m, &m->mount_event_source); + r = sd_event_add_io(m->event, &m->mount_event_source, fileno(m->proc_self_mountinfo), EPOLLPRI, mount_dispatch_io, m); if (r < 0) goto fail; @@ -1796,6 +1816,8 @@ const UnitVTable mount_vtable = { .bus_set_property = bus_mount_set_property, .bus_commit_properties = bus_mount_commit_properties, + .get_timeout = mount_get_timeout, + .enumerate = mount_enumerate, .shutdown = mount_shutdown,