Sync with ^/head.
Add stubbed vhd.c for VHD support.
We don't need APM definitions here.
Add structure definitions for headers with related constants .
Implement vhd_resize(): we round to a multiple of the block size,
which is 4096 sectors per block or 2M bytes per block.
In vhd_write(), construct the footer and write it out. Next in line
is the dynamic header. After that, the block allocation table and
the actual blocks. It's for the blocks we need some infrastructure
support, because each data block is preceeded by a bitmap that tells
whether a sector in that block has been written, etc. The point is
that we interleave metadata with data and we don't have good support
functions for writing chunks of the image yet.
o   Avoid using strncpy(), as it will confuse Coverity. Use integrals for
    cookies and creator information. Just as meaningless; more cryptic.
o   Construct the dynamuc header and write it out.
Construct and write the BAT.
To allow testing of the code so far, scribble a bitmap before we write
the image. This won't work for images that need multiple blocks, because
each block starts with a sector bitmap, followed by 4096 sectors of user
data. But it works nicely for images that fit in a single block (and are
rounded to a block size.

With this commit, we can test if the Azura platform accepts our images.
Previous commit was premature in stating that we could test. The
file must have the footer at the end and we didn't write it yet.
With this commit we actually write the footer.
Let the testing begin.
Add image_copyout_region(). It allows a format to write chunks of
the image interleaved with metadata.
Add option -y for unit testing. When unit_testing is in effect, fields
that have different values for each run, such as UUIDs and timestamps,
will have a synthesized value. This allows us to compare images against
a known baseline without fails negatives.

Add mkimg_uuid() that wraps uuidgen() and provides synthesized values
for unit testing.
Use mkimg_uuid() instead of uuidgen().
Support unit testing:
o   use mkimg_uuid() instead of uuidgen().
o   Check unit_testing in vhd_timestamp() to synthesize a time.
Add vhd_geometry() to fill in the geometry in the footer. We respect
the command line arguments if possible, but otherwise implement the
algorithm from the specification.
Use image_copyout_region() to write 2MB of user data interleaved with
the block's sector bitmap. This should complete the support, modulo
bug fixing.
Fix sed(1) usage: the extension -i is not an optional.

MFC after:	3 days
Remove some write only variables

MFC after:	3 days
Use correct flag for event index.

Submitted by:	luigi
Obtained from:	Vincenzo Maffione, Universita` di Pisa
MFC after:	1 week
More sed(1) usage fixing: the extension -i is not optional.

Pointed out by:	jmallet
MFC after:	3 days
Use separate memory type M_CTLIO for I/Os.

CTL allocate large amount of RAM.  This change give some more stats.

MFC after:	2 weeks