Re: [Patch 5/23] mask v2 - Add new mask.h file

Matthew Dobson
2004-04-02T20:27:00Z

On Thu, 2004-04-01 at 13:11, Paul Jackson wrote:
> Patch_5_of_23 - New mask ADT
> Adds new include/linux/mask.h header file
>
> ==> See this mask.h header for more extensive mask documentation <==

<snip>

> +/* Use if nbits <= BITS_PER_LONG */
> +#define MASK_ALL1(nbits) \
> +{ { \
> + [BITS_TO_LONGS(nbits)-1] = MASK_LAST_WORD(nbits) \
> +} }
> +
> +/* Use if nbits > BITS_PER_LONG */
> +#define MASK_ALL2(nbits) \
> +{ { \
> + [0 ... BITS_TO_LONGS(nbits)-2] = ~0UL, \
> + [BITS_TO_LONGS(nbits)-1] = MASK_LAST_WORD(nbits) \
> +} }

Gotta say, I'm not a bit fan of the names of these macros. They're
disappointingly short on descriptiveness. ;) Maybe
MASK_ALL_SINGLE_LONG and MASK_ALL_MULTIPLE_LONG? Something that more
explicitly shows the difference between them. So when we're reading
code later on, we're not constantly looking up the definition and
saying, "What's the difference between MASK_ALL1 & MASK_ALL2 again?"

-Matt