Doc; fix mtrr userspace programs to build cleanly
PATCH 1/1 Doc; fix mtrr userspace programs to build cleanly
From: Randy Dunlap <[email protected]>
Fix mtrr-add.c and mtrr-show.c in Doc/mtrr.txt to build cleanly.
Signed-off-by Randy Dunlap <[email protected]>
--- Documentation/mtrr.txt | 23 +++++++++++++++++++++-- 1 files changed, 21 insertions(+), 2 deletions(-)
Documentation/mtrr.txt +21 -2
@@ -138,19 +138,29 @@ Reading MTRRs from a C program using ioc */ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <sys/ioctl.h> #include <errno.h> -#define MTRR_NEED_STRINGS #include <asm/mtrr.h> #define TRUE 1 #define FALSE 0 #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 () {
@@ -232,13 +242,22 @@ Creating MTRRs from a C programme using #include <fcntl.h> #include <sys/ioctl.h> #include <errno.h> -#define MTRR_NEED_STRINGS #include <asm/mtrr.h> #define TRUE 1 #define FALSE 0 #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) {
---
Hi,
Documentation/mtrr.txt Reading MTRRs from a C program using ioc · line 163
Quoted 10 lines · Randy.Dunlap
Documentation/mtrr.txt +10
-0+static char *mtrr_strings[MTRR_NUM_TYPES] = +{ + "uncachable", /* 0 */ + "write-combining", /* 1 */ + "?", /* 2 */ + "?", /* 3 */ + "write-through", /* 4 */ + "write-protect", /* 5 */ + "write-back", /* 6 */ +};
How about something like that ?
+static char *mtrr_strings[MTRR_NUM_TYPES] =
+{
+ [MTRR_TYPE_UNCACHABLE] = "uncachable", /* 0 */ + [MTRR_TYPE_WRCOMB] = "write-combining", /* 1 */ + "?", /* 2 */ + "?", /* 3 */ + [MTRR_TYPE_WRTHROUGH] = "write-through", /* 4 */ + [MTRR_TYPE_WRPROT] = "write-protect", /* 5 */ + [MTRR_TYPE_WRBACK] = "write-back", /* 6 */
+};
(Dunno if it's that helpful though).
Xav