[TEST/REVIEW/HEADSUP] tty drivers kilo-patch

From: Poul-Henning Kamp <phk_at_phk.freebsd.dk>
Date: Mon, 12 Jul 2004 01:26:26 +0200
http://phk.freebsd.dk/patch/tty.patch

This patch removes 800 lines of copy&paste insanity in tty drivers
and generally tries to get things to be less confused & confusing.

I have no way to test most of the affected drivers so if you have
the hardware and ability please do so.  If you find problems, please
try to debug as far as you can, lacking hardware, I can only work
from your reports.

I will update the patch as things develop, so if you find a problem,
please make sure you have the latest version of the patch before
you yell at me.

I have no doubt that I have changed minor semantics for the individual
drivers, but I belive it all works out for a more systematic behaviour
of tty drivers in general.

If you own one of the drivers I have not overhauled, I would really
appreciate if you could do it yourself.  Send me email with your
questions and I'll help as best I can.

Poul-Henning

---------------------------------------------------------------------

Patch revision: Mon Jul 12 01:24:34 CEST 2004

Move tty/cua handling up to generic level.

Move init/lock handling up to generic level.

Do COMPAT_43 ioctl processing at generic level.

Overhaul various drivers to use all this.


Add general minor bits for CALLOUT, INIT and LOCK and macros to
tell if they are there.

Add function ttymakeslaves() to do all the tedious make_dev() calls
after the first has been done by driver.  Make the other 5 depend
on the first.

Add init/lock states for tty/cua to struct tty and code in ttyioctl
to handle them.

Add code in ttyioctl to do the COMPAT_43 swizzle.

Add an t_cioctl method so drivers can run special ioctls on control
devices.

Overhaul drivers.

Use the above three generic facilities to aliminate approx 200 lines
per driver which had these facilities.  Exploit ->t_sc, and ->si_drv1
to eliminate much minor number magic.  Eliminate some entire ioctl,
read and write cdevsw methods.  Lots of other minor cleanups while
there anyway.

        dev/sio (-257 lines)
        pc98/sio (-274 lines)
        dev/digi (-345 lines)
        dev/cy (-187 lines)
        dev/rp (-311 lines)
        dev/uart (gains init/lock capability)

Not overhauled:
        dev/si
        dev/sx
	dev/usb/*

Files affected:

	Index: dev/cy/cy.c
	Index: dev/digi/digi.c
	Index: dev/digi/digi.h
	Index: dev/rp/rp.c
	Index: dev/rp/rpvar.h
	Index: dev/sio/sio.c
	Index: dev/uart/uart_bus.h
	Index: dev/uart/uart_tty.c
	Index: kern/tty.c
	Index: pc98/pc98/sio.c
	Index: sys/tty.h


-- 
Poul-Henning Kamp       | UNIX since Zilog Zeus 3.20
phk_at_FreeBSD.ORG         | TCP/IP since RFC 956
FreeBSD committer       | BSD since 4.3-tahoe
Never attribute to malice what can adequately be explained by incompetence.
Received on Sun Jul 11 2004 - 21:26:29 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:01 UTC