Subject: Re: Attack of the clones: turning sl*, strip*, ppp* into cloners.
To: Christos Zoulas <christos@zoulas.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-net
Date: 02/25/2002 17:10:10
>| >If we are going to redo the line discipline stuff, I'd rather see
>| >TIOCSETD to take, or whatever is appropriate.
>| 
>| this isn't TIOCSETD (although it's related), this is TIOCSLINED, which
>| takes a char* instead of an int.
>| 
>| >struct linedisc {
>| >	char l_name[20];
>| >	int l_flags;
>| >	int l_unit;
>| >};
>| 
>| flags and unit could be added to the end of the char* with total
>| backward compatibility.
>
>but isn't it better to use make the TIOCGLINED and TIOCSLINED take
>the struct and deprecate the old ones?

imho, it's easier to leave it as a char*, but i can see why this might
be better for some purposes.  the only problem i can see is the lack
of a difference between a value of zero in l_flags (meaning please
leave all flags clear) vs a value of zero in l_flags (meaning i don't
wish to specify any flags).  the unit value, otoh, could easily be -1
for unspecified.  there's also no real need to change the length of
the string from 32 to 20.

that amibiguity is nicely sidestepped in the char* case, although in
the char* case, you can't TIOCSLINED to "sl0" (or "sl") and then do a
TIOCGLINED and get back the same thing.  TIOCGLINED would either give
back "sl" or "sl0", either of which might be "wrong" (or at least
unexpected).  the struct case would probably fair worse in the
TIOCGLINED case, wrt the l_flags and l_unit fields.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."