Subject: Re: port-amiga/794: MAKEDEV doesn't build mfcs devices
To: Chris G Demetriou <Chris_G_Demetriou@LAGAVULIN.PDL.CS.CMU.EDU>
From: Ty Sarna <tsarna@endicor.com>
List: netbsd-bugs
Date: 02/11/1995 22:56:48
Chris G Demetriou wrote:
> 
> > tty00...tty09, then tty0a? I don't think so. Why bother with the leading
> > 0 then?
> 
> so that the tty name will be 5 letters long?  so that you can have 256
> units (the maximum number of minor device numbers allowed with the
> current device naming scheme)?

The current naming scheme (in this context) only allows 10 (or 16, if
you're counting in hex) ports anyway, because of the ttymN name,
assuming constant-length names are wanted. If that's the case, the
leading 0 can never be filled in anyway. If constant-length names
aren't wanted on the other hand, why start with a leading 0 anyway? Just
use as many characters as are required to represent the port number, be
it in whatever base.

> in fact, it was normal in the days of many serial ports to name things
> tty[0-9a-f][0-9a-f].  You'll also note that ptys are numbered in hex.

Hmm..  the only system I ever used with more than 9 standard ports
counted in decimal for the "standard" ports.  (except for SunOS, which
doesn't count at all, but rather letters...  ttya is the first, then b, etc).

> The real naming problem is, what do you do when you have _multiple
> types_ of devices providing your tty interfaces.  i.e. what do you
> assign as the 4th letter?

Right.

> traditionally, you could have ~256 names for the the "standard" serial
> ports.  and then you'd have a lot of ptys, generally starting with
> ttyp[0-9a-f], etc.  (nowadays, i the 256 allowed ptys are
> tty[p-zP-T][0-9a-f] -- note that that conflicts with ports that use
> 'ttyv[0-9a-f]' as "virtual terminals!)
> 
> I take it that the standard Amiga serial ports fit in the tty0? slot.

There is always exactly one standard port on an Amiga, so it's always
tty00.

> Given that people tend to interpret numbers as... numbers (rather than
> as names, which they really are in the this case), even though there
> probably aren't going to be 256 (or even 160) 'standard' serial ports
> on an amiga, the tty[1-9]? names should probably be avoided.  (i'd say
> you can probably safely use tty[a-f]?, and, indeed, i believe ttye? is
> already in use!)

Yes, ttye is used for the different built in terminal emulations, ttye0
being the internal gfx/kbd terminal, ttye1 being Retina Gfx/internal
kbd, etc...

> so pick a group letter that's unused any maybe makes sense, and use
> it.  If you can have more than 16 ports of a type (i.e. with a given
> major number), pick several letters.

> It'd probably be reasonable to note what's used for what, in the
> machine's MAKEDEV file and/or some of its man pages...
> 
> as for the names of callout devices:  to my mind (and there are
> several opinions here... mine's slightly different than sun's, i
> think...) callout devices should be named cuaXX, where XX is the last
> two characters of the corresponding tty device.  it makes it that much
> easier to figure out.

That's exactly what I'd prefer.  Actually that *is* pretty much the Sun
scheme, except that in their case what follows the 'cua' is a number and
what follows the 'tty' is that number's corresponding letter, or
possibly d followed by the same number, depending on which of their
advice you follow. Also, their MAKEDEV uses the letter scheme and
doesn't even know how to make callout devices.

[If you want to be really sadistic, couple Sun's letter-based naming
scheme with Commodore's 7 (yes, 7) port A2232 serial boards, and their
numbering scheme (internal port is 0, then 1...7 for A2232 #1, 8...14
for board #2, etc).  Then ask your system administrator to convert
between the device node names and board number/port number.  "ttyl?
Uh...  <sings the alphabet song while counting with fingers, discovers l
== 12>..  that would be uh, <12/7 = 1, +1 = 2> board 2..  er...  <12%7 =
5> port 5".  And that's assuming he remembers that A2232 boards counting
is 1-based because of the internal port and remembers not to subtract
one as he usually would...]

I don't really care HOW things are named, I'd just like the naming to
make sense, which the current amiga system definately doesn't.

How about the following?

Internal port:		ttya0/cuaa0		# a for "amiga"
MFC's:			ttym?/cuam?		# m for MFC
A2232:			ttyA??/cuaA??		# A for A2232

I'd say ttyQ?? or q?? for the A2232 since the (unreleased) driver is
called "ql", but that conflicts with pty's.

I'd also suggest that the ttyA?? numbering be encoded as first digit for
board number, second digit the port number 0..6.  Sequentially numbering
makes figuring out board/number harder, especially with modulo-7
arithmetic, and it's OK to waste that much of the potential number space
since there can only be 35 A2232 ports max anyway (5 slots max * 7 ports
each). 

If people are really dead set on sequentially numbering all ports, the
easiest way to do that would probably be to do it like the /sys/scsi
system and use autoconf magic to number things sequentially no matter
what the order or number of ports on each board. This would require a
seperate "serial bus" driver. I think that's massive overkill though,
and actually harder to decode. (if you have the internal port,
then a 2 port MFC, then a 7 port A2232, then a 4 port ASDG board, what
does tty0c correspond to? Uh... uh...)

Of course if you get right down to it, the whole naming system is broken
anyway, because 99.9% of these devices aren't teletypes anyway :-)

-- 
Ty Sarna                 "Don't be wet or humidity, for the cause of
tsarna@endicor.com        electric obstacle." -- Warning from a manual