History log of /openbsd-current/sbin/fdisk/gpt.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.20 20-Apr-2022 krw

Sigh. Another forgotten header file.


# 1.19 19-Apr-2022 krw

Forgot a file for previous commit.

No functional change.


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.18 21-Jul-2021 krw

Use a dedicated struct mbr to hold the GPT protective MBR,
either the one read from disk or the default one created
when initializing GPT.

Simplifies logic, eliminates MBR_init_GPT() and demotes
MBR_protective_mbr() to a helper function called from
GPT_read().

Nuke an unused variable in passing.

No intentional functional change.


# 1.17 18-Jul-2021 krw

Make GPT_read() obtain and validate the on-disk MBR itself, via
MBR_read(), and report success/failure.

Simplifies logic and makes clearer that the protective MBR is a
required part of a GPT.

With the standardization on 0/-1 return values for helper
functions, rename 'valid' to 'error' in GPT_read() to make logic
less mind bending.

No functional change.


# 1.16 15-Jul-2021 krw

No need for separate b_sectors, b_offset and b_type variables. We have struct
prt to hold this info in one place.

Construct a struct prt to hold the boot partition information and stash it in
the struct disk for both MBR and GPT to access as needed.

Move the blocks to sectors conversions into DISK_open() with all of its
geometry friends.

No intentional functional change.


# 1.15 12-Jul-2021 krw

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.19 19-Apr-2022 krw

Forgot a file for previous commit.

No functional change.


Revision tags: OPENBSD_7_0_BASE OPENBSD_7_1_BASE
# 1.18 21-Jul-2021 krw

Use a dedicated struct mbr to hold the GPT protective MBR,
either the one read from disk or the default one created
when initializing GPT.

Simplifies logic, eliminates MBR_init_GPT() and demotes
MBR_protective_mbr() to a helper function called from
GPT_read().

Nuke an unused variable in passing.

No intentional functional change.


# 1.17 18-Jul-2021 krw

Make GPT_read() obtain and validate the on-disk MBR itself, via
MBR_read(), and report success/failure.

Simplifies logic and makes clearer that the protective MBR is a
required part of a GPT.

With the standardization on 0/-1 return values for helper
functions, rename 'valid' to 'error' in GPT_read() to make logic
less mind bending.

No functional change.


# 1.16 15-Jul-2021 krw

No need for separate b_sectors, b_offset and b_type variables. We have struct
prt to hold this info in one place.

Construct a struct prt to hold the boot partition information and stash it in
the struct disk for both MBR and GPT to access as needed.

Move the blocks to sectors conversions into DISK_open() with all of its
geometry friends.

No intentional functional change.


# 1.15 12-Jul-2021 krw

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.18 21-Jul-2021 krw

Use a dedicated struct mbr to hold the GPT protective MBR,
either the one read from disk or the default one created
when initializing GPT.

Simplifies logic, eliminates MBR_init_GPT() and demotes
MBR_protective_mbr() to a helper function called from
GPT_read().

Nuke an unused variable in passing.

No intentional functional change.


# 1.17 18-Jul-2021 krw

Make GPT_read() obtain and validate the on-disk MBR itself, via
MBR_read(), and report success/failure.

Simplifies logic and makes clearer that the protective MBR is a
required part of a GPT.

With the standardization on 0/-1 return values for helper
functions, rename 'valid' to 'error' in GPT_read() to make logic
less mind bending.

No functional change.


# 1.16 15-Jul-2021 krw

No need for separate b_sectors, b_offset and b_type variables. We have struct
prt to hold this info in one place.

Construct a struct prt to hold the boot partition information and stash it in
the struct disk for both MBR and GPT to access as needed.

Move the blocks to sectors conversions into DISK_open() with all of its
geometry friends.

No intentional functional change.


# 1.15 12-Jul-2021 krw

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.17 18-Jul-2021 krw

Make GPT_read() obtain and validate the on-disk MBR itself, via
MBR_read(), and report success/failure.

Simplifies logic and makes clearer that the protective MBR is a
required part of a GPT.

With the standardization on 0/-1 return values for helper
functions, rename 'valid' to 'error' in GPT_read() to make logic
less mind bending.

No functional change.


# 1.16 15-Jul-2021 krw

No need for separate b_sectors, b_offset and b_type variables. We have struct
prt to hold this info in one place.

Construct a struct prt to hold the boot partition information and stash it in
the struct disk for both MBR and GPT to access as needed.

Move the blocks to sectors conversions into DISK_open() with all of its
geometry friends.

No intentional functional change.


# 1.15 12-Jul-2021 krw

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.16 15-Jul-2021 krw

No need for separate b_sectors, b_offset and b_type variables. We have struct
prt to hold this info in one place.

Construct a struct prt to hold the boot partition information and stash it in
the struct disk for both MBR and GPT to access as needed.

Move the blocks to sectors conversions into DISK_open() with all of its
geometry friends.

No intentional functional change.


# 1.15 12-Jul-2021 krw

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.15 12-Jul-2021 krw

Toss 'const' in anywhere the compiler doesn't complain about, thus identifying
places that *should* be const but currently aren't and preventing the rot from
spreading further while those issues are dealt with.

No functional change.


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.14 11-Jul-2021 krw

Add tabs to make struct definitions and function prototypes easier
to read.

No functional change.


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.13 28-Jun-2021 krw

Add another epicycle to -A processing that ensures ONLY the
partition table is changed. Not the GPT header. Not the MBR. And
only write back as much partition table information as the header
claims to have room for.

At a minimum should make -A safer when operating on the Apple M1
GPT.

A major overhaul of this code is urgently needed before someone
sneezes too hard in its vicinity.

Feedback kettenis@ & ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.12 16-Jun-2021 krw

Ensure that the '-i' command line option and the 'reinit [mbr]'
editing commnd completely remove any existing on-disk GPT header
when writing the MBR.

'-ig'/'reinit gpt' must be used to create GPT format.

Previous interactions between '-i', '-b' and overly clever
'reinit' produced surprising, inconsistent and incorrect
behaviour.

ok deraadt@ kettenis@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.11 12-Jun-2021 krw

GPT_get_header() and GPT_get_partition_table() are only used
in gpt.c. Move declarations and rename to get_header() and
get_partition_table().

No functional change.


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.10 19-May-2021 krw

No need to pass the location of the partition table to
GPT_get_partition_table() since the global 'gh' knows where it is.

Fixes a couple of missing letoh64() calls by eliminating the need for
them.


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.9 10-May-2021 krw

Replace some magic numbers with #define's. Rename GPT_get_gpt() to
GPT_read() to match MBR_read().

No intentional functional change.


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.8 06-May-2021 krw

GPT_get_hdr() is actually spelled GPT_get_header().


Revision tags: OPENBSD_6_9_BASE
# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


# 1.7 30-Jan-2021 krw

Make editing GPT easier/safer by defaulting offet to beginning of largest
free space and preventing the creation of overlapping partitions.

Prompted & tested by landry@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@


Revision tags: OPENBSD_5_9_BASE OPENBSD_6_0_BASE OPENBSD_6_1_BASE OPENBSD_6_2_BASE
# 1.6 09-Jan-2016 krw

Revamp the display of GPT information, hiding less important
information under the '-v' flag. This brings the GPT display more
into line with the MBR display and simplifies and hardens the parsing
of the partition info in the install scripts.

Original problem with install scripts parsing hand edited GPT
information reported by Valere Monseur via bugs@.

Man page fixes and tweaks from jmc@.
Install script changes tested & ok rpe@.


# 1.5 11-Dec-2015 krw

Add '-v' flag that forces the display of both GPT's and the MBR.
Useful for seeing exactly what is currently on the disk. Suggested
by a request from kettenis@.

Man page & usage ok jmc@


# 1.4 15-Nov-2015 krw

Move zapping of invalid GPT data into GPT_get_gpt() rather than
returning a value to tell callers to zap it. Use consistant idiom
to check for the presence of a GPT (check gh.gh_sig). When zapping
GPT, always zap both the header and partition table just for
paranoia's sake.


# 1.3 13-Nov-2015 krw

Move from opening/closing disk for every i/o to opening the disk once
and saving the fd in the global 'disk' structure. Stop passing around
fd's and just use the global.

Makes pledge() feasible.

Prompted by and ok deraadt@


# 1.2 26-Oct-2015 krw

Add GPT editing. Based on GSOC 2014 work by Markus Muller.


# 1.1 05-Oct-2015 krw

Enhance '-g' to create a default GPT label in addition to the protective
MBR. If '-b' is specified an EFI System partition of the requested size is
created. All remaining space is put into an OpenBSD partition.

Minimal enhancement necessary for upcoming UEFI install support.
Committed first to flush out any unexpected impacts on 'normal' MBR
operation and install media.

ok deraadt@