From a3b51e0142d1be156ac697eaadadd6cfbb7ba32b Mon Sep 17 00:00:00 2001 From: David Rientjes Date: Mon, 28 Apr 2008 02:12:23 -0700 Subject: mempolicy: convert MPOL constants to enum The mempolicy mode constants, MPOL_DEFAULT, MPOL_PREFERRED, MPOL_BIND, and MPOL_INTERLEAVE, are better declared as part of an enum since they are sequentially numbered and cannot be combined. The policy member of struct mempolicy is also converted from type short to type unsigned short. A negative policy does not have any legitimate meaning, so it is possible to change its type in preparation for adding optional mode flags later. The equivalent member of struct shmem_sb_info is also changed from int to unsigned short. For compatibility, the policy formal to get_mempolicy() remains as a pointer to an int: int get_mempolicy(int *policy, unsigned long *nmask, unsigned long maxnode, unsigned long addr, unsigned long flags); although the only possible values is the range of type unsigned short. Cc: Paul Jackson Cc: Christoph Lameter Cc: Lee Schermerhorn Cc: Andi Kleen Signed-off-by: David Rientjes Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- mm/shmem.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'mm/shmem.c') diff --git a/mm/shmem.c b/mm/shmem.c index f514dd392cd9..d8ef7ba831a5 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1079,7 +1079,8 @@ redirty: #ifdef CONFIG_NUMA #ifdef CONFIG_TMPFS -static int shmem_parse_mpol(char *value, int *policy, nodemask_t *policy_nodes) +static int shmem_parse_mpol(char *value, unsigned short *policy, + nodemask_t *policy_nodes) { char *nodelist = strchr(value, ':'); int err = 1; @@ -1128,7 +1129,7 @@ out: return err; } -static void shmem_show_mpol(struct seq_file *seq, int policy, +static void shmem_show_mpol(struct seq_file *seq, unsigned short policy, const nodemask_t policy_nodes) { char *policy_string; @@ -1197,13 +1198,13 @@ static struct page *shmem_alloc_page(gfp_t gfp, } #else /* !CONFIG_NUMA */ #ifdef CONFIG_TMPFS -static inline int shmem_parse_mpol(char *value, int *policy, +static inline int shmem_parse_mpol(char *value, unsigned short *policy, nodemask_t *policy_nodes) { return 1; } -static inline void shmem_show_mpol(struct seq_file *seq, int policy, +static inline void shmem_show_mpol(struct seq_file *seq, unsigned short policy, const nodemask_t policy_nodes) { } -- cgit v1.2.3