diff options
author | Leah Rowe <leah@libreboot.org> | 2025-01-27 04:47:49 +0000 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2025-01-27 04:47:49 +0000 |
commit | d666f67ebe5648ac72de698ff61d6593a8ea83ea (patch) | |
tree | a57ee3998722be4a1b2ca0c8dde8a8d9312fc350 | |
parent | b2d6393ed5fe110f446b22902b840336253f4faf (diff) |
util/nvmutil: Show bytes written in writeGbe
This will be useful for future debugging, and future
work on optimisations.
Signed-off-by: Leah Rowe <leah@libreboot.org>
-rw-r--r-- | util/nvmutil/nvmutil.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c index 729f2830..a7aee76f 100644 --- a/util/nvmutil/nvmutil.c +++ b/util/nvmutil/nvmutil.c @@ -420,16 +420,24 @@ writeGbe(void) if ((!gbeFileChanged) || (flags == O_RDONLY)) return; + size_t tbw = 0; /* total bytes written */ + for (int p = 0; p < 2; p++) { if ((!nvmPartChanged[p])) continue; swap(p); /* swap bytes on big-endian host CPUs */ - err_if(pwrite(fd, (uint8_t *) gbe[p], nf, p * partsize) == -1); + + tbw += nf; } + if ((!tbw) && (gbeFileChanged)) + fprintf(stderr, "No changes needed on file '%s'\n", filename); + else if (tbw) + printf("%ld bytes written to file '%s'\n", tbw, filename); + errno = 0; err_if(close(fd) == -1); } |