From owner-cvs-all@FreeBSD.ORG Mon Apr 21 22:38:35 2008 Return-Path: Delivered-To: cvs-all@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A84C2106567D; Mon, 21 Apr 2008 22:38:35 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.freebsd.org (Postfix) with ESMTP id 6132F8FC20; Mon, 21 Apr 2008 22:38:34 +0000 (UTC) (envelope-from scottl@samsco.org) Received: from phobos.samsco.home (phobos.samsco.home [192.168.254.11]) (authenticated bits=0) by pooker.samsco.org (8.13.8/8.13.8) with ESMTP id m3LLxWph071404; Mon, 21 Apr 2008 15:59:32 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <480D0E44.9070201@samsco.org> Date: Mon, 21 Apr 2008 15:59:32 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.1.13) Gecko/20080313 SeaMonkey/1.1.9 MIME-Version: 1.0 To: John-Mark Gurney References: <200804201745.m3KHjWma066842@repoman.freebsd.org> <20080421213724.GL82555@funkthat.com> In-Reply-To: <20080421213724.GL82555@funkthat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-1.4 required=3.8 tests=ALL_TRUSTED autolearn=ham version=3.1.8 X-Spam-Checker-Version: SpamAssassin 3.1.8 (2007-02-13) on pooker.samsco.org Cc: cvs-src@FreeBSD.org, "Bjoern A. Zeeb" , cvs-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/ata ata-all.c 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: Mon, 21 Apr 2008 22:38:35 -0000 John-Mark Gurney wrote: > Bjoern A. Zeeb wrote this message on Sun, Apr 20, 2008 at 17:45 +0000: >> bz 2008-04-20 17:45:32 UTC >> >> FreeBSD src repository >> >> Modified files: >> sys/dev/ata ata-all.c >> Log: >> devclass_get_maxunit() returns n+1 with n starting at 0. >> So if we have channel 0..3 devclass_get_maxunit is 4. >> >> It's never been a problem as devclass_get_device() has >> catched a possibly bad input. > > Any one object to changing: > .Nm devclass_get_maxunit > .Nd find the maximum unit number in the class > > to: > .Nm devclass_get_maxunit > .Nd find the next free unit number in the class > That's not what it actually returns though. It returned the highest allocated unit number plus 1. The unit numbering can be sparse, with the next available unit number being less than the highest allocated unit number. Most callers use this value as the limit in a for loop, hence why it's convenient for it to return the +1. Scott