All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: linux-mm@kvack.org, linux-numa@vger.kernel.org
Cc: akpm@linux-foundation.org,
	Hugh Dickins <hugh.dickins@tiscali.co.uk>,
	Ravikiran Thirumalai <kiran@scalex86.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	eric.whitney@hp.com
Subject: [PATCH 3/6] Mempolicy: rename policy_types and cleanup initialization
Date: Fri, 19 Mar 2010 14:59:52 -0400	[thread overview]
Message-ID: <20100319185952.21430.8872.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20100319185933.21430.72039.sendpatchset@localhost.localdomain>

Rename 'policy_types[]' to 'policy_modes[]' to better match the
array contents.

Use designated intializer syntax for policy_modes[].

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>

 mm/mempolicy.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Index: linux-2.6.34-rc1-mmotm-100311-1313/mm/mempolicy.c
===================================================================
--- linux-2.6.34-rc1-mmotm-100311-1313.orig/mm/mempolicy.c	2010-03-19 09:03:21.000000000 -0400
+++ linux-2.6.34-rc1-mmotm-100311-1313/mm/mempolicy.c	2010-03-19 12:22:17.000000000 -0400
@@ -2127,9 +2127,15 @@ void numa_default_policy(void)
  * "local" is pseudo-policy:  MPOL_PREFERRED with MPOL_F_LOCAL flag
  * Used only for mpol_parse_str() and mpol_to_str()
  */
-#define MPOL_LOCAL (MPOL_INTERLEAVE + 1)
-static const char * const policy_types[] =
-	{ "default", "prefer", "bind", "interleave", "local" };
+#define MPOL_LOCAL MPOL_MAX
+static const char * const policy_modes[] =
+{
+ 	[MPOL_DEFAULT]    = "default",
+ 	[MPOL_PREFERRED]  = "prefer",
+	[MPOL_BIND]       = "bind",
+	[MPOL_INTERLEAVE] = "interleave",
+	[MPOL_LOCAL]      = "local"
+};
 
 
 #ifdef CONFIG_TMPFS
@@ -2175,7 +2181,7 @@ int mpol_parse_str(char *str, struct mem
 		*flags++ = '\0';	/* terminate mode string */
 
 	for (mode = 0; mode <= MPOL_LOCAL; mode++) {
-		if (!strcmp(str, policy_types[mode])) {
+		if (!strcmp(str, policy_modes[mode])) {
 			break;
 		}
 	}
@@ -2330,11 +2336,11 @@ int mpol_to_str(char *buffer, int maxlen
 		BUG();
 	}
 
-	l = strlen(policy_types[mode]);
+	l = strlen(policy_modes[mode]);
 	if (buffer + maxlen < p + l + 1)
 		return -ENOSPC;
 
-	strcpy(p, policy_types[mode]);
+	strcpy(p, policy_modes[mode]);
 	p += l;
 
 	if (flags & MPOL_MODE_FLAGS) {

WARNING: multiple messages have this Message-ID (diff)
From: Lee Schermerhorn <lee.schermerhorn@hp.com>
To: linux-mm@kvack.org, linux-numa@vger.kernel.org
Cc: akpm@linux-foundation.org,
	Hugh Dickins <hugh.dickins@tiscali.co.uk>,
	Ravikiran Thirumalai <kiran@scalex86.org>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	David Rientjes <rientjes@google.com>,
	eric.whitney@hp.com
Subject: [PATCH 3/6] Mempolicy: rename policy_types and cleanup initialization
Date: Fri, 19 Mar 2010 14:59:52 -0400	[thread overview]
Message-ID: <20100319185952.21430.8872.sendpatchset@localhost.localdomain> (raw)
In-Reply-To: <20100319185933.21430.72039.sendpatchset@localhost.localdomain>

Rename 'policy_types[]' to 'policy_modes[]' to better match the
array contents.

Use designated intializer syntax for policy_modes[].

Signed-off-by: Lee Schermerhorn <lee.schermerhorn@hp.com>

 mm/mempolicy.c |   18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

Index: linux-2.6.34-rc1-mmotm-100311-1313/mm/mempolicy.c
===================================================================
--- linux-2.6.34-rc1-mmotm-100311-1313.orig/mm/mempolicy.c	2010-03-19 09:03:21.000000000 -0400
+++ linux-2.6.34-rc1-mmotm-100311-1313/mm/mempolicy.c	2010-03-19 12:22:17.000000000 -0400
@@ -2127,9 +2127,15 @@ void numa_default_policy(void)
  * "local" is pseudo-policy:  MPOL_PREFERRED with MPOL_F_LOCAL flag
  * Used only for mpol_parse_str() and mpol_to_str()
  */
-#define MPOL_LOCAL (MPOL_INTERLEAVE + 1)
-static const char * const policy_types[] =
-	{ "default", "prefer", "bind", "interleave", "local" };
+#define MPOL_LOCAL MPOL_MAX
+static const char * const policy_modes[] =
+{
+ 	[MPOL_DEFAULT]    = "default",
+ 	[MPOL_PREFERRED]  = "prefer",
+	[MPOL_BIND]       = "bind",
+	[MPOL_INTERLEAVE] = "interleave",
+	[MPOL_LOCAL]      = "local"
+};
 
 
 #ifdef CONFIG_TMPFS
@@ -2175,7 +2181,7 @@ int mpol_parse_str(char *str, struct mem
 		*flags++ = '\0';	/* terminate mode string */
 
 	for (mode = 0; mode <= MPOL_LOCAL; mode++) {
-		if (!strcmp(str, policy_types[mode])) {
+		if (!strcmp(str, policy_modes[mode])) {
 			break;
 		}
 	}
@@ -2330,11 +2336,11 @@ int mpol_to_str(char *buffer, int maxlen
 		BUG();
 	}
 
-	l = strlen(policy_types[mode]);
+	l = strlen(policy_modes[mode]);
 	if (buffer + maxlen < p + l + 1)
 		return -ENOSPC;
 
-	strcpy(p, policy_types[mode]);
+	strcpy(p, policy_modes[mode]);
 	p += l;
 
 	if (flags & MPOL_MODE_FLAGS) {

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  parent reply	other threads:[~2010-03-19 18:59 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-19 18:59 [PATCH 0/6] Mempolicy: additional cleanups Lee Schermerhorn
2010-03-19 18:59 ` Lee Schermerhorn
2010-03-19 18:59 ` [PATCH 1/6] Mempolicy: Don't call mpol_set_nodemask() when no_context Lee Schermerhorn
2010-03-19 18:59   ` Lee Schermerhorn
2010-03-22 14:40   ` Christoph Lameter
2010-03-22 16:11     ` Lee Schermerhorn
2010-03-19 18:59 ` [PATCH 2/6] Mempolicy: Lose unnecessary loop variable in mpol_parse_str() Lee Schermerhorn
2010-03-19 18:59   ` Lee Schermerhorn
2010-03-19 18:59 ` Lee Schermerhorn [this message]
2010-03-19 18:59   ` [PATCH 3/6] Mempolicy: rename policy_types and cleanup initialization Lee Schermerhorn
2010-03-22 14:43   ` Christoph Lameter
2010-03-22 16:22     ` Lee Schermerhorn
2010-03-19 18:59 ` [PATCH 4/6] Mempolicy: factor mpol_shared_policy_init() return paths Lee Schermerhorn
2010-03-19 18:59   ` Lee Schermerhorn
2010-03-22 14:45   ` Christoph Lameter
2010-03-19 19:00 ` [BUGFIX][PATCH 5/6] Mempolicy: fix get_mempolicy() for relative and static nodes Lee Schermerhorn
2010-03-19 19:00   ` Lee Schermerhorn
2010-03-19 19:00 ` [PATCH 6/6] Mempolicy: document cpuset interaction with tmpfs mpol mount option Lee Schermerhorn
2010-03-19 19:00   ` Lee Schermerhorn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100319185952.21430.8872.sendpatchset@localhost.localdomain \
    --to=lee.schermerhorn@hp.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=eric.whitney@hp.com \
    --cc=hugh.dickins@tiscali.co.uk \
    --cc=kiran@scalex86.org \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=linux-numa@vger.kernel.org \
    --cc=rientjes@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.