summaryrefslogtreecommitdiff
path: root/util/nvmutil
diff options
context:
space:
mode:
authorLeah Rowe <leah@libreboot.org>2026-02-23 09:34:51 +0000
committerLeah Rowe <leah@libreboot.org>2026-02-23 09:34:51 +0000
commit45413f1209b93015d5af28e8e41fa3af71be4750 (patch)
treef107648bfd8b1ed212e3168d11d81d4f0f848adc /util/nvmutil
parenta55af90b6c324ec9fdea9c19b65451b72bf08faf (diff)
util/nvmutil: say part number on read/write report
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/nvmutil')
-rw-r--r--util/nvmutil/nvmutil.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/util/nvmutil/nvmutil.c b/util/nvmutil/nvmutil.c
index b1469586..4f229b1f 100644
--- a/util/nvmutil/nvmutil.c
+++ b/util/nvmutil/nvmutil.c
@@ -219,13 +219,15 @@ readGbe(void)
ssize_t nr = pread(fd, (uint8_t *) gbe[p], nf, p * partsize);
err_if(nr == -1);
- if (nr != nf)
- err(errno == ECANCELED,
- "%ld bytes read from '%s', expected %ld bytes\n",
- nr, filename, nf);
+ if (nr == nf) {
+ tnr += nr;
+ swap(p); /* handle big-endian host CPU */
+ continue;
+ }
- tnr += nr;
- swap(p); /* handle big-endian host CPU */
+ err(errno == ECANCELED,
+ "%ld bytes read from '%s' part %d, expected %ld bytes\n",
+ nr, filename, p, nf);
}
printf("%ld bytes read from file '%s'\n", tnr, filename);
@@ -431,12 +433,14 @@ writeGbe(void)
swap(p); /* swap bytes on big-endian host CPUs */
ssize_t nw = pwrite(fd, (uint8_t *) gbe[p], nf, p * partsize);
err_if(nw == -1);
- if (nw != nf)
- err(errno == ECANCELED,
- "%ld bytes written to '%s', expected %ld bytes\n",
- nw, filename, nf);
+ if (nw == nf) {
+ tnw += nf;
+ continue;
+ }
- tnw += nf;
+ err(errno == ECANCELED,
+ "%ld bytes written to '%s' part %d, expected %ld bytes\n",
+ nw, filename, p, nf);
}
if ((flags != O_RDONLY) && (cmd != cmd_dump)) {