dd: add support for the conv=sparse option
commit4e776faa8482ae630d2ea9bc767298e664f07ba9
authorRoman Rybalko <devel@romanr.info>
Mon, 27 Feb 2012 13:53:07 +0000 (27 13:53 +0000)
committerPádraig Brady <P@draigBrady.com>
Wed, 29 Feb 2012 00:17:56 +0000 (29 00:17 +0000)
tree22c337b9f4986e7448ab952d1999d6ee5ca3cff6
parent697d00c321ed1a9610974f375e6146cb025f5198
dd: add support for the conv=sparse option

Notes:
  Small seeks are not coalesced to larger ones,
  like is done in cache_round() for example.

  conv= is used rather then oflag= for FreeBSD compatibility.

* src/dd.c (final_op_was_seek): A new global boolean to flag
whether the final "write" was converted to a seek.
(usage): Describe the new conf=sparse option.
(iwrite): Convert a write of a NUL block to a seek if requested.
(do_copy): Initialize the output buffer to have a sentinel,
to allow for efficient testing for NUL output blocks.
If the last block in the file was converted to a seek,
then convert back to a write so the size is updated.
* NEWS: Mention the new feature.
* tests/dd/sparse: A new test for the feature.
* tests/Makefile.am: Reference the new test.
NEWS
doc/coreutils.texi
src/dd.c
tests/Makefile.am
tests/dd/sparse [new file with mode: 0755]