History log of /freebsd-head/usr.bin/mkimg/vtoc8.c
Revision Date Author Comments
1cceceb8e256cc06c9697066cd42540b588287e7 06-Jan-2019 delphij <delphij@FreeBSD.org> Remove unneeded headers.

MFC after: 1 month
a31300a1ec00c0d5b95ebc0cd0d59818668fabc4 18-Oct-2016 marcel <marcel@FreeBSD.org> o Provide a private definition for UUIDs (mkimg_uuid_t) because
UUIDs are not portable.
o Move mkimg_uuid() to a new file and merge both gpt_uuid_enc()
and vhd_uuid_enc() into a single mkimg_uuid_enc() that lives
in the same file.
o Move the OS-specific implementation of generating a UUID to
osdep_uuidgen() and provide the implementations for FreeBSD,
macOS and Linux.
o Expect the partitioning scheme headers to be found by having
a search to the directory in which the headers live. This
avoids conflicts on non-FreeBSD machines.
3b59134ffec88be4d292bc7a93a30f98008b256c 16-Oct-2016 marcel <marcel@FreeBSD.org> Switch to using the portable partition scheme headers.
5e84416ac964829fd8974acdd790791ef1d2aa7e 03-Oct-2016 marcel <marcel@FreeBSD.org> Prefer <stdint.h> over <sys/types.h>. While here remove redundant
inclusion of <sys/queue.h>.

Move the inclusion of the disk partitioning headers out of order
and inbetween standard headers and local header. They will change
in a subsequent commit.
f258aa5cde1113f397c3300bd85cc1798b6a7960 03-Oct-2016 marcel <marcel@FreeBSD.org> Replace STAILQ with TAILQ. TAILQs are portable enough that they can
be used on both macOS and Linux. STAILQs are not. In particular,
STAILQ_LAST does not next on Linux. Since neither STAILQ_FOREACH_SAFE
nor TAILQ_FOREACH_SAFE exist on Linux, replace its use with a regular
TAILQ_FOREACH. The _SAFE variant was only used for having the next
pointer in a local variable.
741bf1228e837b7eb7ffbfe84f3c9544c0246ffe 26-Sep-2016 marcel <marcel@FreeBSD.org> Avoid depending on the <sys/endian.h> header for le*enc and be*enc.
Not only is the header unportable, the encoding/decoding functions
are as well. Instead, duplicate the handful of small inlines we
need into a private header called endian.h.

Aside: an alternative approach is to move the encoding/decoding
functions to a separate system header. While the header is still
nonportable, such an approach would make it possible to re-use the
definitions by playing games with include paths. This may be the
preferred approach if more (build) utilities need this. This
change does not preclude that. In fact, it makes it easier.
00d578928eca75be320b36d37543a7e2a4f9fbdb 27-May-2016 grehan <grehan@FreeBSD.org> Create branch for bhyve graphics import.
0eb256ebfd6ec7a8d152bc026d9c3c9b4ba98a8e 23-Sep-2014 marcel <marcel@FreeBSD.org> MFC 271881: Fix partition alignment and image rounding when any of
-P (block size), -T (track size) or -H (number of heads) is given.

Approved by: re@ (gjb)
9dc0698640fe960ea83bb4dbd1fdb76293868037 19-Sep-2014 marcel <marcel@FreeBSD.org> Fix partition alignment and image rounding when any of -P (block size),
-T (track size) or -H (number of heads) is given:
o scheme_metadata() always rounded to the block size. This is not
always valid (e.g. vtoc8 that must have partitions start at cylinder
o The bsd and vtoc8 schemes "resized" the image to make it match the
geometry, but since the geometry is an approximation and the size
of the image computed from cylinders * heads * sectors is always
smaller than the original image size, the partition information ran
out of bounds.

The fix is to have scheme_metadata() simply pass it's arguments to the
per-scheme metadata callback, so that schemes not only know where the
metadata is to go, but also what the current block address is. It's now
up to the per-scheme callback to reserve room for metadata and to make
sure alignment and rounding is applied.

The BSD scheme now has the most elaborate alignment and rounding. Just
to make the point: partitions are aligned on block boundaries, but the
image is rounded to the next cyclinder boundary.

vtoc8 now properly has all partitions aligned (and rounded) to the
cyclinder boundary.

Obtained from: Juniper Networks, Inc.
MFC after: 3 days
a33844e926a330bdb5c1966b112da53d2735b82a 02-Jul-2014 marcel <marcel@FreeBSD.org> MFC mkimg(1) -- revisions 268159, 268134, 266556, 266514, 266513,
266512, 266511, 266510, 266509, 266176, 265468, 265467,
265462, 265170, 263926, 263924, 263923, 263919 and 263918.

Revision 267182 changed mkimg.1 alongside other unrelated manpages.
The change to mkimg.1 has been applied without registering a merge
of the revision. This allows a future merge of r267182 to happen.

Relnotes: yes
12d9d80011126926f1ca0cc86990a22ac1d3da84 21-May-2014 marcel <marcel@FreeBSD.org> Fix CID 1204379 (vtoc8.c) & CID 1204380 (bsd.c): Cast ncyls to lba_t
before multiplying the 32-bit integrals to avoid any possibility of
truncation before widening. Not a likely scenario to begin with...
f10e28b41fb321b32c2b40e964d002b0cd1cc51a 06-May-2014 marcel <marcel@FreeBSD.org> Add mkimg_write() which combines lseek(2) and write(2) and uses
sector granularity for both offset and length. Have all schemes
use mkimg_write() instead of mkimg_seek() followed by write(2).

Now that schemes don't use lseek(2) nor write(2) directly, it's
easier to support output formats other than raw disks.
c374630340e8b48a5207d313eb2ed6c0453e31f9 29-Mar-2014 marcel <marcel@FreeBSD.org> Fix build on FreeBSD 8 where partition types for nandfs do not exist.