udevd: trivial refactoring of is_device_busy()

This commit is contained in:
Yu Watanabe 2019-01-29 13:53:13 +01:00
parent 92dc48ac45
commit 0bd0407efc

View file

@ -743,10 +743,8 @@ static int is_device_busy(Manager *manager, struct event *event) {
continue; continue;
/* check our old name */ /* check our old name */
if (devpath_old && streq(devpath_old, loop_devpath)) { if (devpath_old && streq(devpath_old, loop_devpath))
event->delaying_seqnum = loop_event->seqnum; goto set_delaying_seqnum;
return true;
}
loop_devpath_len = strlen(loop_devpath); loop_devpath_len = strlen(loop_devpath);
@ -762,24 +760,23 @@ static int is_device_busy(Manager *manager, struct event *event) {
/* devices names might have changed/swapped in the meantime */ /* devices names might have changed/swapped in the meantime */
if (major(devnum) != 0 || ifindex > 0) if (major(devnum) != 0 || ifindex > 0)
continue; continue;
event->delaying_seqnum = loop_event->seqnum; goto set_delaying_seqnum;
return true;
} }
/* parent device event found */ /* parent device event found */
if (devpath[common] == '/') { if (devpath[common] == '/')
event->delaying_seqnum = loop_event->seqnum; goto set_delaying_seqnum;
return true;
}
/* child device event found */ /* child device event found */
if (loop_devpath[common] == '/') { if (loop_devpath[common] == '/')
event->delaying_seqnum = loop_event->seqnum; goto set_delaying_seqnum;
return true;
}
} }
return false; return false;
set_delaying_seqnum:
event->delaying_seqnum = loop_event->seqnum;
return true;
} }
static int on_exit_timeout(sd_event_source *s, uint64_t usec, void *userdata) { static int on_exit_timeout(sd_event_source *s, uint64_t usec, void *userdata) {