Subject: Re: I don't understand alpha/alpha/disksubr.c:178
To: None <port-alpha@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: port-alpha
Date: 03/04/2002 14:56:21
In article <2100.1015220192@brandenburg.cs.mu.OZ.AU>,
Robert Elz <kre@munnari.OZ.AU> wrote:
>In arch/alpha/alpha/disksubr.c - in setdisklabel() the code around
>line 178 is ...
>
>        if (nlp->d_magic != DISKMAGIC || nlp->d_magic2 != DISKMAGIC ||
>                dkcksum(nlp) != 0)
>                return (EINVAL);
>
>        while ((i = ffs((long)openmask)) != 0) {
>                i--;
>                openmask &= ~(1 << i);
>                if (nlp->d_npartitions <= i)
>                        return (EBUSY);
>
>The query is that "(long)" cast.  Why?   openmask is u_long, ffs takes
>an int arg, according to libkern.h, what is going on there?
>
>I suspect historical baggage that should be cleaned up - but if the alpha
>does have an ffs() that takes a long, rather than an int, then something
>probably needs to happen to libkern.h

Yes, clearly the long cast is not correct. There is a comment in libkern.h
about ffs being part of gcc-3.0. What's the signature of that?

christos