View | Details | Raw Unified | Return to bug 132008
Collapse All | Expand All

(-)config/config.h (+3 lines)
Lines 81-86 Link Here
81
struct device {
81
struct device {
82
	int	d_done;			/* processed */
82
	int	d_done;			/* processed */
83
	char	*d_name;		/* name of device (e.g. rk11) */
83
	char	*d_name;		/* name of device (e.g. rk11) */
84
	char	*section;
84
#define	UNKNOWN -2	/* -2 means not set yet */
85
#define	UNKNOWN -2	/* -2 means not set yet */
85
	STAILQ_ENTRY(device) d_next;	/* Next one in list */
86
	STAILQ_ENTRY(device) d_next;	/* Next one in list */
86
};
87
};
Lines 106-111 Link Here
106
 */
107
 */
107
struct cputype {
108
struct cputype {
108
	char	*cpu_name;
109
	char	*cpu_name;
110
	char	*section;
109
	SLIST_ENTRY(cputype) cpu_next;
111
	SLIST_ENTRY(cputype) cpu_next;
110
};
112
};
111
113
Lines 119-124 Link Here
119
struct opt {
121
struct opt {
120
	char	*op_name;
122
	char	*op_name;
121
	char	*op_value;
123
	char	*op_value;
124
	char	*section;
122
	int	op_ownfile;	/* true = own file, false = makefile */
125
	int	op_ownfile;	/* true = own file, false = makefile */
123
	SLIST_ENTRY(opt) op_next;
126
	SLIST_ENTRY(opt) op_next;
124
	SLIST_ENTRY(opt) op_append;
127
	SLIST_ENTRY(opt) op_append;
(-)config/config.y (+49 lines)
Lines 22-27 Link Here
22
%token	NOOPTION
22
%token	NOOPTION
23
%token	MAKEOPTIONS
23
%token	MAKEOPTIONS
24
%token	NOMAKEOPTION 
24
%token	NOMAKEOPTION 
25
%token	SECTION
26
%token	NOSECTION
25
%token	SEMICOLON
27
%token	SEMICOLON
26
%token	INCLUDE
28
%token	INCLUDE
27
%token	FILES
29
%token	FILES
Lines 29-34 Link Here
29
%token	<str>	ID
31
%token	<str>	ID
30
%token	<val>	NUMBER
32
%token	<val>	NUMBER
31
33
34
%type	<str>	Sec_name
32
%type	<str>	Save_id
35
%type	<str>	Save_id
33
%type	<str>	Opt_value
36
%type	<str>	Opt_value
34
%type	<str>	Dev
37
%type	<str>	Dev
Lines 91-96 Link Here
91
struct  files_name_head fntab;
94
struct  files_name_head fntab;
92
char	errbuf[80];
95
char	errbuf[80];
93
int	maxusers;
96
int	maxusers;
97
char	section_init[]="main";
98
char	*section=section_init;
94
99
95
#define ns(s)	strdup(s)
100
#define ns(s)	strdup(s)
96
int include(const char *, int);
101
int include(const char *, int);
Lines 126-131 Link Here
126
		;
131
		;
127
132
128
Spec:
133
Spec:
134
	Section_spec SEMICOLON
135
		|
129
	Device_spec SEMICOLON
136
	Device_spec SEMICOLON
130
		|
137
		|
131
	Config_spec SEMICOLON
138
	Config_spec SEMICOLON
Lines 147-152 Link Here
147
	error SEMICOLON
154
	error SEMICOLON
148
		;
155
		;
149
156
157
Section_spec:
158
	SECTION Sec_name { section = $2; } |
159
	NOSECTION Sec_name {
160
		struct cputype *cp, *cp2;
161
		SLIST_FOREACH_SAFE(cp, &cputype, cpu_next, cp2) {
162
			if (eq(cp->section, $2)){
163
				SLIST_REMOVE(&cputype, cp, cputype, cpu_next);
164
				free(cp);
165
			}
166
		}
167
		struct opt *op, *op2;
168
		SLIST_FOREACH_SAFE(op, &opt, op_next, op2){
169
			if(eq(op->section, $2)){
170
				SLIST_REMOVE(&opt, op, opt, op_next);
171
				free(op->op_name);
172
				free(op);
173
			}
174
		}
175
		SLIST_FOREACH_SAFE(op, &mkopt, op_next, op2){
176
			if(eq(op->section, $2)){
177
				SLIST_REMOVE(&mkopt, op, opt, op_next);
178
				free(op->op_name);
179
				free(op);
180
			}
181
		}
182
		struct device *dp, *dp2;
183
		STAILQ_FOREACH_SAFE(dp, &dtab, d_next, dp2){
184
			if (eq(dp->section, $2)){
185
				STAILQ_REMOVE(&dtab, dp, device, d_next);
186
				free(dp->d_name);
187
				free(dp);
188
			}
189
		}
190
	      }
191
150
Config_spec:
192
Config_spec:
151
	ARCH Save_id {
193
	ARCH Save_id {
152
		if (machinename != NULL && !eq($2, machinename))
194
		if (machinename != NULL && !eq($2, machinename))
Lines 167-172 Link Here
167
		struct cputype *cp =
209
		struct cputype *cp =
168
		    (struct cputype *)calloc(1, sizeof (struct cputype));
210
		    (struct cputype *)calloc(1, sizeof (struct cputype));
169
		cp->cpu_name = $2;
211
		cp->cpu_name = $2;
212
		cp->section=section;
170
		SLIST_INSERT_HEAD(&cputype, cp, cpu_next);
213
		SLIST_INSERT_HEAD(&cputype, cp, cpu_next);
171
	      } |
214
	      } |
172
	NOCPU Save_id {
215
	NOCPU Save_id {
Lines 249-254 Link Here
249
	ID { $$ = $1; }
292
	ID { $$ = $1; }
250
	;
293
	;
251
294
295
Sec_name:
296
	ID { $$ = $1; }
297
	;
298
252
Mkopt_list:
299
Mkopt_list:
253
	Mkopt_list COMMA Mkoption
300
	Mkopt_list COMMA Mkoption
254
		|
301
		|
Lines 365-370 Link Here
365
412
366
	np = (struct device *) calloc(1, sizeof *np);
413
	np = (struct device *) calloc(1, sizeof *np);
367
	np->d_name = name;
414
	np->d_name = name;
415
	np->section = section;
368
	STAILQ_INSERT_TAIL(&dtab, np, d_next);
416
	STAILQ_INSERT_TAIL(&dtab, np, d_next);
369
}
417
}
370
418
Lines 425-430 Link Here
425
	op->op_name = name;
473
	op->op_name = name;
426
	op->op_ownfile = 0;
474
	op->op_ownfile = 0;
427
	op->op_value = value;
475
	op->op_value = value;
476
	op->section = section;
428
	if (op2 != NULL) {
477
	if (op2 != NULL) {
429
		while (SLIST_NEXT(op2, op_append) != NULL)
478
		while (SLIST_NEXT(op2, op_append) != NULL)
430
			op2 = SLIST_NEXT(op2, op_append);
479
			op2 = SLIST_NEXT(op2, op_append);
(-)config/lang.l (+2 lines)
Lines 81-86 Link Here
81
	{ "options",	OPTIONS },
81
	{ "options",	OPTIONS },
82
	{ "nooption",	NOOPTION },
82
	{ "nooption",	NOOPTION },
83
	{ "nooptions",	NOOPTION },
83
	{ "nooptions",	NOOPTION },
84
	{ "section",	SECTION },
85
	{ "nosection",	NOSECTION },
84
	{ "include",	INCLUDE },
86
	{ "include",	INCLUDE },
85
	{ "files", 	FILES },
87
	{ "files", 	FILES },
86
	{ 0, 0 },
88
	{ 0, 0 },

Return to bug 132008