Date: Mon, 21 Apr 2008 16:38:47 -0700 From: John-Mark Gurney <jmg@funkthat.com> To: Scott Long <scottl@samsco.org> Cc: cvs-src@FreeBSD.org, "Bjoern A. Zeeb" <bz@FreeBSD.org>, cvs-all@FreeBSD.org, src-committers@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/ata ata-all.c Message-ID: <20080421233847.GM82555@funkthat.com> In-Reply-To: <480D0E44.9070201@samsco.org> References: <200804201745.m3KHjWma066842@repoman.freebsd.org> <20080421213724.GL82555@funkthat.com> <480D0E44.9070201@samsco.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Scott Long wrote this message on Mon, Apr 21, 2008 at 15:59 -0600:
> 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.
Yeh, that was partly about changing the description... Can you think of
a better name besides devclass_get_maxunitplusone?
> Most callers use this value as the limit in a for loop, hence why it's
> convenient for it to return the +1.
Yeh, but it definately does not return maxunit.. :) unitarraysize?
Hmmm... find isn't a useful verb, since it doesn't do any finding...
it returns a stored value... How about:
.Nd return the max number of units in the class
And then flush out the description about using it for an array? Though
it doesn't solve the naming issue...
--
John-Mark Gurney Voice: +1 415 225 5579
"All that I will do, has been done, All that I have, has not."
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20080421233847.GM82555>
