* [PATCH 5/19] kconfig: improve config load/save output
@ 2006-04-09 15:27 Roman Zippel
2006-04-09 21:36 ` Sam Ravnborg
0 siblings, 1 reply; 5+ messages in thread
From: Roman Zippel @ 2006-04-09 15:27 UTC (permalink / raw)
To: linux-kernel, Andrew Morton
During loading special case the first common case (.config), be silent
about it and otherwise mark it as a change that requires saving. Instead
output that the file has been changed.
IOW if conf does nothing (special), it's silent.
Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
---
scripts/kconfig/confdata.c | 22 ++++++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
Index: linux-2.6-git/scripts/kconfig/confdata.c
===================================================================
--- linux-2.6-git.orig/scripts/kconfig/confdata.c
+++ linux-2.6-git/scripts/kconfig/confdata.c
@@ -98,20 +98,28 @@ int conf_read_simple(const char *name)
in = zconf_fopen(name);
} else {
const char **names = conf_confnames;
+ name = *names++;
+ if (!name)
+ return 1;
+ in = zconf_fopen(name);
+ if (in)
+ goto load;
+ sym_change_count++;
while ((name = *names++)) {
name = conf_expand_value(name);
in = zconf_fopen(name);
if (in) {
printf(_("#\n"
- "# using defaults found in %s\n"
- "#\n"), name);
- break;
+ "# using defaults found in %s\n"
+ "#\n"), name);
+ goto load;
}
}
}
if (!in)
return 1;
+load:
conf_filename = name;
conf_lineno = 0;
conf_warnings = 0;
@@ -275,6 +283,8 @@ int conf_read(const char *name)
struct expr *e;
int i;
+ sym_change_count = 0;
+
if (conf_read_simple(name))
return 1;
@@ -325,7 +335,7 @@ int conf_read(const char *name)
sym->flags |= e->right.sym->flags & SYMBOL_NEW;
}
- sym_change_count = conf_warnings || conf_unsaved;
+ sym_change_count += conf_warnings || conf_unsaved;
return 0;
}
@@ -524,6 +534,10 @@ int conf_write(const char *name)
if (rename(newname, tmpname))
return 1;
+ printf(_("#\n"
+ "# configuration written to %s\n"
+ "#\n"), tmpname);
+
sym_change_count = 0;
return 0;
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 5/19] kconfig: improve config load/save output
2006-04-09 15:27 [PATCH 5/19] kconfig: improve config load/save output Roman Zippel
@ 2006-04-09 21:36 ` Sam Ravnborg
2006-04-09 21:49 ` Roman Zippel
0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2006-04-09 21:36 UTC (permalink / raw)
To: Roman Zippel; +Cc: linux-kernel, Andrew Morton
On Sun, Apr 09, 2006 at 05:27:41PM +0200, Roman Zippel wrote:
>
> During loading special case the first common case (.config), be silent
> about it and otherwise mark it as a change that requires saving. Instead
> output that the file has been changed.
> IOW if conf does nothing (special), it's silent.
>
> Signed-off-by: Roman Zippel <zippel@linux-m68k.org>
>
> ---
>
> scripts/kconfig/confdata.c | 22 ++++++++++++++++++----
> 1 file changed, 18 insertions(+), 4 deletions(-)
>
> Index: linux-2.6-git/scripts/kconfig/confdata.c
> ===================================================================
> --- linux-2.6-git.orig/scripts/kconfig/confdata.c
> +++ linux-2.6-git/scripts/kconfig/confdata.c
> @@ -98,20 +98,28 @@ int conf_read_simple(const char *name)
> in = zconf_fopen(name);
> } else {
> const char **names = conf_confnames;
> + name = *names++;
> + if (!name)
> + return 1;
> + in = zconf_fopen(name);
> + if (in)
> + goto load;
> + sym_change_count++;
sym_change_count is only used as a flag, not as a counter.
It would be less confusing to let the name reflect it is a flag.
@@ -325,7 +335,7 @@ int conf_read(const char *name)
> sym->flags |= e->right.sym->flags & SYMBOL_NEW;
> }
>
> - sym_change_count = conf_warnings || conf_unsaved;
> + sym_change_count += conf_warnings || conf_unsaved;
One example where is obvious it is a flag.
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH 5/19] kconfig: improve config load/save output
2006-04-09 21:36 ` Sam Ravnborg
@ 2006-04-09 21:49 ` Roman Zippel
2006-04-09 21:56 ` Sam Ravnborg
0 siblings, 1 reply; 5+ messages in thread
From: Roman Zippel @ 2006-04-09 21:49 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, Andrew Morton
Hi,
On Sun, 9 Apr 2006, Sam Ravnborg wrote:
> > + name = *names++;
> > + if (!name)
> > + return 1;
> > + in = zconf_fopen(name);
> > + if (in)
> > + goto load;
> > + sym_change_count++;
>
> sym_change_count is only used as a flag, not as a counter.
It was intended as a counter, even it's currently only tested againsted
zero.
bye, Roman
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/19] kconfig: improve config load/save output
2006-04-09 21:49 ` Roman Zippel
@ 2006-04-09 21:56 ` Sam Ravnborg
2006-04-09 22:01 ` Roman Zippel
0 siblings, 1 reply; 5+ messages in thread
From: Sam Ravnborg @ 2006-04-09 21:56 UTC (permalink / raw)
To: Roman Zippel; +Cc: linux-kernel, Andrew Morton
On Sun, Apr 09, 2006 at 11:49:55PM +0200, Roman Zippel wrote:
> Hi,
>
> On Sun, 9 Apr 2006, Sam Ravnborg wrote:
>
> > > + name = *names++;
> > > + if (!name)
> > > + return 1;
> > > + in = zconf_fopen(name);
> > > + if (in)
> > > + goto load;
> > > + sym_change_count++;
> >
> > sym_change_count is only used as a flag, not as a counter.
>
> It was intended as a counter, even it's currently only tested againsted
> zero.
That I figured out myself. But the intention should not be reflected
years after when the intention did not hold.
Sam
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 5/19] kconfig: improve config load/save output
2006-04-09 21:56 ` Sam Ravnborg
@ 2006-04-09 22:01 ` Roman Zippel
0 siblings, 0 replies; 5+ messages in thread
From: Roman Zippel @ 2006-04-09 22:01 UTC (permalink / raw)
To: Sam Ravnborg; +Cc: linux-kernel, Andrew Morton
Hi,
On Sun, 9 Apr 2006, Sam Ravnborg wrote:
> > > sym_change_count is only used as a flag, not as a counter.
> >
> > It was intended as a counter, even it's currently only tested againsted
> > zero.
> That I figured out myself. But the intention should not be reflected
> years after when the intention did not hold.
There is not much point in changing it right now and it doesn't really
matter for this patch.
bye, Roman
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2006-04-09 22:01 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-09 15:27 [PATCH 5/19] kconfig: improve config load/save output Roman Zippel
2006-04-09 21:36 ` Sam Ravnborg
2006-04-09 21:49 ` Roman Zippel
2006-04-09 21:56 ` Sam Ravnborg
2006-04-09 22:01 ` Roman Zippel
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.