From owner-cvs-all@FreeBSD.ORG Wed Aug 17 17:28:21 2005 Return-Path: X-Original-To: cvs-all@FreeBSD.org Delivered-To: cvs-all@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B171A16A441; Wed, 17 Aug 2005 17:28:21 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from mv.twc.weather.com (mv.twc.weather.com [65.212.71.225]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15D9E43D45; Wed, 17 Aug 2005 17:28:20 +0000 (GMT) (envelope-from jhb@FreeBSD.org) Received: from [10.50.40.201] (Not Verified[10.50.40.201]) by mv.twc.weather.com with NetIQ MailMarshal (v6, 0, 3, 8) id ; Wed, 17 Aug 2005 13:42:48 -0400 From: John Baldwin To: Nate Lawson Date: Wed, 17 Aug 2005 13:24:30 -0400 User-Agent: KMail/1.8 References: <20050817082000.0B70016A437@hub.freebsd.org> <43036E25.6010508@root.org> In-Reply-To: <43036E25.6010508@root.org> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200508171324.32231.jhb@FreeBSD.org> Cc: cvs-src@FreeBSD.org, src-committers@FreeBSD.org, Poul-Henning Kamp , cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/fs/devfs devfs_vnops.c src/sys/kern kern_conf.c src/sys/sys conf.h X-BeenThere: cvs-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: CVS commit messages for the entire tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2005 17:28:21 -0000 On Wednesday 17 August 2005 01:04 pm, Nate Lawson wrote: > Poul-Henning Kamp wrote: > > phk 2005-08-17 08:19:53 UTC > > > > FreeBSD src repository > > > > Modified files: > > sys/fs/devfs devfs_vnops.c > > sys/kern kern_conf.c > > sys/sys conf.h > > Log: > > Handle device drivers with D_NEEDGIANT in a way which does not > > penalize the 'good' drivers: Allocate a shadow cdevsw and populate > > it with wrapper functions which grab Giant > > > > Revision Changes Path > > 1.120 +0 -24 src/sys/fs/devfs/devfs_vnops.c > > 1.190 +155 -9 src/sys/kern/kern_conf.c > > 1.226 +1 -0 src/sys/sys/conf.h > > > > > > static void > > prep_cdevsw(struct cdevsw *devsw) > > { > > + struct cdevsw *dsw2; > > > > + if (devsw->d_flags & D_NEEDGIANT) > > + dsw2 = malloc(sizeof *dsw2, M_DEVT, M_WAITOK); > > + else > > + dsw2 = NULL; > > dev_lock(); > > > > if (devsw->d_version != D_VERSION_01) { > > Is it guaranteed that prep_cdevsw() won't be called twice without a call > to fini_cdevsw()? Otherwise, the shadow cdevsw could leak when its > pointer is set to NULL. I'm not familiar with this code, just asking. Err, how exactly? If devsw->d_gianttrick is already non-NULL, it just free's dsw2. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve" = http://www.FreeBSD.org