Skip to contentSkip to conversation

page-types: constify read only arrays

PATCH New Tommi Rantala 2 participants 3 messages Oct 12, 2009 – Oct 13, 2009 Documentation

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 page-types: constify read only arrays

Constify read only arrays.

---
 Documentation/vm/page-types.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
Documentation/vm/page-types.c +3 -3
index 3ec4f2a..16fb478 100644
@@ -100,7 +100,7 @@
 #define BIT(name)		(1ULL << KPF_##name)
 #define BITS_COMPOUND		(BIT(COMPOUND_HEAD) | BIT(COMPOUND_TAIL))
 
-static char *page_flag_names[] = {
+static const char *page_flag_names[] = {
 	[KPF_LOCKED]		= "L:locked",
 	[KPF_ERROR]		= "E:error",
 	[KPF_REFERENCED]	= "R:referenced",
@@ -173,7 +173,7 @@ static int		kpageflags_fd;
 static int		opt_hwpoison;
 static int		opt_unpoison;
 
-static char		*hwpoison_debug_fs = "/debug/hwpoison";
+static const char	hwpoison_debug_fs[] = "/debug/hwpoison";
 static int		hwpoison_inject_fd;
 static int		hwpoison_forget_fd;
 
@@ -885,7 +885,7 @@ static void parse_bits_mask(const char *optarg)
 }
 
 
-static struct option opts[] = {
+static const struct option opts[] = {
 	{ "raw"       , 0, NULL, 'r' },
 	{ "pid"       , 1, NULL, 'p' },
 	{ "file"      , 1, NULL, 'f' },
Signature · 1 line
1.5.6.5
#1 lore raw

PATCH 1/1 page-types: trivial typo fixes

Trivial typo fixes.

---
 Documentation/vm/page-types.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/vm/page-types.c +2 -2
index 16fb478..d6d21c2 100644
@@ -301,7 +301,7 @@ static char *page_flag_name(uint64_t flags)
 		present = (flags >> i) & 1;
 		if (!page_flag_names[i]) {
 			if (present)
-				fatal("unkown flag bit %d\n", i);
+				fatal("unknown flag bit %d\n", i);
 			continue;
 		}
 		buf[j++] = present ? page_flag_names[i][0] : '_';
@@ -682,7 +682,7 @@ static void usage(void)
 #endif
 "            -l|--list                 Show page details in ranges\n"
 "            -L|--list-each            Show page details one by one\n"
-"            -N|--no-summary           Don't show summay info\n"
+"            -N|--no-summary           Don't show summary info\n"
 "            -X|--hwpoison             hwpoison pages\n"
 "            -x|--unpoison             unpoison pages\n"
 "            -h|--help                 Show this usage message\n"
Signature · 1 line
1.5.6.5
#2 lore raw

Re: [PATCH] page-types: trivial typo fixes

Quoted 1 line · Tommi Rantala

Trivial typo fixes.

Good catch, thanks!

Fengguang

Quoted 29 lines
---
 Documentation/vm/page-types.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/vm/page-types.c +2 -2
index 16fb478..d6d21c2 100644
@@ -301,7 +301,7 @@ static char *page_flag_name(uint64_t flags)
 		present = (flags >> i) & 1;
 		if (!page_flag_names[i]) {
 			if (present)
-				fatal("unkown flag bit %d\n", i);
+				fatal("unknown flag bit %d\n", i);
 			continue;
 		}
 		buf[j++] = present ? page_flag_names[i][0] : '_';
@@ -682,7 +682,7 @@ static void usage(void)
 #endif
 "            -l|--list                 Show page details in ranges\n"
 "            -L|--list-each            Show page details one by one\n"
-"            -N|--no-summary           Don't show summay info\n"
+"            -N|--no-summary           Don't show summary info\n"
 "            -X|--hwpoison             hwpoison pages\n"
 "            -x|--unpoison             unpoison pages\n"
 "            -h|--help                 Show this usage message\n"
Signature · 1 line
1.5.6.5