Page MenuHomeFreeBSD

Add iflag=fullblock to dd
ClosedPublic

Authored by freqlabs on Aug 27 2019, 6:25 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 10, 8:44 PM
Unknown Object (File)
Wed, Oct 8, 3:16 AM
Unknown Object (File)
Mon, Oct 6, 3:06 AM
Unknown Object (File)
Sun, Oct 5, 1:03 AM
Unknown Object (File)
Fri, Sep 26, 8:22 AM
Unknown Object (File)
Thu, Sep 25, 6:15 PM
Unknown Object (File)
Wed, Sep 24, 1:37 AM
Unknown Object (File)
Tue, Sep 23, 9:09 PM
Subscribers

Details

Summary

Normally, count=n means read(2) will be called n times on the input to dd. If the read() returns short, as may happen when reading from a pipe, fewer bytes will be copied from the input. With conv=sync the buffer is padded with zeros to fill the rest of the block.

iflag=fullblock causes dd to continue reading until the block is full, so that count=n means n full blocks are copied. This flag is compatible with illumos and GNU dd and is used in the ZFS test suite.

Sponsored by: iXsystems, Inc.

Test Plan
# Notice a varying number of partial reads being padded:
dd if=/var/log/messages bs=8 | dd bs=64 conv=sync | hexdump | fgrep '*' | wc -l
# 634
# 658
# 623
# ...
# Notice 0 partial reads:
dd if=/var/log/messages bs=8 | dd bs=64 iflag=fullblock | hexdump | fgrep '*' | wc -l
# 0
# 0
# 0
# ...

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Make conv=sync and iflag=fullblock mutually exclusive rather than silently ignoring the iflag.

Can you run textproc/igor and "mandoc -Tlint" over your man page? It should give you some warnings/hints on how to fix a few things in there, nothing major.

bin/dd/dd.1
111 ↗(On Diff #61892)

A line break is needed after a sentence stop.

Fixed man page additions. Thanks, @bcr!

Delete redundant setting of in.dbsz in error case.

This revision is now accepted and ready to land.Sep 30 2019, 9:58 PM
This revision was automatically updated to reflect the committed changes.