summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index cf8c63d4..8681ed55 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -437,9 +437,14 @@ void
writeGbeFile(int *fd, const char *filename)
{
int p;
+ int tw = 0;
int nw = SIZE_4KB;
errno = 0;
+ /* if copy/swap not performed, write only the nvm part */
+ if ((gbe[0] != gbe[1]) && (gbe[0] < gbe[1]))
+ nw = 128;
+
for (p = 0; p < 2; p++) {
if (nvmPartModified[p]) {
printf("Part %d modified\n", p);
@@ -450,11 +455,12 @@ writeGbeFile(int *fd, const char *filename)
}
if (pwrite((*fd), (uint8_t *) gbe[p], nw, p << 12) != nw)
err(errno, "%s", filename);
+ tw += nw;
}
if (close((*fd)))
err(errno, "%s", filename);
if (errno != 0)
err(errno, "%s", filename);
- printf("File `%s` successfully re-written.\n", filename);
+ printf("%d bytes written to file: `%s`\n", tw, filename);
}