From 45413f1209b93015d5af28e8e41fa3af71be4750 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Mon, 23 Feb 2026 09:34:51 +0000 Subject: util/nvmutil: say part number on read/write report Signed-off-by: Leah Rowe --- util/nvmutil/nvmutil.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'util/nvmutil') 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)) { -- cgit v1.2.1