Subject: Re: TTY virtualization driver
To: NetBSD Kernel Technical Discussion List <tech-kern@NetBSD.ORG>
From: Lennart Augustsson <lennart@augustsson.net>
List: tech-kern
Date: 01/23/2002 10:43:43
"Greg A. Woods" wrote:

> Now if there were a separation of low-level serial-port drivers and
> high-level tty interfaces, then we could have:
>
>         foo* at pci?
>         bar* at pci?
>         bit* at pci?
>
>         tty* at foo? port ?
>         tty* at bar?
>         tty* at bit? port ?
>
> and then there'd just be /dev/ttyN where 'N' was some number (in
> whatever base you like), and user-level things that desire to allocate
> and assign ttys need only know how to count and new values of 'X' can be
> introduced merely by re-configuring the kernel alone.
>
> I personally think there's more benefit to doing this kind of name
> mapping in ttys, network interfaces (at least per physical layer type),
> audio interfaces, and anything else that's more likely to be used
> directly by ordinary (non-superuser) users, than there is to do it for
> the likes of SCSI devices (especially since it's not been done for all
> types of disks in general like it is in certain other common derivatives
> of Unix).

I agree, I think there should be uniform numbering for these kind of
devices.



> If I'm not mistaken currently only audio devices, SCSI bus devices (but
> not disks, tapes, etc., generically), and potentially wscons devices,
> and I suppose USB buses, etc., are truly generically mapped to specific
> instances of underlying lowlevel hardware drivers.  Eg. you can access
> any and every audio device through the appropriate device node with the
> same major number no matter what type chip it uses, or what type bus
> it's plugged into, etc.  Same for any given class of USB device, SCSI
> device, etc.

Yes, audio, wskbd, wsmouse, and all USB specific devices are done in this
way.  I think it works well.  If you need to nail down specific numbers to
specfic devices you can of course do so in the kernel config file.

There are several device types the should be reworked into working
this way.  The lpt device is one, and tty is certainly another.  Ttys are a
totally weird beast in the kernel now, they show clear signs of having been
around for too long without rototilling. :-)

    -- Lennart