Re: aic7xxx_biosparam

Doug Ledford
2002-11-18T02:47:54Z

On Mon, Nov 18, 2002 at 01:43:41AM +0100, Andries Brouwer wrote:
>
> Yes. But note: the number of cylinders (i) is totally immaterial,
> (ii) is returned in a short, the only place where it is used.
> Thus, computing values larger than 65535 is undesired, they will
> be truncated later.

That is a bit of information I was looking for. I figured it would get
truncated somewhere (or worse, wrap), and I wanted to know where that
might be.

> That is why you can replace this strange
>
> > + while( capacity >= (cylinders * sectors * heads))
> > + cylinders++;
> > + cylinders--;
>
> by a test like:
>
> if (capacity > 65535 * sectors * heads)
> cylinders = 65535;
> else
> cylinders = ((unsigned int) capacity) / (sectors * heads);

Thanks, I'll do that.

--
Doug Ledford <dledford@redhat.com> 919-754-3700 x44233
Red Hat, Inc.
1801 Varsity Dr.
Raleigh, NC 27606