Commit Graph

8 Commits

Author SHA1 Message Date
marcel
cedbce4789 Allow schemes to specify a maximum sector size. The minimum is fixed
at 512. This allows checking of the sector size up-front when given
on the command line.
2014-03-25 02:32:04 +00:00
marcel
c9139def6c Implement the APM scheme. 2014-03-23 04:21:56 +00:00
marcel
3cd87458c0 Revamp:
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...
2014-03-23 01:10:05 +00:00
marcel
d449c3f144 Handle the -b option for specifying boot code that lives in the
partitioning scheme's meta data. Implement it for GPT.
2014-03-21 19:40:05 +00:00
marcel
ace52aef3d Add more partition types (mostly just the FreeBSD ones) to GPT.
Avoid having schemes use literal strings by introducing an enum
as the intermediate representation (see geom_part).
2014-03-21 16:11:49 +00:00
marcel
0dddaf6f49 Add a scheme-specific write callback to write the metadata.
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.
2014-03-20 20:14:26 +00:00
marcel
3f2295fee5 Replace *_get_leader() and *_get_trailer() with a single *_metadata().
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.
2014-03-20 19:37:30 +00:00
marcel
7f983a3b38 Use linker sets to provide build-time selection of the schemes
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.
2014-03-20 00:38:17 +00:00