From 7849f23f8140e024c0abb91e1035f103154f5681 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 27 Jan 2025 05:26:59 +0000 Subject: [PATCH] util/nvmutil: show nvm words written on writeGbe Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 4eecebe..9800379 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -331,6 +331,10 @@ void cmd_dump(void) { for (int partnum = 0, numInvalid = 0; partnum < 2; partnum++) { + if ((cmd != cmd_dump) && (flags != O_RDONLY) && + (!nvmPartChanged[partnum])) + continue; + if (!goodChecksum(partnum)) ++numInvalid; printf("MAC (part %d): ", partnum); @@ -437,6 +441,13 @@ writeGbe(void) { ssize_t tnw = 0; /* total bytes written */ + if ((flags != O_RDONLY) && (cmd != cmd_dump)) { + if (nvmPartChanged[0] || nvmPartChanged[1]) + printf("The following nvm words will be written:\n"); + cmd_dump(); + errno = 0; /* reset for cmd_brick */ + } + for (int p = 0; p < 2; p++) { if ((!nvmPartChanged[p]) || (flags == O_RDONLY)) continue;