Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Julien Thierry <jthierry@redhat.com>
To: kexec@lists.infradead.org
Cc: bhsharma@redhat.com, Julien Thierry <jthierry@redhat.com>,
	k-hagio-ab@nec.com, lijiang@redhat.com
Subject: [MAKEDUMPFILE PATCH 2/2] Add shorthand option to show report stats
Date: Tue, 24 Nov 2020 10:45:25 +0000	[thread overview]
Message-ID: <20201124104525.1070885-3-jthierry@redhat.com> (raw)
In-Reply-To: <20201124104525.1070885-1-jthierry@redhat.com>

Provide shorthand option to enable report messages without needing
to set a particular value for message-level.

Signed-off-by: Julien Thierry <jthierry@redhat.com>
---
 makedumpfile.8 |  5 +++++
 makedumpfile.c | 12 +++++++++++-
 makedumpfile.h |  1 +
 print_info.c   |  3 +++
 4 files changed, 20 insertions(+), 1 deletion(-)

diff --git a/makedumpfile.8 b/makedumpfile.8
index 39a63ba..ec1e625 100644
--- a/makedumpfile.8
+++ b/makedumpfile.8
@@ -642,6 +642,11 @@ Preferable to be given as the first parameter.
 Do not write the output dump file while still performing operations specified
 by other options.
 
+.TP
+\fB\-\-show-stats\fR
+Display report messages. This is an alternative to enabling bit 4 in the level
+provided to --message-level.
+
 .SH ENVIRONMENT VARIABLES
 
 .TP 8
diff --git a/makedumpfile.c b/makedumpfile.c
index 90258f3..db31a03 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -11424,13 +11424,14 @@ static struct option longopts[] = {
 	{"num-threads", required_argument, NULL, OPT_NUM_THREADS},
 	{"check-params", no_argument, NULL, OPT_CHECK_PARAMS},
 	{"dry-run", no_argument, NULL, OPT_DRY_RUN},
+	{"show-stats", no_argument, NULL, OPT_SHOW_STATS},
 	{0, 0, 0, 0}
 };
 
 int
 main(int argc, char *argv[])
 {
-	int i, opt, flag_debug = FALSE;
+	int i, opt, flag_debug = FALSE, flag_show_stats = FALSE;
 
 	if ((info = calloc(1, sizeof(struct DumpInfo))) == NULL) {
 		ERRMSG("Can't allocate memory for the pagedesc cache. %s.\n",
@@ -11593,6 +11594,9 @@ main(int argc, char *argv[])
 		case OPT_DRY_RUN:
 			info->flag_dry_run = TRUE;
 			break;
+		case OPT_SHOW_STATS:
+			flag_show_stats = TRUE;
+			break;
 		case '?':
 			MSG("Commandline parameter is invalid.\n");
 			MSG("Try `makedumpfile --help' for more information.\n");
@@ -11606,6 +11610,12 @@ main(int argc, char *argv[])
 		/* suppress debugging messages */
 		message_level = DEFAULT_MSG_LEVEL;
 
+	if (flag_show_stats) {
+		message_level |= ML_PRINT_REPORT_MSG;
+		/* Progress indicator interferes with report messages */
+		message_level &= ~ML_PRINT_PROGRESS;
+	}
+
 	if (info->flag_dry_run)
 		/* Suppress progress indicator as dumpfile won't get written */
 		message_level &= ~ML_PRINT_PROGRESS;
diff --git a/makedumpfile.h b/makedumpfile.h
index 58126cb..18c8b0b 100644
--- a/makedumpfile.h
+++ b/makedumpfile.h
@@ -2366,6 +2366,7 @@ struct elf_prstatus {
 #define OPT_PARTIAL_DMESG       OPT_START+17
 #define OPT_CHECK_PARAMS        OPT_START+18
 #define OPT_DRY_RUN             OPT_START+19
+#define OPT_SHOW_STATS          OPT_START+20
 
 /*
  * Function Prototype.
diff --git a/print_info.c b/print_info.c
index d2b0cb7..6ebf611 100644
--- a/print_info.c
+++ b/print_info.c
@@ -311,6 +311,9 @@ print_usage(void)
 	MSG("  [--dry-run]:\n");
 	MSG("      This option runs makedumpfile without writting output dump file.\n");
 	MSG("\n");
+	MSG("  [--show-stats]:\n");
+	MSG("      This option sets message-level to print report messages\n");
+	MSG("\n");
 	MSG("  [-D]:\n");
 	MSG("      Print debugging message.\n");
 	MSG("\n");
-- 
2.25.4


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

  parent reply	other threads:[~2020-11-24 10:45 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 10:45 [MAKDUMPFILE PATCH 0/2] Get stats without writing dumpfile Julien Thierry
2020-11-24 10:45 ` [MAKEDUMPFILE PATCH 1/2] Add option to prevent writing the dumpfile Julien Thierry
2021-01-18  6:43   ` HAGIO KAZUHITO(萩尾 一仁)
2021-01-28  9:00     ` HAGIO KAZUHITO(萩尾 一仁)
2021-02-04  8:21       ` HAGIO KAZUHITO(萩尾 一仁)
2020-11-24 10:45 ` Julien Thierry [this message]
2021-01-18  7:19   ` [MAKEDUMPFILE PATCH 2/2] Add shorthand option to show report stats HAGIO KAZUHITO(萩尾 一仁)

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=20201124104525.1070885-3-jthierry@redhat.com \
    --to=jthierry@redhat.com \
    --cc=bhsharma@redhat.com \
    --cc=k-hagio-ab@nec.com \
    --cc=kexec@lists.infradead.org \
    --cc=lijiang@redhat.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