bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9157: [PATCH] dd: sparse conv flag


From: Pádraig Brady
Subject: bug#9157: [PATCH] dd: sparse conv flag
Date: Mon, 27 Feb 2012 15:20:00 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0

I recently noticed a use case for this feature:
  https://review.openstack.org/#change,4435
But I managed to forget we had a patch pending for this,
and spent a couple of hours writing my own version :p
Well at least it's good practise for reviewing Roman's...

I notice Roman's seeks() the output for any run of NULs,
while mine only considers blocks of the full output block size.
Checking the full block is a bit more CPU efficient,
and gives a bit more control, so I'm marginally leaning
towards doing that?

Also Roman's doesn't handle the case where a seek
is done at the end of the file. In that case an ftruncate()
or write() is needed to correctly set the size.

Notes on my version attached are:
 I first need to refactor is_nul() for use by cp too.
 My version is advisory also
 We may need to coalesce seeks to larger ones? something like cache_round()?
   I thought it better to keep the code simple in this regard though
   as it's probably not of practical concern.
 I used conv= for bsd compat, rather than oflag=.
 Needs tests and docs yet.

cheers,
Pádraig.

Attachment: dd-sparse.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]