浏览代码

[PATCH] Doc: fix mtrr userspace programs to build cleanly

Fix mtrr-add.c and mtrr-show.c in Doc/mtrr.txt to build cleanly.

Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Randy Dunlap 19 年之前
父节点
当前提交
235963b2ed
共有 1 个文件被更改,包括 21 次插入2 次删除
  1. 21 2
      Documentation/mtrr.txt

+ 21 - 2
Documentation/mtrr.txt

@@ -138,19 +138,29 @@ Reading MTRRs from a C program using ioctl()'s:
 
 
 */
 */
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
 #include <sys/types.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <errno.h>
-#define MTRR_NEED_STRINGS
 #include <asm/mtrr.h>
 #include <asm/mtrr.h>
 
 
 #define TRUE 1
 #define TRUE 1
 #define FALSE 0
 #define FALSE 0
 #define ERRSTRING strerror (errno)
 #define ERRSTRING strerror (errno)
 
 
+static char *mtrr_strings[MTRR_NUM_TYPES] =
+{
+    "uncachable",               /* 0 */
+    "write-combining",          /* 1 */
+    "?",                        /* 2 */
+    "?",                        /* 3 */
+    "write-through",            /* 4 */
+    "write-protect",            /* 5 */
+    "write-back",               /* 6 */
+};
 
 
 int main ()
 int main ()
 {
 {
@@ -232,13 +242,22 @@ Creating MTRRs from a C programme using ioctl()'s:
 #include <fcntl.h>
 #include <fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/ioctl.h>
 #include <errno.h>
 #include <errno.h>
-#define MTRR_NEED_STRINGS
 #include <asm/mtrr.h>
 #include <asm/mtrr.h>
 
 
 #define TRUE 1
 #define TRUE 1
 #define FALSE 0
 #define FALSE 0
 #define ERRSTRING strerror (errno)
 #define ERRSTRING strerror (errno)
 
 
+static char *mtrr_strings[MTRR_NUM_TYPES] =
+{
+    "uncachable",               /* 0 */
+    "write-combining",          /* 1 */
+    "?",                        /* 2 */
+    "?",                        /* 3 */
+    "write-through",            /* 4 */
+    "write-protect",            /* 5 */
+    "write-back",               /* 6 */
+};
 
 
 int main (int argc, char **argv)
 int main (int argc, char **argv)
 {
 {