On Mon, 13 Dec 2010 14:28:42 +0100, MERIGHI Marcus <mcmer-open...@tor.at> wrote: > mark.kette...@xs4all.nl (Mark Kettenis), 2010.12.13 (Mon) 13:41 (CET): >> > Date: Mon, 13 Dec 2010 12:48:55 +0100 >> > From: MERIGHI Marcus <mcmer-open...@tor.at> >> > > That sounds good. I was aware of the change, but didn't think anybody >> > > would notice. :) >> >> A bit late to the game, but I don't really agree with Tedu that the >> changed behaviour is an improvement. Say I have configured >> hotplugd(8) such that it automatically mounts things when I plug in my >> camera. Now I reboot my machine, without unplugging the camera. >> Previously hotplugd(8) would remount things upon boot. Now suddenly >> it doesn't and I have to unplug and replug the camera. > > I've had similar usage patterns and I'm gonna miss them. >
Maybe a bit aggressive, but why not something like this in put_event : if (!opened && event.type == DETACH) { foreach (ev in event_queue) if (ev.type == ATTACH && ev.devclass == event.devclass && ev.devname == event.devname) remove(ev); } So we remove all attached then detached devices before hotplugd is started. >> > Index: share/man/man4/hotplug.4 >> > =================================================================== >> > RCS file: /cvs/src/share/man/man4/hotplug.4,v >> > retrieving revision 1.3 >> > diff -u -r1.3 hotplug.4 >> > --- share/man/man4/hotplug.4 31 May 2007 19:19:50 -0000 1.3 >> > +++ share/man/man4/hotplug.4 13 Dec 2010 11:29:30 -0000 >> > @@ -31,7 +31,8 @@ >> > .Nm >> > pseudo-device passes device attachment and detachment events to >> > userland. >> > -When a device attaches or detaches, the corresponding event is queued. >> > +Once the device is opened by userland, when a device attaches or detaches, >> > +the corresponding event is queued. >> > The events can then be obtained from the queue through the >> > .Xr read 2 >> > call on the >> >> That looks like an improvement to me. >> >> > Index: usr.sbin/hotplugd/hotplugd.8 >> > =================================================================== >> > RCS file: /cvs/src/usr.sbin/hotplugd/hotplugd.8,v >> > retrieving revision 1.10 >> > diff -u -r1.10 hotplugd.8 >> > --- usr.sbin/hotplugd/hotplugd.8 20 Mar 2009 17:53:14 -0000 1.10 >> > +++ usr.sbin/hotplugd/hotplugd.8 13 Dec 2010 11:26:51 -0000 >> > @@ -26,9 +26,11 @@ >> > .Sh DESCRIPTION >> > The >> > .Nm >> > -daemon monitors the >> > +daemon opens the >> > .Xr hotplug 4 >> > -pseudo-device, acting on signaled events by executing the scripts in the >> > +pseudo-device and thus enables event signaling. >> > +It then monitors the device, acting on signaled events by executing the >> > +scripts in the >> > .Pa /etc/hotplug >> > directory. >> > By default it uses the >> >> But this just seems to change the wording without actually changing >> the meaning. I think the existing wording is better. > > I thought it would make clear that only starting hotplugd enables the > entire hotplug queueing. (As opposed to the old behaviour.) > >> > Index: sys/dev/hotplug.c >> > =================================================================== >> > RCS file: /cvs/src/sys/dev/hotplug.c,v >> > retrieving revision 1.10 >> > diff -u -r1.10 hotplug.c >> > --- sys/dev/hotplug.c 2 Dec 2010 04:12:35 -0000 1.10 >> > +++ sys/dev/hotplug.c 13 Dec 2010 11:41:59 -0000 >> > @@ -89,6 +89,13 @@ >> > printf("hotplug: event lost, queue full\n"); >> > return (1); >> > } >> > + >> > + /* >> > + * Do not queue events prior to hotplugopen anymore. This prevents >> > + * problems where the device is both attached and detached before >> > + * the device is opened. >> > + */ >> >> Adding comments like this, describing historical behaviour really >> isn't such a good idea. > > That is beyond my competence.