static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = {
[PATH_DEAD] = UNIT_INACTIVE,
static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = {
[PATH_DEAD] = UNIT_INACTIVE,
-int path_spec_watch(PathSpec *s, Unit *u) {
+static int path_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata);
+
+int path_spec_watch(PathSpec *s, sd_event_io_handler_t handler) {
static const int flags_table[_PATH_TYPE_MAX] = {
[PATH_EXISTS] = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB,
static const int flags_table[_PATH_TYPE_MAX] = {
[PATH_EXISTS] = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB,
- r = unit_watch_fd(u, s->inotify_fd, EPOLLIN, &s->watch);
+ r = sd_event_add_io(s->unit->manager->event, s->inotify_fd, EPOLLIN, handler, s, &s->event_source);
- path_spec_unwatch(s, UNIT(p));
- LIST_REMOVE(PathSpec, spec, p->specs, s);
+ path_spec_unwatch(s);
+ LIST_REMOVE(spec, p->specs, s);
-static void path_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
- Path *p = PATH(u);
- PathSpec *s;
+static int path_dispatch_io(sd_event_source *source, int fd, uint32_t revents, void *userdata) {
+ PathSpec *s = userdata;
+ Path *p;
const UnitVTable path_vtable = {
.object_size = sizeof(Path),
const UnitVTable path_vtable = {
.object_size = sizeof(Path),
.active_state = path_active_state,
.sub_state_to_string = path_sub_state_to_string,
.active_state = path_active_state,
.sub_state_to_string = path_sub_state_to_string,
.trigger_notify = path_trigger_notify,
.reset_failed = path_reset_failed,
.bus_interface = "org.freedesktop.systemd1.Path",
.trigger_notify = path_trigger_notify,
.reset_failed = path_reset_failed,
.bus_interface = "org.freedesktop.systemd1.Path",
- .bus_message_handler = bus_path_message_handler,
- .bus_invalidating_properties = bus_path_invalidating_properties
+ .bus_vtable = bus_path_vtable,
+ .bus_changing_properties = bus_path_changing_properties