Re: [patch 1/6] mempolicy: convert MPOL constants to enum

From: David Rientjes
Date: Mon Feb 25 2008 - 23:22:50 EST


On Mon, 25 Feb 2008, Paul Jackson wrote:

> Eh ... each bit of added clarity to the code reduces
> errors.
>
> Looking around the kernel, it really seems to me to be
> a common coding to explicitly spell out enum values
> when for some reason they actually matter.
>
> Like most coding mechanisms, nothing guarantees anything.
>
> It just nicely represents one particular detail, that
> the values of these MPOL_* terms are not arbitrary.
>

Of course the MPOL_* modes aren't arbitrary; they are defined in an enum
that has a well-defined and explicit behavior for how they are mapped to
int values based on a standard.

I have more mempolicy patches that add additional behavior and cleanups so
I can queue the following for a later posting. I'd like to avoid
respinning this set unless there are actual design or implementation
concerns that are raised.
---
include/linux/mempolicy.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/include/linux/mempolicy.h b/include/linux/mempolicy.h
--- a/include/linux/mempolicy.h
+++ b/include/linux/mempolicy.h
@@ -20,7 +20,9 @@ enum {
MPOL_PREFERRED,
MPOL_BIND,
MPOL_INTERLEAVE,
- MPOL_MAX, /* always last member of enum */
+ /* add additional MPOL_* modes here */
+
+ MPOL_MAX,
};

/* Flags for set_mempolicy */
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/