sparse_write() and make sure to check for errors. In particular,
lseek(2) may not be possible (e.g. the output file is stdout)
and sparse_write(2) will do what is optimal (i.e. use lseek(2)
when possible).
scheme_write(). The second time is immediately before we call
the format's write function. The first call is needed to have
the scheme know the right image size. The second call is needed
to compensate for the scheme adjusting the size while writing.
o The VMDK image can be queried and comverted by qemu-img
o VMware Fusion finds no errors when recovering using
'vmware-vdiskmanager -R' and the disk can be added to any
vortual machine.
Create the VMDK (embedded) descriptor file and round its size
to a multiple of 512.
TODO: We need the name of the output file -- it's in the extent
description. For now, just use "mkimg.vmdk".
and SEEK_DATA to "quickly" find occupied sectors. This is all short-
lived, because the image should not be kept in a file, but in memory.
To be precise: the image API should be both efficient and scalable
and using a file is not efficient -- it works, which is what I need
right now.
to create the VMDK file. Add some notes as well.
What I needed to know (roughly) is what interface the image API
is to provide and whether there are (knowledge) gaps that prevent
me from implementing it for real.
copies the logic verbatim from mkimg.c to image.c. The difference
is that in image.c the temporary file is always created, whereas
before we only created a temporary file when writing to stdout.
Cleanup mkimg.c now that the song and dance of using a temporary
file is gone.
1. Replace calls to mkimg_set_size() with calls to image_set_size()
2. Remove the mkimg_set_size() function
3. As above but for mkimg_write() and image_write()
Note that this breaks mkimg(1). The image API has no implementation.
Hence doing it on my branch :-)
the management of the raw image that's being created. The most notable of
the API is that there's no file descriptor argument. This is because the
image is managed in memory.
Once we have the in-memory (raw) image, we can write it out acording to
different formats. This two-pass approach shields schemes from formats
and formats from schemes.
sectors/track to 8 and number or heads to 1, partitions that are block
aligned are also cyclinder aligned. With that trick, fix the vtoc8:
1. Set physcyls, ncyls, altcyls, nheads and nsecs appropriately.
2. Truncate the image size to exactly ncyls * nheads * nsecs * secsz.
3. Properly write the cylinder number as the start of the partition.
4. Oh, and actually calculate the checksum of the label...
size.
2. Replace scheme_first_block() & scheme_next_block() with
scheme_metadata(). When we round to block sizes, we can't
reliably fixup any miscalculations.
3. In scheme_write, calculate ncyls (number of cyclinders), based
on the total size, sectors/track and number of heads.
4. Add verbosity when constructing the partitions. This includes
the starting block address and size in bytes and blocks.
5. Add verbosity about the sectors/track and number of heads.
2. Fix copy-paste bug -- acrually check secsz for being a power of 2
3. Check secsz and blksz parameters
4. Print the sector and block size when -v is given
1. Change -h to -H and change -t to -T. Use -H to specify the number of
heads and -T to specify the track size (number of sectors per track).
2. Add -S and -P. Use -S to specify the logical sector size and -P to
specify the physical sector size.
Default to 512 for both the logical and physical sector size.
Set nheads and nsecs to 1 by default.