History log of /netbsd-current/sbin/gpt/gpt.h
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.44 20-Nov-2022 mlelstv

Fix destroying and moving GPT header also for truncated/extended
images.


# 1.43 16-Jul-2022 mlelstv

Whitespace


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.42 24-May-2020 jmcneill

Add -H flag to ignore existing MBR (Hybrid MBR/GPT mode).


Revision tags: netbsd-9-3-RELEASE netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.41 30-Jun-2019 sevan

Add rcsid


# 1.40 25-Jun-2019 jnemeth

Add gpt_change_hdr() similar to gpt_change_ent() for changing
arbitrary header fields.


# 1.39 21-Jun-2019 jnemeth

Add a third argument to the "cfn" function that is an argument to
gpt_change_ent(). The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry. It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

branches: 1.37.2;
Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.43 16-Jul-2022 mlelstv

Whitespace


Revision tags: cjep_sun2x-base1 cjep_sun2x-base cjep_staticlib_x-base1 cjep_staticlib_x-base
# 1.42 24-May-2020 jmcneill

Add -H flag to ignore existing MBR (Hybrid MBR/GPT mode).


Revision tags: netbsd-9-2-RELEASE netbsd-9-1-RELEASE phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.41 30-Jun-2019 sevan

Add rcsid


# 1.40 25-Jun-2019 jnemeth

Add gpt_change_hdr() similar to gpt_change_ent() for changing
arbitrary header fields.


# 1.39 21-Jun-2019 jnemeth

Add a third argument to the "cfn" function that is an argument to
gpt_change_ent(). The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry. It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

branches: 1.37.2;
Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.42 24-May-2020 jmcneill

Add -H flag to ignore existing MBR (Hybrid MBR/GPT mode).


Revision tags: phil-wifi-20200421 phil-wifi-20200411 is-mlppp-base phil-wifi-20200406 netbsd-9-0-RELEASE netbsd-9-0-RC2 netbsd-9-0-RC1 phil-wifi-20191119 netbsd-9-base
# 1.41 30-Jun-2019 sevan

Add rcsid


# 1.40 25-Jun-2019 jnemeth

Add gpt_change_hdr() similar to gpt_change_ent() for changing
arbitrary header fields.


# 1.39 21-Jun-2019 jnemeth

Add a third argument to the "cfn" function that is an argument to
gpt_change_ent(). The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry. It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

branches: 1.37.2;
Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.41 30-Jun-2019 sevan

Add rcsid


# 1.40 25-Jun-2019 jnemeth

Add gpt_change_hdr() similar to gpt_change_ent() for changing
arbitrary header fields.


# 1.39 21-Jun-2019 jnemeth

Add a third argument to the "cfn" function that is an argument to
gpt_change_ent(). The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry. It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

branches: 1.37.2;
Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.40 25-Jun-2019 jnemeth

Add gpt_change_hdr() similar to gpt_change_ent() for changing
arbitrary header fields.


# 1.39 21-Jun-2019 jnemeth

Add a third argument to the "cfn" function that is an argument to
gpt_change_ent(). The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry. It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

branches: 1.37.2;
Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.39 21-Jun-2019 jnemeth

Add a third argument to the "cfn" function that is an argument to
gpt_change_ent(). The purpose of the third argument is to specify
whether the entry to be changed is a primary GPT entry or a secondary
GPT entry. It is assumed that a secondary GPT entry will always
follow a corresponding primary entry.

This is in preparation for an upcoming change that will require it.


Revision tags: phil-wifi-20190609 pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

branches: 1.37.2;
Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-compat-20190127 pgoyette-compat-20190118 pgoyette-compat-1226 pgoyette-compat-1126 pgoyette-compat-1020 pgoyette-compat-0930 pgoyette-compat-0906 pgoyette-compat-0728
# 1.38 03-Jul-2018 jnemeth

Not all things that write to the disk do something that dk(4) will
be interested in. Let individual commands decide if ioctl(DIOCMWEDGES)
should be done. I was conservative and set the flag on any command
that might create/modify/delete partitions in any way.


Revision tags: phil-wifi-base pgoyette-compat-0625 pgoyette-compat-0521 pgoyette-compat-0502 pgoyette-compat-0422 pgoyette-compat-0415 pgoyette-compat-0407 pgoyette-compat-0330 pgoyette-compat-0322
# 1.37 19-Mar-2018 mlelstv

Check device parameter to avoid segfaults. Agument synopsis for -l option.


Revision tags: pgoyette-compat-0315 pgoyette-compat-base
# 1.36 06-Sep-2017 christos

branches: 1.36.2;
- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: matt-nb8-mediatek-base perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

branches: 1.35.4;
allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.36 06-Sep-2017 christos

- make sure that the utf16 string is padded with 0's where needed.
- since the utf16 string is not 0 terminated, pass the size of the string.


Revision tags: perseant-stdc-iso10646-base netbsd-8-base prg-localcount2-base3 prg-localcount2-base2 prg-localcount2-base1 prg-localcount2-base pgoyette-localcount-20170426 bouyer-socketcan-base1 pgoyette-localcount-20170320
# 1.35 16-Feb-2017 christos

allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

branches: 1.33.2; 1.33.4;
PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


# 1.35 16-Feb-2017 christos

allow 0 timestamp


# 1.34 16-Feb-2017 christos

Add -T timestamp for reproducible builds.


Revision tags: bouyer-socketcan-base pgoyette-localcount-20170107 pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision


Revision tags: pgoyette-localcount-20161104 localcount-20160914 pgoyette-localcount-20160806 pgoyette-localcount-20160726 pgoyette-localcount-base
# 1.33 09-Jun-2016 christos

PR/51230: Add the ability to set the active flag in the PMBR.


# 1.32 29-Dec-2015 christos

- add more informational messages
- handle case where last argument is an option not a device (set -l)


# 1.31 06-Dec-2015 christos

Add listing commands for type, set and unset.
Add help and formatting for set and unset.
Change show to print all the attribute info in one line.


# 1.30 04-Dec-2015 christos

Fix resizedisk.


# 1.29 04-Dec-2015 christos

don't print dkctl message for files
fix typo


# 1.28 03-Dec-2015 christos

WARNS=6


# 1.27 02-Dec-2015 christos

refactor the utf code so that it does not leak memory.


# 1.26 01-Dec-2015 christos

merge command line parsers and check all memory allocations.


# 1.25 01-Dec-2015 christos

refactor more duplicated code.


# 1.24 01-Dec-2015 christos

Refactor the command dispatching and help printing logic.


# 1.23 01-Dec-2015 christos

Firs step of refactoring, remove all globals, factor out some common code,
handle alternate usage but not advertise it.


# 1.22 30-Nov-2015 christos

- automatically sync the wedge information unless -n is specified.
- document the general options in the traditional way.
- split the main program into a separate file.


# 1.21 29-Nov-2015 christos

Remove getdisksize support; we either have the ioctls (current/-7) or we
don't (non-netbsd-current/7+tools).


# 1.20 29-Nov-2015 christos

merge the create errors in one place and fix them.


# 1.19 03-Nov-2015 jnemeth

Add a "header" subcommand that displays information about the size of
the disk along with information from the GPT header if it exists.


# 1.18 29-Dec-2014 christos

Factor out the getdisksize() drvctl method, and provide an alternative that
directly uses the disk ioctl's instead of relying on the drvctl device driver
which is currently not mandatory.


# 1.17 17-Nov-2014 mlelstv

handle constness better


# 1.16 30-Sep-2014 christos

Add internal uuid support, since the linux+macos versions of the library
are different than than *bsd ones, and others might not have it at all.


# 1.15 30-Sep-2014 christos

remove compat defines.


# 1.14 29-Sep-2014 christos

more toolification changes


# 1.13 28-Sep-2014 jnemeth

PR/44218 - David Young -- add "type" subcommand to change a partition type


# 1.12 23-Sep-2014 jnemeth

- make gpt_gpt() available for use directly by subcommands
- create new resizedisk disk subcommand for relocating backup GPT


Revision tags: netbsd-7-base tls-maxphys-base
# 1.11 10-Aug-2014 jnemeth

branches: 1.11.2;
Add restore subcommand.

XXX It does not actually work yet. It is being committed now to make
later pullups easier.


Revision tags: yamt-pagecache-base9 tls-earlyentropy-base riastradh-xf86-video-intel-2-7-1-pre-2-21-15 riastradh-drm2-base3
# 1.10 19-Dec-2013 jnemeth

Add the backup subcommand. It dumps the contents of the partition
tables as a plist, which is readable by the restore subcommand.

XXX restore subcommand forthcoming


# 1.9 09-Dec-2013 jnemeth

Add two new subcommands, "set" and "unset". These were inspired by
FreeBSD's gpart(8), but the code is all mine. The purpose of these
is to set and unset partition attributes.


# 1.8 27-Nov-2013 jnemeth

Remove FreeBSD specific code as per message to tech-userlevel.


# 1.7 20-Nov-2013 jnemeth

Add a resize command. This command was inspired by FreeBSD's gpart(8),
but the code was written by myself.


Revision tags: riastradh-drm2-base2 riastradh-drm2-base1 riastradh-drm2-base
# 1.6 13-Apr-2013 jakllsch

Clean up gpt(8) a bit more

uuid_create_nil(3) and uuid_is_nil(3) take a uuid_t*, not a pointer to
an array of bytes merely casted to compatible type.

Additonally, there no need for extra casts and address-of operations when
using le_uuid_*() functions.

Furthermore, le_uuid_*() are identical to uuid_*_le functions in
libc/libuuid, so use those instead on NetBSD.


Revision tags: netbsd-6-0-6-RELEASE netbsd-6-1-5-RELEASE yamt-pagecache-tag8 netbsd-6-1-4-RELEASE netbsd-6-0-5-RELEASE netbsd-6-1-3-RELEASE netbsd-6-0-4-RELEASE netbsd-6-1-2-RELEASE netbsd-6-0-3-RELEASE netbsd-6-1-1-RELEASE netbsd-6-0-2-RELEASE netbsd-6-1-RELEASE netbsd-6-1-RC4 netbsd-6-1-RC3 agc-symver-base netbsd-6-1-RC2 netbsd-6-1-RC1 yamt-pagecache-base8 netbsd-6-0-1-RELEASE yamt-pagecache-base7 matt-nb6-plus-nbase yamt-pagecache-base6 netbsd-6-0-RELEASE netbsd-6-0-RC2 matt-nb6-plus-base netbsd-6-0-RC1 yamt-pagecache-base5 yamt-pagecache-base4 netbsd-6-base yamt-pagecache-base3 yamt-pagecache-base2 yamt-pagecache-base cherry-xenmp-base bouyer-quota2-nbase bouyer-quota2-base
# 1.5 06-Jan-2011 jakllsch

branches: 1.5.6; 1.5.12;
Support booting from GPT-partioned disks on PC-BIOS-compatible systems.

Much of the work in this commit was done by Mike Volokhov during GSoC 2009.


Revision tags: matt-mips64-premerge-20101231 matt-premerge-20091211 jym-xensuspend-nbase jym-xensuspend-base
# 1.4 07-Feb-2009 uebayasi

Let 'gpt add' suggest a collect device name so that opendisk(3) called by
dkctl(8) succeeds.


Revision tags: mjf-devfs2-base
# 1.3 12-Nov-2008 thorpej

Don't use sizeof(struct gpt_hdr). It will pad the structure on x86-64,
which causes some systems to reject the GPT.

kern/38997


Revision tags: netbsd-5-base matt-mips64-base2 netbsd-4-0-1-RELEASE wrstuden-revivesa-base-3 wrstuden-revivesa-base-2 wrstuden-fixsa-newbase wrstuden-revivesa-base-1 yamt-pf42-base4 yamt-pf42-base3 hpcarm-cleanup-nbase yamt-pf42-baseX yamt-pf42-base2 wrstuden-revivesa-base yamt-pf42-base keiichi-mipv6-base matt-armv6-nbase matt-armv6-prevmlocking wrstuden-fixsa-base-1 netbsd-4-0-RELEASE cube-autoconf-base mjf-devfs-base netbsd-4-0-RC5 netbsd-4-0-RC4 netbsd-4-0-RC3 netbsd-4-0-RC2 netbsd-4-0-RC1 matt-armv6-base matt-mips64-base hpcarm-cleanup-base wrstuden-fixsa-base netbsd-4-base
# 1.2 15-Oct-2006 christos

branches: 1.2.18; 1.2.26;
Make this work under NetBSD.


# 1.1 15-Oct-2006 christos

branches: 1.1.1;
Initial revision