util/nvmutil: do not write non-changes to disk
parent
3e150bf303
commit
adc76e3814
|
@ -129,6 +129,8 @@ main(int argc, char *argv[])
|
||||||
|
|
||||||
if (gbeFileModified)
|
if (gbeFileModified)
|
||||||
writeGbeFile(&fd, FILENAME);
|
writeGbeFile(&fd, FILENAME);
|
||||||
|
else if ((cmd != &cmd_dump))
|
||||||
|
printf("File `%s` not modified.\n", FILENAME);
|
||||||
|
|
||||||
nvmutil_exit:
|
nvmutil_exit:
|
||||||
if ((errno != 0) && (cmd != &cmd_dump))
|
if ((errno != 0) && (cmd != &cmd_dump))
|
||||||
|
@ -406,6 +408,9 @@ word(int pos16, int partnum)
|
||||||
void
|
void
|
||||||
setWord(int pos16, int partnum, uint16_t val16)
|
setWord(int pos16, int partnum, uint16_t val16)
|
||||||
{
|
{
|
||||||
|
if (word(pos16, partnum) == val16)
|
||||||
|
return;
|
||||||
|
|
||||||
uint8_t *nbuf = (uint8_t *) gbe[partnum];
|
uint8_t *nbuf = (uint8_t *) gbe[partnum];
|
||||||
uint8_t val8[2] = {(uint8_t) (val16 & 0xff), (uint8_t) (val16 >> 8)};
|
uint8_t val8[2] = {(uint8_t) (val16 & 0xff), (uint8_t) (val16 >> 8)};
|
||||||
uint16_t pos8 = pos16 << 1;
|
uint16_t pos8 = pos16 << 1;
|
||||||
|
|
Loading…
Reference in New Issue