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 :-)
1. Make secsz globally visible.
2. Have all code use the global secsz and nparts, rather than passing
them around.
3. Introduce lba_t as the type to use when talking about block addresses.
4. Work on LBAs instead of offsets. There's just too much division with
the sector size and there's really no value to use by offsets other
than that is what lseek() wants. For that we now have mkimg_seek().
The bigger picture is that geometry (cylinders, heads, sectors/track) and
also a possible physical sector size are to be globals that can be used
from anyway. We really don't want to pass all that stuff as arguments to
functions and then add __unused for most of them...
1. Fix copy-paste bug that resulted in not sizing the image correctly
for the secondary header and table.
2. The hdr_lba_end field in the header is the LBA of the last usable
sector, not the one after it.
While here, fix a white-space nit.
While here:
1. Move FreeBSD-specific headers to a more centralized place, so that
it's easier to port mkimg.
2. Remove inclusion of <uuid.h> where we don't need it (copy-pasted).
3. Check the partition data given on the command line before we do any
I/O.
4. Add scheme_round() for rounding the partition size.
5. Have scheme_write call the scheme-specific write callback and have
it propagate errors back to the caller.
This single function takes a where argument to indicate the kind of
metadata to "size". This way we can also get rid of the "padding"
field in the scheme structure.
This should make it a little more understandable what's going on.
that need to be supported. Each scheme provides data and callbacks
for handling the scheme-specifics.
To this end, put each scheme in its own source file.