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

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