mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-17 08:40:14 +02:00
util/nvmutil: remove unnecessary debug messages
these were put in when i was testing the feature to limit read/written bytes in loading/saving of files
This commit is contained in:
+8
-21
@@ -134,13 +134,10 @@ main(int argc, char *argv[])
|
|||||||
else if (cmd != NULL)
|
else if (cmd != NULL)
|
||||||
(*cmd)();
|
(*cmd)();
|
||||||
|
|
||||||
if (gbeFileModified) {
|
if (gbeFileModified)
|
||||||
writeGbeFile(&fd, FILENAME);
|
writeGbeFile(&fd, FILENAME);
|
||||||
} else if ((cmd != &cmd_dump)) {
|
else if (gbeWriteAttempted && (cmd != &cmd_dump))
|
||||||
printf("File `%s` not modified.\n", FILENAME);
|
errno = 0;
|
||||||
if (gbeWriteAttempted)
|
|
||||||
errno = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
nvmutil_exit:
|
nvmutil_exit:
|
||||||
if ((errno != 0) && (cmd != &cmd_dump))
|
if ((errno != 0) && (cmd != &cmd_dump))
|
||||||
@@ -152,7 +149,7 @@ void
|
|||||||
readGbeFile(int *fd, const char *path, int flags, size_t nr)
|
readGbeFile(int *fd, const char *path, int flags, size_t nr)
|
||||||
{
|
{
|
||||||
struct stat st;
|
struct stat st;
|
||||||
int p, r, tr;
|
int p, r;
|
||||||
|
|
||||||
if (opendir(path) != NULL)
|
if (opendir(path) != NULL)
|
||||||
err(errno = EISDIR, "%s", path);
|
err(errno = EISDIR, "%s", path);
|
||||||
@@ -167,16 +164,14 @@ readGbeFile(int *fd, const char *path, int flags, size_t nr)
|
|||||||
else if (errno != 0)
|
else if (errno != 0)
|
||||||
err(errno, "%s", path);
|
err(errno, "%s", path);
|
||||||
|
|
||||||
for (tr = 0, p = 0; p < 2; p++) {
|
for (p = 0; p < 2; p++) {
|
||||||
if (skipread[p])
|
if (skipread[p])
|
||||||
continue;
|
continue;
|
||||||
if ((r = pread((*fd), (uint8_t *) gbe[p], nr, p << 12)) == -1)
|
if ((r = pread((*fd), (uint8_t *) gbe[p], nr, p << 12)) == -1)
|
||||||
err(errno, "%s", path);
|
err(errno, "%s", path);
|
||||||
tr += r;
|
|
||||||
if (big_endian)
|
if (big_endian)
|
||||||
byteswap(nr, p);
|
byteswap(nr, p);
|
||||||
}
|
}
|
||||||
printf("%d bytes read from file: `%s`\n", tr, path);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -396,34 +391,26 @@ byteswap(int n, int partnum)
|
|||||||
void
|
void
|
||||||
writeGbeFile(int *fd, const char *filename)
|
writeGbeFile(int *fd, const char *filename)
|
||||||
{
|
{
|
||||||
int p, nw, tw;
|
int p, nw;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if ((gbe[0] != gbe[1]) && (gbe[0] < gbe[1]))
|
if ((gbe[0] != gbe[1]) && (gbe[0] < gbe[1]))
|
||||||
nw = 128; /* copy/swap command, so only write the nvm part */
|
nw = 128; /* copy/swap command, so only write the nvm part */
|
||||||
else
|
else
|
||||||
nw = SIZE_4KB;
|
nw = SIZE_4KB;
|
||||||
|
|
||||||
for (tw = 0, p = 0; p < 2; p++) {
|
for (p = 0; p < 2; p++) {
|
||||||
if (gbe[0] > gbe[1])
|
if (gbe[0] > gbe[1])
|
||||||
p ^= 1;
|
p ^= 1;
|
||||||
if (nvmPartModified[p]) {
|
if (!nvmPartModified[p])
|
||||||
printf("Part %d modified\n", p);
|
|
||||||
} else {
|
|
||||||
fprintf (stderr,
|
|
||||||
"Part %d NOT modified\n", p);
|
|
||||||
goto next_part;
|
goto next_part;
|
||||||
}
|
|
||||||
if (big_endian)
|
if (big_endian)
|
||||||
byteswap(nw, p);
|
byteswap(nw, p);
|
||||||
if (pwrite((*fd), (uint8_t *) gbe[p], nw, p << 12) != nw)
|
if (pwrite((*fd), (uint8_t *) gbe[p], nw, p << 12) != nw)
|
||||||
err(errno, "%s", filename);
|
err(errno, "%s", filename);
|
||||||
tw += nw;
|
|
||||||
next_part:
|
next_part:
|
||||||
if (gbe[0] > gbe[1])
|
if (gbe[0] > gbe[1])
|
||||||
p ^= 1;
|
p ^= 1;
|
||||||
}
|
}
|
||||||
if (close((*fd)))
|
if (close((*fd)))
|
||||||
err(errno, "%s", filename);
|
err(errno, "%s", filename);
|
||||||
else
|
|
||||||
printf("%d bytes written to file: `%s`\n", tw, filename);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user