From owner-freebsd-current@FreeBSD.ORG Sun Jul 11 23:26:29 2004 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4B33C16A4CE for ; Sun, 11 Jul 2004 23:26:29 +0000 (GMT) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by mx1.FreeBSD.org (Postfix) with ESMTP id 8E7EB43D46 for ; Sun, 11 Jul 2004 23:26:28 +0000 (GMT) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.11/8.12.11) with ESMTP id i6BNQQRW007483 for ; Mon, 12 Jul 2004 01:26:26 +0200 (CEST) (envelope-from phk@critter.freebsd.dk) To: current@freebsd.org From: Poul-Henning Kamp Date: Mon, 12 Jul 2004 01:26:26 +0200 Message-ID: <7482.1089588386@critter.freebsd.dk> Sender: phk@critter.freebsd.dk Subject: [TEST/REVIEW/HEADSUP] tty drivers kilo-patch X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 11 Jul 2004 23:26:29 -0000 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@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.