Re: [PATCH] mask ADT: new mask.h file [2/22]

Rusty Russell
2004-04-05T01:26:54Z

On Mon, 2004-03-29 at 22:12, Paul Jackson wrote:
> Patch_2_of_22 - New mask ADT
> Adds new include/linux/mask.h header file
>
> ==> See this mask.h header for more extensive mask documentation <==

Y'know, I dislike this. I really do. I know you've done a lot of work,
but too much abstraction scares me.

Especially when what you're abstracting is so trivial.

We have include/linux/bitmap.h which has a collection of unsigned long[]
operations. I suggest that people who want to use a bitmap should wrap
this in a struct and use the bitops directly, eg:

struct cpumap {
DECLARE_BITMAP(bits,NR_CPUS);
};

This has several advantages:
1) It doesn't add new code to the kernel,
2) Operations on "cpumap.bits" are easy to read, write and understand,
3) Different mask types are not type compatible,
4) Any new operations you need to write can be used by anyone who needs
a bitmap, whether in a struct or not.

Please consider...
Rusty.
--
Anyone who quotes me in their signature is an idiot -- Rusty Russell