lib/pattern: add set of functions to parse combined pattern input
The idea of this patch is to have several helpers to parse combined
pattern input, which can consists of strings, numbers and formats.
For example now pattern can be combined and look like this string:
input : 0xdeadbeef"123"0xdeadface
output: de ad be ef 31 32 33 de ad fa ce
or
input : -99"some string"0x66
output: 9d ff ff ff 73 6f 6d 65 20 73 74 72 69 6e 67 66
or with formats
input : 0xdeadface0xffff%o
output: de ad fa ce ff ff 00 00 00 00 00 00 00 00
where %o - offset of the block, reserved 8 bytes
Space for formats is reserved in output buffer.
When buffer will be ready to be written to disk - 'paste' callback
should be called for each pattern format. Each callback is responsible
for writing data inside the reserved space in the output buffer.
Format array can be extended at any time, all you need is to provide
the name of the format and correct 'paste' callback.
Signed-off-by: Roman Pen <r.peniaev@gmail.com>
Signed-off-by: Jens Axboe <axboe@fb.com>