Add dd sparse output mode

Review Request #662 — Created Sept. 15, 2017 and updated — Latest diff uploaded

seeemef@mac.com
illumos-gate
8542
general
It would be convenient to have a conv=sparse mode for /usr/bin/dd akin to FreeBSD's and compatible with illumos's ostride mode.

N.b. the patch has many git-pbchk, cstyle fixes; but the effective changes are the new flsh2() and dd_close() functions and the two, new calls to the latter when reading input either has finished or produced an error.
* added dd_copy_test runner (and supporting scripts, bincomp and mkrandzero):
** regular-file dd for an input with no NUL bytes
** regular-file conv=sparse dd for an input with no NUL bytes
** regular-file dd for an input with some NUL bytes (random, but with certain, tail NUL blocks)
** regular-file conv=sparse dd for an input with some NUL bytes (random, but with certain, tail NUL blocks)
** regular-file dd for an input with all NUL bytes
** regular-file conv=sparse dd for an input with all NUL bytes
** same tests as above but for writing to a ZVOL
** same tests as above but for writing to a ZVOL in multiple passes using ostride
** same tests as above but for writing to a ZVOL in multiple passes using ostride with alternate block size
Loading...