devio is a command line tool designed to read and write data to block devices. It allows random access to the device. Read and write operations occur in complete device blocks and are optimised to avoid a write if the data has not changed.
devio is controlled by a sequence of commands given on the devio command line. These commands support a number of different operations:
The command syntax is designed to be easy to parse, reducing the size of devio, but is consequently somewhat cryptic. By default the devio build compiles in help. devio with no arguments outputs a very basic usage message.
devio -h commands
Gives a list of the commands.
IO in devio is optimised for reading and writing sections of block devices. The main consideration is to restrict all accesses to the device to whole device blocks aligned to a device block boundary. Standard stdio implementations do the same thing, however this is not guaranteed by the stdio API. In addition devio performs all write operations as read-modify-write, with the write only being done if the modify really changed some data. This is important with flash (MTD) devices where a write requires an erase and reduces the life of the flash device.
devio write operations are fully synced, using the fdatasync(2) system call, and fully checked for error conditions.
The byte reading and formatting support in the devio commands is intended to facilitate operations where it is necessary to interpret information contained within the device. This frequently happens during system bootstrap of embedded systems where the flash memory contains important configuration data.