mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-21 10:12:04 +02:00
nvmutil: split pread from readGbe
split it into readGbe_part, for code clarity. Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
+12
-7
@@ -18,7 +18,8 @@ void cmd_setchecksum(void), cmd_brick(void), swap(int partnum), writeGbe(void),
|
|||||||
cmd_dump(void), cmd_setmac(void), nvmalloc(void), readGbe(void),
|
cmd_dump(void), cmd_setmac(void), nvmalloc(void), readGbe(void),
|
||||||
checkdir(const char *path), macf(int partnum), hexdump(int partnum),
|
checkdir(const char *path), macf(int partnum), hexdump(int partnum),
|
||||||
parseMacString(const char *strMac, uint16_t *mac), cmd_swap(void),
|
parseMacString(const char *strMac, uint16_t *mac), cmd_swap(void),
|
||||||
openFiles(const char *path), cmd_copy(void), writeGbe_part(int);
|
openFiles(const char *path), cmd_copy(void), writeGbe_part(int),
|
||||||
|
readGbe_part(int);
|
||||||
int goodChecksum(int partnum);
|
int goodChecksum(int partnum);
|
||||||
uint8_t hextonum(char chs), rhex(void);
|
uint8_t hextonum(char chs), rhex(void);
|
||||||
|
|
||||||
@@ -221,15 +222,19 @@ void
|
|||||||
readGbe(void)
|
readGbe(void)
|
||||||
{
|
{
|
||||||
for (int p = 0; p < 2; p++) {
|
for (int p = 0; p < 2; p++) {
|
||||||
if (!do_read[p])
|
if (do_read[p])
|
||||||
continue;
|
readGbe_part(p);
|
||||||
if (pread(fd, (uint8_t *) gbe[p], nf, p * partsize) != nf)
|
|
||||||
err(ERR(), "Couldn't read %ld bytes from '%s' part %d",
|
|
||||||
nf, filename, p);
|
|
||||||
swap(p); /* handle big-endian host CPU */
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
readGbe_part(int p)
|
||||||
|
{
|
||||||
|
if (pread(fd, (uint8_t *) gbe[p], nf, p * partsize) != nf)
|
||||||
|
err(ERR(), "Can't read %ld b from '%s' p%d", nf, filename, p);
|
||||||
|
swap(p); /* handle big-endian host CPU */
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cmd_setmac(void)
|
cmd_setmac(void)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user