util/nvmutil: make writeGbeFile more readable

fsdg20230625
Leah Rowe 2023-01-17 10:52:45 +00:00
parent 8dea350a62
commit e398331b38
1 changed files with 7 additions and 7 deletions

View File

@ -436,19 +436,19 @@ byteswap(uint8_t *byte)
void void
writeGbeFile(int *fd, const char *filename) writeGbeFile(int *fd, const char *filename)
{ {
int partnum; int p;
int nw = SIZE_4KB;
errno = 0; errno = 0;
for (partnum = 0; partnum < 2; partnum++) { for (p = 0; p < 2; p++) {
if (nvmPartModified[partnum]) { if (nvmPartModified[p]) {
printf("Part %d modified\n", partnum); printf("Part %d modified\n", p);
} else { } else {
fprintf (stderr, fprintf (stderr,
"Part %d NOT modified\n", partnum); "Part %d NOT modified\n", p);
continue; continue;
} }
if (pwrite((*fd), (uint8_t *) gbe[partnum], SIZE_4KB, if (pwrite((*fd), (uint8_t *) gbe[p], nw, p << 12) != nw)
partnum << 12) != SIZE_4KB)
err(errno, "%s", filename); err(errno, "%s", filename);
} }
if (close((*fd))) if (close((*fd)))