Subject: Re: Attack of the clones: turning sl*, strip*, ppp* into cloners.
To: None <tech-net@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: tech-net
Date: 02/23/2002 20:36:05
> 2) the line discipline open routine needs to know the requested unit
> number.

> 2) two options:

> a) we change the signature of (struct linesw)'s l_open routine to
> take a third "int" parameter.

> b) we add an "int t_lunit;" field to "struct tty", defaulting to
> "-1"; TIOCSLINED fills it in before calling the line discipline's
> l_open routine if one was specified.

For what it's worth, speaking with my interface design aesthetics hat
on, I definitely prefer b.  That extra int is just too special-case,
used only for the one instance of TIOCSETD to PPP.

I'm not sure I really like (b) itself all that much, though.  I'd
rather add something like "void *t_ldcookie" and "size_t t_ldcooksz",
an opaque cookie block with meaning only to the line discipline and the
code setting the line discipline.

This means complicating the TIOCSETD interface a bit (more), since it
has to pass a buffer of size not known at compile time through from
userland.  But I really hate to solve a specific instance of a general
problem (getting ldisc-specific info from userland through to the line
dscipline) in a way that can't readily be used to solve the general
problem, when (as here) it takes only a little more effort to do the
general solution.

Of course, since I'm not the one doing the work... :-)

/~\ The ASCII				der Mouse
\ / Ribbon Campaign
 X  Against HTML	       mouse@rodents.montreal.qc.ca
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B