From owner-freebsd-current Sun Feb 16 12:45:34 2003 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 0CD3037B401 for ; Sun, 16 Feb 2003 12:45:33 -0800 (PST) Received: from phk.freebsd.dk (phk.freebsd.dk [212.242.86.175]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2534943F3F for ; Sun, 16 Feb 2003 12:45:32 -0800 (PST) (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (critter.freebsd.dk [212.242.86.163]) by phk.freebsd.dk (8.12.6/8.12.6) with ESMTP id h1GKjT6E043693 for ; Sun, 16 Feb 2003 20:45:29 GMT (envelope-from phk@phk.freebsd.dk) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.12.6/8.12.6) with ESMTP id h1GKjSOx091630 for ; Sun, 16 Feb 2003 21:45:29 +0100 (CET) (envelope-from phk@phk.freebsd.dk) To: current@freebsd.org Subject: Console API related patch. From: Poul-Henning Kamp Date: Sun, 16 Feb 2003 21:45:28 +0100 Message-ID: <91629.1045428328@critter.freebsd.dk> Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I am trying to do some weird things with some custom console code and got stuck on the fact that our console code belives all consoles have a dev_t. This patch changes the API so that rather than pass a "dev_t" to the console functions, the "struct consdev *" is passed: -typedef void cn_putc_t(dev_t, int); +typedef void cn_putc_t(struct consdev *, int); The dev_t can still be gotten hold of: int -zs_cncheckc(dev_t dev) +zs_cncheckc(struct consdev *cp) { int s = spltty(); - int c = zs_maygetc(zs_console_addr, minor(dev)); + int c = zs_maygetc(zs_console_addr, minor(cp->cn_dev)); splx(s); return c; } But in addition to this I have added a driver-private element to the consdev structure for other needs: + void *cn_arg; /* drivers method argument */ The patch compiles and runs on all platforms I can currently test, but I'd like if some of you can give it a spin too: http://phk.freebsd.dk/patch/console.patch The patch just does the not quite mechanical switch, some of the drivers could get some mileage from the cn_arg field but I have not tried that. Thanks in advance, Poul-Henning -- 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. To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message