Subject: Re: DAD verbosity
To: None <tech-kern@netbsd.org>
From: Chris Torek <torek@BSDI.COM>
List: tech-kern
Date: 02/18/2000 12:20:49
I believe the "collect stuff up until you have a complete printout"
approach is the right one.  I also think the easiest way to get there
from here is to do most of the work inside printf (really, putchar),
using a "semi-exposed" state.  However -- this is the tricky bit -- the
state should be entered *explicitly* by calling some special function,
or putting in a special formatting directive.  Just for fun, let me
write this as "%\n", meaning "save stuff up per-context until newline".
Then:

>consider:
>	foo0 at bar0 loc X loc Y: some device info\n
>       AAAAAAAAAAAAPPPPPPPPPPPPDDDDDDDDDDDDDDDDDDDD
>A: printed by generic autoconfig code.
>P: printed by parent device 'print' function if any.
>D: printed by child device attach function.

We just have autoconfig printf("%\n%s at %s", devname, parentname);
to kick this off.

>then consider the messages you get when you have an unconfigured
>device on a direct config bus:
>	usefuldevicename at bar0 loc X loc Y not configured\n
>       PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPAAAAAAAAAAAAAAAAA
>same meanings as above (and of course the " not configured\n") bit
>won't get printed if there's no parent device print function.

And here the parent-print function, or whoever calls it, has to
printf("%\n") first.  "Whoever calls it" turns out to be the
generic autoconfig code, again, so again it requires no driver-level
changes.

("%\n" is rather ugly; feel free to invent a different format,
or a function like saveupline(), or whatever.)

How to implement "save stuff up until newline" is another, separate
(and not quite as easy as it sounds) question, to worry about after
you decide whether this approach is sane.

Chris