History log of /openbsd-current/sbin/disklabel/extern.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.36 21-Jun-2023 krw

Add a parameter 'action' to mpfree() so it can optionally discard
or keep the memory pointed at by the char ** parameter.

Allows mpfree() to be used against the global mountpoints[] and
eliminates a couple of manual loops to free the current contents
of mountpoints[].

No intentional functional change.


Revision tags: OPENBSD_7_3_BASE
# 1.35 04-Jan-2023 krw

Use 'const struct disklabel *' parameters where the disklabel is
not altered. And 'const struct partition *' for pointers into
newly const disklabels.

No intentional functional change.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.34 18-Feb-2022 krw

Move prototypes for checklabel(), readlabel() and parselabel()
into disklabel.c since editor.c and dkcksum.c have no need to
know.


# 1.33 18-Feb-2022 krw

No need for makebootarea() prototype as makebootarea() perished with NUMBOOT in
2015 (r1.211).


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.32 31-Mar-2019 krw

Enhance prompt shown during -E label editing. Always
display the disk device whose label is being
edited. Change '>' to '#' when in expert mode.


Revision tags: OPENBSD_6_4_BASE
# 1.31 03-Jul-2018 krw

No need for print_unit to be a global.

ok otto@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.30 29-Sep-2017 otto

don't be silent on auto-allocation failure in write mode. ok millert@ krw@


Revision tags: OPENBSD_6_1_BASE
# 1.29 04-Mar-2017 otto

Allow R (resize auto-partition) after A as well as when started with -A.
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@


Revision tags: OPENBSD_6_0_BASE
# 1.28 19-Jun-2016 tb

Split readlabel() into two functions, readlabel() and parselabel(), and
pledge in-between the two funtion calls. The new readlabel() only does
a DIOC*DINFO ioctl, making sure the fd points to a disk, while
parselabel() does the scary string manipulations. In the makelabel()
code path do an early DIOCGDINFO before pledge. This fixes yet another
pledge problem (disklabel -w /dev/tty floppy576).

Some of this was discussed with beck.

ok semarie, earlier version ok deraadt


Revision tags: OPENBSD_5_9_BASE
# 1.27 17-Oct-2015 krw

NUMBOOT is dead! Nuke the variables and abstractions that were used
to build boot blocks.

ok miod@


Revision tags: OPENBSD_5_8_BASE
# 1.26 29-Apr-2015 henning

support passing a template file for the auto-allocation to disklabel.
template gives mountpoints, min-max size ranges and percentage of disk
foremost intended for autoinstalls, installer bits to follow soon.
with input from many, ok theo


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.25 10-Jul-2014 florian

Forward declarations for mpcopy & mpfree.
OK miod@, deraadt@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.24 13-Jul-2012 krw

Replace a '512' with DEV_BSIZE. Calculate physmem size in blocks and
not sectors, since the values being tested/manipulated in the auto_alloc
tables are blocks at that point. Use MEG(256) instead of hand
expanding it when testing physmem.


Revision tags: OPENBSD_5_1_BASE
# 1.23 16-Jan-2012 krw

Nuke unused parameter (f) to makebootarea(). Unused since r1.123
(2008), when '-r' support was removed. Spotted by jsg@ with the
assistance of clang.


Revision tags: OPENBSD_5_0_BASE
# 1.22 16-Apr-2011 krw

Add '-F'. Same as '-f' but uses DUIDs when writing the mount point
information to the specified file. After every label write, read the
label to get current UID info.

Some internal code cleanup with no intended functional change.

ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.21 24-Nov-2010 jsing

When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.

ok krw@


# 1.20 23-Sep-2010 jsing

Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function.

ok krw@


# 1.19 12-Aug-2010 tedu

fix a few warnings. ok jsing


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 07-Aug-2009 martynas

move editor_allocspace & mpsave out to extern.h so that disklabel.c
gets the declarations it uses. ok krw@


Revision tags: OPENBSD_4_6_BASE
# 1.17 04-Jun-2009 deraadt

Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn


# 1.16 02-Jun-2009 krw

Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.

Prodded & ok deraadt@, verbiage tweaks from jmc@


# 1.15 18-Apr-2009 sthen

Alexander Hall points out that disklabel -AE <disk> followed by quitting
without making manual changes does not ask whether you'd like to save the
new automatic disklabel. Change to follow the behaviour of -d and ask
every time. ok krw@.


# 1.14 12-Apr-2009 krw

When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.


# 1.13 11-Apr-2009 krw

readlabel() either errored out or returned a pointer to the global
'lab'. So there is no need for the return value. Just use &lab
wherever it was used. No functional change.

Slightly different version read ok to blambert@


# 1.12 10-Apr-2009 krw

Re-work '-A' so that it sets a flag that -E and -w use, and which will
just display the auto-allocation plan otherwise. Don't overwrite any
spoofed partitions, insert auto allocated partitions where we can.

This is much more install script and weird architecture friendly. I'm
talking about you, macppc.

Many suggestions and code from otto@, feedback from many, cattle
prod applied by deraadt@.

ok deraadt@
"if it works for >8GB ... put it in" miod@
"to be clear, ok" todd@


# 1.11 29-Mar-2009 deraadt

otto points out that the -v printing changes are incompatible with the
expectation that -R will read the output of disklabel. I suspect we
will find another way to do this; ok otto


# 1.10 28-Mar-2009 krw

Move some output under the control of the '-v' flag. In particular only
display the partition info by default as is done in the E(ditor). The
physical info is now only displayed if '-v' is specified.

ok deraadt@


# 1.9 22-Mar-2009 krw

Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space
on the disk into a reasonable partition scheme for a root disk.

Feedback from several, time to work on it in-tree.

Prodded (repeatedly) by and ok deraadt@


Revision tags: OPENBSD_4_5_BASE
# 1.8 11-Jan-2009 miod

On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.

ok krw@


Revision tags: OPENBSD_4_4_BASE
# 1.7 25-Jun-2008 otto

In interactive mode, always suggest offsets and sizes inside the
OpenBSD area and change the 'p' command to only print the boundaries
and size of the OpenBSD area and the free space within that area.
Introduce a 'l' command to print the header only. With krw@; ok krw@
deraadt@; jmc@ for the man page bits


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.6 08-Jun-2007 otto

Make disklabel(8) aware of the new fields, allowing for larger than
2T disks, partitions and offsets. ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.5 02-Mar-2007 krw

If a default label has been created with the -d command line option or
the 'D' editor command and has not been written to disk when the user
issues the 'q' editor command, ask if the label should be written to
disk before exiting.


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.4 07-Jan-2005 otto

Print disk size and free space in requested unit. Some refactoring to
avoid code duplication as well. ok marco@ deraadt@


# 1.3 01-Oct-2004 jsg

add some missing $, ok djm@ 'That looks fine to me' millert@


# 1.2 28-Sep-2004 otto

Tidy disklabel output for todays big disks. Based on a diff from f
at obiit dot org in PR 3847. ok tedu@ deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.1 02-Jul-2003 deraadt

missing protos


# 1.35 04-Jan-2023 krw

Use 'const struct disklabel *' parameters where the disklabel is
not altered. And 'const struct partition *' for pointers into
newly const disklabels.

No intentional functional change.


Revision tags: OPENBSD_7_1_BASE OPENBSD_7_2_BASE
# 1.34 18-Feb-2022 krw

Move prototypes for checklabel(), readlabel() and parselabel()
into disklabel.c since editor.c and dkcksum.c have no need to
know.


# 1.33 18-Feb-2022 krw

No need for makebootarea() prototype as makebootarea() perished with NUMBOOT in
2015 (r1.211).


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.32 31-Mar-2019 krw

Enhance prompt shown during -E label editing. Always
display the disk device whose label is being
edited. Change '>' to '#' when in expert mode.


Revision tags: OPENBSD_6_4_BASE
# 1.31 03-Jul-2018 krw

No need for print_unit to be a global.

ok otto@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.30 29-Sep-2017 otto

don't be silent on auto-allocation failure in write mode. ok millert@ krw@


Revision tags: OPENBSD_6_1_BASE
# 1.29 04-Mar-2017 otto

Allow R (resize auto-partition) after A as well as when started with -A.
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@


Revision tags: OPENBSD_6_0_BASE
# 1.28 19-Jun-2016 tb

Split readlabel() into two functions, readlabel() and parselabel(), and
pledge in-between the two funtion calls. The new readlabel() only does
a DIOC*DINFO ioctl, making sure the fd points to a disk, while
parselabel() does the scary string manipulations. In the makelabel()
code path do an early DIOCGDINFO before pledge. This fixes yet another
pledge problem (disklabel -w /dev/tty floppy576).

Some of this was discussed with beck.

ok semarie, earlier version ok deraadt


Revision tags: OPENBSD_5_9_BASE
# 1.27 17-Oct-2015 krw

NUMBOOT is dead! Nuke the variables and abstractions that were used
to build boot blocks.

ok miod@


Revision tags: OPENBSD_5_8_BASE
# 1.26 29-Apr-2015 henning

support passing a template file for the auto-allocation to disklabel.
template gives mountpoints, min-max size ranges and percentage of disk
foremost intended for autoinstalls, installer bits to follow soon.
with input from many, ok theo


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.25 10-Jul-2014 florian

Forward declarations for mpcopy & mpfree.
OK miod@, deraadt@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.24 13-Jul-2012 krw

Replace a '512' with DEV_BSIZE. Calculate physmem size in blocks and
not sectors, since the values being tested/manipulated in the auto_alloc
tables are blocks at that point. Use MEG(256) instead of hand
expanding it when testing physmem.


Revision tags: OPENBSD_5_1_BASE
# 1.23 16-Jan-2012 krw

Nuke unused parameter (f) to makebootarea(). Unused since r1.123
(2008), when '-r' support was removed. Spotted by jsg@ with the
assistance of clang.


Revision tags: OPENBSD_5_0_BASE
# 1.22 16-Apr-2011 krw

Add '-F'. Same as '-f' but uses DUIDs when writing the mount point
information to the specified file. After every label write, read the
label to get current UID info.

Some internal code cleanup with no intended functional change.

ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.21 24-Nov-2010 jsing

When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.

ok krw@


# 1.20 23-Sep-2010 jsing

Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function.

ok krw@


# 1.19 12-Aug-2010 tedu

fix a few warnings. ok jsing


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 07-Aug-2009 martynas

move editor_allocspace & mpsave out to extern.h so that disklabel.c
gets the declarations it uses. ok krw@


Revision tags: OPENBSD_4_6_BASE
# 1.17 04-Jun-2009 deraadt

Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn


# 1.16 02-Jun-2009 krw

Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.

Prodded & ok deraadt@, verbiage tweaks from jmc@


# 1.15 18-Apr-2009 sthen

Alexander Hall points out that disklabel -AE <disk> followed by quitting
without making manual changes does not ask whether you'd like to save the
new automatic disklabel. Change to follow the behaviour of -d and ask
every time. ok krw@.


# 1.14 12-Apr-2009 krw

When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.


# 1.13 11-Apr-2009 krw

readlabel() either errored out or returned a pointer to the global
'lab'. So there is no need for the return value. Just use &lab
wherever it was used. No functional change.

Slightly different version read ok to blambert@


# 1.12 10-Apr-2009 krw

Re-work '-A' so that it sets a flag that -E and -w use, and which will
just display the auto-allocation plan otherwise. Don't overwrite any
spoofed partitions, insert auto allocated partitions where we can.

This is much more install script and weird architecture friendly. I'm
talking about you, macppc.

Many suggestions and code from otto@, feedback from many, cattle
prod applied by deraadt@.

ok deraadt@
"if it works for >8GB ... put it in" miod@
"to be clear, ok" todd@


# 1.11 29-Mar-2009 deraadt

otto points out that the -v printing changes are incompatible with the
expectation that -R will read the output of disklabel. I suspect we
will find another way to do this; ok otto


# 1.10 28-Mar-2009 krw

Move some output under the control of the '-v' flag. In particular only
display the partition info by default as is done in the E(ditor). The
physical info is now only displayed if '-v' is specified.

ok deraadt@


# 1.9 22-Mar-2009 krw

Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space
on the disk into a reasonable partition scheme for a root disk.

Feedback from several, time to work on it in-tree.

Prodded (repeatedly) by and ok deraadt@


Revision tags: OPENBSD_4_5_BASE
# 1.8 11-Jan-2009 miod

On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.

ok krw@


Revision tags: OPENBSD_4_4_BASE
# 1.7 25-Jun-2008 otto

In interactive mode, always suggest offsets and sizes inside the
OpenBSD area and change the 'p' command to only print the boundaries
and size of the OpenBSD area and the free space within that area.
Introduce a 'l' command to print the header only. With krw@; ok krw@
deraadt@; jmc@ for the man page bits


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.6 08-Jun-2007 otto

Make disklabel(8) aware of the new fields, allowing for larger than
2T disks, partitions and offsets. ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.5 02-Mar-2007 krw

If a default label has been created with the -d command line option or
the 'D' editor command and has not been written to disk when the user
issues the 'q' editor command, ask if the label should be written to
disk before exiting.


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.4 07-Jan-2005 otto

Print disk size and free space in requested unit. Some refactoring to
avoid code duplication as well. ok marco@ deraadt@


# 1.3 01-Oct-2004 jsg

add some missing $, ok djm@ 'That looks fine to me' millert@


# 1.2 28-Sep-2004 otto

Tidy disklabel output for todays big disks. Based on a diff from f
at obiit dot org in PR 3847. ok tedu@ deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.1 02-Jul-2003 deraadt

missing protos


# 1.34 18-Feb-2022 krw

Move prototypes for checklabel(), readlabel() and parselabel()
into disklabel.c since editor.c and dkcksum.c have no need to
know.


# 1.33 18-Feb-2022 krw

No need for makebootarea() prototype as makebootarea() perished with NUMBOOT in
2015 (r1.211).


Revision tags: OPENBSD_6_5_BASE OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE OPENBSD_7_0_BASE
# 1.32 31-Mar-2019 krw

Enhance prompt shown during -E label editing. Always
display the disk device whose label is being
edited. Change '>' to '#' when in expert mode.


Revision tags: OPENBSD_6_4_BASE
# 1.31 03-Jul-2018 krw

No need for print_unit to be a global.

ok otto@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.30 29-Sep-2017 otto

don't be silent on auto-allocation failure in write mode. ok millert@ krw@


Revision tags: OPENBSD_6_1_BASE
# 1.29 04-Mar-2017 otto

Allow R (resize auto-partition) after A as well as when started with -A.
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@


Revision tags: OPENBSD_6_0_BASE
# 1.28 19-Jun-2016 tb

Split readlabel() into two functions, readlabel() and parselabel(), and
pledge in-between the two funtion calls. The new readlabel() only does
a DIOC*DINFO ioctl, making sure the fd points to a disk, while
parselabel() does the scary string manipulations. In the makelabel()
code path do an early DIOCGDINFO before pledge. This fixes yet another
pledge problem (disklabel -w /dev/tty floppy576).

Some of this was discussed with beck.

ok semarie, earlier version ok deraadt


Revision tags: OPENBSD_5_9_BASE
# 1.27 17-Oct-2015 krw

NUMBOOT is dead! Nuke the variables and abstractions that were used
to build boot blocks.

ok miod@


Revision tags: OPENBSD_5_8_BASE
# 1.26 29-Apr-2015 henning

support passing a template file for the auto-allocation to disklabel.
template gives mountpoints, min-max size ranges and percentage of disk
foremost intended for autoinstalls, installer bits to follow soon.
with input from many, ok theo


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.25 10-Jul-2014 florian

Forward declarations for mpcopy & mpfree.
OK miod@, deraadt@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.24 13-Jul-2012 krw

Replace a '512' with DEV_BSIZE. Calculate physmem size in blocks and
not sectors, since the values being tested/manipulated in the auto_alloc
tables are blocks at that point. Use MEG(256) instead of hand
expanding it when testing physmem.


Revision tags: OPENBSD_5_1_BASE
# 1.23 16-Jan-2012 krw

Nuke unused parameter (f) to makebootarea(). Unused since r1.123
(2008), when '-r' support was removed. Spotted by jsg@ with the
assistance of clang.


Revision tags: OPENBSD_5_0_BASE
# 1.22 16-Apr-2011 krw

Add '-F'. Same as '-f' but uses DUIDs when writing the mount point
information to the specified file. After every label write, read the
label to get current UID info.

Some internal code cleanup with no intended functional change.

ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.21 24-Nov-2010 jsing

When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.

ok krw@


# 1.20 23-Sep-2010 jsing

Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function.

ok krw@


# 1.19 12-Aug-2010 tedu

fix a few warnings. ok jsing


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 07-Aug-2009 martynas

move editor_allocspace & mpsave out to extern.h so that disklabel.c
gets the declarations it uses. ok krw@


Revision tags: OPENBSD_4_6_BASE
# 1.17 04-Jun-2009 deraadt

Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn


# 1.16 02-Jun-2009 krw

Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.

Prodded & ok deraadt@, verbiage tweaks from jmc@


# 1.15 18-Apr-2009 sthen

Alexander Hall points out that disklabel -AE <disk> followed by quitting
without making manual changes does not ask whether you'd like to save the
new automatic disklabel. Change to follow the behaviour of -d and ask
every time. ok krw@.


# 1.14 12-Apr-2009 krw

When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.


# 1.13 11-Apr-2009 krw

readlabel() either errored out or returned a pointer to the global
'lab'. So there is no need for the return value. Just use &lab
wherever it was used. No functional change.

Slightly different version read ok to blambert@


# 1.12 10-Apr-2009 krw

Re-work '-A' so that it sets a flag that -E and -w use, and which will
just display the auto-allocation plan otherwise. Don't overwrite any
spoofed partitions, insert auto allocated partitions where we can.

This is much more install script and weird architecture friendly. I'm
talking about you, macppc.

Many suggestions and code from otto@, feedback from many, cattle
prod applied by deraadt@.

ok deraadt@
"if it works for >8GB ... put it in" miod@
"to be clear, ok" todd@


# 1.11 29-Mar-2009 deraadt

otto points out that the -v printing changes are incompatible with the
expectation that -R will read the output of disklabel. I suspect we
will find another way to do this; ok otto


# 1.10 28-Mar-2009 krw

Move some output under the control of the '-v' flag. In particular only
display the partition info by default as is done in the E(ditor). The
physical info is now only displayed if '-v' is specified.

ok deraadt@


# 1.9 22-Mar-2009 krw

Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space
on the disk into a reasonable partition scheme for a root disk.

Feedback from several, time to work on it in-tree.

Prodded (repeatedly) by and ok deraadt@


Revision tags: OPENBSD_4_5_BASE
# 1.8 11-Jan-2009 miod

On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.

ok krw@


Revision tags: OPENBSD_4_4_BASE
# 1.7 25-Jun-2008 otto

In interactive mode, always suggest offsets and sizes inside the
OpenBSD area and change the 'p' command to only print the boundaries
and size of the OpenBSD area and the free space within that area.
Introduce a 'l' command to print the header only. With krw@; ok krw@
deraadt@; jmc@ for the man page bits


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.6 08-Jun-2007 otto

Make disklabel(8) aware of the new fields, allowing for larger than
2T disks, partitions and offsets. ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.5 02-Mar-2007 krw

If a default label has been created with the -d command line option or
the 'D' editor command and has not been written to disk when the user
issues the 'q' editor command, ask if the label should be written to
disk before exiting.


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.4 07-Jan-2005 otto

Print disk size and free space in requested unit. Some refactoring to
avoid code duplication as well. ok marco@ deraadt@


# 1.3 01-Oct-2004 jsg

add some missing $, ok djm@ 'That looks fine to me' millert@


# 1.2 28-Sep-2004 otto

Tidy disklabel output for todays big disks. Based on a diff from f
at obiit dot org in PR 3847. ok tedu@ deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.1 02-Jul-2003 deraadt

missing protos


Revision tags: OPENBSD_6_5_BASE
# 1.32 31-Mar-2019 krw

Enhance prompt shown during -E label editing. Always
display the disk device whose label is being
edited. Change '>' to '#' when in expert mode.


Revision tags: OPENBSD_6_4_BASE
# 1.31 03-Jul-2018 krw

No need for print_unit to be a global.

ok otto@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.30 29-Sep-2017 otto

don't be silent on auto-allocation failure in write mode. ok millert@ krw@


Revision tags: OPENBSD_6_1_BASE
# 1.29 04-Mar-2017 otto

Allow R (resize auto-partition) after A as well as when started with -A.
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@


Revision tags: OPENBSD_6_0_BASE
# 1.28 19-Jun-2016 tb

Split readlabel() into two functions, readlabel() and parselabel(), and
pledge in-between the two funtion calls. The new readlabel() only does
a DIOC*DINFO ioctl, making sure the fd points to a disk, while
parselabel() does the scary string manipulations. In the makelabel()
code path do an early DIOCGDINFO before pledge. This fixes yet another
pledge problem (disklabel -w /dev/tty floppy576).

Some of this was discussed with beck.

ok semarie, earlier version ok deraadt


Revision tags: OPENBSD_5_9_BASE
# 1.27 17-Oct-2015 krw

NUMBOOT is dead! Nuke the variables and abstractions that were used
to build boot blocks.

ok miod@


Revision tags: OPENBSD_5_8_BASE
# 1.26 29-Apr-2015 henning

support passing a template file for the auto-allocation to disklabel.
template gives mountpoints, min-max size ranges and percentage of disk
foremost intended for autoinstalls, installer bits to follow soon.
with input from many, ok theo


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.25 10-Jul-2014 florian

Forward declarations for mpcopy & mpfree.
OK miod@, deraadt@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.24 13-Jul-2012 krw

Replace a '512' with DEV_BSIZE. Calculate physmem size in blocks and
not sectors, since the values being tested/manipulated in the auto_alloc
tables are blocks at that point. Use MEG(256) instead of hand
expanding it when testing physmem.


Revision tags: OPENBSD_5_1_BASE
# 1.23 16-Jan-2012 krw

Nuke unused parameter (f) to makebootarea(). Unused since r1.123
(2008), when '-r' support was removed. Spotted by jsg@ with the
assistance of clang.


Revision tags: OPENBSD_5_0_BASE
# 1.22 16-Apr-2011 krw

Add '-F'. Same as '-f' but uses DUIDs when writing the mount point
information to the specified file. After every label write, read the
label to get current UID info.

Some internal code cleanup with no intended functional change.

ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.21 24-Nov-2010 jsing

When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.

ok krw@


# 1.20 23-Sep-2010 jsing

Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function.

ok krw@


# 1.19 12-Aug-2010 tedu

fix a few warnings. ok jsing


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 07-Aug-2009 martynas

move editor_allocspace & mpsave out to extern.h so that disklabel.c
gets the declarations it uses. ok krw@


Revision tags: OPENBSD_4_6_BASE
# 1.17 04-Jun-2009 deraadt

Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn


# 1.16 02-Jun-2009 krw

Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.

Prodded & ok deraadt@, verbiage tweaks from jmc@


# 1.15 18-Apr-2009 sthen

Alexander Hall points out that disklabel -AE <disk> followed by quitting
without making manual changes does not ask whether you'd like to save the
new automatic disklabel. Change to follow the behaviour of -d and ask
every time. ok krw@.


# 1.14 12-Apr-2009 krw

When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.


# 1.13 11-Apr-2009 krw

readlabel() either errored out or returned a pointer to the global
'lab'. So there is no need for the return value. Just use &lab
wherever it was used. No functional change.

Slightly different version read ok to blambert@


# 1.12 10-Apr-2009 krw

Re-work '-A' so that it sets a flag that -E and -w use, and which will
just display the auto-allocation plan otherwise. Don't overwrite any
spoofed partitions, insert auto allocated partitions where we can.

This is much more install script and weird architecture friendly. I'm
talking about you, macppc.

Many suggestions and code from otto@, feedback from many, cattle
prod applied by deraadt@.

ok deraadt@
"if it works for >8GB ... put it in" miod@
"to be clear, ok" todd@


# 1.11 29-Mar-2009 deraadt

otto points out that the -v printing changes are incompatible with the
expectation that -R will read the output of disklabel. I suspect we
will find another way to do this; ok otto


# 1.10 28-Mar-2009 krw

Move some output under the control of the '-v' flag. In particular only
display the partition info by default as is done in the E(ditor). The
physical info is now only displayed if '-v' is specified.

ok deraadt@


# 1.9 22-Mar-2009 krw

Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space
on the disk into a reasonable partition scheme for a root disk.

Feedback from several, time to work on it in-tree.

Prodded (repeatedly) by and ok deraadt@


Revision tags: OPENBSD_4_5_BASE
# 1.8 11-Jan-2009 miod

On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.

ok krw@


Revision tags: OPENBSD_4_4_BASE
# 1.7 25-Jun-2008 otto

In interactive mode, always suggest offsets and sizes inside the
OpenBSD area and change the 'p' command to only print the boundaries
and size of the OpenBSD area and the free space within that area.
Introduce a 'l' command to print the header only. With krw@; ok krw@
deraadt@; jmc@ for the man page bits


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.6 08-Jun-2007 otto

Make disklabel(8) aware of the new fields, allowing for larger than
2T disks, partitions and offsets. ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.5 02-Mar-2007 krw

If a default label has been created with the -d command line option or
the 'D' editor command and has not been written to disk when the user
issues the 'q' editor command, ask if the label should be written to
disk before exiting.


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.4 07-Jan-2005 otto

Print disk size and free space in requested unit. Some refactoring to
avoid code duplication as well. ok marco@ deraadt@


# 1.3 01-Oct-2004 jsg

add some missing $, ok djm@ 'That looks fine to me' millert@


# 1.2 28-Sep-2004 otto

Tidy disklabel output for todays big disks. Based on a diff from f
at obiit dot org in PR 3847. ok tedu@ deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.1 02-Jul-2003 deraadt

missing protos


# 1.31 03-Jul-2018 krw

No need for print_unit to be a global.

ok otto@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
# 1.30 29-Sep-2017 otto

don't be silent on auto-allocation failure in write mode. ok millert@ krw@


Revision tags: OPENBSD_6_1_BASE
# 1.29 04-Mar-2017 otto

Allow R (resize auto-partition) after A as well as when started with -A.
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@


Revision tags: OPENBSD_6_0_BASE
# 1.28 19-Jun-2016 tb

Split readlabel() into two functions, readlabel() and parselabel(), and
pledge in-between the two funtion calls. The new readlabel() only does
a DIOC*DINFO ioctl, making sure the fd points to a disk, while
parselabel() does the scary string manipulations. In the makelabel()
code path do an early DIOCGDINFO before pledge. This fixes yet another
pledge problem (disklabel -w /dev/tty floppy576).

Some of this was discussed with beck.

ok semarie, earlier version ok deraadt


Revision tags: OPENBSD_5_9_BASE
# 1.27 17-Oct-2015 krw

NUMBOOT is dead! Nuke the variables and abstractions that were used
to build boot blocks.

ok miod@


Revision tags: OPENBSD_5_8_BASE
# 1.26 29-Apr-2015 henning

support passing a template file for the auto-allocation to disklabel.
template gives mountpoints, min-max size ranges and percentage of disk
foremost intended for autoinstalls, installer bits to follow soon.
with input from many, ok theo


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.25 10-Jul-2014 florian

Forward declarations for mpcopy & mpfree.
OK miod@, deraadt@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.24 13-Jul-2012 krw

Replace a '512' with DEV_BSIZE. Calculate physmem size in blocks and
not sectors, since the values being tested/manipulated in the auto_alloc
tables are blocks at that point. Use MEG(256) instead of hand
expanding it when testing physmem.


Revision tags: OPENBSD_5_1_BASE
# 1.23 16-Jan-2012 krw

Nuke unused parameter (f) to makebootarea(). Unused since r1.123
(2008), when '-r' support was removed. Spotted by jsg@ with the
assistance of clang.


Revision tags: OPENBSD_5_0_BASE
# 1.22 16-Apr-2011 krw

Add '-F'. Same as '-f' but uses DUIDs when writing the mount point
information to the specified file. After every label write, read the
label to get current UID info.

Some internal code cleanup with no intended functional change.

ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.21 24-Nov-2010 jsing

When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.

ok krw@


# 1.20 23-Sep-2010 jsing

Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function.

ok krw@


# 1.19 12-Aug-2010 tedu

fix a few warnings. ok jsing


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 07-Aug-2009 martynas

move editor_allocspace & mpsave out to extern.h so that disklabel.c
gets the declarations it uses. ok krw@


Revision tags: OPENBSD_4_6_BASE
# 1.17 04-Jun-2009 deraadt

Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn


# 1.16 02-Jun-2009 krw

Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.

Prodded & ok deraadt@, verbiage tweaks from jmc@


# 1.15 18-Apr-2009 sthen

Alexander Hall points out that disklabel -AE <disk> followed by quitting
without making manual changes does not ask whether you'd like to save the
new automatic disklabel. Change to follow the behaviour of -d and ask
every time. ok krw@.


# 1.14 12-Apr-2009 krw

When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.


# 1.13 11-Apr-2009 krw

readlabel() either errored out or returned a pointer to the global
'lab'. So there is no need for the return value. Just use &lab
wherever it was used. No functional change.

Slightly different version read ok to blambert@


# 1.12 10-Apr-2009 krw

Re-work '-A' so that it sets a flag that -E and -w use, and which will
just display the auto-allocation plan otherwise. Don't overwrite any
spoofed partitions, insert auto allocated partitions where we can.

This is much more install script and weird architecture friendly. I'm
talking about you, macppc.

Many suggestions and code from otto@, feedback from many, cattle
prod applied by deraadt@.

ok deraadt@
"if it works for >8GB ... put it in" miod@
"to be clear, ok" todd@


# 1.11 29-Mar-2009 deraadt

otto points out that the -v printing changes are incompatible with the
expectation that -R will read the output of disklabel. I suspect we
will find another way to do this; ok otto


# 1.10 28-Mar-2009 krw

Move some output under the control of the '-v' flag. In particular only
display the partition info by default as is done in the E(ditor). The
physical info is now only displayed if '-v' is specified.

ok deraadt@


# 1.9 22-Mar-2009 krw

Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space
on the disk into a reasonable partition scheme for a root disk.

Feedback from several, time to work on it in-tree.

Prodded (repeatedly) by and ok deraadt@


Revision tags: OPENBSD_4_5_BASE
# 1.8 11-Jan-2009 miod

On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.

ok krw@


Revision tags: OPENBSD_4_4_BASE
# 1.7 25-Jun-2008 otto

In interactive mode, always suggest offsets and sizes inside the
OpenBSD area and change the 'p' command to only print the boundaries
and size of the OpenBSD area and the free space within that area.
Introduce a 'l' command to print the header only. With krw@; ok krw@
deraadt@; jmc@ for the man page bits


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.6 08-Jun-2007 otto

Make disklabel(8) aware of the new fields, allowing for larger than
2T disks, partitions and offsets. ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.5 02-Mar-2007 krw

If a default label has been created with the -d command line option or
the 'D' editor command and has not been written to disk when the user
issues the 'q' editor command, ask if the label should be written to
disk before exiting.


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.4 07-Jan-2005 otto

Print disk size and free space in requested unit. Some refactoring to
avoid code duplication as well. ok marco@ deraadt@


# 1.3 01-Oct-2004 jsg

add some missing $, ok djm@ 'That looks fine to me' millert@


# 1.2 28-Sep-2004 otto

Tidy disklabel output for todays big disks. Based on a diff from f
at obiit dot org in PR 3847. ok tedu@ deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.1 02-Jul-2003 deraadt

missing protos


Revision tags: OPENBSD_6_2_BASE
# 1.30 29-Sep-2017 otto

don't be silent on auto-allocation failure in write mode. ok millert@ krw@


Revision tags: OPENBSD_6_1_BASE
# 1.29 04-Mar-2017 otto

Allow R (resize auto-partition) after A as well as when started with -A.
This ability was lost in editor.c 1.264; noted by ajacoutot@; ok krw@


Revision tags: OPENBSD_6_0_BASE
# 1.28 19-Jun-2016 tb

Split readlabel() into two functions, readlabel() and parselabel(), and
pledge in-between the two funtion calls. The new readlabel() only does
a DIOC*DINFO ioctl, making sure the fd points to a disk, while
parselabel() does the scary string manipulations. In the makelabel()
code path do an early DIOCGDINFO before pledge. This fixes yet another
pledge problem (disklabel -w /dev/tty floppy576).

Some of this was discussed with beck.

ok semarie, earlier version ok deraadt


Revision tags: OPENBSD_5_9_BASE
# 1.27 17-Oct-2015 krw

NUMBOOT is dead! Nuke the variables and abstractions that were used
to build boot blocks.

ok miod@


Revision tags: OPENBSD_5_8_BASE
# 1.26 29-Apr-2015 henning

support passing a template file for the auto-allocation to disklabel.
template gives mountpoints, min-max size ranges and percentage of disk
foremost intended for autoinstalls, installer bits to follow soon.
with input from many, ok theo


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE
# 1.25 10-Jul-2014 florian

Forward declarations for mpcopy & mpfree.
OK miod@, deraadt@


Revision tags: OPENBSD_5_2_BASE OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
# 1.24 13-Jul-2012 krw

Replace a '512' with DEV_BSIZE. Calculate physmem size in blocks and
not sectors, since the values being tested/manipulated in the auto_alloc
tables are blocks at that point. Use MEG(256) instead of hand
expanding it when testing physmem.


Revision tags: OPENBSD_5_1_BASE
# 1.23 16-Jan-2012 krw

Nuke unused parameter (f) to makebootarea(). Unused since r1.123
(2008), when '-r' support was removed. Spotted by jsg@ with the
assistance of clang.


Revision tags: OPENBSD_5_0_BASE
# 1.22 16-Apr-2011 krw

Add '-F'. Same as '-f' but uses DUIDs when writing the mount point
information to the specified file. After every label write, read the
label to get current UID info.

Some internal code cleanup with no intended functional change.

ok deraadt@


Revision tags: OPENBSD_4_9_BASE
# 1.21 24-Nov-2010 jsing

When dealing with disklabel UIDs (DUIDs) be specific and consistent with
naming.

ok krw@


# 1.20 23-Sep-2010 jsing

Print disklabel UIDs using printf/fprintf instead of using the hand rolled
uid_print() function.

ok krw@


# 1.19 12-Aug-2010 tedu

fix a few warnings. ok jsing


Revision tags: OPENBSD_4_7_BASE OPENBSD_4_8_BASE
# 1.18 07-Aug-2009 martynas

move editor_allocspace & mpsave out to extern.h so that disklabel.c
gets the declarations it uses. ok krw@


Revision tags: OPENBSD_4_6_BASE
# 1.17 04-Jun-2009 deraadt

Recycle four ancient fields in the disklabel structure, replacing them with
bounds information, ie. the zone of the disk that OpenBSD can use. Have each
pre-disklabel parser (MBR, DPME, or per-arch MD disklabel parsers) figure out
this area and pass it up to userland. Then, delete all the same disk parsing
code from disklabel(8) since the kernel passes it up. Lots and lots of - signs
in the disklabel(8) code.
Tested on as many platforms as possible, the fallout will be repaired as time
goes on. To test, use disklabel -d <drive> and validate that the bounds do not
overlap any boot blocks. This same information is used by disklabel -A...
OK for the concept from krw, miod, and drahn


# 1.16 02-Jun-2009 krw

Add '-h' flag, and '*' as a unit specifier for 'p' Editor command.
Both cause partition sizes to be displayed using a human readable
format with the units automatically chosen by looking at the smallest
partition in the disk label. Remove forceable humanization in 'A'
code and use '-h' in install scripts.

Prodded & ok deraadt@, verbiage tweaks from jmc@


# 1.15 18-Apr-2009 sthen

Alexander Hall points out that disklabel -AE <disk> followed by quitting
without making manual changes does not ask whether you'd like to save the
new automatic disklabel. Change to follow the behaviour of -d and ask
every time. ok krw@.


# 1.14 12-Apr-2009 krw

When auto-allocating, check the size of the disk and display
offset/size information in MB if the disk is <10G, and in GB
otherwise. '-p' will override this default.


# 1.13 11-Apr-2009 krw

readlabel() either errored out or returned a pointer to the global
'lab'. So there is no need for the return value. Just use &lab
wherever it was used. No functional change.

Slightly different version read ok to blambert@


# 1.12 10-Apr-2009 krw

Re-work '-A' so that it sets a flag that -E and -w use, and which will
just display the auto-allocation plan otherwise. Don't overwrite any
spoofed partitions, insert auto allocated partitions where we can.

This is much more install script and weird architecture friendly. I'm
talking about you, macppc.

Many suggestions and code from otto@, feedback from many, cattle
prod applied by deraadt@.

ok deraadt@
"if it works for >8GB ... put it in" miod@
"to be clear, ok" todd@


# 1.11 29-Mar-2009 deraadt

otto points out that the -v printing changes are incompatible with the
expectation that -R will read the output of disklabel. I suspect we
will find another way to do this; ok otto


# 1.10 28-Mar-2009 krw

Move some output under the control of the '-v' flag. In particular only
display the partition info by default as is done in the E(ditor). The
physical info is now only displayed if '-v' is specified.

ok deraadt@


# 1.9 22-Mar-2009 krw

Add 'A' command to Editor mode, and -A flag to automatically execute it
on disks without an existing label. The 'A' command allocates all space
on the disk into a reasonable partition scheme for a root disk.

Feedback from several, time to work on it in-tree.

Prodded (repeatedly) by and ok deraadt@


Revision tags: OPENBSD_4_5_BASE
# 1.8 11-Jan-2009 miod

On *ppc disks shared with MacOS, walk the Apple partition map to find out
the bounds of the OpenBSD area. Should prevent users from shooting themselves
in the feet.

ok krw@


Revision tags: OPENBSD_4_4_BASE
# 1.7 25-Jun-2008 otto

In interactive mode, always suggest offsets and sizes inside the
OpenBSD area and change the 'p' command to only print the boundaries
and size of the OpenBSD area and the free space within that area.
Introduce a 'l' command to print the header only. With krw@; ok krw@
deraadt@; jmc@ for the man page bits


Revision tags: OPENBSD_4_2_BASE OPENBSD_4_3_BASE
# 1.6 08-Jun-2007 otto

Make disklabel(8) aware of the new fields, allowing for larger than
2T disks, partitions and offsets. ok deraadt@


Revision tags: OPENBSD_4_1_BASE
# 1.5 02-Mar-2007 krw

If a default label has been created with the -d command line option or
the 'D' editor command and has not been written to disk when the user
issues the 'q' editor command, ask if the label should be written to
disk before exiting.


Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE OPENBSD_4_0_BASE
# 1.4 07-Jan-2005 otto

Print disk size and free space in requested unit. Some refactoring to
avoid code duplication as well. ok marco@ deraadt@


# 1.3 01-Oct-2004 jsg

add some missing $, ok djm@ 'That looks fine to me' millert@


# 1.2 28-Sep-2004 otto

Tidy disklabel output for todays big disks. Based on a diff from f
at obiit dot org in PR 3847. ok tedu@ deraadt@ millert@


Revision tags: OPENBSD_3_4_BASE OPENBSD_3_5_BASE OPENBSD_3_6_BASE
# 1.1 02-Jul-2003 deraadt

missing protos