diff options
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/dtc/data.c | 2 | ||||
-rw-r--r-- | scripts/dtc/dtc-lexer.l | 2 | ||||
-rw-r--r-- | scripts/dtc/dtc-lexer.lex.c_shipped | 69 | ||||
-rw-r--r-- | scripts/dtc/libfdt/fdt_ro.c | 2 | ||||
-rw-r--r-- | scripts/dtc/treesource.c | 2 | ||||
-rw-r--r-- | scripts/genksyms/keywords.c_shipped | 95 | ||||
-rw-r--r-- | scripts/genksyms/keywords.gperf | 2 | ||||
-rw-r--r-- | scripts/kconfig/Makefile | 4 | ||||
-rw-r--r-- | scripts/kconfig/lex.zconf.c_shipped | 25 | ||||
-rw-r--r-- | scripts/kconfig/streamline_config.pl | 12 | ||||
-rw-r--r-- | scripts/kconfig/zconf.gperf | 2 | ||||
-rw-r--r-- | scripts/kconfig/zconf.hash.c_shipped | 2 | ||||
-rw-r--r-- | scripts/kconfig/zconf.l | 6 | ||||
-rw-r--r-- | scripts/kconfig/zconf.tab.c_shipped | 379 | ||||
-rw-r--r-- | scripts/kconfig/zconf.y | 13 | ||||
-rwxr-xr-x | scripts/recordmcount.pl | 218 | ||||
-rw-r--r-- | scripts/selinux/Makefile | 4 | ||||
-rw-r--r-- | scripts/selinux/genheaders/.gitignore | 1 | ||||
-rw-r--r-- | scripts/selinux/genheaders/Makefile | 5 | ||||
-rw-r--r-- | scripts/selinux/genheaders/genheaders.c | 118 | ||||
-rw-r--r-- | scripts/selinux/mdp/mdp.c | 151 |
21 files changed, 596 insertions, 518 deletions
diff --git a/scripts/dtc/data.c b/scripts/dtc/data.c index dd2e3d39d4c1..fe555e819bf8 100644 --- a/scripts/dtc/data.c +++ b/scripts/dtc/data.c | |||
@@ -217,7 +217,7 @@ struct data data_insert_at_marker(struct data d, struct marker *m, | |||
217 | return d; | 217 | return d; |
218 | } | 218 | } |
219 | 219 | ||
220 | struct data data_append_markers(struct data d, struct marker *m) | 220 | static struct data data_append_markers(struct data d, struct marker *m) |
221 | { | 221 | { |
222 | struct marker **mp = &d.markers; | 222 | struct marker **mp = &d.markers; |
223 | 223 | ||
diff --git a/scripts/dtc/dtc-lexer.l b/scripts/dtc/dtc-lexer.l index 44dbfd3f0976..a627bbee91d4 100644 --- a/scripts/dtc/dtc-lexer.l +++ b/scripts/dtc/dtc-lexer.l | |||
@@ -18,7 +18,7 @@ | |||
18 | * USA | 18 | * USA |
19 | */ | 19 | */ |
20 | 20 | ||
21 | %option noyywrap nounput yylineno | 21 | %option noyywrap noinput nounput yylineno |
22 | 22 | ||
23 | %x INCLUDE | 23 | %x INCLUDE |
24 | %x BYTESTRING | 24 | %x BYTESTRING |
diff --git a/scripts/dtc/dtc-lexer.lex.c_shipped b/scripts/dtc/dtc-lexer.lex.c_shipped index ac392cb040f6..e27cc636e326 100644 --- a/scripts/dtc/dtc-lexer.lex.c_shipped +++ b/scripts/dtc/dtc-lexer.lex.c_shipped | |||
@@ -9,7 +9,7 @@ | |||
9 | #define FLEX_SCANNER | 9 | #define FLEX_SCANNER |
10 | #define YY_FLEX_MAJOR_VERSION 2 | 10 | #define YY_FLEX_MAJOR_VERSION 2 |
11 | #define YY_FLEX_MINOR_VERSION 5 | 11 | #define YY_FLEX_MINOR_VERSION 5 |
12 | #define YY_FLEX_SUBMINOR_VERSION 34 | 12 | #define YY_FLEX_SUBMINOR_VERSION 35 |
13 | #if YY_FLEX_SUBMINOR_VERSION > 0 | 13 | #if YY_FLEX_SUBMINOR_VERSION > 0 |
14 | #define FLEX_BETA | 14 | #define FLEX_BETA |
15 | #endif | 15 | #endif |
@@ -54,7 +54,6 @@ typedef int flex_int32_t; | |||
54 | typedef unsigned char flex_uint8_t; | 54 | typedef unsigned char flex_uint8_t; |
55 | typedef unsigned short int flex_uint16_t; | 55 | typedef unsigned short int flex_uint16_t; |
56 | typedef unsigned int flex_uint32_t; | 56 | typedef unsigned int flex_uint32_t; |
57 | #endif /* ! C99 */ | ||
58 | 57 | ||
59 | /* Limits of integral types. */ | 58 | /* Limits of integral types. */ |
60 | #ifndef INT8_MIN | 59 | #ifndef INT8_MIN |
@@ -85,6 +84,8 @@ typedef unsigned int flex_uint32_t; | |||
85 | #define UINT32_MAX (4294967295U) | 84 | #define UINT32_MAX (4294967295U) |
86 | #endif | 85 | #endif |
87 | 86 | ||
87 | #endif /* ! C99 */ | ||
88 | |||
88 | #endif /* ! FLEXINT_H */ | 89 | #endif /* ! FLEXINT_H */ |
89 | 90 | ||
90 | #ifdef __cplusplus | 91 | #ifdef __cplusplus |
@@ -141,7 +142,15 @@ typedef unsigned int flex_uint32_t; | |||
141 | 142 | ||
142 | /* Size of default input buffer. */ | 143 | /* Size of default input buffer. */ |
143 | #ifndef YY_BUF_SIZE | 144 | #ifndef YY_BUF_SIZE |
145 | #ifdef __ia64__ | ||
146 | /* On IA-64, the buffer size is 16k, not 8k. | ||
147 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
148 | * Ditto for the __ia64__ case accordingly. | ||
149 | */ | ||
150 | #define YY_BUF_SIZE 32768 | ||
151 | #else | ||
144 | #define YY_BUF_SIZE 16384 | 152 | #define YY_BUF_SIZE 16384 |
153 | #endif /* __ia64__ */ | ||
145 | #endif | 154 | #endif |
146 | 155 | ||
147 | /* The state buf must be large enough to hold one state per character in the main buffer. | 156 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -192,13 +201,6 @@ extern FILE *yyin, *yyout; | |||
192 | 201 | ||
193 | #define unput(c) yyunput( c, (yytext_ptr) ) | 202 | #define unput(c) yyunput( c, (yytext_ptr) ) |
194 | 203 | ||
195 | /* The following is because we cannot portably get our hands on size_t | ||
196 | * (without autoconf's help, which isn't available because we want | ||
197 | * flex-generated scanners to compile on their own). | ||
198 | * Given that the standard has decreed that size_t exists since 1989, | ||
199 | * I guess we can afford to depend on it. Manoj. | ||
200 | */ | ||
201 | |||
202 | #ifndef YY_TYPEDEF_YY_SIZE_T | 204 | #ifndef YY_TYPEDEF_YY_SIZE_T |
203 | #define YY_TYPEDEF_YY_SIZE_T | 205 | #define YY_TYPEDEF_YY_SIZE_T |
204 | typedef size_t yy_size_t; | 206 | typedef size_t yy_size_t; |
@@ -604,6 +606,7 @@ char *yytext; | |||
604 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | 606 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
605 | * USA | 607 | * USA |
606 | */ | 608 | */ |
609 | #define YY_NO_INPUT 1 | ||
607 | 610 | ||
608 | 611 | ||
609 | 612 | ||
@@ -634,7 +637,7 @@ static int dts_version; /* = 0 */ | |||
634 | 637 | ||
635 | static void push_input_file(const char *filename); | 638 | static void push_input_file(const char *filename); |
636 | static int pop_input_file(void); | 639 | static int pop_input_file(void); |
637 | #line 638 "dtc-lexer.lex.c" | 640 | #line 641 "dtc-lexer.lex.c" |
638 | 641 | ||
639 | #define INITIAL 0 | 642 | #define INITIAL 0 |
640 | #define INCLUDE 1 | 643 | #define INCLUDE 1 |
@@ -656,6 +659,35 @@ static int pop_input_file(void); | |||
656 | 659 | ||
657 | static int yy_init_globals (void ); | 660 | static int yy_init_globals (void ); |
658 | 661 | ||
662 | /* Accessor methods to globals. | ||
663 | These are made visible to non-reentrant scanners for convenience. */ | ||
664 | |||
665 | int yylex_destroy (void ); | ||
666 | |||
667 | int yyget_debug (void ); | ||
668 | |||
669 | void yyset_debug (int debug_flag ); | ||
670 | |||
671 | YY_EXTRA_TYPE yyget_extra (void ); | ||
672 | |||
673 | void yyset_extra (YY_EXTRA_TYPE user_defined ); | ||
674 | |||
675 | FILE *yyget_in (void ); | ||
676 | |||
677 | void yyset_in (FILE * in_str ); | ||
678 | |||
679 | FILE *yyget_out (void ); | ||
680 | |||
681 | void yyset_out (FILE * out_str ); | ||
682 | |||
683 | int yyget_leng (void ); | ||
684 | |||
685 | char *yyget_text (void ); | ||
686 | |||
687 | int yyget_lineno (void ); | ||
688 | |||
689 | void yyset_lineno (int line_number ); | ||
690 | |||
659 | /* Macros after this point can all be overridden by user definitions in | 691 | /* Macros after this point can all be overridden by user definitions in |
660 | * section 1. | 692 | * section 1. |
661 | */ | 693 | */ |
@@ -688,7 +720,12 @@ static int input (void ); | |||
688 | 720 | ||
689 | /* Amount of stuff to slurp up with each read. */ | 721 | /* Amount of stuff to slurp up with each read. */ |
690 | #ifndef YY_READ_BUF_SIZE | 722 | #ifndef YY_READ_BUF_SIZE |
723 | #ifdef __ia64__ | ||
724 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
725 | #define YY_READ_BUF_SIZE 16384 | ||
726 | #else | ||
691 | #define YY_READ_BUF_SIZE 8192 | 727 | #define YY_READ_BUF_SIZE 8192 |
728 | #endif /* __ia64__ */ | ||
692 | #endif | 729 | #endif |
693 | 730 | ||
694 | /* Copy whatever the last rule matched to the standard output. */ | 731 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -696,7 +733,7 @@ static int input (void ); | |||
696 | /* This used to be an fputs(), but since the string might contain NUL's, | 733 | /* This used to be an fputs(), but since the string might contain NUL's, |
697 | * we now use fwrite(). | 734 | * we now use fwrite(). |
698 | */ | 735 | */ |
699 | #define ECHO fwrite( yytext, yyleng, 1, yyout ) | 736 | #define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0) |
700 | #endif | 737 | #endif |
701 | 738 | ||
702 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 739 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -707,7 +744,7 @@ static int input (void ); | |||
707 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ | 744 | if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \ |
708 | { \ | 745 | { \ |
709 | int c = '*'; \ | 746 | int c = '*'; \ |
710 | int n; \ | 747 | size_t n; \ |
711 | for ( n = 0; n < max_size && \ | 748 | for ( n = 0; n < max_size && \ |
712 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ | 749 | (c = getc( yyin )) != EOF && c != '\n'; ++n ) \ |
713 | buf[n] = (char) c; \ | 750 | buf[n] = (char) c; \ |
@@ -791,7 +828,7 @@ YY_DECL | |||
791 | 828 | ||
792 | #line 64 "dtc-lexer.l" | 829 | #line 64 "dtc-lexer.l" |
793 | 830 | ||
794 | #line 795 "dtc-lexer.lex.c" | 831 | #line 832 "dtc-lexer.lex.c" |
795 | 832 | ||
796 | if ( !(yy_init) ) | 833 | if ( !(yy_init) ) |
797 | { | 834 | { |
@@ -1116,7 +1153,7 @@ YY_RULE_SETUP | |||
1116 | #line 222 "dtc-lexer.l" | 1153 | #line 222 "dtc-lexer.l" |
1117 | ECHO; | 1154 | ECHO; |
1118 | YY_BREAK | 1155 | YY_BREAK |
1119 | #line 1120 "dtc-lexer.lex.c" | 1156 | #line 1157 "dtc-lexer.lex.c" |
1120 | 1157 | ||
1121 | case YY_END_OF_BUFFER: | 1158 | case YY_END_OF_BUFFER: |
1122 | { | 1159 | { |
@@ -1840,8 +1877,8 @@ YY_BUFFER_STATE yy_scan_string (yyconst char * yystr ) | |||
1840 | 1877 | ||
1841 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will | 1878 | /** Setup the input buffer state to scan the given bytes. The next call to yylex() will |
1842 | * scan from a @e copy of @a bytes. | 1879 | * scan from a @e copy of @a bytes. |
1843 | * @param bytes the byte buffer to scan | 1880 | * @param yybytes the byte buffer to scan |
1844 | * @param len the number of bytes in the buffer pointed to by @a bytes. | 1881 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
1845 | * | 1882 | * |
1846 | * @return the newly allocated buffer state object. | 1883 | * @return the newly allocated buffer state object. |
1847 | */ | 1884 | */ |
diff --git a/scripts/dtc/libfdt/fdt_ro.c b/scripts/dtc/libfdt/fdt_ro.c index fbbba44fcd0d..22e692919ff9 100644 --- a/scripts/dtc/libfdt/fdt_ro.c +++ b/scripts/dtc/libfdt/fdt_ro.c | |||
@@ -411,7 +411,7 @@ int fdt_node_offset_by_phandle(const void *fdt, uint32_t phandle) | |||
411 | &phandle, sizeof(phandle)); | 411 | &phandle, sizeof(phandle)); |
412 | } | 412 | } |
413 | 413 | ||
414 | int _stringlist_contains(const char *strlist, int listlen, const char *str) | 414 | static int _stringlist_contains(const char *strlist, int listlen, const char *str) |
415 | { | 415 | { |
416 | int len = strlen(str); | 416 | int len = strlen(str); |
417 | const char *p; | 417 | const char *p; |
diff --git a/scripts/dtc/treesource.c b/scripts/dtc/treesource.c index ebeb6eb27907..1521ff11bb97 100644 --- a/scripts/dtc/treesource.c +++ b/scripts/dtc/treesource.c | |||
@@ -52,7 +52,7 @@ static void write_prefix(FILE *f, int level) | |||
52 | fputc('\t', f); | 52 | fputc('\t', f); |
53 | } | 53 | } |
54 | 54 | ||
55 | int isstring(char c) | 55 | static int isstring(char c) |
56 | { | 56 | { |
57 | return (isprint(c) | 57 | return (isprint(c) |
58 | || (c == '\0') | 58 | || (c == '\0') |
diff --git a/scripts/genksyms/keywords.c_shipped b/scripts/genksyms/keywords.c_shipped index 971e0113ae7a..287467a2e8c7 100644 --- a/scripts/genksyms/keywords.c_shipped +++ b/scripts/genksyms/keywords.c_shipped | |||
@@ -1,4 +1,4 @@ | |||
1 | /* ANSI-C code produced by gperf version 3.0.2 */ | 1 | /* ANSI-C code produced by gperf version 3.0.3 */ |
2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ | 2 | /* Command-line: gperf -L ANSI-C -a -C -E -g -H is_reserved_hash -k '1,3,$' -N is_reserved_word -p -t scripts/genksyms/keywords.gperf */ |
3 | 3 | ||
4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ | 4 | #if !((' ' == 32) && ('!' == 33) && ('"' == 34) && ('#' == 35) \ |
@@ -30,7 +30,9 @@ | |||
30 | 30 | ||
31 | #line 1 "scripts/genksyms/keywords.gperf" | 31 | #line 1 "scripts/genksyms/keywords.gperf" |
32 | 32 | ||
33 | #line 3 "scripts/genksyms/keywords.gperf" | 33 | struct resword; |
34 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); | ||
35 | #line 5 "scripts/genksyms/keywords.gperf" | ||
34 | struct resword { const char *name; int token; }; | 36 | struct resword { const char *name; int token; }; |
35 | /* maximum key range = 62, duplicates = 0 */ | 37 | /* maximum key range = 62, duplicates = 0 */ |
36 | 38 | ||
@@ -78,6 +80,9 @@ is_reserved_hash (register const char *str, register unsigned int len) | |||
78 | 80 | ||
79 | #ifdef __GNUC__ | 81 | #ifdef __GNUC__ |
80 | __inline | 82 | __inline |
83 | #ifdef __GNUC_STDC_INLINE__ | ||
84 | __attribute__ ((__gnu_inline__)) | ||
85 | #endif | ||
81 | #endif | 86 | #endif |
82 | const struct resword * | 87 | const struct resword * |
83 | is_reserved_word (register const char *str, register unsigned int len) | 88 | is_reserved_word (register const char *str, register unsigned int len) |
@@ -94,105 +99,105 @@ is_reserved_word (register const char *str, register unsigned int len) | |||
94 | static const struct resword wordlist[] = | 99 | static const struct resword wordlist[] = |
95 | { | 100 | { |
96 | {""}, {""}, {""}, | 101 | {""}, {""}, {""}, |
97 | #line 26 "scripts/genksyms/keywords.gperf" | 102 | #line 28 "scripts/genksyms/keywords.gperf" |
98 | {"asm", ASM_KEYW}, | 103 | {"asm", ASM_KEYW}, |
99 | {""}, | 104 | {""}, |
100 | #line 8 "scripts/genksyms/keywords.gperf" | 105 | #line 10 "scripts/genksyms/keywords.gperf" |
101 | {"__asm", ASM_KEYW}, | 106 | {"__asm", ASM_KEYW}, |
102 | {""}, | 107 | {""}, |
103 | #line 9 "scripts/genksyms/keywords.gperf" | 108 | #line 11 "scripts/genksyms/keywords.gperf" |
104 | {"__asm__", ASM_KEYW}, | 109 | {"__asm__", ASM_KEYW}, |
105 | {""}, {""}, | 110 | {""}, {""}, |
106 | #line 52 "scripts/genksyms/keywords.gperf" | 111 | #line 54 "scripts/genksyms/keywords.gperf" |
107 | {"__typeof__", TYPEOF_KEYW}, | 112 | {"__typeof__", TYPEOF_KEYW}, |
108 | {""}, | 113 | {""}, |
109 | #line 12 "scripts/genksyms/keywords.gperf" | 114 | #line 14 "scripts/genksyms/keywords.gperf" |
110 | {"__const", CONST_KEYW}, | 115 | {"__const", CONST_KEYW}, |
111 | #line 11 "scripts/genksyms/keywords.gperf" | ||
112 | {"__attribute__", ATTRIBUTE_KEYW}, | ||
113 | #line 13 "scripts/genksyms/keywords.gperf" | 116 | #line 13 "scripts/genksyms/keywords.gperf" |
117 | {"__attribute__", ATTRIBUTE_KEYW}, | ||
118 | #line 15 "scripts/genksyms/keywords.gperf" | ||
114 | {"__const__", CONST_KEYW}, | 119 | {"__const__", CONST_KEYW}, |
115 | #line 18 "scripts/genksyms/keywords.gperf" | 120 | #line 20 "scripts/genksyms/keywords.gperf" |
116 | {"__signed__", SIGNED_KEYW}, | 121 | {"__signed__", SIGNED_KEYW}, |
117 | #line 44 "scripts/genksyms/keywords.gperf" | 122 | #line 46 "scripts/genksyms/keywords.gperf" |
118 | {"static", STATIC_KEYW}, | 123 | {"static", STATIC_KEYW}, |
119 | #line 20 "scripts/genksyms/keywords.gperf" | 124 | #line 22 "scripts/genksyms/keywords.gperf" |
120 | {"__volatile__", VOLATILE_KEYW}, | 125 | {"__volatile__", VOLATILE_KEYW}, |
121 | #line 39 "scripts/genksyms/keywords.gperf" | 126 | #line 41 "scripts/genksyms/keywords.gperf" |
122 | {"int", INT_KEYW}, | 127 | {"int", INT_KEYW}, |
123 | #line 32 "scripts/genksyms/keywords.gperf" | 128 | #line 34 "scripts/genksyms/keywords.gperf" |
124 | {"char", CHAR_KEYW}, | 129 | {"char", CHAR_KEYW}, |
125 | #line 33 "scripts/genksyms/keywords.gperf" | 130 | #line 35 "scripts/genksyms/keywords.gperf" |
126 | {"const", CONST_KEYW}, | 131 | {"const", CONST_KEYW}, |
127 | #line 45 "scripts/genksyms/keywords.gperf" | 132 | #line 47 "scripts/genksyms/keywords.gperf" |
128 | {"struct", STRUCT_KEYW}, | 133 | {"struct", STRUCT_KEYW}, |
129 | #line 24 "scripts/genksyms/keywords.gperf" | 134 | #line 26 "scripts/genksyms/keywords.gperf" |
130 | {"__restrict__", RESTRICT_KEYW}, | 135 | {"__restrict__", RESTRICT_KEYW}, |
131 | #line 25 "scripts/genksyms/keywords.gperf" | 136 | #line 27 "scripts/genksyms/keywords.gperf" |
132 | {"restrict", RESTRICT_KEYW}, | 137 | {"restrict", RESTRICT_KEYW}, |
133 | #line 23 "scripts/genksyms/keywords.gperf" | 138 | #line 25 "scripts/genksyms/keywords.gperf" |
134 | {"_restrict", RESTRICT_KEYW}, | 139 | {"_restrict", RESTRICT_KEYW}, |
135 | #line 16 "scripts/genksyms/keywords.gperf" | 140 | #line 18 "scripts/genksyms/keywords.gperf" |
136 | {"__inline__", INLINE_KEYW}, | 141 | {"__inline__", INLINE_KEYW}, |
137 | #line 10 "scripts/genksyms/keywords.gperf" | 142 | #line 12 "scripts/genksyms/keywords.gperf" |
138 | {"__attribute", ATTRIBUTE_KEYW}, | 143 | {"__attribute", ATTRIBUTE_KEYW}, |
139 | {""}, | 144 | {""}, |
140 | #line 14 "scripts/genksyms/keywords.gperf" | 145 | #line 16 "scripts/genksyms/keywords.gperf" |
141 | {"__extension__", EXTENSION_KEYW}, | 146 | {"__extension__", EXTENSION_KEYW}, |
142 | #line 35 "scripts/genksyms/keywords.gperf" | 147 | #line 37 "scripts/genksyms/keywords.gperf" |
143 | {"enum", ENUM_KEYW}, | 148 | {"enum", ENUM_KEYW}, |
144 | #line 19 "scripts/genksyms/keywords.gperf" | 149 | #line 21 "scripts/genksyms/keywords.gperf" |
145 | {"__volatile", VOLATILE_KEYW}, | 150 | {"__volatile", VOLATILE_KEYW}, |
146 | #line 36 "scripts/genksyms/keywords.gperf" | 151 | #line 38 "scripts/genksyms/keywords.gperf" |
147 | {"extern", EXTERN_KEYW}, | 152 | {"extern", EXTERN_KEYW}, |
148 | {""}, | 153 | {""}, |
149 | #line 17 "scripts/genksyms/keywords.gperf" | 154 | #line 19 "scripts/genksyms/keywords.gperf" |
150 | {"__signed", SIGNED_KEYW}, | 155 | {"__signed", SIGNED_KEYW}, |
151 | #line 7 "scripts/genksyms/keywords.gperf" | 156 | #line 9 "scripts/genksyms/keywords.gperf" |
152 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, | 157 | {"EXPORT_SYMBOL_GPL_FUTURE", EXPORT_SYMBOL_KEYW}, |
153 | {""}, | 158 | {""}, |
154 | #line 51 "scripts/genksyms/keywords.gperf" | 159 | #line 53 "scripts/genksyms/keywords.gperf" |
155 | {"typeof", TYPEOF_KEYW}, | 160 | {"typeof", TYPEOF_KEYW}, |
156 | #line 46 "scripts/genksyms/keywords.gperf" | 161 | #line 48 "scripts/genksyms/keywords.gperf" |
157 | {"typedef", TYPEDEF_KEYW}, | 162 | {"typedef", TYPEDEF_KEYW}, |
158 | #line 15 "scripts/genksyms/keywords.gperf" | 163 | #line 17 "scripts/genksyms/keywords.gperf" |
159 | {"__inline", INLINE_KEYW}, | 164 | {"__inline", INLINE_KEYW}, |
160 | #line 31 "scripts/genksyms/keywords.gperf" | 165 | #line 33 "scripts/genksyms/keywords.gperf" |
161 | {"auto", AUTO_KEYW}, | 166 | {"auto", AUTO_KEYW}, |
162 | #line 47 "scripts/genksyms/keywords.gperf" | 167 | #line 49 "scripts/genksyms/keywords.gperf" |
163 | {"union", UNION_KEYW}, | 168 | {"union", UNION_KEYW}, |
164 | {""}, {""}, | 169 | {""}, {""}, |
165 | #line 48 "scripts/genksyms/keywords.gperf" | 170 | #line 50 "scripts/genksyms/keywords.gperf" |
166 | {"unsigned", UNSIGNED_KEYW}, | 171 | {"unsigned", UNSIGNED_KEYW}, |
167 | #line 49 "scripts/genksyms/keywords.gperf" | 172 | #line 51 "scripts/genksyms/keywords.gperf" |
168 | {"void", VOID_KEYW}, | 173 | {"void", VOID_KEYW}, |
169 | #line 42 "scripts/genksyms/keywords.gperf" | 174 | #line 44 "scripts/genksyms/keywords.gperf" |
170 | {"short", SHORT_KEYW}, | 175 | {"short", SHORT_KEYW}, |
171 | {""}, {""}, | 176 | {""}, {""}, |
172 | #line 50 "scripts/genksyms/keywords.gperf" | 177 | #line 52 "scripts/genksyms/keywords.gperf" |
173 | {"volatile", VOLATILE_KEYW}, | 178 | {"volatile", VOLATILE_KEYW}, |
174 | {""}, | 179 | {""}, |
175 | #line 37 "scripts/genksyms/keywords.gperf" | 180 | #line 39 "scripts/genksyms/keywords.gperf" |
176 | {"float", FLOAT_KEYW}, | 181 | {"float", FLOAT_KEYW}, |
177 | #line 34 "scripts/genksyms/keywords.gperf" | 182 | #line 36 "scripts/genksyms/keywords.gperf" |
178 | {"double", DOUBLE_KEYW}, | 183 | {"double", DOUBLE_KEYW}, |
179 | {""}, | 184 | {""}, |
180 | #line 5 "scripts/genksyms/keywords.gperf" | 185 | #line 7 "scripts/genksyms/keywords.gperf" |
181 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, | 186 | {"EXPORT_SYMBOL", EXPORT_SYMBOL_KEYW}, |
182 | {""}, {""}, | 187 | {""}, {""}, |
183 | #line 38 "scripts/genksyms/keywords.gperf" | 188 | #line 40 "scripts/genksyms/keywords.gperf" |
184 | {"inline", INLINE_KEYW}, | 189 | {"inline", INLINE_KEYW}, |
185 | #line 6 "scripts/genksyms/keywords.gperf" | 190 | #line 8 "scripts/genksyms/keywords.gperf" |
186 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, | 191 | {"EXPORT_SYMBOL_GPL", EXPORT_SYMBOL_KEYW}, |
187 | #line 41 "scripts/genksyms/keywords.gperf" | 192 | #line 43 "scripts/genksyms/keywords.gperf" |
188 | {"register", REGISTER_KEYW}, | 193 | {"register", REGISTER_KEYW}, |
189 | {""}, | 194 | {""}, |
190 | #line 22 "scripts/genksyms/keywords.gperf" | 195 | #line 24 "scripts/genksyms/keywords.gperf" |
191 | {"_Bool", BOOL_KEYW}, | 196 | {"_Bool", BOOL_KEYW}, |
192 | #line 43 "scripts/genksyms/keywords.gperf" | 197 | #line 45 "scripts/genksyms/keywords.gperf" |
193 | {"signed", SIGNED_KEYW}, | 198 | {"signed", SIGNED_KEYW}, |
194 | {""}, {""}, | 199 | {""}, {""}, |
195 | #line 40 "scripts/genksyms/keywords.gperf" | 200 | #line 42 "scripts/genksyms/keywords.gperf" |
196 | {"long", LONG_KEYW} | 201 | {"long", LONG_KEYW} |
197 | }; | 202 | }; |
198 | 203 | ||
diff --git a/scripts/genksyms/keywords.gperf b/scripts/genksyms/keywords.gperf index 5ef3733225fb..8fe977a4d57b 100644 --- a/scripts/genksyms/keywords.gperf +++ b/scripts/genksyms/keywords.gperf | |||
@@ -1,4 +1,6 @@ | |||
1 | %{ | 1 | %{ |
2 | struct resword; | ||
3 | static const struct resword *is_reserved_word(register const char *str, register unsigned int len); | ||
2 | %} | 4 | %} |
3 | struct resword { const char *name; int token; } | 5 | struct resword { const char *name; int token; } |
4 | %% | 6 | %% |
diff --git a/scripts/kconfig/Makefile b/scripts/kconfig/Makefile index 6d69c7ccdcc7..80599e3a7994 100644 --- a/scripts/kconfig/Makefile +++ b/scripts/kconfig/Makefile | |||
@@ -30,7 +30,7 @@ silentoldconfig: $(obj)/conf | |||
30 | $< -s $(Kconfig) | 30 | $< -s $(Kconfig) |
31 | 31 | ||
32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | 32 | localmodconfig: $(obj)/streamline_config.pl $(obj)/conf |
33 | $(Q)perl $< $(Kconfig) > .tmp.config | 33 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config |
34 | $(Q)if [ -f .config ]; then \ | 34 | $(Q)if [ -f .config ]; then \ |
35 | cmp -s .tmp.config .config || \ | 35 | cmp -s .tmp.config .config || \ |
36 | (mv -f .config .config.old.1; \ | 36 | (mv -f .config .config.old.1; \ |
@@ -44,7 +44,7 @@ localmodconfig: $(obj)/streamline_config.pl $(obj)/conf | |||
44 | $(Q)rm -f .tmp.config | 44 | $(Q)rm -f .tmp.config |
45 | 45 | ||
46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf | 46 | localyesconfig: $(obj)/streamline_config.pl $(obj)/conf |
47 | $(Q)perl $< $(Kconfig) > .tmp.config | 47 | $(Q)perl $< $(srctree) $(Kconfig) > .tmp.config |
48 | $(Q)sed -i s/=m/=y/ .tmp.config | 48 | $(Q)sed -i s/=m/=y/ .tmp.config |
49 | $(Q)if [ -f .config ]; then \ | 49 | $(Q)if [ -f .config ]; then \ |
50 | cmp -s .tmp.config .config || \ | 50 | cmp -s .tmp.config .config || \ |
diff --git a/scripts/kconfig/lex.zconf.c_shipped b/scripts/kconfig/lex.zconf.c_shipped index dc3e81807d13..fdc7113b08d1 100644 --- a/scripts/kconfig/lex.zconf.c_shipped +++ b/scripts/kconfig/lex.zconf.c_shipped | |||
@@ -160,7 +160,15 @@ typedef unsigned int flex_uint32_t; | |||
160 | 160 | ||
161 | /* Size of default input buffer. */ | 161 | /* Size of default input buffer. */ |
162 | #ifndef YY_BUF_SIZE | 162 | #ifndef YY_BUF_SIZE |
163 | #ifdef __ia64__ | ||
164 | /* On IA-64, the buffer size is 16k, not 8k. | ||
165 | * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case. | ||
166 | * Ditto for the __ia64__ case accordingly. | ||
167 | */ | ||
168 | #define YY_BUF_SIZE 32768 | ||
169 | #else | ||
163 | #define YY_BUF_SIZE 16384 | 170 | #define YY_BUF_SIZE 16384 |
171 | #endif /* __ia64__ */ | ||
164 | #endif | 172 | #endif |
165 | 173 | ||
166 | /* The state buf must be large enough to hold one state per character in the main buffer. | 174 | /* The state buf must be large enough to hold one state per character in the main buffer. |
@@ -802,7 +810,7 @@ static int last_ts, first_ts; | |||
802 | static void zconf_endhelp(void); | 810 | static void zconf_endhelp(void); |
803 | static void zconf_endfile(void); | 811 | static void zconf_endfile(void); |
804 | 812 | ||
805 | void new_string(void) | 813 | static void new_string(void) |
806 | { | 814 | { |
807 | text = malloc(START_STRSIZE); | 815 | text = malloc(START_STRSIZE); |
808 | text_asize = START_STRSIZE; | 816 | text_asize = START_STRSIZE; |
@@ -810,7 +818,7 @@ void new_string(void) | |||
810 | *text = 0; | 818 | *text = 0; |
811 | } | 819 | } |
812 | 820 | ||
813 | void append_string(const char *str, int size) | 821 | static void append_string(const char *str, int size) |
814 | { | 822 | { |
815 | int new_size = text_size + size + 1; | 823 | int new_size = text_size + size + 1; |
816 | if (new_size > text_asize) { | 824 | if (new_size > text_asize) { |
@@ -824,7 +832,7 @@ void append_string(const char *str, int size) | |||
824 | text[text_size] = 0; | 832 | text[text_size] = 0; |
825 | } | 833 | } |
826 | 834 | ||
827 | void alloc_string(const char *str, int size) | 835 | static void alloc_string(const char *str, int size) |
828 | { | 836 | { |
829 | text = malloc(size + 1); | 837 | text = malloc(size + 1); |
830 | memcpy(text, str, size); | 838 | memcpy(text, str, size); |
@@ -914,7 +922,12 @@ static int input (void ); | |||
914 | 922 | ||
915 | /* Amount of stuff to slurp up with each read. */ | 923 | /* Amount of stuff to slurp up with each read. */ |
916 | #ifndef YY_READ_BUF_SIZE | 924 | #ifndef YY_READ_BUF_SIZE |
925 | #ifdef __ia64__ | ||
926 | /* On IA-64, the buffer size is 16k, not 8k */ | ||
927 | #define YY_READ_BUF_SIZE 16384 | ||
928 | #else | ||
917 | #define YY_READ_BUF_SIZE 8192 | 929 | #define YY_READ_BUF_SIZE 8192 |
930 | #endif /* __ia64__ */ | ||
918 | #endif | 931 | #endif |
919 | 932 | ||
920 | /* Copy whatever the last rule matched to the standard output. */ | 933 | /* Copy whatever the last rule matched to the standard output. */ |
@@ -922,7 +935,7 @@ static int input (void ); | |||
922 | /* This used to be an fputs(), but since the string might contain NUL's, | 935 | /* This used to be an fputs(), but since the string might contain NUL's, |
923 | * we now use fwrite(). | 936 | * we now use fwrite(). |
924 | */ | 937 | */ |
925 | #define ECHO fwrite( zconftext, zconfleng, 1, zconfout ) | 938 | #define ECHO do { if (fwrite( zconftext, zconfleng, 1, zconfout )) {} } while (0) |
926 | #endif | 939 | #endif |
927 | 940 | ||
928 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, | 941 | /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL, |
@@ -2060,8 +2073,8 @@ YY_BUFFER_STATE zconf_scan_string (yyconst char * yystr ) | |||
2060 | 2073 | ||
2061 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will | 2074 | /** Setup the input buffer state to scan the given bytes. The next call to zconflex() will |
2062 | * scan from a @e copy of @a bytes. | 2075 | * scan from a @e copy of @a bytes. |
2063 | * @param bytes the byte buffer to scan | 2076 | * @param yybytes the byte buffer to scan |
2064 | * @param len the number of bytes in the buffer pointed to by @a bytes. | 2077 | * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes. |
2065 | * | 2078 | * |
2066 | * @return the newly allocated buffer state object. | 2079 | * @return the newly allocated buffer state object. |
2067 | */ | 2080 | */ |
diff --git a/scripts/kconfig/streamline_config.pl b/scripts/kconfig/streamline_config.pl index 95984db8e1e0..0d800820c3cd 100644 --- a/scripts/kconfig/streamline_config.pl +++ b/scripts/kconfig/streamline_config.pl | |||
@@ -43,7 +43,6 @@ | |||
43 | # make oldconfig | 43 | # make oldconfig |
44 | # | 44 | # |
45 | my $config = ".config"; | 45 | my $config = ".config"; |
46 | my $linuxpath = "."; | ||
47 | 46 | ||
48 | my $uname = `uname -r`; | 47 | my $uname = `uname -r`; |
49 | chomp $uname; | 48 | chomp $uname; |
@@ -111,7 +110,11 @@ sub find_config { | |||
111 | 110 | ||
112 | find_config; | 111 | find_config; |
113 | 112 | ||
114 | my @makefiles = `find $linuxpath -name Makefile`; | 113 | # Get the build source and top level Kconfig file (passed in) |
114 | my $ksource = $ARGV[0]; | ||
115 | my $kconfig = $ARGV[1]; | ||
116 | |||
117 | my @makefiles = `find $ksource -name Makefile`; | ||
115 | my %depends; | 118 | my %depends; |
116 | my %selects; | 119 | my %selects; |
117 | my %prompts; | 120 | my %prompts; |
@@ -119,9 +122,6 @@ my %objects; | |||
119 | my $var; | 122 | my $var; |
120 | my $cont = 0; | 123 | my $cont = 0; |
121 | 124 | ||
122 | # Get the top level Kconfig file (passed in) | ||
123 | my $kconfig = $ARGV[0]; | ||
124 | |||
125 | # prevent recursion | 125 | # prevent recursion |
126 | my %read_kconfigs; | 126 | my %read_kconfigs; |
127 | 127 | ||
@@ -132,7 +132,7 @@ sub read_kconfig { | |||
132 | my $config; | 132 | my $config; |
133 | my @kconfigs; | 133 | my @kconfigs; |
134 | 134 | ||
135 | open(KIN, $kconfig) || die "Can't open $kconfig"; | 135 | open(KIN, "$ksource/$kconfig") || die "Can't open $kconfig"; |
136 | while (<KIN>) { | 136 | while (<KIN>) { |
137 | chomp; | 137 | chomp; |
138 | 138 | ||
diff --git a/scripts/kconfig/zconf.gperf b/scripts/kconfig/zconf.gperf index 25ef5d01c0af..d8bc74249622 100644 --- a/scripts/kconfig/zconf.gperf +++ b/scripts/kconfig/zconf.gperf | |||
@@ -9,6 +9,8 @@ | |||
9 | 9 | ||
10 | struct kconf_id; | 10 | struct kconf_id; |
11 | 11 | ||
12 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | ||
13 | |||
12 | %% | 14 | %% |
13 | mainmenu, T_MAINMENU, TF_COMMAND | 15 | mainmenu, T_MAINMENU, TF_COMMAND |
14 | menu, T_MENU, TF_COMMAND | 16 | menu, T_MENU, TF_COMMAND |
diff --git a/scripts/kconfig/zconf.hash.c_shipped b/scripts/kconfig/zconf.hash.c_shipped index 5c73d51339d8..c1748faf4634 100644 --- a/scripts/kconfig/zconf.hash.c_shipped +++ b/scripts/kconfig/zconf.hash.c_shipped | |||
@@ -30,6 +30,8 @@ | |||
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | struct kconf_id; | 32 | struct kconf_id; |
33 | |||
34 | static struct kconf_id *kconf_id_lookup(register const char *str, register unsigned int len); | ||
33 | /* maximum key range = 47, duplicates = 0 */ | 35 | /* maximum key range = 47, duplicates = 0 */ |
34 | 36 | ||
35 | #ifdef __GNUC__ | 37 | #ifdef __GNUC__ |
diff --git a/scripts/kconfig/zconf.l b/scripts/kconfig/zconf.l index 21ff69c9ad4e..d8f7236cb0a3 100644 --- a/scripts/kconfig/zconf.l +++ b/scripts/kconfig/zconf.l | |||
@@ -39,7 +39,7 @@ static int last_ts, first_ts; | |||
39 | static void zconf_endhelp(void); | 39 | static void zconf_endhelp(void); |
40 | static void zconf_endfile(void); | 40 | static void zconf_endfile(void); |
41 | 41 | ||
42 | void new_string(void) | 42 | static void new_string(void) |
43 | { | 43 | { |
44 | text = malloc(START_STRSIZE); | 44 | text = malloc(START_STRSIZE); |
45 | text_asize = START_STRSIZE; | 45 | text_asize = START_STRSIZE; |
@@ -47,7 +47,7 @@ void new_string(void) | |||
47 | *text = 0; | 47 | *text = 0; |
48 | } | 48 | } |
49 | 49 | ||
50 | void append_string(const char *str, int size) | 50 | static void append_string(const char *str, int size) |
51 | { | 51 | { |
52 | int new_size = text_size + size + 1; | 52 | int new_size = text_size + size + 1; |
53 | if (new_size > text_asize) { | 53 | if (new_size > text_asize) { |
@@ -61,7 +61,7 @@ void append_string(const char *str, int size) | |||
61 | text[text_size] = 0; | 61 | text[text_size] = 0; |
62 | } | 62 | } |
63 | 63 | ||
64 | void alloc_string(const char *str, int size) | 64 | static void alloc_string(const char *str, int size) |
65 | { | 65 | { |
66 | text = malloc(size + 1); | 66 | text = malloc(size + 1); |
67 | memcpy(text, str, size); | 67 | memcpy(text, str, size); |
diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index 95df833b5a9d..6e9dcd59aa87 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped | |||
@@ -1,24 +1,23 @@ | |||
1 | /* A Bison parser, made by GNU Bison 2.3. */ | ||
2 | 1 | ||
3 | /* Skeleton implementation for Bison's Yacc-like parsers in C | 2 | /* A Bison parser, made by GNU Bison 2.4.1. */ |
4 | 3 | ||
5 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | 4 | /* Skeleton implementation for Bison's Yacc-like parsers in C |
5 | |||
6 | Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006 | ||
6 | Free Software Foundation, Inc. | 7 | Free Software Foundation, Inc. |
7 | 8 | ||
8 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software: you can redistribute it and/or modify |
9 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
10 | the Free Software Foundation; either version 2, or (at your option) | 11 | the Free Software Foundation, either version 3 of the License, or |
11 | any later version. | 12 | (at your option) any later version. |
12 | 13 | ||
13 | This program is distributed in the hope that it will be useful, | 14 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 16 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. | 17 | GNU General Public License for more details. |
17 | 18 | ||
18 | You should have received a copy of the GNU General Public License | 19 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software | 20 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ |
20 | Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
21 | Boston, MA 02110-1301, USA. */ | ||
22 | 21 | ||
23 | /* As a special exception, you may create a larger work that contains | 22 | /* As a special exception, you may create a larger work that contains |
24 | part or all of the Bison parser skeleton and distribute that work | 23 | part or all of the Bison parser skeleton and distribute that work |
@@ -29,7 +28,7 @@ | |||
29 | special exception, which will cause the skeleton and the resulting | 28 | special exception, which will cause the skeleton and the resulting |
30 | Bison output files to be licensed under the GNU General Public | 29 | Bison output files to be licensed under the GNU General Public |
31 | License without this special exception. | 30 | License without this special exception. |
32 | 31 | ||
33 | This special exception was added by the Free Software Foundation in | 32 | This special exception was added by the Free Software Foundation in |
34 | version 2.2 of Bison. */ | 33 | version 2.2 of Bison. */ |
35 | 34 | ||
@@ -47,7 +46,7 @@ | |||
47 | #define YYBISON 1 | 46 | #define YYBISON 1 |
48 | 47 | ||
49 | /* Bison version. */ | 48 | /* Bison version. */ |
50 | #define YYBISON_VERSION "2.3" | 49 | #define YYBISON_VERSION "2.4.1" |
51 | 50 | ||
52 | /* Skeleton name. */ | 51 | /* Skeleton name. */ |
53 | #define YYSKELETON_NAME "yacc.c" | 52 | #define YYSKELETON_NAME "yacc.c" |
@@ -55,94 +54,23 @@ | |||
55 | /* Pure parsers. */ | 54 | /* Pure parsers. */ |
56 | #define YYPURE 0 | 55 | #define YYPURE 0 |
57 | 56 | ||
57 | /* Push parsers. */ | ||
58 | #define YYPUSH 0 | ||
59 | |||
60 | /* Pull parsers. */ | ||
61 | #define YYPULL 1 | ||
62 | |||
58 | /* Using locations. */ | 63 | /* Using locations. */ |
59 | #define YYLSP_NEEDED 0 | 64 | #define YYLSP_NEEDED 0 |
60 | 65 | ||
61 | /* Substitute the variable and function names. */ | 66 | /* Substitute the variable and function names. */ |
62 | #define yyparse zconfparse | 67 | #define yyparse zconfparse |
63 | #define yylex zconflex | 68 | #define yylex zconflex |
64 | #define yyerror zconferror | 69 | #define yyerror zconferror |
65 | #define yylval zconflval | 70 | #define yylval zconflval |
66 | #define yychar zconfchar | 71 | #define yychar zconfchar |
67 | #define yydebug zconfdebug | 72 | #define yydebug zconfdebug |
68 | #define yynerrs zconfnerrs | 73 | #define yynerrs zconfnerrs |
69 | |||
70 | |||
71 | /* Tokens. */ | ||
72 | #ifndef YYTOKENTYPE | ||
73 | # define YYTOKENTYPE | ||
74 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
75 | know about them. */ | ||
76 | enum yytokentype { | ||
77 | T_MAINMENU = 258, | ||
78 | T_MENU = 259, | ||
79 | T_ENDMENU = 260, | ||
80 | T_SOURCE = 261, | ||
81 | T_CHOICE = 262, | ||
82 | T_ENDCHOICE = 263, | ||
83 | T_COMMENT = 264, | ||
84 | T_CONFIG = 265, | ||
85 | T_MENUCONFIG = 266, | ||
86 | T_HELP = 267, | ||
87 | T_HELPTEXT = 268, | ||
88 | T_IF = 269, | ||
89 | T_ENDIF = 270, | ||
90 | T_DEPENDS = 271, | ||
91 | T_OPTIONAL = 272, | ||
92 | T_PROMPT = 273, | ||
93 | T_TYPE = 274, | ||
94 | T_DEFAULT = 275, | ||
95 | T_SELECT = 276, | ||
96 | T_RANGE = 277, | ||
97 | T_OPTION = 278, | ||
98 | T_ON = 279, | ||
99 | T_WORD = 280, | ||
100 | T_WORD_QUOTE = 281, | ||
101 | T_UNEQUAL = 282, | ||
102 | T_CLOSE_PAREN = 283, | ||
103 | T_OPEN_PAREN = 284, | ||
104 | T_EOL = 285, | ||
105 | T_OR = 286, | ||
106 | T_AND = 287, | ||
107 | T_EQUAL = 288, | ||
108 | T_NOT = 289 | ||
109 | }; | ||
110 | #endif | ||
111 | /* Tokens. */ | ||
112 | #define T_MAINMENU 258 | ||
113 | #define T_MENU 259 | ||
114 | #define T_ENDMENU 260 | ||
115 | #define T_SOURCE 261 | ||
116 | #define T_CHOICE 262 | ||
117 | #define T_ENDCHOICE 263 | ||
118 | #define T_COMMENT 264 | ||
119 | #define T_CONFIG 265 | ||
120 | #define T_MENUCONFIG 266 | ||
121 | #define T_HELP 267 | ||
122 | #define T_HELPTEXT 268 | ||
123 | #define T_IF 269 | ||
124 | #define T_ENDIF 270 | ||
125 | #define T_DEPENDS 271 | ||
126 | #define T_OPTIONAL 272 | ||
127 | #define T_PROMPT 273 | ||
128 | #define T_TYPE 274 | ||
129 | #define T_DEFAULT 275 | ||
130 | #define T_SELECT 276 | ||
131 | #define T_RANGE 277 | ||
132 | #define T_OPTION 278 | ||
133 | #define T_ON 279 | ||
134 | #define T_WORD 280 | ||
135 | #define T_WORD_QUOTE 281 | ||
136 | #define T_UNEQUAL 282 | ||
137 | #define T_CLOSE_PAREN 283 | ||
138 | #define T_OPEN_PAREN 284 | ||
139 | #define T_EOL 285 | ||
140 | #define T_OR 286 | ||
141 | #define T_AND 287 | ||
142 | #define T_EQUAL 288 | ||
143 | #define T_NOT 289 | ||
144 | |||
145 | |||
146 | 74 | ||
147 | 75 | ||
148 | /* Copy the first part of user declarations. */ | 76 | /* Copy the first part of user declarations. */ |
@@ -163,8 +91,6 @@ | |||
163 | #define LKC_DIRECT_LINK | 91 | #define LKC_DIRECT_LINK |
164 | #include "lkc.h" | 92 | #include "lkc.h" |
165 | 93 | ||
166 | #include "zconf.hash.c" | ||
167 | |||
168 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 94 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
169 | 95 | ||
170 | #define PRINTD 0x0001 | 96 | #define PRINTD 0x0001 |
@@ -188,6 +114,7 @@ static struct menu *current_menu, *current_entry; | |||
188 | #endif | 114 | #endif |
189 | 115 | ||
190 | 116 | ||
117 | |||
191 | /* Enabling traces. */ | 118 | /* Enabling traces. */ |
192 | #ifndef YYDEBUG | 119 | #ifndef YYDEBUG |
193 | # define YYDEBUG 0 | 120 | # define YYDEBUG 0 |
@@ -206,31 +133,77 @@ static struct menu *current_menu, *current_entry; | |||
206 | # define YYTOKEN_TABLE 0 | 133 | # define YYTOKEN_TABLE 0 |
207 | #endif | 134 | #endif |
208 | 135 | ||
136 | |||
137 | /* Tokens. */ | ||
138 | #ifndef YYTOKENTYPE | ||
139 | # define YYTOKENTYPE | ||
140 | /* Put the tokens into the symbol table, so that GDB and other debuggers | ||
141 | know about them. */ | ||
142 | enum yytokentype { | ||
143 | T_MAINMENU = 258, | ||
144 | T_MENU = 259, | ||
145 | T_ENDMENU = 260, | ||
146 | T_SOURCE = 261, | ||
147 | T_CHOICE = 262, | ||
148 | T_ENDCHOICE = 263, | ||
149 | T_COMMENT = 264, | ||
150 | T_CONFIG = 265, | ||
151 | T_MENUCONFIG = 266, | ||
152 | T_HELP = 267, | ||
153 | T_HELPTEXT = 268, | ||
154 | T_IF = 269, | ||
155 | T_ENDIF = 270, | ||
156 | T_DEPENDS = 271, | ||
157 | T_OPTIONAL = 272, | ||
158 | T_PROMPT = 273, | ||
159 | T_TYPE = 274, | ||
160 | T_DEFAULT = 275, | ||
161 | T_SELECT = 276, | ||
162 | T_RANGE = 277, | ||
163 | T_OPTION = 278, | ||
164 | T_ON = 279, | ||
165 | T_WORD = 280, | ||
166 | T_WORD_QUOTE = 281, | ||
167 | T_UNEQUAL = 282, | ||
168 | T_CLOSE_PAREN = 283, | ||
169 | T_OPEN_PAREN = 284, | ||
170 | T_EOL = 285, | ||
171 | T_OR = 286, | ||
172 | T_AND = 287, | ||
173 | T_EQUAL = 288, | ||
174 | T_NOT = 289 | ||
175 | }; | ||
176 | #endif | ||
177 | |||
178 | |||
179 | |||
209 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED | 180 | #if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED |
210 | typedef union YYSTYPE | 181 | typedef union YYSTYPE |
211 | |||
212 | { | 182 | { |
183 | |||
184 | |||
213 | char *string; | 185 | char *string; |
214 | struct file *file; | 186 | struct file *file; |
215 | struct symbol *symbol; | 187 | struct symbol *symbol; |
216 | struct expr *expr; | 188 | struct expr *expr; |
217 | struct menu *menu; | 189 | struct menu *menu; |
218 | struct kconf_id *id; | 190 | struct kconf_id *id; |
219 | } | ||
220 | /* Line 187 of yacc.c. */ | ||
221 | 191 | ||
222 | YYSTYPE; | 192 | |
193 | |||
194 | } YYSTYPE; | ||
195 | # define YYSTYPE_IS_TRIVIAL 1 | ||
223 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ | 196 | # define yystype YYSTYPE /* obsolescent; will be withdrawn */ |
224 | # define YYSTYPE_IS_DECLARED 1 | 197 | # define YYSTYPE_IS_DECLARED 1 |
225 | # define YYSTYPE_IS_TRIVIAL 1 | ||
226 | #endif | 198 | #endif |
227 | 199 | ||
228 | 200 | ||
229 | |||
230 | /* Copy the second part of user declarations. */ | 201 | /* Copy the second part of user declarations. */ |
231 | 202 | ||
232 | 203 | ||
233 | /* Line 216 of yacc.c. */ | 204 | /* Include zconf.hash.c here so it can see the token constants. */ |
205 | #include "zconf.hash.c" | ||
206 | |||
234 | 207 | ||
235 | 208 | ||
236 | #ifdef short | 209 | #ifdef short |
@@ -306,14 +279,14 @@ typedef short int yytype_int16; | |||
306 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 279 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
307 | || defined __cplusplus || defined _MSC_VER) | 280 | || defined __cplusplus || defined _MSC_VER) |
308 | static int | 281 | static int |
309 | YYID (int i) | 282 | YYID (int yyi) |
310 | #else | 283 | #else |
311 | static int | 284 | static int |
312 | YYID (i) | 285 | YYID (yyi) |
313 | int i; | 286 | int yyi; |
314 | #endif | 287 | #endif |
315 | { | 288 | { |
316 | return i; | 289 | return yyi; |
317 | } | 290 | } |
318 | #endif | 291 | #endif |
319 | 292 | ||
@@ -394,9 +367,9 @@ void free (void *); /* INFRINGES ON USER NAME SPACE */ | |||
394 | /* A type that is properly aligned for any stack member. */ | 367 | /* A type that is properly aligned for any stack member. */ |
395 | union yyalloc | 368 | union yyalloc |
396 | { | 369 | { |
397 | yytype_int16 yyss; | 370 | yytype_int16 yyss_alloc; |
398 | YYSTYPE yyvs; | 371 | YYSTYPE yyvs_alloc; |
399 | }; | 372 | }; |
400 | 373 | ||
401 | /* The size of the maximum gap between one aligned stack and the next. */ | 374 | /* The size of the maximum gap between one aligned stack and the next. */ |
402 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) | 375 | # define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1) |
@@ -430,12 +403,12 @@ union yyalloc | |||
430 | elements in the stack, and YYPTR gives the new location of the | 403 | elements in the stack, and YYPTR gives the new location of the |
431 | stack. Advance YYPTR to a properly aligned location for the next | 404 | stack. Advance YYPTR to a properly aligned location for the next |
432 | stack. */ | 405 | stack. */ |
433 | # define YYSTACK_RELOCATE(Stack) \ | 406 | # define YYSTACK_RELOCATE(Stack_alloc, Stack) \ |
434 | do \ | 407 | do \ |
435 | { \ | 408 | { \ |
436 | YYSIZE_T yynewbytes; \ | 409 | YYSIZE_T yynewbytes; \ |
437 | YYCOPY (&yyptr->Stack, Stack, yysize); \ | 410 | YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \ |
438 | Stack = &yyptr->Stack; \ | 411 | Stack = &yyptr->Stack_alloc; \ |
439 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ | 412 | yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \ |
440 | yyptr += yynewbytes / sizeof (*yyptr); \ | 413 | yyptr += yynewbytes / sizeof (*yyptr); \ |
441 | } \ | 414 | } \ |
@@ -558,18 +531,18 @@ static const yytype_int8 yyrhs[] = | |||
558 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ | 531 | /* YYRLINE[YYN] -- source line where rule number YYN was defined. */ |
559 | static const yytype_uint16 yyrline[] = | 532 | static const yytype_uint16 yyrline[] = |
560 | { | 533 | { |
561 | 0, 104, 104, 106, 108, 109, 110, 111, 112, 113, | 534 | 0, 107, 107, 109, 111, 112, 113, 114, 115, 116, |
562 | 114, 118, 122, 122, 122, 122, 122, 122, 122, 126, | 535 | 117, 121, 125, 125, 125, 125, 125, 125, 125, 129, |
563 | 127, 128, 129, 130, 131, 135, 136, 142, 150, 156, | 536 | 130, 131, 132, 133, 134, 138, 139, 145, 153, 159, |
564 | 164, 174, 176, 177, 178, 179, 180, 181, 184, 192, | 537 | 167, 177, 179, 180, 181, 182, 183, 184, 187, 195, |
565 | 198, 208, 214, 220, 223, 225, 236, 237, 242, 251, | 538 | 201, 211, 217, 223, 226, 228, 239, 240, 245, 254, |
566 | 256, 264, 267, 269, 270, 271, 272, 273, 276, 282, | 539 | 259, 267, 270, 272, 273, 274, 275, 276, 279, 285, |
567 | 293, 299, 309, 311, 316, 324, 332, 335, 337, 338, | 540 | 296, 302, 312, 314, 319, 327, 335, 338, 340, 341, |
568 | 339, 344, 351, 356, 364, 367, 369, 370, 371, 374, | 541 | 342, 347, 354, 359, 367, 370, 372, 373, 374, 377, |
569 | 382, 389, 396, 402, 409, 411, 412, 413, 416, 424, | 542 | 385, 392, 399, 405, 412, 414, 415, 416, 419, 427, |
570 | 426, 431, 432, 435, 436, 437, 441, 442, 445, 446, | 543 | 429, 434, 435, 438, 439, 440, 444, 445, 448, 449, |
571 | 449, 450, 451, 452, 453, 454, 455, 458, 459, 462, | 544 | 452, 453, 454, 455, 456, 457, 458, 461, 462, 465, |
572 | 463 | 545 | 466 |
573 | }; | 546 | }; |
574 | #endif | 547 | #endif |
575 | 548 | ||
@@ -985,17 +958,20 @@ yy_symbol_print (yyoutput, yytype, yyvaluep) | |||
985 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 958 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
986 | || defined __cplusplus || defined _MSC_VER) | 959 | || defined __cplusplus || defined _MSC_VER) |
987 | static void | 960 | static void |
988 | yy_stack_print (yytype_int16 *bottom, yytype_int16 *top) | 961 | yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop) |
989 | #else | 962 | #else |
990 | static void | 963 | static void |
991 | yy_stack_print (bottom, top) | 964 | yy_stack_print (yybottom, yytop) |
992 | yytype_int16 *bottom; | 965 | yytype_int16 *yybottom; |
993 | yytype_int16 *top; | 966 | yytype_int16 *yytop; |
994 | #endif | 967 | #endif |
995 | { | 968 | { |
996 | YYFPRINTF (stderr, "Stack now"); | 969 | YYFPRINTF (stderr, "Stack now"); |
997 | for (; bottom <= top; ++bottom) | 970 | for (; yybottom <= yytop; yybottom++) |
998 | YYFPRINTF (stderr, " %d", *bottom); | 971 | { |
972 | int yybot = *yybottom; | ||
973 | YYFPRINTF (stderr, " %d", yybot); | ||
974 | } | ||
999 | YYFPRINTF (stderr, "\n"); | 975 | YYFPRINTF (stderr, "\n"); |
1000 | } | 976 | } |
1001 | 977 | ||
@@ -1029,11 +1005,11 @@ yy_reduce_print (yyvsp, yyrule) | |||
1029 | /* The symbols being reduced. */ | 1005 | /* The symbols being reduced. */ |
1030 | for (yyi = 0; yyi < yynrhs; yyi++) | 1006 | for (yyi = 0; yyi < yynrhs; yyi++) |
1031 | { | 1007 | { |
1032 | fprintf (stderr, " $%d = ", yyi + 1); | 1008 | YYFPRINTF (stderr, " $%d = ", yyi + 1); |
1033 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], | 1009 | yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi], |
1034 | &(yyvsp[(yyi + 1) - (yynrhs)]) | 1010 | &(yyvsp[(yyi + 1) - (yynrhs)]) |
1035 | ); | 1011 | ); |
1036 | fprintf (stderr, "\n"); | 1012 | YYFPRINTF (stderr, "\n"); |
1037 | } | 1013 | } |
1038 | } | 1014 | } |
1039 | 1015 | ||
@@ -1343,10 +1319,8 @@ yydestruct (yymsg, yytype, yyvaluep) | |||
1343 | break; | 1319 | break; |
1344 | } | 1320 | } |
1345 | } | 1321 | } |
1346 | |||
1347 | 1322 | ||
1348 | /* Prevent warnings from -Wmissing-prototypes. */ | 1323 | /* Prevent warnings from -Wmissing-prototypes. */ |
1349 | |||
1350 | #ifdef YYPARSE_PARAM | 1324 | #ifdef YYPARSE_PARAM |
1351 | #if defined __STDC__ || defined __cplusplus | 1325 | #if defined __STDC__ || defined __cplusplus |
1352 | int yyparse (void *YYPARSE_PARAM); | 1326 | int yyparse (void *YYPARSE_PARAM); |
@@ -1362,11 +1336,10 @@ int yyparse (); | |||
1362 | #endif /* ! YYPARSE_PARAM */ | 1336 | #endif /* ! YYPARSE_PARAM */ |
1363 | 1337 | ||
1364 | 1338 | ||
1365 | 1339 | /* The lookahead symbol. */ | |
1366 | /* The look-ahead symbol. */ | ||
1367 | int yychar; | 1340 | int yychar; |
1368 | 1341 | ||
1369 | /* The semantic value of the look-ahead symbol. */ | 1342 | /* The semantic value of the lookahead symbol. */ |
1370 | YYSTYPE yylval; | 1343 | YYSTYPE yylval; |
1371 | 1344 | ||
1372 | /* Number of syntax errors so far. */ | 1345 | /* Number of syntax errors so far. */ |
@@ -1374,9 +1347,9 @@ int yynerrs; | |||
1374 | 1347 | ||
1375 | 1348 | ||
1376 | 1349 | ||
1377 | /*----------. | 1350 | /*-------------------------. |
1378 | | yyparse. | | 1351 | | yyparse or yypush_parse. | |
1379 | `----------*/ | 1352 | `-------------------------*/ |
1380 | 1353 | ||
1381 | #ifdef YYPARSE_PARAM | 1354 | #ifdef YYPARSE_PARAM |
1382 | #if (defined __STDC__ || defined __C99__FUNC__ \ | 1355 | #if (defined __STDC__ || defined __C99__FUNC__ \ |
@@ -1400,66 +1373,68 @@ yyparse () | |||
1400 | #endif | 1373 | #endif |
1401 | #endif | 1374 | #endif |
1402 | { | 1375 | { |
1403 | |||
1404 | int yystate; | ||
1405 | int yyn; | ||
1406 | int yyresult; | ||
1407 | /* Number of tokens to shift before error messages enabled. */ | ||
1408 | int yyerrstatus; | ||
1409 | /* Look-ahead token as an internal (translated) token number. */ | ||
1410 | int yytoken = 0; | ||
1411 | #if YYERROR_VERBOSE | ||
1412 | /* Buffer for error messages, and its allocated size. */ | ||
1413 | char yymsgbuf[128]; | ||
1414 | char *yymsg = yymsgbuf; | ||
1415 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1416 | #endif | ||
1417 | |||
1418 | /* Three stacks and their tools: | ||
1419 | `yyss': related to states, | ||
1420 | `yyvs': related to semantic values, | ||
1421 | `yyls': related to locations. | ||
1422 | 1376 | ||
1423 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1424 | to reallocate them elsewhere. */ | ||
1425 | 1377 | ||
1426 | /* The state stack. */ | 1378 | int yystate; |
1427 | yytype_int16 yyssa[YYINITDEPTH]; | 1379 | /* Number of tokens to shift before error messages enabled. */ |
1428 | yytype_int16 *yyss = yyssa; | 1380 | int yyerrstatus; |
1429 | yytype_int16 *yyssp; | ||
1430 | 1381 | ||
1431 | /* The semantic value stack. */ | 1382 | /* The stacks and their tools: |
1432 | YYSTYPE yyvsa[YYINITDEPTH]; | 1383 | `yyss': related to states. |
1433 | YYSTYPE *yyvs = yyvsa; | 1384 | `yyvs': related to semantic values. |
1434 | YYSTYPE *yyvsp; | ||
1435 | 1385 | ||
1386 | Refer to the stacks thru separate pointers, to allow yyoverflow | ||
1387 | to reallocate them elsewhere. */ | ||
1436 | 1388 | ||
1389 | /* The state stack. */ | ||
1390 | yytype_int16 yyssa[YYINITDEPTH]; | ||
1391 | yytype_int16 *yyss; | ||
1392 | yytype_int16 *yyssp; | ||
1437 | 1393 | ||
1438 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | 1394 | /* The semantic value stack. */ |
1395 | YYSTYPE yyvsa[YYINITDEPTH]; | ||
1396 | YYSTYPE *yyvs; | ||
1397 | YYSTYPE *yyvsp; | ||
1439 | 1398 | ||
1440 | YYSIZE_T yystacksize = YYINITDEPTH; | 1399 | YYSIZE_T yystacksize; |
1441 | 1400 | ||
1401 | int yyn; | ||
1402 | int yyresult; | ||
1403 | /* Lookahead token as an internal (translated) token number. */ | ||
1404 | int yytoken; | ||
1442 | /* The variables used to return semantic value and location from the | 1405 | /* The variables used to return semantic value and location from the |
1443 | action routines. */ | 1406 | action routines. */ |
1444 | YYSTYPE yyval; | 1407 | YYSTYPE yyval; |
1445 | 1408 | ||
1409 | #if YYERROR_VERBOSE | ||
1410 | /* Buffer for error messages, and its allocated size. */ | ||
1411 | char yymsgbuf[128]; | ||
1412 | char *yymsg = yymsgbuf; | ||
1413 | YYSIZE_T yymsg_alloc = sizeof yymsgbuf; | ||
1414 | #endif | ||
1415 | |||
1416 | #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) | ||
1446 | 1417 | ||
1447 | /* The number of symbols on the RHS of the reduced rule. | 1418 | /* The number of symbols on the RHS of the reduced rule. |
1448 | Keep to zero when no symbol should be popped. */ | 1419 | Keep to zero when no symbol should be popped. */ |
1449 | int yylen = 0; | 1420 | int yylen = 0; |
1450 | 1421 | ||
1422 | yytoken = 0; | ||
1423 | yyss = yyssa; | ||
1424 | yyvs = yyvsa; | ||
1425 | yystacksize = YYINITDEPTH; | ||
1426 | |||
1451 | YYDPRINTF ((stderr, "Starting parse\n")); | 1427 | YYDPRINTF ((stderr, "Starting parse\n")); |
1452 | 1428 | ||
1453 | yystate = 0; | 1429 | yystate = 0; |
1454 | yyerrstatus = 0; | 1430 | yyerrstatus = 0; |
1455 | yynerrs = 0; | 1431 | yynerrs = 0; |
1456 | yychar = YYEMPTY; /* Cause a token to be read. */ | 1432 | yychar = YYEMPTY; /* Cause a token to be read. */ |
1457 | 1433 | ||
1458 | /* Initialize stack pointers. | 1434 | /* Initialize stack pointers. |
1459 | Waste one element of value and location stack | 1435 | Waste one element of value and location stack |
1460 | so that they stay on the same level as the state stack. | 1436 | so that they stay on the same level as the state stack. |
1461 | The wasted elements are never initialized. */ | 1437 | The wasted elements are never initialized. */ |
1462 | |||
1463 | yyssp = yyss; | 1438 | yyssp = yyss; |
1464 | yyvsp = yyvs; | 1439 | yyvsp = yyvs; |
1465 | 1440 | ||
@@ -1489,7 +1464,6 @@ yyparse () | |||
1489 | YYSTYPE *yyvs1 = yyvs; | 1464 | YYSTYPE *yyvs1 = yyvs; |
1490 | yytype_int16 *yyss1 = yyss; | 1465 | yytype_int16 *yyss1 = yyss; |
1491 | 1466 | ||
1492 | |||
1493 | /* Each stack pointer address is followed by the size of the | 1467 | /* Each stack pointer address is followed by the size of the |
1494 | data in use in that stack, in bytes. This used to be a | 1468 | data in use in that stack, in bytes. This used to be a |
1495 | conditional around just the two extra args, but that might | 1469 | conditional around just the two extra args, but that might |
@@ -1497,7 +1471,6 @@ yyparse () | |||
1497 | yyoverflow (YY_("memory exhausted"), | 1471 | yyoverflow (YY_("memory exhausted"), |
1498 | &yyss1, yysize * sizeof (*yyssp), | 1472 | &yyss1, yysize * sizeof (*yyssp), |
1499 | &yyvs1, yysize * sizeof (*yyvsp), | 1473 | &yyvs1, yysize * sizeof (*yyvsp), |
1500 | |||
1501 | &yystacksize); | 1474 | &yystacksize); |
1502 | 1475 | ||
1503 | yyss = yyss1; | 1476 | yyss = yyss1; |
@@ -1520,9 +1493,8 @@ yyparse () | |||
1520 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); | 1493 | (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); |
1521 | if (! yyptr) | 1494 | if (! yyptr) |
1522 | goto yyexhaustedlab; | 1495 | goto yyexhaustedlab; |
1523 | YYSTACK_RELOCATE (yyss); | 1496 | YYSTACK_RELOCATE (yyss_alloc, yyss); |
1524 | YYSTACK_RELOCATE (yyvs); | 1497 | YYSTACK_RELOCATE (yyvs_alloc, yyvs); |
1525 | |||
1526 | # undef YYSTACK_RELOCATE | 1498 | # undef YYSTACK_RELOCATE |
1527 | if (yyss1 != yyssa) | 1499 | if (yyss1 != yyssa) |
1528 | YYSTACK_FREE (yyss1); | 1500 | YYSTACK_FREE (yyss1); |
@@ -1533,7 +1505,6 @@ yyparse () | |||
1533 | yyssp = yyss + yysize - 1; | 1505 | yyssp = yyss + yysize - 1; |
1534 | yyvsp = yyvs + yysize - 1; | 1506 | yyvsp = yyvs + yysize - 1; |
1535 | 1507 | ||
1536 | |||
1537 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", | 1508 | YYDPRINTF ((stderr, "Stack size increased to %lu\n", |
1538 | (unsigned long int) yystacksize)); | 1509 | (unsigned long int) yystacksize)); |
1539 | 1510 | ||
@@ -1543,6 +1514,9 @@ yyparse () | |||
1543 | 1514 | ||
1544 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); | 1515 | YYDPRINTF ((stderr, "Entering state %d\n", yystate)); |
1545 | 1516 | ||
1517 | if (yystate == YYFINAL) | ||
1518 | YYACCEPT; | ||
1519 | |||
1546 | goto yybackup; | 1520 | goto yybackup; |
1547 | 1521 | ||
1548 | /*-----------. | 1522 | /*-----------. |
@@ -1551,16 +1525,16 @@ yyparse () | |||
1551 | yybackup: | 1525 | yybackup: |
1552 | 1526 | ||
1553 | /* Do appropriate processing given the current state. Read a | 1527 | /* Do appropriate processing given the current state. Read a |
1554 | look-ahead token if we need one and don't already have one. */ | 1528 | lookahead token if we need one and don't already have one. */ |
1555 | 1529 | ||
1556 | /* First try to decide what to do without reference to look-ahead token. */ | 1530 | /* First try to decide what to do without reference to lookahead token. */ |
1557 | yyn = yypact[yystate]; | 1531 | yyn = yypact[yystate]; |
1558 | if (yyn == YYPACT_NINF) | 1532 | if (yyn == YYPACT_NINF) |
1559 | goto yydefault; | 1533 | goto yydefault; |
1560 | 1534 | ||
1561 | /* Not known => get a look-ahead token if don't already have one. */ | 1535 | /* Not known => get a lookahead token if don't already have one. */ |
1562 | 1536 | ||
1563 | /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol. */ | 1537 | /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ |
1564 | if (yychar == YYEMPTY) | 1538 | if (yychar == YYEMPTY) |
1565 | { | 1539 | { |
1566 | YYDPRINTF ((stderr, "Reading a token: ")); | 1540 | YYDPRINTF ((stderr, "Reading a token: ")); |
@@ -1592,20 +1566,16 @@ yybackup: | |||
1592 | goto yyreduce; | 1566 | goto yyreduce; |
1593 | } | 1567 | } |
1594 | 1568 | ||
1595 | if (yyn == YYFINAL) | ||
1596 | YYACCEPT; | ||
1597 | |||
1598 | /* Count tokens shifted since error; after three, turn off error | 1569 | /* Count tokens shifted since error; after three, turn off error |
1599 | status. */ | 1570 | status. */ |
1600 | if (yyerrstatus) | 1571 | if (yyerrstatus) |
1601 | yyerrstatus--; | 1572 | yyerrstatus--; |
1602 | 1573 | ||
1603 | /* Shift the look-ahead token. */ | 1574 | /* Shift the lookahead token. */ |
1604 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); | 1575 | YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc); |
1605 | 1576 | ||
1606 | /* Discard the shifted token unless it is eof. */ | 1577 | /* Discard the shifted token. */ |
1607 | if (yychar != YYEOF) | 1578 | yychar = YYEMPTY; |
1608 | yychar = YYEMPTY; | ||
1609 | 1579 | ||
1610 | yystate = yyn; | 1580 | yystate = yyn; |
1611 | *++yyvsp = yylval; | 1581 | *++yyvsp = yylval; |
@@ -2029,7 +1999,6 @@ yyreduce: | |||
2029 | break; | 1999 | break; |
2030 | 2000 | ||
2031 | 2001 | ||
2032 | /* Line 1267 of yacc.c. */ | ||
2033 | 2002 | ||
2034 | default: break; | 2003 | default: break; |
2035 | } | 2004 | } |
@@ -2041,7 +2010,6 @@ yyreduce: | |||
2041 | 2010 | ||
2042 | *++yyvsp = yyval; | 2011 | *++yyvsp = yyval; |
2043 | 2012 | ||
2044 | |||
2045 | /* Now `shift' the result of the reduction. Determine what state | 2013 | /* Now `shift' the result of the reduction. Determine what state |
2046 | that goes to, based on the state we popped back to and the rule | 2014 | that goes to, based on the state we popped back to and the rule |
2047 | number reduced by. */ | 2015 | number reduced by. */ |
@@ -2106,7 +2074,7 @@ yyerrlab: | |||
2106 | 2074 | ||
2107 | if (yyerrstatus == 3) | 2075 | if (yyerrstatus == 3) |
2108 | { | 2076 | { |
2109 | /* If just tried and failed to reuse look-ahead token after an | 2077 | /* If just tried and failed to reuse lookahead token after an |
2110 | error, discard it. */ | 2078 | error, discard it. */ |
2111 | 2079 | ||
2112 | if (yychar <= YYEOF) | 2080 | if (yychar <= YYEOF) |
@@ -2123,7 +2091,7 @@ yyerrlab: | |||
2123 | } | 2091 | } |
2124 | } | 2092 | } |
2125 | 2093 | ||
2126 | /* Else will try to reuse look-ahead token after shifting the error | 2094 | /* Else will try to reuse lookahead token after shifting the error |
2127 | token. */ | 2095 | token. */ |
2128 | goto yyerrlab1; | 2096 | goto yyerrlab1; |
2129 | 2097 | ||
@@ -2180,9 +2148,6 @@ yyerrlab1: | |||
2180 | YY_STACK_PRINT (yyss, yyssp); | 2148 | YY_STACK_PRINT (yyss, yyssp); |
2181 | } | 2149 | } |
2182 | 2150 | ||
2183 | if (yyn == YYFINAL) | ||
2184 | YYACCEPT; | ||
2185 | |||
2186 | *++yyvsp = yylval; | 2151 | *++yyvsp = yylval; |
2187 | 2152 | ||
2188 | 2153 | ||
@@ -2207,7 +2172,7 @@ yyabortlab: | |||
2207 | yyresult = 1; | 2172 | yyresult = 1; |
2208 | goto yyreturn; | 2173 | goto yyreturn; |
2209 | 2174 | ||
2210 | #ifndef yyoverflow | 2175 | #if !defined(yyoverflow) || YYERROR_VERBOSE |
2211 | /*-------------------------------------------------. | 2176 | /*-------------------------------------------------. |
2212 | | yyexhaustedlab -- memory exhaustion comes here. | | 2177 | | yyexhaustedlab -- memory exhaustion comes here. | |
2213 | `-------------------------------------------------*/ | 2178 | `-------------------------------------------------*/ |
@@ -2218,7 +2183,7 @@ yyexhaustedlab: | |||
2218 | #endif | 2183 | #endif |
2219 | 2184 | ||
2220 | yyreturn: | 2185 | yyreturn: |
2221 | if (yychar != YYEOF && yychar != YYEMPTY) | 2186 | if (yychar != YYEMPTY) |
2222 | yydestruct ("Cleanup: discarding lookahead", | 2187 | yydestruct ("Cleanup: discarding lookahead", |
2223 | yytoken, &yylval); | 2188 | yytoken, &yylval); |
2224 | /* Do not reclaim the symbols of the rule which action triggered | 2189 | /* Do not reclaim the symbols of the rule which action triggered |
@@ -2284,7 +2249,7 @@ void conf_parse(const char *name) | |||
2284 | sym_set_change_count(1); | 2249 | sym_set_change_count(1); |
2285 | } | 2250 | } |
2286 | 2251 | ||
2287 | const char *zconf_tokenname(int token) | 2252 | static const char *zconf_tokenname(int token) |
2288 | { | 2253 | { |
2289 | switch (token) { | 2254 | switch (token) { |
2290 | case T_MENU: return "menu"; | 2255 | case T_MENU: return "menu"; |
@@ -2348,7 +2313,7 @@ static void zconferror(const char *err) | |||
2348 | #endif | 2313 | #endif |
2349 | } | 2314 | } |
2350 | 2315 | ||
2351 | void print_quoted_string(FILE *out, const char *str) | 2316 | static void print_quoted_string(FILE *out, const char *str) |
2352 | { | 2317 | { |
2353 | const char *p; | 2318 | const char *p; |
2354 | int len; | 2319 | int len; |
@@ -2365,7 +2330,7 @@ void print_quoted_string(FILE *out, const char *str) | |||
2365 | putc('"', out); | 2330 | putc('"', out); |
2366 | } | 2331 | } |
2367 | 2332 | ||
2368 | void print_symbol(FILE *out, struct menu *menu) | 2333 | static void print_symbol(FILE *out, struct menu *menu) |
2369 | { | 2334 | { |
2370 | struct symbol *sym = menu->sym; | 2335 | struct symbol *sym = menu->sym; |
2371 | struct property *prop; | 2336 | struct property *prop; |
diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 9710b82466f2..8c43491f8cc9 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y | |||
@@ -14,8 +14,6 @@ | |||
14 | #define LKC_DIRECT_LINK | 14 | #define LKC_DIRECT_LINK |
15 | #include "lkc.h" | 15 | #include "lkc.h" |
16 | 16 | ||
17 | #include "zconf.hash.c" | ||
18 | |||
19 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) | 17 | #define printd(mask, fmt...) if (cdebug & (mask)) printf(fmt) |
20 | 18 | ||
21 | #define PRINTD 0x0001 | 19 | #define PRINTD 0x0001 |
@@ -100,6 +98,11 @@ static struct menu *current_menu, *current_entry; | |||
100 | menu_end_menu(); | 98 | menu_end_menu(); |
101 | } if_entry menu_entry choice_entry | 99 | } if_entry menu_entry choice_entry |
102 | 100 | ||
101 | %{ | ||
102 | /* Include zconf.hash.c here so it can see the token constants. */ | ||
103 | #include "zconf.hash.c" | ||
104 | %} | ||
105 | |||
103 | %% | 106 | %% |
104 | input: stmt_list; | 107 | input: stmt_list; |
105 | 108 | ||
@@ -501,7 +504,7 @@ void conf_parse(const char *name) | |||
501 | sym_set_change_count(1); | 504 | sym_set_change_count(1); |
502 | } | 505 | } |
503 | 506 | ||
504 | const char *zconf_tokenname(int token) | 507 | static const char *zconf_tokenname(int token) |
505 | { | 508 | { |
506 | switch (token) { | 509 | switch (token) { |
507 | case T_MENU: return "menu"; | 510 | case T_MENU: return "menu"; |
@@ -565,7 +568,7 @@ static void zconferror(const char *err) | |||
565 | #endif | 568 | #endif |
566 | } | 569 | } |
567 | 570 | ||
568 | void print_quoted_string(FILE *out, const char *str) | 571 | static void print_quoted_string(FILE *out, const char *str) |
569 | { | 572 | { |
570 | const char *p; | 573 | const char *p; |
571 | int len; | 574 | int len; |
@@ -582,7 +585,7 @@ void print_quoted_string(FILE *out, const char *str) | |||
582 | putc('"', out); | 585 | putc('"', out); |
583 | } | 586 | } |
584 | 587 | ||
585 | void print_symbol(FILE *out, struct menu *menu) | 588 | static void print_symbol(FILE *out, struct menu *menu) |
586 | { | 589 | { |
587 | struct symbol *sym = menu->sym; | 590 | struct symbol *sym = menu->sym; |
588 | struct property *prop; | 591 | struct property *prop; |
diff --git a/scripts/recordmcount.pl b/scripts/recordmcount.pl index bfb8b2cdd92a..f0d14452632b 100755 --- a/scripts/recordmcount.pl +++ b/scripts/recordmcount.pl | |||
@@ -6,77 +6,93 @@ | |||
6 | # all the offsets to the calls to mcount. | 6 | # all the offsets to the calls to mcount. |
7 | # | 7 | # |
8 | # | 8 | # |
9 | # What we want to end up with is a section in vmlinux called | 9 | # What we want to end up with this is that each object file will have a |
10 | # __mcount_loc that contains a list of pointers to all the | 10 | # section called __mcount_loc that will hold the list of pointers to mcount |
11 | # call sites in the kernel that call mcount. Later on boot up, the kernel | 11 | # callers. After final linking, the vmlinux will have within .init.data the |
12 | # will read this list, save the locations and turn them into nops. | 12 | # list of all callers to mcount between __start_mcount_loc and __stop_mcount_loc. |
13 | # When tracing or profiling is later enabled, these locations will then | 13 | # Later on boot up, the kernel will read this list, save the locations and turn |
14 | # be converted back to pointers to some function. | 14 | # them into nops. When tracing or profiling is later enabled, these locations |
15 | # will then be converted back to pointers to some function. | ||
15 | # | 16 | # |
16 | # This is no easy feat. This script is called just after the original | 17 | # This is no easy feat. This script is called just after the original |
17 | # object is compiled and before it is linked. | 18 | # object is compiled and before it is linked. |
18 | # | 19 | # |
19 | # The references to the call sites are offsets from the section of text | 20 | # When parse this object file using 'objdump', the references to the call |
20 | # that the call site is in. Hence, all functions in a section that | 21 | # sites are offsets from the section that the call site is in. Hence, all |
21 | # has a call site to mcount, will have the offset from the beginning of | 22 | # functions in a section that has a call site to mcount, will have the |
22 | # the section and not the beginning of the function. | 23 | # offset from the beginning of the section and not the beginning of the |
24 | # function. | ||
25 | # | ||
26 | # But where this section will reside finally in vmlinx is undetermined at | ||
27 | # this point. So we can't use this kind of offsets to record the final | ||
28 | # address of this call site. | ||
29 | # | ||
30 | # The trick is to change the call offset referring the start of a section to | ||
31 | # referring a function symbol in this section. During the link step, 'ld' will | ||
32 | # compute the final address according to the information we record. | ||
23 | # | 33 | # |
24 | # The trick is to find a way to record the beginning of the section. | ||
25 | # The way we do this is to look at the first function in the section | ||
26 | # which will also be the location of that section after final link. | ||
27 | # e.g. | 34 | # e.g. |
28 | # | 35 | # |
29 | # .section ".sched.text", "ax" | 36 | # .section ".sched.text", "ax" |
30 | # .globl my_func | ||
31 | # my_func: | ||
32 | # [...] | 37 | # [...] |
33 | # call mcount (offset: 0x5) | 38 | # func1: |
39 | # [...] | ||
40 | # call mcount (offset: 0x10) | ||
34 | # [...] | 41 | # [...] |
35 | # ret | 42 | # ret |
36 | # other_func: | 43 | # .globl fun2 |
44 | # func2: (offset: 0x20) | ||
37 | # [...] | 45 | # [...] |
38 | # call mcount (offset: 0x1b) | 46 | # [...] |
47 | # ret | ||
48 | # func3: | ||
49 | # [...] | ||
50 | # call mcount (offset: 0x30) | ||
39 | # [...] | 51 | # [...] |
40 | # | 52 | # |
41 | # Both relocation offsets for the mcounts in the above example will be | 53 | # Both relocation offsets for the mcounts in the above example will be |
42 | # offset from .sched.text. If we make another file called tmp.s with: | 54 | # offset from .sched.text. If we choose global symbol func2 as a reference and |
55 | # make another file called tmp.s with the new offsets: | ||
43 | # | 56 | # |
44 | # .section __mcount_loc | 57 | # .section __mcount_loc |
45 | # .quad my_func + 0x5 | 58 | # .quad func2 - 0x10 |
46 | # .quad my_func + 0x1b | 59 | # .quad func2 + 0x10 |
47 | # | 60 | # |
48 | # We can then compile this tmp.s into tmp.o, and link it to the original | 61 | # We can then compile this tmp.s into tmp.o, and link it back to the original |
49 | # object. | 62 | # object. |
50 | # | 63 | # |
51 | # But this gets hard if my_func is not globl (a static function). | 64 | # In our algorithm, we will choose the first global function we meet in this |
52 | # In such a case we have: | 65 | # section as the reference. But this gets hard if there is no global functions |
66 | # in this section. In such a case we have to select a local one. E.g. func1: | ||
53 | # | 67 | # |
54 | # .section ".sched.text", "ax" | 68 | # .section ".sched.text", "ax" |
55 | # my_func: | 69 | # func1: |
56 | # [...] | 70 | # [...] |
57 | # call mcount (offset: 0x5) | 71 | # call mcount (offset: 0x10) |
58 | # [...] | 72 | # [...] |
59 | # ret | 73 | # ret |
60 | # other_func: | 74 | # func2: |
61 | # [...] | 75 | # [...] |
62 | # call mcount (offset: 0x1b) | 76 | # call mcount (offset: 0x20) |
63 | # [...] | 77 | # [...] |
78 | # .section "other.section" | ||
64 | # | 79 | # |
65 | # If we make the tmp.s the same as above, when we link together with | 80 | # If we make the tmp.s the same as above, when we link together with |
66 | # the original object, we will end up with two symbols for my_func: | 81 | # the original object, we will end up with two symbols for func1: |
67 | # one local, one global. After final compile, we will end up with | 82 | # one local, one global. After final compile, we will end up with |
68 | # an undefined reference to my_func. | 83 | # an undefined reference to func1 or a wrong reference to another global |
84 | # func1 in other files. | ||
69 | # | 85 | # |
70 | # Since local objects can reference local variables, we need to find | 86 | # Since local objects can reference local variables, we need to find |
71 | # a way to make tmp.o reference the local objects of the original object | 87 | # a way to make tmp.o reference the local objects of the original object |
72 | # file after it is linked together. To do this, we convert the my_func | 88 | # file after it is linked together. To do this, we convert func1 |
73 | # into a global symbol before linking tmp.o. Then after we link tmp.o | 89 | # into a global symbol before linking tmp.o. Then after we link tmp.o |
74 | # we will only have a single symbol for my_func that is global. | 90 | # we will only have a single symbol for func1 that is global. |
75 | # We can convert my_func back into a local symbol and we are done. | 91 | # We can convert func1 back into a local symbol and we are done. |
76 | # | 92 | # |
77 | # Here are the steps we take: | 93 | # Here are the steps we take: |
78 | # | 94 | # |
79 | # 1) Record all the local symbols by using 'nm' | 95 | # 1) Record all the local and weak symbols by using 'nm' |
80 | # 2) Use objdump to find all the call site offsets and sections for | 96 | # 2) Use objdump to find all the call site offsets and sections for |
81 | # mcount. | 97 | # mcount. |
82 | # 3) Compile the list into its own object. | 98 | # 3) Compile the list into its own object. |
@@ -86,10 +102,8 @@ | |||
86 | # 6) Link together this new object with the list object. | 102 | # 6) Link together this new object with the list object. |
87 | # 7) Convert the local functions back to local symbols and rename | 103 | # 7) Convert the local functions back to local symbols and rename |
88 | # the result as the original object. | 104 | # the result as the original object. |
89 | # End. | ||
90 | # 8) Link the object with the list object. | 105 | # 8) Link the object with the list object. |
91 | # 9) Move the result back to the original object. | 106 | # 9) Move the result back to the original object. |
92 | # End. | ||
93 | # | 107 | # |
94 | 108 | ||
95 | use strict; | 109 | use strict; |
@@ -99,7 +113,7 @@ $P =~ s@.*/@@g; | |||
99 | 113 | ||
100 | my $V = '0.1'; | 114 | my $V = '0.1'; |
101 | 115 | ||
102 | if ($#ARGV < 7) { | 116 | if ($#ARGV != 10) { |
103 | print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n"; | 117 | print "usage: $P arch bits objdump objcopy cc ld nm rm mv is_module inputfile\n"; |
104 | print "version: $V\n"; | 118 | print "version: $V\n"; |
105 | exit(1); | 119 | exit(1); |
@@ -109,7 +123,7 @@ my ($arch, $bits, $objdump, $objcopy, $cc, | |||
109 | $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV; | 123 | $ld, $nm, $rm, $mv, $is_module, $inputfile) = @ARGV; |
110 | 124 | ||
111 | # This file refers to mcount and shouldn't be ftraced, so lets' ignore it | 125 | # This file refers to mcount and shouldn't be ftraced, so lets' ignore it |
112 | if ($inputfile eq "kernel/trace/ftrace.o") { | 126 | if ($inputfile =~ m,kernel/trace/ftrace\.o$,) { |
113 | exit(0); | 127 | exit(0); |
114 | } | 128 | } |
115 | 129 | ||
@@ -138,13 +152,47 @@ my %weak; # List of weak functions | |||
138 | my %convert; # List of local functions used that needs conversion | 152 | my %convert; # List of local functions used that needs conversion |
139 | 153 | ||
140 | my $type; | 154 | my $type; |
141 | my $nm_regex; # Find the local functions (return function) | 155 | my $local_regex; # Match a local function (return function) |
156 | my $weak_regex; # Match a weak function (return function) | ||
142 | my $section_regex; # Find the start of a section | 157 | my $section_regex; # Find the start of a section |
143 | my $function_regex; # Find the name of a function | 158 | my $function_regex; # Find the name of a function |
144 | # (return offset and func name) | 159 | # (return offset and func name) |
145 | my $mcount_regex; # Find the call site to mcount (return offset) | 160 | my $mcount_regex; # Find the call site to mcount (return offset) |
146 | my $alignment; # The .align value to use for $mcount_section | 161 | my $alignment; # The .align value to use for $mcount_section |
147 | my $section_type; # Section header plus possible alignment command | 162 | my $section_type; # Section header plus possible alignment command |
163 | my $can_use_local = 0; # If we can use local function references | ||
164 | |||
165 | # Shut up recordmcount if user has older objcopy | ||
166 | my $quiet_recordmcount = ".tmp_quiet_recordmcount"; | ||
167 | my $print_warning = 1; | ||
168 | $print_warning = 0 if ( -f $quiet_recordmcount); | ||
169 | |||
170 | ## | ||
171 | # check_objcopy - whether objcopy supports --globalize-symbols | ||
172 | # | ||
173 | # --globalize-symbols came out in 2.17, we must test the version | ||
174 | # of objcopy, and if it is less than 2.17, then we can not | ||
175 | # record local functions. | ||
176 | sub check_objcopy | ||
177 | { | ||
178 | open (IN, "$objcopy --version |") or die "error running $objcopy"; | ||
179 | while (<IN>) { | ||
180 | if (/objcopy.*\s(\d+)\.(\d+)/) { | ||
181 | $can_use_local = 1 if ($1 > 2 || ($1 == 2 && $2 >= 17)); | ||
182 | last; | ||
183 | } | ||
184 | } | ||
185 | close (IN); | ||
186 | |||
187 | if (!$can_use_local && $print_warning) { | ||
188 | print STDERR "WARNING: could not find objcopy version or version " . | ||
189 | "is less than 2.17.\n" . | ||
190 | "\tLocal function references are disabled.\n"; | ||
191 | open (QUIET, ">$quiet_recordmcount"); | ||
192 | printf QUIET "Disables the warning from recordmcount.pl\n"; | ||
193 | close QUIET; | ||
194 | } | ||
195 | } | ||
148 | 196 | ||
149 | if ($arch eq "x86") { | 197 | if ($arch eq "x86") { |
150 | if ($bits == 64) { | 198 | if ($bits == 64) { |
@@ -158,7 +206,8 @@ if ($arch eq "x86") { | |||
158 | # We base the defaults off of i386, the other archs may | 206 | # We base the defaults off of i386, the other archs may |
159 | # feel free to change them in the below if statements. | 207 | # feel free to change them in the below if statements. |
160 | # | 208 | # |
161 | $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; | 209 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\S+)"; |
210 | $weak_regex = "^[0-9a-fA-F]+\\s+([wW])\\s+(\\S+)"; | ||
162 | $section_regex = "Disassembly of section\\s+(\\S+):"; | 211 | $section_regex = "Disassembly of section\\s+(\\S+):"; |
163 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; | 212 | $function_regex = "^([0-9a-fA-F]+)\\s+<(.*?)>:"; |
164 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; | 213 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\smcount\$"; |
@@ -207,7 +256,7 @@ if ($arch eq "x86_64") { | |||
207 | $cc .= " -m32"; | 256 | $cc .= " -m32"; |
208 | 257 | ||
209 | } elsif ($arch eq "powerpc") { | 258 | } elsif ($arch eq "powerpc") { |
210 | $nm_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; | 259 | $local_regex = "^[0-9a-fA-F]+\\s+t\\s+(\\.?\\S+)"; |
211 | $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:"; | 260 | $function_regex = "^([0-9a-fA-F]+)\\s+<(\\.?.*?)>:"; |
212 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; | 261 | $mcount_regex = "^\\s*([0-9a-fA-F]+):.*\\s\\.?_mcount\$"; |
213 | 262 | ||
@@ -279,44 +328,17 @@ if ($filename =~ m,^(.*)(\.\S),) { | |||
279 | my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s"; | 328 | my $mcount_s = $dirname . "/.tmp_mc_" . $prefix . ".s"; |
280 | my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o"; | 329 | my $mcount_o = $dirname . "/.tmp_mc_" . $prefix . ".o"; |
281 | 330 | ||
282 | # | 331 | check_objcopy(); |
283 | # --globalize-symbols came out in 2.17, we must test the version | ||
284 | # of objcopy, and if it is less than 2.17, then we can not | ||
285 | # record local functions. | ||
286 | my $use_locals = 01; | ||
287 | my $local_warn_once = 0; | ||
288 | my $found_version = 0; | ||
289 | |||
290 | open (IN, "$objcopy --version |") || die "error running $objcopy"; | ||
291 | while (<IN>) { | ||
292 | if (/objcopy.*\s(\d+)\.(\d+)/) { | ||
293 | my $major = $1; | ||
294 | my $minor = $2; | ||
295 | |||
296 | $found_version = 1; | ||
297 | if ($major < 2 || | ||
298 | ($major == 2 && $minor < 17)) { | ||
299 | $use_locals = 0; | ||
300 | } | ||
301 | last; | ||
302 | } | ||
303 | } | ||
304 | close (IN); | ||
305 | |||
306 | if (!$found_version) { | ||
307 | print STDERR "WARNING: could not find objcopy version.\n" . | ||
308 | "\tDisabling local function references.\n"; | ||
309 | } | ||
310 | 332 | ||
311 | # | 333 | # |
312 | # Step 1: find all the local (static functions) and weak symbols. | 334 | # Step 1: find all the local (static functions) and weak symbols. |
313 | # 't' is local, 'w/W' is weak (we never use a weak function) | 335 | # 't' is local, 'w/W' is weak |
314 | # | 336 | # |
315 | open (IN, "$nm $inputfile|") || die "error running $nm"; | 337 | open (IN, "$nm $inputfile|") || die "error running $nm"; |
316 | while (<IN>) { | 338 | while (<IN>) { |
317 | if (/$nm_regex/) { | 339 | if (/$local_regex/) { |
318 | $locals{$1} = 1; | 340 | $locals{$1} = 1; |
319 | } elsif (/^[0-9a-fA-F]+\s+([wW])\s+(\S+)/) { | 341 | } elsif (/$weak_regex/) { |
320 | $weak{$2} = $1; | 342 | $weak{$2} = $1; |
321 | } | 343 | } |
322 | } | 344 | } |
@@ -334,26 +356,20 @@ my $offset = 0; # offset of ref_func to section beginning | |||
334 | # | 356 | # |
335 | sub update_funcs | 357 | sub update_funcs |
336 | { | 358 | { |
337 | return if ($#offsets < 0); | 359 | return unless ($ref_func and @offsets); |
338 | |||
339 | defined($ref_func) || die "No function to reference"; | ||
340 | 360 | ||
341 | # A section only had a weak function, to represent it. | 361 | # Sanity check on weak function. A weak function may be overwritten by |
342 | # Unfortunately, a weak function may be overwritten by another | 362 | # another function of the same name, making all these offsets incorrect. |
343 | # function of the same name, making all these offsets incorrect. | ||
344 | # To be safe, we simply print a warning and bail. | ||
345 | if (defined $weak{$ref_func}) { | 363 | if (defined $weak{$ref_func}) { |
346 | print STDERR | 364 | die "$inputfile: ERROR: referencing weak function" . |
347 | "$inputfile: WARNING: referencing weak function" . | ||
348 | " $ref_func for mcount\n"; | 365 | " $ref_func for mcount\n"; |
349 | return; | ||
350 | } | 366 | } |
351 | 367 | ||
352 | # is this function static? If so, note this fact. | 368 | # is this function static? If so, note this fact. |
353 | if (defined $locals{$ref_func}) { | 369 | if (defined $locals{$ref_func}) { |
354 | 370 | ||
355 | # only use locals if objcopy supports globalize-symbols | 371 | # only use locals if objcopy supports globalize-symbols |
356 | if (!$use_locals) { | 372 | if (!$can_use_local) { |
357 | return; | 373 | return; |
358 | } | 374 | } |
359 | $convert{$ref_func} = 1; | 375 | $convert{$ref_func} = 1; |
@@ -379,9 +395,27 @@ open(IN, "$objdump -hdr $inputfile|") || die "error running $objdump"; | |||
379 | 395 | ||
380 | my $text; | 396 | my $text; |
381 | 397 | ||
398 | |||
399 | # read headers first | ||
382 | my $read_headers = 1; | 400 | my $read_headers = 1; |
383 | 401 | ||
384 | while (<IN>) { | 402 | while (<IN>) { |
403 | |||
404 | if ($read_headers && /$mcount_section/) { | ||
405 | # | ||
406 | # Somehow the make process can execute this script on an | ||
407 | # object twice. If it does, we would duplicate the mcount | ||
408 | # section and it will cause the function tracer self test | ||
409 | # to fail. Check if the mcount section exists, and if it does, | ||
410 | # warn and exit. | ||
411 | # | ||
412 | print STDERR "ERROR: $mcount_section already in $inputfile\n" . | ||
413 | "\tThis may be an indication that your build is corrupted.\n" . | ||
414 | "\tDelete $inputfile and try again. If the same object file\n" . | ||
415 | "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n"; | ||
416 | exit(-1); | ||
417 | } | ||
418 | |||
385 | # is it a section? | 419 | # is it a section? |
386 | if (/$section_regex/) { | 420 | if (/$section_regex/) { |
387 | $read_headers = 0; | 421 | $read_headers = 0; |
@@ -393,7 +427,7 @@ while (<IN>) { | |||
393 | $read_function = 0; | 427 | $read_function = 0; |
394 | } | 428 | } |
395 | # print out any recorded offsets | 429 | # print out any recorded offsets |
396 | update_funcs() if (defined($ref_func)); | 430 | update_funcs(); |
397 | 431 | ||
398 | # reset all markers and arrays | 432 | # reset all markers and arrays |
399 | $text_found = 0; | 433 | $text_found = 0; |
@@ -422,21 +456,7 @@ while (<IN>) { | |||
422 | $offset = hex $1; | 456 | $offset = hex $1; |
423 | } | 457 | } |
424 | } | 458 | } |
425 | } elsif ($read_headers && /$mcount_section/) { | ||
426 | # | ||
427 | # Somehow the make process can execute this script on an | ||
428 | # object twice. If it does, we would duplicate the mcount | ||
429 | # section and it will cause the function tracer self test | ||
430 | # to fail. Check if the mcount section exists, and if it does, | ||
431 | # warn and exit. | ||
432 | # | ||
433 | print STDERR "ERROR: $mcount_section already in $inputfile\n" . | ||
434 | "\tThis may be an indication that your build is corrupted.\n" . | ||
435 | "\tDelete $inputfile and try again. If the same object file\n" . | ||
436 | "\tstill causes an issue, then disable CONFIG_DYNAMIC_FTRACE.\n"; | ||
437 | exit(-1); | ||
438 | } | 459 | } |
439 | |||
440 | # is this a call site to mcount? If so, record it to print later | 460 | # is this a call site to mcount? If so, record it to print later |
441 | if ($text_found && /$mcount_regex/) { | 461 | if ($text_found && /$mcount_regex/) { |
442 | $offsets[$#offsets + 1] = hex $1; | 462 | $offsets[$#offsets + 1] = hex $1; |
@@ -444,7 +464,7 @@ while (<IN>) { | |||
444 | } | 464 | } |
445 | 465 | ||
446 | # dump out anymore offsets that may have been found | 466 | # dump out anymore offsets that may have been found |
447 | update_funcs() if (defined($ref_func)); | 467 | update_funcs(); |
448 | 468 | ||
449 | # If we did not find any mcount callers, we are done (do nothing). | 469 | # If we did not find any mcount callers, we are done (do nothing). |
450 | if (!$opened) { | 470 | if (!$opened) { |
diff --git a/scripts/selinux/Makefile b/scripts/selinux/Makefile index ca4b1ec01822..e8049da1831f 100644 --- a/scripts/selinux/Makefile +++ b/scripts/selinux/Makefile | |||
@@ -1,2 +1,2 @@ | |||
1 | subdir-y := mdp | 1 | subdir-y := mdp genheaders |
2 | subdir- += mdp | 2 | subdir- += mdp genheaders |
diff --git a/scripts/selinux/genheaders/.gitignore b/scripts/selinux/genheaders/.gitignore new file mode 100644 index 000000000000..4c0b646ff8d5 --- /dev/null +++ b/scripts/selinux/genheaders/.gitignore | |||
@@ -0,0 +1 @@ | |||
genheaders | |||
diff --git a/scripts/selinux/genheaders/Makefile b/scripts/selinux/genheaders/Makefile new file mode 100644 index 000000000000..417b165008ee --- /dev/null +++ b/scripts/selinux/genheaders/Makefile | |||
@@ -0,0 +1,5 @@ | |||
1 | hostprogs-y := genheaders | ||
2 | HOST_EXTRACFLAGS += -Isecurity/selinux/include | ||
3 | |||
4 | always := $(hostprogs-y) | ||
5 | clean-files := $(hostprogs-y) | ||
diff --git a/scripts/selinux/genheaders/genheaders.c b/scripts/selinux/genheaders/genheaders.c new file mode 100644 index 000000000000..24626968055d --- /dev/null +++ b/scripts/selinux/genheaders/genheaders.c | |||
@@ -0,0 +1,118 @@ | |||
1 | #include <stdio.h> | ||
2 | #include <stdlib.h> | ||
3 | #include <unistd.h> | ||
4 | #include <string.h> | ||
5 | #include <errno.h> | ||
6 | #include <ctype.h> | ||
7 | |||
8 | struct security_class_mapping { | ||
9 | const char *name; | ||
10 | const char *perms[sizeof(unsigned) * 8 + 1]; | ||
11 | }; | ||
12 | |||
13 | #include "classmap.h" | ||
14 | #include "initial_sid_to_string.h" | ||
15 | |||
16 | #define max(x, y) (((int)(x) > (int)(y)) ? x : y) | ||
17 | |||
18 | const char *progname; | ||
19 | |||
20 | static void usage(void) | ||
21 | { | ||
22 | printf("usage: %s flask.h av_permissions.h\n", progname); | ||
23 | exit(1); | ||
24 | } | ||
25 | |||
26 | static char *stoupperx(const char *s) | ||
27 | { | ||
28 | char *s2 = strdup(s); | ||
29 | char *p; | ||
30 | |||
31 | if (!s2) { | ||
32 | fprintf(stderr, "%s: out of memory\n", progname); | ||
33 | exit(3); | ||
34 | } | ||
35 | |||
36 | for (p = s2; *p; p++) | ||
37 | *p = toupper(*p); | ||
38 | return s2; | ||
39 | } | ||
40 | |||
41 | int main(int argc, char *argv[]) | ||
42 | { | ||
43 | int i, j, k; | ||
44 | int isids_len; | ||
45 | FILE *fout; | ||
46 | |||
47 | progname = argv[0]; | ||
48 | |||
49 | if (argc < 3) | ||
50 | usage(); | ||
51 | |||
52 | fout = fopen(argv[1], "w"); | ||
53 | if (!fout) { | ||
54 | fprintf(stderr, "Could not open %s for writing: %s\n", | ||
55 | argv[1], strerror(errno)); | ||
56 | exit(2); | ||
57 | } | ||
58 | |||
59 | for (i = 0; secclass_map[i].name; i++) { | ||
60 | struct security_class_mapping *map = &secclass_map[i]; | ||
61 | map->name = stoupperx(map->name); | ||
62 | for (j = 0; map->perms[j]; j++) | ||
63 | map->perms[j] = stoupperx(map->perms[j]); | ||
64 | } | ||
65 | |||
66 | isids_len = sizeof(initial_sid_to_string) / sizeof (char *); | ||
67 | for (i = 1; i < isids_len; i++) | ||
68 | initial_sid_to_string[i] = stoupperx(initial_sid_to_string[i]); | ||
69 | |||
70 | fprintf(fout, "/* This file is automatically generated. Do not edit. */\n"); | ||
71 | fprintf(fout, "#ifndef _SELINUX_FLASK_H_\n#define _SELINUX_FLASK_H_\n\n"); | ||
72 | |||
73 | for (i = 0; secclass_map[i].name; i++) { | ||
74 | struct security_class_mapping *map = &secclass_map[i]; | ||
75 | fprintf(fout, "#define SECCLASS_%s", map->name); | ||
76 | for (j = 0; j < max(1, 40 - strlen(map->name)); j++) | ||
77 | fprintf(fout, " "); | ||
78 | fprintf(fout, "%2d\n", i+1); | ||
79 | } | ||
80 | |||
81 | fprintf(fout, "\n"); | ||
82 | |||
83 | for (i = 1; i < isids_len; i++) { | ||
84 | char *s = initial_sid_to_string[i]; | ||
85 | fprintf(fout, "#define SECINITSID_%s", s); | ||
86 | for (j = 0; j < max(1, 40 - strlen(s)); j++) | ||
87 | fprintf(fout, " "); | ||
88 | fprintf(fout, "%2d\n", i); | ||
89 | } | ||
90 | fprintf(fout, "\n#define SECINITSID_NUM %d\n", i-1); | ||
91 | fprintf(fout, "\n#endif\n"); | ||
92 | fclose(fout); | ||
93 | |||
94 | fout = fopen(argv[2], "w"); | ||
95 | if (!fout) { | ||
96 | fprintf(stderr, "Could not open %s for writing: %s\n", | ||
97 | argv[2], strerror(errno)); | ||
98 | exit(4); | ||
99 | } | ||
100 | |||
101 | fprintf(fout, "/* This file is automatically generated. Do not edit. */\n"); | ||
102 | fprintf(fout, "#ifndef _SELINUX_AV_PERMISSIONS_H_\n#define _SELINUX_AV_PERMISSIONS_H_\n\n"); | ||
103 | |||
104 | for (i = 0; secclass_map[i].name; i++) { | ||
105 | struct security_class_mapping *map = &secclass_map[i]; | ||
106 | for (j = 0; map->perms[j]; j++) { | ||
107 | fprintf(fout, "#define %s__%s", map->name, | ||
108 | map->perms[j]); | ||
109 | for (k = 0; k < max(1, 40 - strlen(map->name) - strlen(map->perms[j])); k++) | ||
110 | fprintf(fout, " "); | ||
111 | fprintf(fout, "0x%08xUL\n", (1<<j)); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | fprintf(fout, "\n#endif\n"); | ||
116 | fclose(fout); | ||
117 | exit(0); | ||
118 | } | ||
diff --git a/scripts/selinux/mdp/mdp.c b/scripts/selinux/mdp/mdp.c index b4ced8562587..62b34ce1f50d 100644 --- a/scripts/selinux/mdp/mdp.c +++ b/scripts/selinux/mdp/mdp.c | |||
@@ -29,86 +29,27 @@ | |||
29 | #include <unistd.h> | 29 | #include <unistd.h> |
30 | #include <string.h> | 30 | #include <string.h> |
31 | 31 | ||
32 | #include "flask.h" | ||
33 | |||
34 | static void usage(char *name) | 32 | static void usage(char *name) |
35 | { | 33 | { |
36 | printf("usage: %s [-m] policy_file context_file\n", name); | 34 | printf("usage: %s [-m] policy_file context_file\n", name); |
37 | exit(1); | 35 | exit(1); |
38 | } | 36 | } |
39 | 37 | ||
40 | static void find_common_name(char *cname, char *dest, int len) | 38 | /* Class/perm mapping support */ |
41 | { | 39 | struct security_class_mapping { |
42 | char *start, *end; | 40 | const char *name; |
43 | 41 | const char *perms[sizeof(unsigned) * 8 + 1]; | |
44 | start = strchr(cname, '_')+1; | ||
45 | end = strchr(start, '_'); | ||
46 | if (!start || !end || start-cname > len || end-start > len) { | ||
47 | printf("Error with commons defines\n"); | ||
48 | exit(1); | ||
49 | } | ||
50 | strncpy(dest, start, end-start); | ||
51 | dest[end-start] = '\0'; | ||
52 | } | ||
53 | |||
54 | #define S_(x) x, | ||
55 | static char *classlist[] = { | ||
56 | #include "class_to_string.h" | ||
57 | NULL | ||
58 | }; | 42 | }; |
59 | #undef S_ | ||
60 | 43 | ||
44 | #include "classmap.h" | ||
61 | #include "initial_sid_to_string.h" | 45 | #include "initial_sid_to_string.h" |
62 | 46 | ||
63 | #define TB_(x) char *x[] = { | ||
64 | #define TE_(x) NULL }; | ||
65 | #define S_(x) x, | ||
66 | #include "common_perm_to_string.h" | ||
67 | #undef TB_ | ||
68 | #undef TE_ | ||
69 | #undef S_ | ||
70 | |||
71 | struct common { | ||
72 | char *cname; | ||
73 | char **perms; | ||
74 | }; | ||
75 | struct common common[] = { | ||
76 | #define TB_(x) { #x, x }, | ||
77 | #define S_(x) | ||
78 | #define TE_(x) | ||
79 | #include "common_perm_to_string.h" | ||
80 | #undef TB_ | ||
81 | #undef TE_ | ||
82 | #undef S_ | ||
83 | }; | ||
84 | |||
85 | #define S_(x, y, z) {x, #y}, | ||
86 | struct av_inherit { | ||
87 | int class; | ||
88 | char *common; | ||
89 | }; | ||
90 | struct av_inherit av_inherit[] = { | ||
91 | #include "av_inherit.h" | ||
92 | }; | ||
93 | #undef S_ | ||
94 | |||
95 | #include "av_permissions.h" | ||
96 | #define S_(x, y, z) {x, y, z}, | ||
97 | struct av_perms { | ||
98 | int class; | ||
99 | int perm_i; | ||
100 | char *perm_s; | ||
101 | }; | ||
102 | struct av_perms av_perms[] = { | ||
103 | #include "av_perm_to_string.h" | ||
104 | }; | ||
105 | #undef S_ | ||
106 | |||
107 | int main(int argc, char *argv[]) | 47 | int main(int argc, char *argv[]) |
108 | { | 48 | { |
109 | int i, j, mls = 0; | 49 | int i, j, mls = 0; |
50 | int initial_sid_to_string_len; | ||
110 | char **arg, *polout, *ctxout; | 51 | char **arg, *polout, *ctxout; |
111 | int classlist_len, initial_sid_to_string_len; | 52 | |
112 | FILE *fout; | 53 | FILE *fout; |
113 | 54 | ||
114 | if (argc < 3) | 55 | if (argc < 3) |
@@ -127,64 +68,25 @@ int main(int argc, char *argv[]) | |||
127 | usage(argv[0]); | 68 | usage(argv[0]); |
128 | } | 69 | } |
129 | 70 | ||
130 | classlist_len = sizeof(classlist) / sizeof(char *); | ||
131 | /* print out the classes */ | 71 | /* print out the classes */ |
132 | for (i=1; i < classlist_len; i++) { | 72 | for (i = 0; secclass_map[i].name; i++) |
133 | if(classlist[i]) | 73 | fprintf(fout, "class %s\n", secclass_map[i].name); |
134 | fprintf(fout, "class %s\n", classlist[i]); | ||
135 | else | ||
136 | fprintf(fout, "class user%d\n", i); | ||
137 | } | ||
138 | fprintf(fout, "\n"); | 74 | fprintf(fout, "\n"); |
139 | 75 | ||
140 | initial_sid_to_string_len = sizeof(initial_sid_to_string) / sizeof (char *); | 76 | initial_sid_to_string_len = sizeof(initial_sid_to_string) / sizeof (char *); |
141 | /* print out the sids */ | 77 | /* print out the sids */ |
142 | for (i=1; i < initial_sid_to_string_len; i++) | 78 | for (i = 1; i < initial_sid_to_string_len; i++) |
143 | fprintf(fout, "sid %s\n", initial_sid_to_string[i]); | 79 | fprintf(fout, "sid %s\n", initial_sid_to_string[i]); |
144 | fprintf(fout, "\n"); | 80 | fprintf(fout, "\n"); |
145 | 81 | ||
146 | /* print out the commons */ | ||
147 | for (i=0; i< sizeof(common)/sizeof(struct common); i++) { | ||
148 | char cname[101]; | ||
149 | find_common_name(common[i].cname, cname, 100); | ||
150 | cname[100] = '\0'; | ||
151 | fprintf(fout, "common %s\n{\n", cname); | ||
152 | for (j=0; common[i].perms[j]; j++) | ||
153 | fprintf(fout, "\t%s\n", common[i].perms[j]); | ||
154 | fprintf(fout, "}\n\n"); | ||
155 | } | ||
156 | fprintf(fout, "\n"); | ||
157 | |||
158 | /* print out the class permissions */ | 82 | /* print out the class permissions */ |
159 | for (i=1; i < classlist_len; i++) { | 83 | for (i = 0; secclass_map[i].name; i++) { |
160 | if (classlist[i]) { | 84 | struct security_class_mapping *map = &secclass_map[i]; |
161 | int firstperm = -1, numperms = 0; | 85 | fprintf(fout, "class %s\n", map->name); |
162 | 86 | fprintf(fout, "{\n"); | |
163 | fprintf(fout, "class %s\n", classlist[i]); | 87 | for (j = 0; map->perms[j]; j++) |
164 | /* does it inherit from a common? */ | 88 | fprintf(fout, "\t%s\n", map->perms[j]); |
165 | for (j=0; j < sizeof(av_inherit)/sizeof(struct av_inherit); j++) | 89 | fprintf(fout, "}\n\n"); |
166 | if (av_inherit[j].class == i) | ||
167 | fprintf(fout, "inherits %s\n", av_inherit[j].common); | ||
168 | |||
169 | for (j=0; j < sizeof(av_perms)/sizeof(struct av_perms); j++) { | ||
170 | if (av_perms[j].class == i) { | ||
171 | if (firstperm == -1) | ||
172 | firstperm = j; | ||
173 | numperms++; | ||
174 | } | ||
175 | } | ||
176 | if (!numperms) { | ||
177 | fprintf(fout, "\n"); | ||
178 | continue; | ||
179 | } | ||
180 | |||
181 | fprintf(fout, "{\n"); | ||
182 | /* print out the av_perms */ | ||
183 | for (j=0; j < numperms; j++) { | ||
184 | fprintf(fout, "\t%s\n", av_perms[firstperm+j].perm_s); | ||
185 | } | ||
186 | fprintf(fout, "}\n\n"); | ||
187 | } | ||
188 | } | 90 | } |
189 | fprintf(fout, "\n"); | 91 | fprintf(fout, "\n"); |
190 | 92 | ||
@@ -197,31 +99,34 @@ int main(int argc, char *argv[]) | |||
197 | /* types, roles, and allows */ | 99 | /* types, roles, and allows */ |
198 | fprintf(fout, "type base_t;\n"); | 100 | fprintf(fout, "type base_t;\n"); |
199 | fprintf(fout, "role base_r types { base_t };\n"); | 101 | fprintf(fout, "role base_r types { base_t };\n"); |
200 | for (i=1; i < classlist_len; i++) { | 102 | for (i = 0; secclass_map[i].name; i++) |
201 | if (classlist[i]) | 103 | fprintf(fout, "allow base_t base_t:%s *;\n", |
202 | fprintf(fout, "allow base_t base_t:%s *;\n", classlist[i]); | 104 | secclass_map[i].name); |
203 | else | ||
204 | fprintf(fout, "allow base_t base_t:user%d *;\n", i); | ||
205 | } | ||
206 | fprintf(fout, "user user_u roles { base_r };\n"); | 105 | fprintf(fout, "user user_u roles { base_r };\n"); |
207 | fprintf(fout, "\n"); | 106 | fprintf(fout, "\n"); |
208 | 107 | ||
209 | /* default sids */ | 108 | /* default sids */ |
210 | for (i=1; i < initial_sid_to_string_len; i++) | 109 | for (i = 1; i < initial_sid_to_string_len; i++) |
211 | fprintf(fout, "sid %s user_u:base_r:base_t\n", initial_sid_to_string[i]); | 110 | fprintf(fout, "sid %s user_u:base_r:base_t\n", initial_sid_to_string[i]); |
212 | fprintf(fout, "\n"); | 111 | fprintf(fout, "\n"); |
213 | 112 | ||
214 | |||
215 | fprintf(fout, "fs_use_xattr ext2 user_u:base_r:base_t;\n"); | 113 | fprintf(fout, "fs_use_xattr ext2 user_u:base_r:base_t;\n"); |
216 | fprintf(fout, "fs_use_xattr ext3 user_u:base_r:base_t;\n"); | 114 | fprintf(fout, "fs_use_xattr ext3 user_u:base_r:base_t;\n"); |
115 | fprintf(fout, "fs_use_xattr ext4 user_u:base_r:base_t;\n"); | ||
217 | fprintf(fout, "fs_use_xattr jfs user_u:base_r:base_t;\n"); | 116 | fprintf(fout, "fs_use_xattr jfs user_u:base_r:base_t;\n"); |
218 | fprintf(fout, "fs_use_xattr xfs user_u:base_r:base_t;\n"); | 117 | fprintf(fout, "fs_use_xattr xfs user_u:base_r:base_t;\n"); |
219 | fprintf(fout, "fs_use_xattr reiserfs user_u:base_r:base_t;\n"); | 118 | fprintf(fout, "fs_use_xattr reiserfs user_u:base_r:base_t;\n"); |
119 | fprintf(fout, "fs_use_xattr jffs2 user_u:base_r:base_t;\n"); | ||
120 | fprintf(fout, "fs_use_xattr gfs2 user_u:base_r:base_t;\n"); | ||
121 | fprintf(fout, "fs_use_xattr lustre user_u:base_r:base_t;\n"); | ||
220 | 122 | ||
123 | fprintf(fout, "fs_use_task eventpollfs user_u:base_r:base_t;\n"); | ||
221 | fprintf(fout, "fs_use_task pipefs user_u:base_r:base_t;\n"); | 124 | fprintf(fout, "fs_use_task pipefs user_u:base_r:base_t;\n"); |
222 | fprintf(fout, "fs_use_task sockfs user_u:base_r:base_t;\n"); | 125 | fprintf(fout, "fs_use_task sockfs user_u:base_r:base_t;\n"); |
223 | 126 | ||
127 | fprintf(fout, "fs_use_trans mqueue user_u:base_r:base_t;\n"); | ||
224 | fprintf(fout, "fs_use_trans devpts user_u:base_r:base_t;\n"); | 128 | fprintf(fout, "fs_use_trans devpts user_u:base_r:base_t;\n"); |
129 | fprintf(fout, "fs_use_trans hugetlbfs user_u:base_r:base_t;\n"); | ||
225 | fprintf(fout, "fs_use_trans tmpfs user_u:base_r:base_t;\n"); | 130 | fprintf(fout, "fs_use_trans tmpfs user_u:base_r:base_t;\n"); |
226 | fprintf(fout, "fs_use_trans shm user_u:base_r:base_t;\n"); | 131 | fprintf(fout, "fs_use_trans shm user_u:base_r:base_t;\n"); |
227 | 132 | ||