summaryrefslogtreecommitdiff
path: root/util/nvmutil
AgeCommit message (Collapse)Author
2023-01-27util/nvmutil: code cleanup in rhex()Leah Rowe
2023-01-17util/nvmutil: update copyright yearsLeah Rowe
2023-01-17util/nvmutil: limit bytes written per commandLeah Rowe
Massive reduction in number of bytes written, if copy/swap commands are not used.
2023-01-17util/nvmutil: make writeGbeFile more readableLeah Rowe
2023-01-17util/nvmutil: only write parts that are modifiedLeah Rowe
Old behaviour: always write both gbe sections. New behaviour: only write back what was changed.
2022-12-24util/nvmutil: use err() more consistentlylbmkplaceholder
2022-12-24util/nvmutil: more robust pointer handlingLeah Rowe
i didn't like the previous commits, they felt really hacky running malloc and then changing the pointer directly just rubs me the wrong way fix that
2022-12-23util/nvmutil: optimise cmd_swap() furtherlbmkplaceholder
don't do xor swap. we know gbe2 is always 4KB higher than gbe in memory, so we can just set gbe2 to the value of gbe, and OR the size in bytes of 4KB into gbe2 this is only a marginal speed boost, negligible even, but it's done for the lulz
2022-12-23util/nvmutil: greatly optimise cmd_copy()lbmkplaceholder
similar to the last change by concept. we now write individual 4KB blocks per part 0 and 1, at the end of nvmutil, based on pointer values gbe and gbe2 instead of running memcpy, simply overwrite the pointer this results in less I/O, thus more speed
2022-12-23util/nvmutil: greatly optimise cmd_swap()lbmkplaceholder
instead of XOR-swapping every byte, have pointers to the two parts and *XOR swap the pointers*. at the end of the program execution, when writing, pwrite the two parts into the same file
2022-12-21util/nvmutil: simplified error handling in rhex()lbmkplaceholder
2022-12-21util/nvmutil: return errno when calling err()lbmkplaceholder
2022-12-21util/nvmutil: exit non-zero if close() failslbmkplaceholder
2022-12-14util/nvmutil: only mask random unicast/local macslbmkplaceholder
Without this change, arbitrary MAC addresses will always be masked. This change restores the intended behaviour.
2022-12-08util/nvmutil: consistent parentheses on comparisonLeah Rowe
2022-12-08util/nvmutil file reads: skip reading if errno!=0Leah Rowe
*This condition will probably never be met, but it is theoretically possible that the code could still fail at this point. Catch all errors, and exit, ruthlessly.
2022-12-08util/nvmutil: return error when fstat() is -1Leah Rowe
Another oversight in my error handling.
2022-12-07util/nvmutil: rhex(): fail if errno not zeroLeah Rowe
The code was only checking whether all of the bytes were read, but there are other errors that can be caught via errno. Enforce strict errno handling, when generating random numbers for command `setmac`.
2022-12-05util/nvmutil: minor code formatting cleanupLeah Rowe
2022-12-03util/nvmutil: remove errant line breakLeah Rowe
2022-12-03util/nvmutil: missing paretheses on if statementLeah Rowe
2022-12-03util/nvmutil: don't initialise rbuf unless neededLeah Rowe
previously, it was always initialised, but now it's only initialised if '?' is used on a mac address character in command `setmac` this is done by simply moving mac address character randomisation to a separate function
2022-12-03util/nvmutil: rename variable in hextonumLeah Rowe
2022-12-03util/nvmutil: don't reallocate memory in hextonumLeah Rowe
2022-12-03util/nvmutil: dont report bad size if /dev/urandomLeah Rowe
2022-12-03util/nvmutil: rename variables in hextonumLeah Rowe
2022-12-03util/nvmutil: use BUFSIZ for rmac size in hextonumLeah Rowe
I will be using this function elsewhere, and in general I want this to be usable for lots of programs.
2022-12-03util/nvtutil: fix out of bounds errorLeah Rowe
the error would have never been triggered, because it never went over 11, but if this code were to be copied elsewhere, it would be problematic
2022-12-01util/nvmutil: reset errno on cmd_swapLeah Rowe
If one of the checksums was valid, but the other was not, errno would be set to E_CANCELED, but then the buffer would be modified anyway; this is acceptable behaviour, and errno would later be reset writing the GBE file, which is done only on the condition that the buffer was modified, but it's also a good idea to reset it here just in case. This is not a bugfix, and no behavioural changes will be observed by the user, but this may *prevent* a bug in the future, so let's pre-fix that bug now.
2022-11-27util/nvmutil: mild refactoringLeah Rowe
2022-11-27util/nvmutil: improved errno handling in mainLeah Rowe
2022-11-27util/nvmutil: put hextonum in its own functionLeah Rowe
2022-11-27util/nvmutil: move ENOTDIR check to functionLeah Rowe
2022-11-27util/nvmutil: further improved errno handlingLeah Rowe
2022-11-27util/nvmutil: remove errant codeLeah Rowe
2022-11-27util/nvmutil: improved error handlingLeah Rowe
2022-11-26util/nvmutil: fix off by one bugLeah Rowe
2022-11-26nvmutil copy/swap: actually set nvmPartModifiedLeah Rowe
2022-11-26util/nvmutil: move cmd copy to own functionLeah Rowe
2022-11-26util/nvmutil: move cmd swap to own functionLeah Rowe
2022-11-26util/nvmutil: move cmd brick to own functionLeah Rowe
2022-11-26util/nvmutil: cmd setchecksum in own functionLeah Rowe
2022-11-26util/nvmutil: split "dump" into smaller functionsLeah Rowe
2022-11-26util/nvmutil: re-factor to reduce code indentationLeah Rowe
2022-11-26util/nvmutil: write gbe files in a functionLeah Rowe
in any C program, main() should not contain detailed logic. ideally, the main() function should only be a skeleton, showing the overall logic flow of the program. split writing gbe files into a separate function, to satisfy this criteria.
2022-11-26util/nvmutil: human-friendly exit messages, part 2Leah Rowe
2022-11-18util/nvmutil: more human-friendly exit messagesLeah Rowe
2022-11-17assimilate nvmutilLeah Rowe