Blame SOURCES/kexec-tools-2.0.20-makedumpfile-Add-shorthand-show-stats-option-to-show.patch

e8a34c
From 6f3e75a558ed50d6ff0b42e3f61c099b2005b7bb Mon Sep 17 00:00:00 2001
e8a34c
From: Julien Thierry <jthierry@redhat.com>
e8a34c
Date: Tue, 24 Nov 2020 10:45:25 +0000
e8a34c
Subject: [PATCH] [PATCH 2/2] Add shorthand --show-stats option to show report
e8a34c
 stats
e8a34c
e8a34c
Provide shorthand --show-stats option to enable report messages
e8a34c
without needing to set a particular value for message-level.
e8a34c
e8a34c
Signed-off-by: Julien Thierry <jthierry@redhat.com>
e8a34c
Signed-off-by: Kazuhito Hagio <k-hagio-ab@nec.com>
e8a34c
---
e8a34c
 makedumpfile.8 | 5 +++++
e8a34c
 makedumpfile.c | 9 ++++++++-
e8a34c
 makedumpfile.h | 1 +
e8a34c
 print_info.c   | 7 ++++++-
e8a34c
 4 files changed, 20 insertions(+), 2 deletions(-)
e8a34c
e8a34c
diff --git a/makedumpfile-1.6.8/makedumpfile.8 b/makedumpfile-1.6.8/makedumpfile.8
e8a34c
index 5e902cd..dcca2dd 100644
e8a34c
--- a/makedumpfile-1.6.8/makedumpfile.8
e8a34c
+++ b/makedumpfile-1.6.8/makedumpfile.8
e8a34c
@@ -643,6 +643,11 @@ Do not write the output dump file while still performing operations specified
e8a34c
 by other options.
e8a34c
 This option cannot be used with the --dump-dmesg, --reassemble and -g options.
e8a34c
 
e8a34c
+.TP
e8a34c
+\fB\-\-show-stats\fR
e8a34c
+Display report messages. This is an alternative to enabling bit 4 in the level
e8a34c
+provided to --message-level.
e8a34c
+
e8a34c
 .SH ENVIRONMENT VARIABLES
e8a34c
 
e8a34c
 .TP 8
e8a34c
diff --git a/makedumpfile-1.6.8/makedumpfile.c b/makedumpfile-1.6.8/makedumpfile.c
e8a34c
index 8c80c49..ba0003a 100644
e8a34c
--- a/makedumpfile-1.6.8/makedumpfile.c
e8a34c
+++ b/makedumpfile-1.6.8/makedumpfile.c
e8a34c
@@ -11540,13 +11540,14 @@ static struct option longopts[] = {
e8a34c
 	{"num-threads", required_argument, NULL, OPT_NUM_THREADS},
e8a34c
 	{"check-params", no_argument, NULL, OPT_CHECK_PARAMS},
e8a34c
 	{"dry-run", no_argument, NULL, OPT_DRY_RUN},
e8a34c
+	{"show-stats", no_argument, NULL, OPT_SHOW_STATS},
e8a34c
 	{0, 0, 0, 0}
e8a34c
 };
e8a34c
 
e8a34c
 int
e8a34c
 main(int argc, char *argv[])
e8a34c
 {
e8a34c
-	int i, opt, flag_debug = FALSE;
e8a34c
+	int i, opt, flag_debug = FALSE, flag_show_stats = FALSE;
e8a34c
 
e8a34c
 	if ((info = calloc(1, sizeof(struct DumpInfo))) == NULL) {
e8a34c
 		ERRMSG("Can't allocate memory for the pagedesc cache. %s.\n",
e8a34c
@@ -11709,6 +11710,9 @@ main(int argc, char *argv[])
e8a34c
 		case OPT_DRY_RUN:
e8a34c
 			info->flag_dry_run = TRUE;
e8a34c
 			break;
e8a34c
+		case OPT_SHOW_STATS:
e8a34c
+			flag_show_stats = TRUE;
e8a34c
+			break;
e8a34c
 		case '?':
e8a34c
 			MSG("Commandline parameter is invalid.\n");
e8a34c
 			MSG("Try `makedumpfile --help' for more information.\n");
e8a34c
@@ -11718,6 +11722,9 @@ main(int argc, char *argv[])
e8a34c
 	if (flag_debug)
e8a34c
 		message_level |= ML_PRINT_DEBUG_MSG;
e8a34c
 
e8a34c
+	if (flag_show_stats)
e8a34c
+		message_level |= ML_PRINT_REPORT_MSG;
e8a34c
+
e8a34c
 	if (info->flag_check_params)
e8a34c
 		/* suppress debugging messages */
e8a34c
 		message_level = DEFAULT_MSG_LEVEL;
e8a34c
diff --git a/makedumpfile-1.6.8/makedumpfile.h b/makedumpfile-1.6.8/makedumpfile.h
e8a34c
index 4c4222c..2fcb62e 100644
e8a34c
--- a/makedumpfile-1.6.8/makedumpfile.h
e8a34c
+++ b/makedumpfile-1.6.8/makedumpfile.h
e8a34c
@@ -2427,6 +2427,7 @@ struct elf_prstatus {
e8a34c
 #define OPT_PARTIAL_DMESG       OPT_START+17
e8a34c
 #define OPT_CHECK_PARAMS        OPT_START+18
e8a34c
 #define OPT_DRY_RUN             OPT_START+19
e8a34c
+#define OPT_SHOW_STATS          OPT_START+20
e8a34c
 
e8a34c
 /*
e8a34c
  * Function Prototype.
e8a34c
diff --git a/makedumpfile-1.6.8/print_info.c b/makedumpfile-1.6.8/print_info.c
e8a34c
index d2b0cb7..ad4184e 100644
e8a34c
--- a/makedumpfile-1.6.8/print_info.c
e8a34c
+++ b/makedumpfile-1.6.8/print_info.c
e8a34c
@@ -309,7 +309,12 @@ print_usage(void)
e8a34c
 	MSG("      vmcoreinfo. So currently /proc/kcore need be specified explicitly.\n");
e8a34c
 	MSG("\n");
e8a34c
 	MSG("  [--dry-run]:\n");
e8a34c
-	MSG("      This option runs makedumpfile without writting output dump file.\n");
e8a34c
+	MSG("      Do not write the output dump file while still performing operations specified\n");
e8a34c
+	MSG("      by other options.  This option cannot be used with --dump-dmesg, --reassemble\n");
e8a34c
+	MSG("      and -g options.\n");
e8a34c
+	MSG("\n");
e8a34c
+	MSG("  [--show-stats]:\n");
e8a34c
+	MSG("      Set message-level to print report messages\n");
e8a34c
 	MSG("\n");
e8a34c
 	MSG("  [-D]:\n");
e8a34c
 	MSG("      Print debugging message.\n");
e8a34c
-- 
e8a34c
2.29.2
e8a34c