Page MenuHomeFreeBSD

Add iflag=fullblock to dd
ClosedPublic

Authored by freqlabs on Aug 27 2019, 6:25 PM.
Tags
None
Referenced Files
F163568208: D21441.id61892.diff
Fri, Jul 24, 2:09 PM
Unknown Object (File)
Wed, Jul 22, 2:37 PM
Unknown Object (File)
Mon, Jul 20, 8:24 AM
Unknown Object (File)
Sun, Jul 19, 3:42 PM
Unknown Object (File)
Sat, Jul 18, 6:56 AM
Unknown Object (File)
Sat, Jul 18, 5:55 AM
Unknown Object (File)
Tue, Jun 30, 4:37 PM
Unknown Object (File)
Fri, Jun 26, 10:08 AM
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.