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)
Mon, Apr 1, 1:12 PM
Unknown Object (File)
Sun, Mar 31, 1:42 PM
Unknown Object (File)
Tue, Mar 26, 2:20 AM
Unknown Object (File)
Fri, Mar 22, 8:34 PM
Unknown Object (File)
Fri, Mar 22, 8:34 PM
Unknown Object (File)
Fri, Mar 22, 8:34 PM
Unknown Object (File)
Mar 9 2024, 5:47 PM
Unknown Object (File)
Feb 23 2024, 2:46 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 Skipped
Unit
Tests Skipped

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

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.