[systemd-devel] [systemd-commits] src/core

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Thu Dec 5 18:23:47 PST 2013


On Fri, Dec 06, 2013 at 03:16:08AM +0100, Lennart Poettering wrote:
> On Thu, 05.12.13 14:38, Zbigniew Jędrzejewski-Szmek (zbyszek at kemper.freedesktop.org) wrote:
> 
> >  src/core/device.c |   10 ++++++++++
> >  1 file changed, 10 insertions(+)
> > 
> > New commits:
> > commit e775289d56ace2f8d23e62ed79316d71332d6d05
> > Author: Zbigniew J??drzejewski-Szmek <zbyszek at in.waw.pl>
> > Date:   Thu Dec 5 00:41:12 2013 -0500
> > 
> >     systemd: add a start job for all units in SYSTEMD_[USER_]WANTS=
> > 
> > diff --git a/src/core/device.c b/src/core/device.c
> > index 4ff7c37..19fc745 100644
> > --- a/src/core/device.c
> > +++ b/src/core/device.c
> > @@ -264,6 +264,7 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
> >                          FOREACH_WORD_QUOTED(w, l, wants, state) {
> >                                  _cleanup_free_ char *n = NULL;
> >                                  char e[l+1];
> > +                                Unit *other;
> >  
> >                                  memcpy(e, w, l);
> >                                  e[l] = 0;
> > @@ -277,6 +278,15 @@ static int device_update_unit(Manager *m, struct udev_device *dev, const char *p
> >                                  r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
> >                                  if (r < 0)
> >                                          goto fail;
> > +
> > +                                other = manager_get_unit(u->manager, n);
> > +                                if (!other || !unit_can_start(other))
> > +                                        continue;
> > +
> > +                                r = manager_add_job(u->manager, JOB_START, other, JOB_REPLACE, true, NULL, NULL);
> > +                                if (r < 0)
> > +                                        log_warning("Failed to add job %s/%s, ignoring: %s.",
> > +                                                    other->id, job_type_to_string(JOB_START), strerror(-r));
> 
> What's the rationale here? 
> 
> We already add UNIT_WANTS dependencies, that should be all that is
> needed. When the device is set to PLUGGED state, then via unit_notify we
> should end up starting the UNIT_WANTS units "retroactively" via
> retroactively_start_dependencies(). 
Yes, it didn't work. I committed this version because it seems to work nicely,
but I didn't investigage why retroactively_start_dependencies doesn't work.
I'll check that.

Zbyszek


More information about the systemd-devel mailing list