ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: Sergey Senozhatsky <sergey.senozhatsky.work@gmail.com>
Cc: ksummit-discuss@lists.linuxfoundation.org,
	Michal Hocko <mhocko@kernel.org>
Subject: [Ksummit-discuss] [PATCH 1/2] kconfig: add a silent option to conf_write()
Date: Thu, 6 Jul 2017 17:41:16 +0300	[thread overview]
Message-ID: <20170706144116.kcvhyxezcpinhwq7@mwanda> (raw)
In-Reply-To: <20170706144028.46a2mt2mdzpt6ip7@mwanda>

The conf_write() function prints output "configuration written to .config" but
I don't want it to print anything so I have added an option for that.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 scripts/kconfig/conf.c      | 4 ++--
 scripts/kconfig/confdata.c  | 5 +++--
 scripts/kconfig/gconf.c     | 4 ++--
 scripts/kconfig/lkc_proto.h | 2 +-
 scripts/kconfig/mconf.c     | 4 ++--
 scripts/kconfig/nconf.c     | 4 ++--
 6 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/scripts/kconfig/conf.c b/scripts/kconfig/conf.c
index 866369f10ff8..c73b5ab859a2 100644
--- a/scripts/kconfig/conf.c
+++ b/scripts/kconfig/conf.c
@@ -690,7 +690,7 @@ int main(int ac, char **av)
 		/* silentoldconfig is used during the build so we shall update autoconf.
 		 * All other commands are only used to generate a config.
 		 */
-		if (conf_get_changed() && conf_write(NULL)) {
+		if (conf_get_changed() && conf_write(NULL, 0)) {
 			fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
 			exit(1);
 		}
@@ -705,7 +705,7 @@ int main(int ac, char **av)
 			return 1;
 		}
 	} else if (input_mode != listnewconfig) {
-		if (conf_write(NULL)) {
+		if (conf_write(NULL, 0)) {
 			fprintf(stderr, _("\n*** Error during writing of the configuration.\n\n"));
 			exit(1);
 		}
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c
index 297b079ae4d9..7e8dbae6af30 100644
--- a/scripts/kconfig/confdata.c
+++ b/scripts/kconfig/confdata.c
@@ -738,7 +738,7 @@ int conf_write_defconfig(const char *filename)
 	return 0;
 }
 
-int conf_write(const char *name)
+int conf_write(const char *name, bool silent)
 {
 	FILE *out;
 	struct symbol *sym;
@@ -831,7 +831,8 @@ int conf_write(const char *name)
 			return 1;
 	}
 
-	conf_message(_("configuration written to %s"), newname);
+	if (!silent)
+		conf_message(_("configuration written to %s"), newname);
 
 	sym_set_change_count(0);
 
diff --git a/scripts/kconfig/gconf.c b/scripts/kconfig/gconf.c
index cfddddb9c9d7..115b5602d05e 100644
--- a/scripts/kconfig/gconf.c
+++ b/scripts/kconfig/gconf.c
@@ -523,7 +523,7 @@ void on_load1_activate(GtkMenuItem * menuitem, gpointer user_data)
 
 void on_save_activate(GtkMenuItem * menuitem, gpointer user_data)
 {
-	if (conf_write(NULL))
+	if (conf_write(NULL), 0)
 		text_insert_msg(_("Error"), _("Unable to save configuration !"));
 }
 
@@ -536,7 +536,7 @@ store_filename(GtkFileSelection * file_selector, gpointer user_data)
 	fn = gtk_file_selection_get_filename(GTK_FILE_SELECTION
 					     (user_data));
 
-	if (conf_write(fn))
+	if (conf_write(fn), 0)
 		text_insert_msg(_("Error"), _("Unable to save configuration !"));
 
 	gtk_widget_destroy(GTK_WIDGET(user_data));
diff --git a/scripts/kconfig/lkc_proto.h b/scripts/kconfig/lkc_proto.h
index d5398718ec2a..1690888bdbc4 100644
--- a/scripts/kconfig/lkc_proto.h
+++ b/scripts/kconfig/lkc_proto.h
@@ -5,7 +5,7 @@ void conf_parse(const char *name);
 int conf_read(const char *name);
 int conf_read_simple(const char *name, int);
 int conf_write_defconfig(const char *name);
-int conf_write(const char *name);
+int conf_write(const char *name, bool silent);
 int conf_write_autoconf(void);
 bool conf_get_changed(void);
 void conf_set_changed_callback(void (*fn)(void));
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 315ce2c7cb9d..c029b5417fa9 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -937,7 +937,7 @@ static void conf_save(void)
 		case 0:
 			if (!dialog_input_result[0])
 				return;
-			if (!conf_write(dialog_input_result)) {
+			if (!conf_write(dialog_input_result, 0)) {
 				set_config_filename(dialog_input_result);
 				return;
 			}
@@ -971,7 +971,7 @@ static int handle_exit(void)
 
 	switch (res) {
 	case 0:
-		if (conf_write(filename)) {
+		if (conf_write(filename, 0)) {
 			fprintf(stderr, _("\n\n"
 					  "Error while writing of the configuration.\n"
 					  "Your configuration changes were NOT saved."
diff --git a/scripts/kconfig/nconf.c b/scripts/kconfig/nconf.c
index 003114779815..b4b0666bdc4c 100644
--- a/scripts/kconfig/nconf.c
+++ b/scripts/kconfig/nconf.c
@@ -666,7 +666,7 @@ static int do_exit(void)
 	/* if we got here, the user really wants to exit */
 	switch (res) {
 	case 0:
-		res = conf_write(filename);
+		res = conf_write(filename, 0);
 		if (res)
 			btn_dialog(
 				main_window,
@@ -1436,7 +1436,7 @@ static void conf_save(void)
 		case 0:
 			if (!dialog_input_result[0])
 				return;
-			res = conf_write(dialog_input_result);
+			res = conf_write(dialog_input_result, 0);
 			if (!res) {
 				set_config_filename(dialog_input_result);
 				return;
-- 
2.11.0

  reply	other threads:[~2017-07-06 14:41 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-27 13:58 [Ksummit-discuss] [TECH TOPIC] is Kconfig a bit hard sometimes? Sergey Senozhatsky
2017-06-27 17:18 ` Linus Torvalds
2017-06-27 18:44   ` Luis R. Rodriguez
2017-06-27 19:27     ` Linus Torvalds
2017-06-27 20:53       ` Kees Cook
2017-06-27 21:16       ` Olof Johansson
2017-06-27 21:36         ` Linus Torvalds
2017-06-27 23:10           ` Serge E. Hallyn
2017-06-28  0:09             ` Luis R. Rodriguez
2017-06-28  0:14               ` Linus Torvalds
2017-06-28  0:26                 ` Luis R. Rodriguez
2017-06-28  3:54                   ` Stephen Hemminger
     [not found]                 ` <CAFhKne-o0S8fMo_XD_aUk2Rf7VbDhgO+PT_bjnM-9WpKfnWBvw@mail.gmail.com>
     [not found]                   ` <CAFhKne8FE=17wNdp=Svf2Z2tADok6htfYqTABEiZUrCOyeMaYg@mail.gmail.com>
2017-06-28 13:35                     ` Matthew Wilcox
2017-06-28 17:56                 ` Geert Uytterhoeven
2017-06-29 10:02                   ` Mauro Carvalho Chehab
2017-06-28  0:11             ` Linus Torvalds
2017-06-29 10:23           ` Mauro Carvalho Chehab
2017-06-28 12:58     ` Dan Carpenter
2017-06-30 17:11   ` Steven Rostedt
2017-06-30 17:52   ` Darren Hart
2017-06-30 17:58     ` Darren Hart
2017-07-01 17:24     ` Hannes Reinecke
2017-06-27 20:41 ` Kees Cook
2017-07-06 14:40 ` Dan Carpenter
2017-07-06 14:41   ` Dan Carpenter [this message]
2017-07-06 15:08     ` [Ksummit-discuss] [PATCH 1/2] kconfig: add a silent option to conf_write() Steven Rostedt
2017-07-06 14:42   ` [Ksummit-discuss] [PATCH 2/2] kconfig: new command line kernel configuration tool Dan Carpenter
2017-07-07  5:55     ` Krzysztof Kozlowski
2017-07-07  9:02       ` Dan Carpenter
2017-07-09  3:56         ` Linus Walleij
2017-07-09  8:31           ` Geert Uytterhoeven
2017-07-09 17:03             ` Randy Dunlap
2017-07-09 19:43               ` Geert Uytterhoeven
2017-07-09 17:32             ` Frank Rowand
2017-07-10  9:44     ` Geert Uytterhoeven
2017-07-10 11:15       ` Dan Carpenter
2017-07-06 16:41   ` [Ksummit-discuss] [TECH TOPIC] is Kconfig a bit hard sometimes? Linus Torvalds
2017-07-06 17:11     ` Randy Dunlap
2017-07-07 11:36     ` Dan Carpenter
2017-07-10 17:15       ` Luck, Tony
2017-07-10 17:33         ` Alexandre Belloni
2017-07-10 18:28           ` Linus Torvalds
2017-07-10 19:44             ` Randy Dunlap
2017-07-11  6:21             ` Valentin Rothberg
2017-07-06 21:19   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170706144116.kcvhyxezcpinhwq7@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=mhocko@kernel.org \
    --cc=sergey.senozhatsky.work@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox