From owner-svn-src-all@FreeBSD.ORG Mon Aug 24 12:09:12 2009 Return-Path: Delivered-To: svn-src-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A1C20106568E; Mon, 24 Aug 2009 12:09:12 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail08.syd.optusnet.com.au (mail08.syd.optusnet.com.au [211.29.132.189]) by mx1.freebsd.org (Postfix) with ESMTP id 3652F8FC14; Mon, 24 Aug 2009 12:09:11 +0000 (UTC) Received: from c122-106-152-1.carlnfd1.nsw.optusnet.com.au (c122-106-152-1.carlnfd1.nsw.optusnet.com.au [122.106.152.1]) by mail08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n7OC97YO014863 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 24 Aug 2009 22:09:09 +1000 Date: Mon, 24 Aug 2009 22:09:07 +1000 (EST) From: Bruce Evans X-X-Sender: bde@delplex.bde.org To: Ed Schouten In-Reply-To: <200908241053.n7OArUhX092666@svn.freebsd.org> Message-ID: <20090824213600.T39644@delplex.bde.org> References: <200908241053.n7OArUhX092666@svn.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: svn-src-head@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: svn commit: r196506 - in head/sys: kern sys X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Aug 2009 12:09:12 -0000 On Mon, 24 Aug 2009, Ed Schouten wrote: > Log: > Allow multiple console devices per driver without insane code duplication. > > Say, a driver wants to have multiple console devices to pick from, you > would normally write down something like this: > > CONSOLE_DRIVER(dev1); > CONSOLE_DRIVER(dev2); > > Unfortunately, this means that you have to declare 10 cn routines, > instead of 5. It also isn't possible to initialize cn_arg on beforehand. > > I noticed this restriction when I was implementing some of the console > bits for my vt(4) driver in my newcons branch. I have a single set of cn > routines (termcn_*) which are shared by all vt(4) console devices. > > In order to solve this, I'm adding a separate consdev_ops structure, > which contains all the function pointers. This structure is referenced > through consdev's cn_ops field. > > While there, I'm removing CONS_DRIVER() and cn_checkc, which have been > deprecated for years. They weren't used throughout the source, until the > Xen console driver showed up. CONSOLE_DRIVER() has been changed to do > the right thing. It now declares both the consdev and consdev_ops > structure and ties them together. In other words: this change doesn't > change the KPI for drivers that used the regular way of declaring > console devices. CONS_DRIVER() was a good interface, unlike CONSOLE_DRIVER(). Removing it completes the bitrot in the support for cn_dbctl, and completes removal of cn_checkc's good name at the driver level. cn_dbctl is still needed to unbreak sysctl's support for ddb (see db_main.c 1.4.2.1, which depends on cn_dbctl's infrastructure not having rotted) and can be used to unbreak polled i/o in all console drivers (not just in ddb mode -- it should have been named cn_ioctl) (see other mail). The higher level cngetc() and cncheckc() are still correctly named, now fully inconsistently with the driver level. Bruce