From 0747e74be6aef95ef320a9044eb6558ac12ab4f6 Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Wed, 23 Jul 2014 01:16:49 +0200 Subject: [PATCH 01/56] Use the libncursesw5-dev ncurses.h instead of libncurses5-dev --- gptcurses.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gptcurses.cc b/gptcurses.cc index 6002077..93c5005 100644 --- a/gptcurses.cc +++ b/gptcurses.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "gptcurses.h" #include "support.h" From fbb1ae51400266f5fc79088d8ec61da808ab221e Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Wed, 23 Jul 2014 01:20:48 +0200 Subject: [PATCH 02/56] Exit on all failures and don't use a kernel dependent default gpt type Thanks James Page for the missing exit --- gdisk_test.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gdisk_test.sh b/gdisk_test.sh index 8c5d800..86c36fc 100755 --- a/gdisk_test.sh +++ b/gdisk_test.sh @@ -147,7 +147,7 @@ EOF ;; sgdisk) - $SGDISK_BIN $TEMP_DISK -${OPT_NEW} 1 -${OPT_CHANGE_NAME} 1:"${TEST_PART_DEFAULT_NAME}" + $SGDISK_BIN $TEMP_DISK -${OPT_NEW} 1 -${OPT_CHANGE_NAME} 1:"${TEST_PART_DEFAULT_NAME}" -${OPT_CHANGE_TYPE} 1:$TEST_PART_TYPE ;; esac @@ -311,6 +311,7 @@ EOF pretty_print "SUCCESS" "GUID of disk has been sucessfully changed" else pretty_print "FAILED" "GUID of disk is the same as the previous one" + exit 1 fi } From fd118a4e0cacae35eca81ca252d41269f416c693 Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Wed, 23 Jul 2014 01:28:29 +0200 Subject: [PATCH 03/56] All devices are characters devices on kFreeBSD --- diskio-unix.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/diskio-unix.cc b/diskio-unix.cc index 388a04d..35032d3 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -74,7 +74,8 @@ int DiskIO::OpenForRead(void) { if (fstat64(fd, &st) == 0) { if (S_ISDIR(st.st_mode)) cerr << "The specified path is a directory!\n"; -#if !defined(__FreeBSD__) && !defined(__APPLE__) +#if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) \ + && !defined(__APPLE__) else if (S_ISCHR(st.st_mode)) cerr << "The specified path is a character device!\n"; #endif From 50d3f8fcb214125c1d31c2955960615e9eab3d81 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Tue, 17 Mar 2015 19:45:46 -0400 Subject: [PATCH 04/56] Added README file for EFI binary. --- README-efi.txt | 132 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 132 insertions(+) create mode 100644 README-efi.txt diff --git a/README-efi.txt b/README-efi.txt new file mode 100644 index 0000000..fc5ef27 --- /dev/null +++ b/README-efi.txt @@ -0,0 +1,132 @@ +README for EFI version of GPT fdisk +=================================== + +GPT fdisk for EFI is a binary build of gdisk to run as a pre-boot EFI +application. It's OS-independent and may be used to check or recover +partition tables before installing or booting an OS. It may be used to +overcome boot problems caused by partition table damage or to prepare a +partition table prior to installing an OS. + +Installing GPT fdisk for EFI +---------------------------- + +The contents of this archive are: + +- COPYING -- The GNU GPL +- gdisk.html -- The gdisk man page, in HTML form +- gdisk_x64.efi -- The gdisk binary, built for EFI (x86-64 CPU) +- NEWS -- The GPT fdisk changelog +- README-efi.txt -- This file +- refind.cer -- The rEFInd public key, .cer (DER) form +- refind.crt -- The rEFInd public key, .crt form + +The gdisk_x64.efi binary included here is built using the UEFI GPT fdisk +library (https://sourceforge.net/p/uefigptfdisk/), which is a beta-level +partial C++ library for UEFI. To use it, you must copy it to your EFI +System Partition (ESP) or some other EFI-accessible location. Under Linux, +the ESP is usually one of the first two or three partitions on /dev/sda. +Under OS X, it's usually the first partition on /dev/disk0 (that is, +/dev/disk0s1). Under Windows, you can mount it to S: by typing "mountvol S: +/S" in an Administrator command prompt. In any of these cases, the +recommended location for gdisk_x64.efi is the EFI/tools directory on the +ESP. In that location, my rEFInd boot manager will detect the gdisk binary +and create a menu option to launch it. If you don't use rEFInd, you can +launch the program using an EFI shell, register it as a boot program with +your firmware, or configure your boot manager (GRUB, gummiboot, etc.) to +launch it. Note that boot LOADERS, such as SYSLINUX and ELILO, can't launch +gdisk. + +Alternatively, you can create a USB flash drive that will launch gdisk when +you boot from it. To do so, create a FAT filesystem on a partition on a USB +flash drive and copy gdisk_x64.efi to it as EFI/BOOT/bootx64.efi. (You'll +need to create the EFI/BOOT directory.) Some systems may require the FAT +filesystem to be flagged as an ESP (with a type code of EF00 in gdisk). You +can use your firmware's built-in boot manager to boot from the USB flash +drive. Some such boot managers present two options for booting USB flash +drives. If yours does this, select the option that includes the string +"UEFI" in the description. + +The gdisk_x64.efi binary is signed with the rEFInd Secure Boot key. Thus, +if you're launching a rEFInd that I've compiled and distributed myself, +gdisk should launch, too. If you're *NOT* running rEFInd but ARE using +Shim, you'll need to add the refind.cer file to your MOK list by using the +MokManager utility. If you're using Secure Boot and you've signed rEFInd +yourself, you'll need to sign gdisk_x64.efi yourself, too. Note that the +rEFInd PPA distributes unsigned binaries and signs them with a local key +stored in /etc/refind/keys. To copy and sign the gdisk_x64.efi binary, you +should type (as root or using sudo): + +sbsign --key /etc/refind.d/keys/refind_local.key \ + --cert /etc/refind.d/keys/refind.crt \ + --output /boot/efi/EFI/tooks/gdisk_x64.efi ./gdisk_x64.efi + +This command assumes you have local rEFInd keys stored in the locations +created by the rEFInd installation script. Substitute your own keys if +you've built them in some other way. Some distributions don't provide the +sbsign binary, so you may need to build it yourself. See the following page +for details: + +https://git.kernel.org/cgit/linux/kernel/git/jejb/sbsigntools.git/ + +Note that you do *NOT* need to sign gdisk if your computer doesn't use +Secure Boot or if you've disabled this feature. + +Using gdisk for EFI +------------------- + +The EFI version of gdisk is basically the same as using the Linux, OS X, or +other OS versions. One exception is that you do not specify a disk device +on the command line; gdisk for EFI instead displays a list of devices when +you launch and enables you to select one, as in: + +List of hard disks found: + 1: Disk EFI_HANDLE(3EB5DD98): 108423424 sectors, 51.7 GiB + Acpi(PNP0A03,0)/Pci(1|1)/Ata(Primary,Master) + 2: Disk EFI_HANDLE(3EB58289): 105456768 sectors, 50.3 GiB + Acpi(PNP0A03,0)/Pci(D|0)? + +Disk number (1-2): 2 + +Once you've selected your disk, it should operate in much the same way as +any other version of gdisk. (See the next section, though!) Some programs, +including my rEFInd boot manager, complain about the changed partition +table, even if you've made no changes. If you run into problems using other +programs or launching an OS immediately after running gdisk, reboot; that +should cause the firmware to re-load its partition table. + +Caveats +------- + +I've tested gdisk_x64.efi on several systems. It's worked fine for me on 4 +of 6 computers (5 of 7, counting VirtualBox). Two systems gave me problems, +though: + +* gdisk presented a never-ending list of options (as if receiving a + never-ending string of "?" or other unrecognized command characters) on a + 2014 MacBook Air. +* A computer based on an Intel DG43NB motherboard rebooted as soon as I + launched gdisk. + +Both computers have relatively old EFIs. (Despite its newness, the Mac has +a 1.10 EFI, as do all Macs, to the best of my knowledge.) Most of the +computers that worked had 2.31 EFIs, although one had a 2.10 EFI. + +The bottom line is that I can't guarantee that this binary will work on all +computers. It's conceivable that recompiling gdisk with the latest version +of the UEFI GPT fdisk library will help. Also, I haven't compiled a 32-bit +version, so if you have a 32-bit EFI, you'll have to compile it yourself or +do without. + +References +---------- + +The following sites have useful additional information: + +UEFI GPT fdisk: +https://sourceforge.net/projects/uefigptfdisk/ + +sbsigntools git repository: +https://git.kernel.org/cgit/linux/kernel/git/jejb/sbsigntools.git/ + +rEFInd: +http://www.rodsbooks.com/refind/ From 54f8fb17e64e09ca508d266356d9c6fd34a4fd4c Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Tue, 17 Mar 2015 19:46:05 -0400 Subject: [PATCH 05/56] Version 1.0.0 release! Added some type codes and the -O/--print-mbr option for sgdisk. --- NEWS | 27 +++++++++++++++++++++++++-- basicmbr.cc | 2 +- cgdisk.8 | 9 +++------ current.spec | 8 ++++---- diskio-unix.cc | 3 ++- fixparts.8 | 7 +++---- gdisk.8 | 7 +++---- gptcl.cc | 4 ++++ mbr.cc | 3 +++ mbr.h | 1 + parttypes.cc | 10 +++++++++- sgdisk.8 | 23 +++++++++++++++-------- support.cc | 14 +++++++++++++- support.h | 2 +- 14 files changed, 87 insertions(+), 33 deletions(-) diff --git a/NEWS b/NEWS index 96810c7..3d33cb3 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,29 @@ -0.8.11 (?/?/2014): +1.0.0 (3/16/2015): ------------------ +- I'm now building a binary package of gdisk_x64.efi, using the UEFI GPT + fdisk package. + +- Added partition type for OpenBSD data + (824CC7A0-36A8-11E3-890A-952519AD3F61/0xa601). Also mapped 0xa600 to the + FreeBSD disklabel type code (516E7CB4-6ECF-11D6-8FF8-00022D09712B). I'm + not sure that's 100% correct, but since I can't find references to an + OpenBSD disklabel GPT type code, it seems the best choice at the moment. + +- Added partition type for Windows Storage Spaces + (E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D/0x4202) + +- Added -O/--print-mbr option to sgdisk, enabling easier display of MBR + data structures without invoking gdisk. + +- Updated warning message: "EBR describes a logical partition" now reads + "EBR points to an EBR," which is more technically correct. + +- Altered warning displayed when run from Windows on non-GPT disk, because + Windows on UEFI-based systems is becoming more common. + +- Fixed spurious "1" return value in gdisk. + - Small code changes to support compilation as EFI application with the UEFI GPT fdisk library (http://sourceforge.net/projects/uefigptfdisk/?source=directory) @@ -9,7 +32,7 @@ (https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81): 4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D/0xf800 (Ceph OSD), 4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D/0xf801 (Ceph dm-crypt OSD), - BFBFAFE7-A34F-448A-9A5B-6213EB736C22/0xf802 (Ceph journal), + 45B0969E-9B03-4F30-B4C6-B4B80CEFF106/0xf802 (Ceph journal), 45B0969E-9B03-4F30-B4C6-5EC00CEFF106/0xf803 (Ceph dm-crypt journal), 89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE/0xf804 (Ceph disk in creation), and 89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE/0xf805 (Ceph dm-crypt disk in diff --git a/basicmbr.cc b/basicmbr.cc index f7e1f6d..5661487 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -296,7 +296,7 @@ int BasicMBRData::ReadLogicalParts(uint64_t extendedStart, int partNum) { // the logical partition when this is the case.... ebrType = ebr.partitions[0].partitionType; if ((ebrType == 0x05) || (ebrType == 0x0f) || (ebrType == 0x85)) { - cout << "EBR describes a logical partition!\n"; + cout << "EBR points to an EBR!\n"; offset = extendedStart + ebr.partitions[0].firstLBA; } else { // Copy over the basic data.... diff --git a/cgdisk.8 b/cgdisk.8 index 53e0d4d..8f7dc9b 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "CGDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual" +.TH "CGDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" cgdisk \- Curses-based GUID partition table (GPT) manipulator .SH "SYNOPSIS" @@ -276,10 +276,7 @@ Write data. Use this command to save your changes. .SH "BUGS" -As of March 2014 (version 0.8.10), \fBcgdisk\fR should be considered -beta software. Although the underlying partition manipulation code is much -older, the \fBcgdisk\fR ncurses user interface is brand new with GPT fdisk -version 0.8.0. Known bugs and limitations include: +Known bugs and limitations include: .TP .B * @@ -367,7 +364,7 @@ Contributors: * Justin Maggard (justin.maggard@netgear.com) -* Dwight Schauer (dschauer@ti.com) +* Dwight Schauer (dschauer@gmail.com) * Florian Zumbiehl (florz@florz.de) diff --git a/current.spec b/current.spec index af26193..42f1d80 100644 --- a/current.spec +++ b/current.spec @@ -1,12 +1,12 @@ Summary: GPT partitioning and MBR repair software Name: gptfdisk -Version: 0.8.10 +Version: 1.0.0 Release: 1%{?dist} License: GPLv2 URL: http://www.rodsbooks.com/gdisk Group: Applications/System -Source: http://www.rodsbooks.com/gdisk/gptfdisk-0.8.10.tar.gz +Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.0.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description @@ -81,5 +81,5 @@ provides a few additional partition manipulation features. %changelog -* Sun Mar 2 2014 R Smith - 0.8.10 -- Created spec file for 0.8.10 release +* Sun Mar 2 2014 R Smith - 1.0.0 +- Created spec file for 1.0.0 release diff --git a/diskio-unix.cc b/diskio-unix.cc index 388a04d..7be0bbe 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -253,7 +253,8 @@ int DiskIO::DiskSync(void) { i = ioctl(fd, BLKRRPART); if (i) { cout << "Warning: The kernel is still using the old partition table.\n" - << "The new table will be used at the next reboot.\n"; + << "The new table will be used at the next reboot or after you\n" + << "run partprobe(8) or kpartx(8)\n"; } else { retval = 1; } // if/else diff --git a/fixparts.8 b/fixparts.8 index d840df2..157bd78 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "FIXPARTS" "8" "0.8.10" "Roderick W. Smith" "FixParts Manual" +.TH "FIXPARTS" "8" "1.0.0" "Roderick W. Smith" "FixParts Manual" .SH "NAME" fixparts \- MBR partition table repair utility .SH "SYNOPSIS" @@ -202,8 +202,7 @@ see a summary of available options. .PP .SH "BUGS" -As of March 2014 (version 0.8.10), \fBfixparts\fR -should be considered beta software. Known bugs and limitations include: +Known bugs and limitations include: .TP .B * @@ -259,7 +258,7 @@ Contributors: * Justin Maggard (justin.maggard@netgear.com) -* Dwight Schauer (dschauer@ti.com) +* Dwight Schauer (dschauer@gmail.com) * Florian Zumbiehl (florz@florz.de) diff --git a/gdisk.8 b/gdisk.8 index 5cbaef5..c5d44f3 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "GDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual" +.TH "GDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" gdisk \- Interactive GUID partition table (GPT) manipulator .SH "SYNOPSIS" @@ -561,8 +561,7 @@ entering data. When only one option is possible, \fBgdisk\fR usually bypasses the prompt entirely. .SH "BUGS" -As of March 2014 (version 0.8.10), \fBgdisk\fR -should be considered beta software. Known bugs and limitations include: +Known bugs and limitations include: .TP .B * @@ -660,7 +659,7 @@ Contributors: * Justin Maggard (justin.maggard@netgear.com) -* Dwight Schauer (dschauer@ti.com) +* Dwight Schauer (dschauer@gmail.com) * Florian Zumbiehl (florz@florz.de) diff --git a/gptcl.cc b/gptcl.cc index ce1766c..ef99d02 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -93,6 +93,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { {"new", 'n', POPT_ARG_STRING, &newPartInfo, 'n', "create new partition", "partnum:start:end"}, {"largest-new", 'N', POPT_ARG_INT, &largestPartNum, 'N', "create largest possible new partition", "partnum"}, {"clear", 'o', POPT_ARG_NONE, NULL, 'o', "clear partition table", ""}, + {"print-mbr", 'O', POPT_ARG_NONE, NULL, 'O', "print MBR partition table", ""}, {"print", 'p', POPT_ARG_NONE, NULL, 'p', "print partition table", ""}, {"pretend", 'P', POPT_ARG_NONE, NULL, 'P', "make changes in memory, but don't write them", ""}, {"transpose", 'r', POPT_ARG_STRING, &twoParts, 'r', "transpose two partitions", "partnum:partnum"}, @@ -320,6 +321,9 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { ClearGPTData(); saveData = 1; break; + case 'O': + DisplayMBRData(); + break; case 'p': DisplayGPTData(); break; diff --git a/mbr.cc b/mbr.cc index 5dbc95e..08c61be 100644 --- a/mbr.cc +++ b/mbr.cc @@ -28,6 +28,9 @@ using namespace std; * * ****************************************/ +MBRData::~MBRData(void) { +} // MBRData destructor + /* // Assignment operator -- copy entire set of MBR data. MBRData & MBRData::operator=(const MBRData & orig) { BasicMBRData::operator=(orig); diff --git a/mbr.h b/mbr.h index 3cacf61..bbb84ef 100644 --- a/mbr.h +++ b/mbr.h @@ -28,6 +28,7 @@ public: MBRData(void) {} MBRData(string deviceFilename) : BasicMBRData(deviceFilename) {} MBRData & operator=(const BasicMBRData & orig); + ~MBRData(void); // Functions to create, delete, or change partitions // Pass EmptyMBR 1 to clear the boot loader code, 0 to leave it intact diff --git a/parttypes.cc b/parttypes.cc index fef8629..18fcbd0 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -103,6 +103,7 @@ void PartType::AddAllTypes(void) { // Windows LDM ("dynamic disk") types AddType(0x4200, "AF9B60A0-1431-4F62-BC68-3311714A69AD", "Windows LDM data"); // Logical disk manager AddType(0x4201, "5808C8AA-7E8F-42E0-85D2-E1E90434CFB3", "Windows LDM metadata"); // Logical disk manager + AddType(0x4202, "E75CAF8F-F680-4CEE-AFA3-B001E56EFC2D", "Windows Storage Spaces"); // A newer LDM-type setup // An oddball IBM filesystem.... AddType(0x7501, "37AFFC90-EF7D-4E96-91C3-2D7AE055B174", "IBM GPFS"); // General Parallel File System (GPFS) @@ -153,6 +154,13 @@ void PartType::AddAllTypes(void) { AddType(0xa584, "85D5E45D-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD ZFS"); AddType(0xa585, "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD Vinum"); + // OpenBSD partition type.... + // Note: MBR type 0xa6 is normally subdivided with a BSD disklabel. It's unclear + // if that has a GPT equivalent, so I've mapped it to the same GUID as the + // FreeBSD diskalbel. + AddType(0xa600, "516E7CB4-6ECF-11D6-8FF8-00022D09712B", "OpenBSD disklabel", 0); + AddType(0xa601, "824CC7A0-36A8-11E3-890A-952519AD3F61", "OpenBSD data"); + // A MacOS partition type, separated from others by NetBSD partition types... AddType(0xa800, "55465300-0000-11AA-AA11-00306543ECAC", "Apple UFS"); // Mac OS X @@ -213,7 +221,7 @@ void PartType::AddAllTypes(void) { // Ceph type codes; see https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81 AddType(0xf800, "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D", "Ceph OSD"); // Ceph Object Storage Daemon AddType(0xf801, "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D", "Ceph dm-crypt OSD"); // Ceph Object Storage Daemon (encrypted) - AddType(0xf802, "BFBFAFE7-A34F-448A-9A5B-6213EB736C22", "Ceph journal"); + AddType(0xf802, "45B0969E-9B03-4F30-B4C6-B4B80CEFF106", "Ceph journal"); AddType(0xf803, "45B0969E-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt journal"); AddType(0xf804, "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE", "Ceph disk in creation"); AddType(0xf805, "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE", "Ceph dm-crypt disk in creation"); diff --git a/sgdisk.8 b/sgdisk.8 index 8bca538..62a24e5 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "SGDISK" "8" "0.8.10" "Roderick W. Smith" "GPT fdisk Manual" +.TH "SGDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix .SH "SYNOPSIS" @@ -352,12 +352,20 @@ and then partition it normally. This option will work even if the disk's original partition table is bad; however, most other options on the same command line will be ignored. +.TP +.B \-O, \-\-print\-mbr +Display basic \fIMBR\fR partition summary data. This includes partition +numbers, starting and ending sector numbers, partition sizes, MBR partition +types codes, and partition names. This option is useful mainly for +diagnosing partition table problems, particularly on disks with hybrid +MBRs. + .TP .B \-p, \-\-print -Display basic partition summary data. This includes partition -numbers, starting and ending sector numbers, partition sizes, -\fBsgdisk\fR's partition types codes, and partition names. For -additional information, use the \fI\-i\fR (\fI\-\-info\fR) option. +Display basic GPT partition summary data. This includes partition numbers, +starting and ending sector numbers, partition sizes, \fBsgdisk\fR's +partition types codes, and partition names. For additional information, use +the \fI\-i\fR (\fI\-\-info\fR) option. .TP .B \-P, \-\-pretend @@ -491,8 +499,7 @@ sgdisk, but may with gdisk) Disk replication operation (-R) failed .SH "BUGS" -As of March 2014 (version 0.8.10), \fBsgdisk\fR -should be considered beta software. Known bugs and limitations include: +Known bugs and limitations include: .TP .B * @@ -578,7 +585,7 @@ Contributors: * Justin Maggard (justin.maggard@netgear.com) -* Dwight Schauer (dschauer@ti.com) +* Dwight Schauer (dschauer@gmail.com) * Florian Zumbiehl (florz@florz.de) diff --git a/support.cc b/support.cc index 8c56c91..0833a3e 100644 --- a/support.cc +++ b/support.cc @@ -34,6 +34,17 @@ using namespace std; // Reads a string from stdin, returning it as a C++-style string. // Note that the returned string will NOT include the carriage return // entered by the user. +#ifdef EFI +extern int __sscanf( const char * str , const char * format , ... ) ; +string ReadString(void) { + string inString; + char efiString[256]; + + fgets(efiString, 255, stdin); + inString = efiString; + return inString; +} // ReadString() +#else string ReadString(void) { string inString; @@ -42,6 +53,7 @@ string ReadString(void) { exit(5); return inString; } // ReadString() +#endif // Get a numeric value from the user, between low and high (inclusive). // Keeps looping until the user enters a value within that range. @@ -225,7 +237,7 @@ string BytesToIeee(uint64_t size, uint32_t sectorSize) { uint64_t sizeInIeee; uint64_t previousIeee; float decimalIeee; - uint index = 0; + uint64_t index = 0; string units, prefixes = " KMGTPEZ"; ostringstream theValue; diff --git a/support.h b/support.h index 3e6fe08..cb67b6b 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "0.8.10.2" +#define GPTFDISK_VERSION "1.0.0" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 From 8017e083aac6377e95170d520184c1834e9021a4 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Fri, 24 Apr 2015 21:39:20 -0400 Subject: [PATCH 06/56] Changed -z and -Z behavior in sgdisk so that subsequent changes are written even if -g is not included. Also some man page updates. --- NEWS | 15 +++++++++++++++ cgdisk.8 | 13 +++++++------ gdisk.8 | 16 +++++++++------- gptcl.cc | 11 ++++++----- sgdisk.8 | 15 ++++++++------- 5 files changed, 45 insertions(+), 25 deletions(-) diff --git a/NEWS b/NEWS index 3d33cb3..cd7b904 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,18 @@ +1.0.1 (?/??/2015): +------------------ + +- Edited man pages to clarify that default alignment is to 1MiB boundaries; + this translates to 2048 sectors on disks with 512-byte sectors, but it + will be something else on disks with other sector sizes. + +- Changed behavior of -z/--zap and -Z/--zap-all options to sgdisk so that + if a subsequent command causes changes, they'll be written to disk. + Previously, doing something like "sgdisk --zap-all --clear /dev/sdd" + would wipe the disk but not create a partition table; to create a blank + table you'd need to do "sgdisk --zap-all --clear --mbrtogpt /dev/sdd", + which is a bit odd and counter-intuitive, to the point of arguably being + a bug. + 1.0.0 (3/16/2015): ------------------ diff --git a/cgdisk.8 b/cgdisk.8 index 8f7dc9b..5a18bcb 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -181,12 +181,13 @@ Change the sector alignment value. Disks with more logical sectors than physical sectors (such as modern Advanced Format drives), some RAID configurations, and many SSD devices, can suffer performance problems if partitions are not aligned properly for their internal data structures. On -new disks, GPT fdisk attempts to align partitions on 2048\-sector (1MiB) -boundaries by default, which optimizes performance for all of these disk -types. On pre\-partitioned disks, GPT fdisk attempts to identify the -alignment value used on that disk, but will set 8-sector alignment on disks -larger than 300 GB even if lesser alignment values are detected. In either -case, it can be changed by using this option. +new disks, GPT fdisk attempts to align partitions on 1MiB boundaries +(2048\-sectors on disks with 512-byte sectors) by default, which optimizes +performance for all of these disk types. On pre\-partitioned disks, GPT +fdisk attempts to identify the alignment value used on that disk, but will +set 8-sector alignment on disks larger than 300 GB even if lesser alignment +values are detected. In either case, it can be changed by using this +option. .TP .B Backup diff --git a/gdisk.8 b/gdisk.8 index c5d44f3..b9dd330 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -212,7 +212,8 @@ sector. .B o Clear out all partition data. This includes GPT header data, all partition definitions, and the protective MBR. The sector alignment -is reset to the default (2048 sectors, or 1MB). +is reset to the default (1MB, or 2048 sectors on a disk with 512-byte +sectors). .TP .B p @@ -470,12 +471,13 @@ Change the sector alignment value. Disks with more logical sectors per physical sectors (such as modern Advanced Format drives), some RAID configurations, and many SSD devices, can suffer performance problems if partitions are not aligned properly for their internal data structures. On -new disks, GPT fdisk attempts to align partitions on 2048\-sector (1MiB) -boundaries by default, which optimizes performance for all of these disk -types. On pre\-partitioned disks, GPT fdisk attempts to identify the -alignment value used on that disk, but will set 8-sector alignment on disks -larger than 300 GB even if lesser alignment values are detected. In either -case, it can be changed by using this option. +new disks, GPT fdisk attempts to align partitions on 1MiB boundaries +(2048\-sectors on disks with 512-byte sectors) by default, which optimizes +performance for all of these disk types. On pre\-partitioned disks, GPT +fdisk attempts to identify the alignment value used on that disk, but will +set 8-sector alignment on disks larger than 300 GB even if lesser alignment +values are detected. In either case, it can be changed by using this +option. .TP .B m diff --git a/gptcl.cc b/gptcl.cc index ef99d02..94709ec 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -72,7 +72,8 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { struct poptOption theOptions[] = { - {"attributes", 'A', POPT_ARG_STRING, &attributeOperation, 'A', "operate on partition attributes", "list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]"}, + {"attributes", 'A', POPT_ARG_STRING, &attributeOperation, 'A', "operate on partition attributes", + "list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]]"}, {"set-alignment", 'a', POPT_ARG_INT, &alignment, 'a', "set sector alignment", "value"}, {"backup", 'b', POPT_ARG_STRING, &backupFile, 'b', "backup GPT to file", "file"}, {"change-name", 'c', POPT_ARG_STRING, &partName, 'c', "change partition's name", "partnum:name"}, @@ -404,7 +405,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { if (!pretend) { DestroyGPT(); } // if - saveNonGPT = 0; + saveNonGPT = 1; saveData = 0; break; case 'Z': @@ -412,7 +413,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { DestroyGPT(); DestroyMBR(); } // if - saveNonGPT = 0; + saveNonGPT = 1; saveData = 0; break; default: @@ -446,7 +447,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { if (!pretend) { DestroyGPT(); } // if - saveNonGPT = 0; + saveNonGPT = 1; saveData = 0; break; case 'Z': @@ -454,7 +455,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { DestroyGPT(); DestroyMBR(); } // if - saveNonGPT = 0; + saveNonGPT = 1; saveData = 0; break; } // switch diff --git a/sgdisk.8 b/sgdisk.8 index 62a24e5..dc0b5fd 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -148,11 +148,11 @@ sibling. Options available in \fBsgdisk\fR are: .TP .B \-a, \-\-set\-alignment=value Set the sector alignment multiple. GPT fdisk aligns the start of partitions -to sectors that are multiples of this value, which defaults to 2048 on -freshly formatted disks. This alignment value is necessary to obtain optimum -performance with Western Digital Advanced Format and similar drives with larger -physical than logical sector sizes, with some types of RAID arrays, and -with SSD devices. +to sectors that are multiples of this value, which defaults to 1MiB (2048 +on disks with 512-byte sectors) on freshly formatted disks. This alignment +value is necessary to obtain optimum performance with Western Digital +Advanced Format and similar drives with larger physical than logical sector +sizes, with some types of RAID arrays, and with SSD devices. .TP .B \-A, \-\-attributes=list|[partnum:show|or|nand|xor|=|set|clear|toggle|get[:bitnum|hexbitmask]] @@ -337,7 +337,7 @@ to use the first available partition number. Subsequent uses of the Create a new partition that fills the largest available block of space on the disk. Note that if used on a completely blank disk, this is likely to result in a sector-moved warning, since the first available sector -(normally 34) doesn't fall on a 2048-sector boundary (the default for +(normally 34) doesn't fall on a 1MiB boundary (the default for alignment). You can use the \fI\-a\fR (\fI\-\-set\-alignment\fR) option to adjust the alignment, if desired. A num value of 0 causes the program to use the first available partition number. @@ -483,7 +483,8 @@ An error occurred while reading the partition table .TP .B 3 -Non\-GPT disk detected and no \fI\-g\fR option +Non\-GPT disk detected and no \fI\-g\fR option, but operation requires a +write action .TP .B 4 From 5b2c6c89be2837a3988128467ec85bf567d9c552 Mon Sep 17 00:00:00 2001 From: William Grant Date: Fri, 19 Jun 2015 19:55:27 +1000 Subject: [PATCH 07/56] Don't leave suffix uninitialised when none was passed to IeeeToInt. Fixes incorrect partition boundaries and other failures on ppc64el and possibly other architectures. --- support.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support.cc b/support.cc index 0833a3e..7a6354d 100644 --- a/support.cc +++ b/support.cc @@ -144,7 +144,7 @@ uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high, uint64_t def) { uint64_t response = def, bytesPerUnit = 1, mult = 1, divide = 1; size_t foundAt = 0; - char suffix, plusFlag = ' '; + char suffix = ' ', plusFlag = ' '; string suffixes = "KMGTPE"; int badInput = 0; // flag bad input; once this goes to 1, other values are irrelevant From 505a62196f8e9a1d21c0b5db6f9854f93290725a Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Fri, 19 Jun 2015 08:59:36 -0400 Subject: [PATCH 08/56] Added new partition type code for Freedesktop.org ARM32 root (/) (0x8307, 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3) --- NEWS | 4 ++++ parttypes.cc | 1 + 2 files changed, 5 insertions(+) diff --git a/NEWS b/NEWS index cd7b904..b808c76 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,10 @@ 1.0.1 (?/??/2015): ------------------ +- Added GUID 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3 for 32-bit ARM Linux root + (/) partition, as per the Freedesktop.org Discoverable Partition Spec + (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/). + - Edited man pages to clarify that default alignment is to 1MiB boundaries; this translates to 2048 sectors on disks with 512-byte sectors, but it will be something else on disks with other sector sizes. diff --git a/parttypes.cc b/parttypes.cc index 18fcbd0..b11e08c 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -129,6 +129,7 @@ void PartType::AddAllTypes(void) { AddType(0x8304, "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709", "Linux x86-64 root (/)"); // Linux / on x86-64 (auto-mounted by systemd) AddType(0x8305, "B921B045-1DF0-41C3-AF44-4C6F280D3FAE", "Linux ARM64 root (/)"); // Linux / on 64-bit ARM (auto-mounted by systemd) AddType(0x8306, "3B8F8425-20E0-4F3B-907F-1A25A76F98E8", "Linux /srv"); // Linux /srv (auto-mounted by systemd) + AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)"); // Linux / on 32-bit ARM (auto-mounted by systemd) // Used by Intel Rapid Start technology AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start"); From 42166485c5c68b868be0a41fe17f198da4ac8f22 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Fri, 19 Jun 2015 10:26:17 -0400 Subject: [PATCH 09/56] Fixed odd compile problem. --- diskio-unix.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/diskio-unix.cc b/diskio-unix.cc index d17fbd3..af71cdb 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -75,7 +75,7 @@ int DiskIO::OpenForRead(void) { if (S_ISDIR(st.st_mode)) cerr << "The specified path is a directory!\n"; #if !(defined(__FreeBSD__) || defined(__FreeBSD_kernel__)) \ - && !defined(__APPLE__) + && !defined(__APPLE__) else if (S_ISCHR(st.st_mode)) cerr << "The specified path is a character device!\n"; #endif From 28809faae4da171e2a2472817e516cef5e850d24 Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Mon, 29 Jun 2015 21:21:17 +0000 Subject: [PATCH 10/56] Redirect dd output stderr and fails some Debian tests (DEP8 look at stderr lines) --- gdisk_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gdisk_test.sh b/gdisk_test.sh index 86c36fc..3cc60ff 100755 --- a/gdisk_test.sh +++ b/gdisk_test.sh @@ -354,7 +354,7 @@ EOF ################################### # create a file to simulate a real device -dd if=/dev/zero of=$TEMP_DISK bs=1024 count=$TEMP_DISK_SIZE +dd if=/dev/zero of=$TEMP_DISK bs=1024 count=$TEMP_DISK_SIZE > /dev/null 2>&1 if [ -s $TEMP_DISK ] then From 00cce4dbb310bc09c2dc952a05b3daf502260977 Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Mon, 29 Jun 2015 21:27:09 +0000 Subject: [PATCH 11/56] new target test the call gdisk_test.sh script --- Makefile | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Makefile b/Makefile index 1ae018e..8c8f9fd 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,9 @@ sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o fixparts: $(MBR_LIB_OBJS) fixparts.o $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts +test: + ./gdisk_test.sh + lint: #no pre-reqs lint $(SRCS) From f8f4ea6ad3ad12a6d41fd4e6c3ec44c4eeb65f3d Mon Sep 17 00:00:00 2001 From: Guillaume Delacour Date: Mon, 29 Jun 2015 21:33:19 +0000 Subject: [PATCH 12/56] Test return code of successful empty partition table creation --- gdisk_test.sh | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/gdisk_test.sh b/gdisk_test.sh index 3cc60ff..25e2651 100755 --- a/gdisk_test.sh +++ b/gdisk_test.sh @@ -115,9 +115,23 @@ Y w Y EOF + + ret=$? + if [ $ret -ne 0 ] + then + pretty_print "FAILED" "gdisk return $ret when creating partition table" + exit 1 + fi ;; sgdisk) $SGDISK_BIN $TEMP_DISK -${OPT_CLEAR} + + ret=$? + if [ $ret -ne 0 ] + then + pretty_print "FAILED" "sgdisk return $ret when creating partition table" + exit 1 + fi ;; esac From a9630e373bda6cd8605b5c93fdb278c586d59fec Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Wed, 7 Oct 2015 17:06:53 -0400 Subject: [PATCH 13/56] Updated several partition type codes. --- Makefile.mac | 18 ++++++++++-------- NEWS | 22 ++++++++++++++++++++-- README | 11 ++++++----- gptcurses.cc | 2 +- parttypes.cc | 14 ++++++++------ support.h | 2 +- 6 files changed, 46 insertions(+), 23 deletions(-) diff --git a/Makefile.mac b/Makefile.mac index e53e016..af0659b 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -1,8 +1,9 @@ CC=gcc -CXX=g++ -CFLAGS=-O2 -D_FILE_OFFSET_BITS=64 -g -#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/sw/include -I/usr/local/include -I/opt/local/include -g -CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -I/sw/include -I /usr/local/include -I/opt/local/include -g +CXX=clang++ +FATBINFLAGS=-arch x86_64 -arch i386 -mmacosx-version-min=10.4 +CFLAGS=$(FATBINFLAGS) -O2 -D_FILE_OFFSET_BITS=64 -g +#CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/opt/local/include -I/usr/local/include -I/opt/local/include -g +CXXFLAGS=$(FATBINFLAGS) -O2 -Wall -D_FILE_OFFSET_BITS=64 -I/opt/local/include -I /usr/local/include -I/opt/local/include -g LIB_NAMES=crc32 support guid gptpart mbrpart basicmbr mbr gpt bsd parttypes attributes diskio diskio-unix MBR_LIBS=support diskio diskio-unix basicmbr mbrpart #LIB_SRCS=$(NAMES:=.cc) @@ -14,19 +15,20 @@ DEPEND= makedepend $(CFLAGS) all: gdisk sgdisk cgdisk fixparts gdisk: $(LIB_OBJS) gpttext.o gdisk.o - $(CXX) $(LIB_OBJS) gpttext.o gdisk.o -o gdisk + $(CXX) $(LIB_OBJS) gpttext.o gdisk.o $(FATBINFLAGS) -o gdisk # $(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o - $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -lncurses -o cgdisk + $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o /opt/local/lib/libncurses.a $(LDFLAGS) $(FATBINFLAGS) -o cgdisk # $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licucore -lncurses -o cgdisk sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o - $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/sw/lib -lpopt -o sgdisk +# $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o /opt/local/lib/libiconv.a /opt/local/lib/libintl.a /opt/local/lib/libpopt.a $(FATBINFLAGS) -o sgdisk + $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/opt/local/lib -lpopt $(FATBINFLAGS) -o sgdisk # $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/sw/lib -licucore -lpopt -o sgdisk fixparts: $(MBR_LIB_OBJS) fixparts.o - $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts + $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) $(FATBINFLAGS) -o fixparts testguid: $(LIB_OBJS) testguid.o $(CXX) $(LIB_OBJS) testguid.o -o testguid diff --git a/NEWS b/NEWS index b808c76..5cb798d 100644 --- a/NEWS +++ b/NEWS @@ -1,8 +1,26 @@ 1.0.1 (?/??/2015): ------------------ -- Added GUID 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3 for 32-bit ARM Linux root - (/) partition, as per the Freedesktop.org Discoverable Partition Spec +- Changed the OpenBSD type codes (0xa600 and 0xa601): 0xa600 is now + 824CC7A0-36A8-11E3-890A-952519AD3F61 (OpenBSD disklabel) and 0xa601 is + now gone. Previously, 0xa600 was 516E7CB4-6ECF-11D6-8FF8-00022D09712B, a + duplicate of the FreeBSD disklabel, and 0xa601 was + 824CC7A0-36A8-11E3-890A-952519AD3F61. OpenBSD is now officially + supporting 824CC7A0-36A8-11E3-890A-952519AD3F61 as a disklabel type, + though. It's unclear what, if anything, OpenBSD will use for + non-disklabel type codes at the moment. + +- Added GUID 0311FC50-01CA-4725-AD77-9ADBB20ACE98 (0xbc00) for + Acronis Secure Zone backup partitions. + +- Fixed bug that caused random crashes on ppc64el systems (and perhaps + others). + +- Added GUID C91818F9-8025-47AF-89D2-F030D7000C2C (0x3900) for Plan 9. + +- Added GUID 69DAD710-2CE4-4E3C-B16C-21A1D49ABED3 (0x8307) for 32-bit ARM + Linux root (/) partition, as per the Freedesktop.org Discoverable + Partition Spec (http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/). - Edited man pages to clarify that default alignment is to 1MiB boundaries; diff --git a/README b/README index a3c0e44..8a612ac 100644 --- a/README +++ b/README @@ -200,11 +200,12 @@ be used instead. In addition, note these requirements: (headers). Most Linux distributions install popt by default, but you may need to install a package called popt-dev, popt-devel, or something similar to obtain the header files. Mac OS users can find a version of - popt for Mac OS from Darwin Ports (http://popt.darwinports.com) or Fink - (http://www.finkproject.org); however, you'll first need to install - DarwinPorts or Fink (instructions exist on the relevant projects' pages). - Alternatively, you can compile gdisk and/or cgdisk alone, without sgdisk; - gdisk doesn't require popt. + popt for Mac OS from Darwin Ports (http://popt.darwinports.com), MacPorts + (https://trac.macports.org/browser/trunk/dports/devel/popt/Portfile), or + Fink (http://www.finkproject.org); however, you'll first need to install + DarwinPorts, MacPorts, or Fink (instructions exist on the relevant + projects' pages). Alternatively, you can compile gdisk and/or cgdisk + alone, without sgdisk; gdisk doesn't require popt. When all the necessary development tools and libraries are installed, you can uncompress the package and type "make" at the command prompt in the diff --git a/gptcurses.cc b/gptcurses.cc index 93c5005..6002077 100644 --- a/gptcurses.cc +++ b/gptcurses.cc @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include "gptcurses.h" #include "support.h" diff --git a/parttypes.cc b/parttypes.cc index b11e08c..af6cf38 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -2,7 +2,7 @@ // Class to manage partition type codes -- a slight variant on MBR type // codes, GUID type codes, and associated names. -/* This program is copyright (c) 2009-2014 by Roderick W. Smith. It is distributed +/* This program is copyright (c) 2009-2015 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ #define __STDC_LIMIT_MACROS @@ -97,6 +97,9 @@ void PartType::AddAllTypes(void) { AddType(0x3000, "7412F7D5-A156-4B13-81DC-867174929325", "ONIE boot"); AddType(0x3001, "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", "ONIE config"); + // Plan 9; see http://man.cat-v.org/9front/8/prep + AddType(0x3900, "C91818F9-8025-47AF-89D2-F030D7000C2C", "Plan 9"); + // PowerPC reference platform boot partition AddType(0x4100, "9E1A2D38-C612-4316-AA26-8B49521E5A8B", "PowerPC PReP boot"); @@ -156,11 +159,7 @@ void PartType::AddAllTypes(void) { AddType(0xa585, "85D5E45C-237C-11E1-B4B3-E89A8F7FC3A7", "Midnight BSD Vinum"); // OpenBSD partition type.... - // Note: MBR type 0xa6 is normally subdivided with a BSD disklabel. It's unclear - // if that has a GPT equivalent, so I've mapped it to the same GUID as the - // FreeBSD diskalbel. - AddType(0xa600, "516E7CB4-6ECF-11D6-8FF8-00022D09712B", "OpenBSD disklabel", 0); - AddType(0xa601, "824CC7A0-36A8-11E3-890A-952519AD3F61", "OpenBSD data"); + AddType(0xa600, "824CC7A0-36A8-11E3-890A-952519AD3F61", "OpenBSD disklabel"); // A MacOS partition type, separated from others by NetBSD partition types... AddType(0xa800, "55465300-0000-11AA-AA11-00306543ECAC", "Apple UFS"); // Mac OS X @@ -184,6 +183,9 @@ void PartType::AddAllTypes(void) { AddType(0xaf04, "5265636F-7665-11AA-AA11-00306543ECAC", "AppleTV recovery"); AddType(0xaf05, "53746F72-6167-11AA-AA11-00306543ECAC", "Apple Core Storage"); + // Acronis Secure Zone + AddType(0xbc00, "0311FC50-01CA-4725-AD77-9ADBB20ACE98", "Acronis Secure Zone"); + // Solaris partition types (one of which is shared with MacOS) AddType(0xbe00, "6A82CB45-1DD2-11B2-99A6-080020736631", "Solaris boot"); AddType(0xbf00, "6A85CF4D-1DD2-11B2-99A6-080020736631", "Solaris root"); diff --git a/support.h b/support.h index cb67b6b..b888d92 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "1.0.0" +#define GPTFDISK_VERSION "1.0.1" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 From 0bb668ee31765f7101e8ed4dfaa1d576b11fb135 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Thu, 8 Oct 2015 09:56:50 -0400 Subject: [PATCH 14/56] Changed name of 0xab00 partitions from "Apple boot" to "Recovery HD". --- NEWS | 22 ++++++++++++++++++++++ parttypes.cc | 2 +- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 5cb798d..e2ec31b 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,28 @@ 1.0.1 (?/??/2015): ------------------ +- OS X 10.11 includes new security features that prevent GPT fdisk from + working unless these features are disabled. To do so, you must boot to a + Recovery HD system, open a Terminal, type "csrutil disable", and reboot + into the normal system. You can re-enable the security features by + repeating the process, but specify "enable" rather than "disable". If you + know of a way around this (including code changes to gdisk), please + contact me. + +- I've updated my OS X environment to OS X 10.11 and LLVM 7.0.0. This has + also meant installing fresh versions of popt and ncurses from MacPorts, + which may require upgrading popt to get sgdisk working on some systems. + (gdisk, cgdisk, and fixparts should continue to work normally on all + systems.) The OS X binaries are now "fat" (32- and 64-bit) versions, + which should have no noticeable effect unless you have a Mac with broken + 32-bit support, in which case the binaries will now work. + +- Changed the default name of 0xab00 partitions from "Apple boot" to + "Recovery HD", since the latter is the name that Apple gives these + partitions. Also, I discovered through painful experience that OS X + flakes out and won't boot if the name is something other than "Recovery + HD", so it really has to have the right name! + - Changed the OpenBSD type codes (0xa600 and 0xa601): 0xa600 is now 824CC7A0-36A8-11E3-890A-952519AD3F61 (OpenBSD disklabel) and 0xa601 is now gone. Previously, 0xa600 was 516E7CB4-6ECF-11D6-8FF8-00022D09712B, a diff --git a/parttypes.cc b/parttypes.cc index af6cf38..175aca5 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -175,7 +175,7 @@ void PartType::AddAllTypes(void) { AddType(0xa906, "49F48DAA-B10E-11DC-B99B-0019D1879648", "NetBSD RAID"); // Mac OS partition types (See also 0xa800, above).... - AddType(0xab00, "426F6F74-0000-11AA-AA11-00306543ECAC", "Apple boot"); + AddType(0xab00, "426F6F74-0000-11AA-AA11-00306543ECAC", "Recovery HD"); AddType(0xaf00, "48465300-0000-11AA-AA11-00306543ECAC", "Apple HFS/HFS+"); AddType(0xaf01, "52414944-0000-11AA-AA11-00306543ECAC", "Apple RAID"); AddType(0xaf02, "52414944-5F4F-11AA-AA11-00306543ECAC", "Apple RAID offline"); From 9dadc0d3c6a2b5685ac3b5c3b10f881c27fec0eb Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Fri, 16 Oct 2015 09:57:02 -0400 Subject: [PATCH 15/56] Added uninstall-fixparts and uninstall-gdisk scripts for use under OS X. --- uninstall-fixparts | 24 ++++++++++++++++++++++++ uninstall-gdisk | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100755 uninstall-fixparts create mode 100755 uninstall-gdisk diff --git a/uninstall-fixparts b/uninstall-fixparts new file mode 100755 index 0000000..311a0a0 --- /dev/null +++ b/uninstall-fixparts @@ -0,0 +1,24 @@ +#!/bin/bash + +# Script to uninstall FixParts from OS X + +OSName=`uname -s` +if [[ $OSName != 'Darwin' ]] ; then + echo "This script is useful only under OS X! Exiting!" + exit 1 +fi + +# Remove from pre-1.0.1 locations +rm -f /usr/sbin/fixparts +rm -rf /usr/share/doc/fixparts +rm -f /usr/share/man/man8/fixparts.8 + +# Remove from 1.0.1 (and later) locations +rm -f /usr/local/bin/fixparts +rm -rf /usr/local/doc/fixparts +rm -f /usr/local/man/man8/fixparts.8 + +echo "All FixParts program files successfully removed!" + +# And finally, erase this script itself.... +rm -f /usr/local/bin/uninstall-fixparts diff --git a/uninstall-gdisk b/uninstall-gdisk new file mode 100755 index 0000000..b74f7f0 --- /dev/null +++ b/uninstall-gdisk @@ -0,0 +1,32 @@ +#!/bin/bash + +# Script to uninstall GPT fdisk from OS X + +OSName=`uname -s` +if [[ $OSName != 'Darwin' ]] ; then + echo "This script is useful only under OS X! Exiting!" + exit 1 +fi + +# Remove from pre-1.0.1 locations +rm -f /usr/sbin/gdisk +rm -f /usr/sbin/sgdisk +rm -f /usr/sbin/cgdisk +rm -rf /usr/share/doc/gdisk/ +rm -f /usr/share/man/man8/gdisk.8 +rm -f /usr/share/man/man8/sgdisk.8 +rm -f /usr/share/man/man8/cgdisk.8 + +# Remove from 1.0.1 (and later) locations +rm -f /usr/local/bin/gdisk +rm -f /usr/local/bin/sgdisk +rm -f /usr/local/bin/cgdisk +rm -rf /usr/local/doc/gdisk +rm -f /usr/local/man/man8/gdisk.8 +rm -f /usr/local/man/man8/sgdisk.8 +rm -f /usr/local/man/man8/cgdisk.8 + +echo "All GPT fdisk program files successfully removed!" + +# And finally, erase this script itself.... +rm -f /usr/local/bin/uninstall-gdisk From 1392964ef5d1d3e0b8bfd703d2bcf79774b6d050 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Sat, 17 Oct 2015 18:07:51 -0400 Subject: [PATCH 16/56] Fixed bug that caused cgdisk's reported partition size to be too small by one sector. --- NEWS | 9 +++++++++ gptcurses.cc | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index e2ec31b..c1ad438 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 1.0.1 (?/??/2015): ------------------ +- Fixed bug that caused cgdisk's "Info" display to under-report the + partition's size by one sector. + - OS X 10.11 includes new security features that prevent GPT fdisk from working unless these features are disabled. To do so, you must boot to a Recovery HD system, open a Terminal, type "csrutil disable", and reboot @@ -9,6 +12,12 @@ know of a way around this (including code changes to gdisk), please contact me. +- I've updated the OS X installation location from the Unix-standard + /usr/sbin (and related locations for documentation) to /usr/local/bin + (and related locations for documentation). This is Just Plain Crazy from + a Unix point of view, but Apple has to be Apple and do things just a + little bit differently. + - I've updated my OS X environment to OS X 10.11 and LLVM 7.0.0. This has also meant installing fresh versions of popt and ncurses from MacPorts, which may require upgrading popt to get sgdisk working on some systems. diff --git a/gptcurses.cc b/gptcurses.cc index 6002077..0e18f8f 100644 --- a/gptcurses.cc +++ b/gptcurses.cc @@ -332,7 +332,7 @@ void GPTDataCurses::ShowInfo(int partNum) { BytesToIeee(partitions[partNum].GetFirstLBA(), blockSize).c_str()); printw("Last sector: %lld (at %s)\n", partitions[partNum].GetLastLBA(), BytesToIeee(partitions[partNum].GetLastLBA(), blockSize).c_str()); - size = partitions[partNum].GetLastLBA() - partitions[partNum].GetFirstLBA(); + size = partitions[partNum].GetLastLBA() - partitions[partNum].GetFirstLBA() + 1; printw("Partition size: %lld sectors (%s)\n", size, BytesToIeee(size, blockSize).c_str()); printw("Attribute flags: %016x\n", partitions[partNum].GetAttributes().GetAttributes()); #ifdef USE_UTF16 From bdae07073456eeddbedb99c8a2c1f9ec7862a9c5 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Sat, 17 Oct 2015 18:37:07 -0400 Subject: [PATCH 17/56] Fixed bug that caused sgdisk to not return an appropriate error code (4) when it encountered write errors under some circumstances. --- NEWS | 3 +++ gptcl.cc | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index c1ad438..fd2338f 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 1.0.1 (?/??/2015): ------------------ +- Fixed bug that caused sgdisk to not return an appropriate error code + when it encountered a write error when saving changes. + - Fixed bug that caused cgdisk's "Info" display to under-report the partition's size by one sector. diff --git a/gptcl.cc b/gptcl.cc index 94709ec..2044244 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -463,7 +463,8 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { retval = 2; } // if/else loaded OK if ((saveData) && (!neverSaveData) && (saveNonGPT) && (!pretend)) { - SaveGPTData(1); + if (!SaveGPTData(1)) + retval = 4; } if (saveData && (!saveNonGPT)) { cout << "Non-GPT disk; not saving changes. Use -g to override.\n"; From 080ff55bc2d1b4d928b30159812033c31ae27ae5 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Sun, 18 Oct 2015 13:43:03 -0400 Subject: [PATCH 18/56] Fixed bug that caused input glitches (trailing line feeds and difficulty entering type codes) on EFI version. --- NEWS | 2 ++ support.cc | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/NEWS b/NEWS index fd2338f..24f824a 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,8 @@ 1.0.1 (?/??/2015): ------------------ +- Fixed bug that caused input glitches in EFI version of gdisk. + - Fixed bug that caused sgdisk to not return an appropriate error code when it encountered a write error when saving changes. diff --git a/support.cc b/support.cc index 7a6354d..0ff3485 100644 --- a/support.cc +++ b/support.cc @@ -39,9 +39,16 @@ extern int __sscanf( const char * str , const char * format , ... ) ; string ReadString(void) { string inString; char efiString[256]; + int stringLength; - fgets(efiString, 255, stdin); - inString = efiString; + if (fgets(efiString, 255, stdin) != NULL) { + stringLength = strlen(efiString); + if ((stringLength > 0) && (efiString[stringLength - 1] == '\n')) + efiString[stringLength - 1] = '\0'; + inString = efiString; + } else { + inString = ""; + } return inString; } // ReadString() #else From 6aec1dcf15f726b3049412418da59b6e2c882263 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Sun, 18 Oct 2015 15:56:31 -0400 Subject: [PATCH 19/56] Fixed bug in sgdisk that caused --largest-new/-N to fail if fed a value of "0" for the partition number. (This should work, according to the man page, and now it does.) --- NEWS | 3 +++ gptcl.cc | 4 ++-- sgdisk.8 | 5 +---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 24f824a..d2f274c 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 1.0.1 (?/??/2015): ------------------ +- Fixed bug that caused -N/--largest-new option to sgdisk to fail when + fed a "0" option. + - Fixed bug that caused input glitches in EFI version of gdisk. - Fixed bug that caused sgdisk to not return an appropriate error code diff --git a/gptcl.cc b/gptcl.cc index 2044244..7c1d5cf 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -307,8 +307,8 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { startSector = FindFirstInLargest(); Align(&startSector); endSector = FindLastInFree(startSector); - if (largestPartNum < 0) - largestPartNum = FindFirstFreePart(); + if (largestPartNum <= 0) + largestPartNum = FindFirstFreePart() + 1; if (CreatePartition(largestPartNum - 1, startSector, endSector)) { saveData = 1; } else { diff --git a/sgdisk.8 b/sgdisk.8 index dc0b5fd..a1d3b21 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -335,10 +335,7 @@ to use the first available partition number. Subsequent uses of the .TP .B \-N, \-\-largest\-new=num Create a new partition that fills the largest available block of space on -the disk. Note that if used on a completely blank disk, this is likely to -result in a sector-moved warning, since the first available sector -(normally 34) doesn't fall on a 1MiB boundary (the default for -alignment). You can use the \fI\-a\fR (\fI\-\-set\-alignment\fR) option to +the disk. You can use the \fI\-a\fR (\fI\-\-set\-alignment\fR) option to adjust the alignment, if desired. A num value of 0 causes the program to use the first available partition number. From 846a9e30cda88f75369d175f2f549cad3ea15db2 Mon Sep 17 00:00:00 2001 From: "Roderick W. Smith" Date: Sun, 18 Oct 2015 19:21:11 -0400 Subject: [PATCH 20/56] Version 1.0.1 release. --- Makefile.mac | 2 +- NEWS | 16 +++++++++++----- cgdisk.8 | 4 ++-- current.spec | 8 ++++---- fixparts.8 | 4 ++-- gdisk.8 | 4 ++-- gpt.cc | 7 ++++++- sgdisk.8 | 4 ++-- 8 files changed, 30 insertions(+), 19 deletions(-) diff --git a/Makefile.mac b/Makefile.mac index af0659b..ac5e773 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -37,7 +37,7 @@ lint: #no pre-reqs lint $(SRCS) clean: #no pre-reqs - rm -f core *.o *~ gdisk sgdisk + rm -f core *.o *~ gdisk sgdisk cgdisk fixparts # what are the source dependencies depend: $(SRCS) diff --git a/NEWS b/NEWS index d2f274c..94c01f1 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,9 @@ -1.0.1 (?/??/2015): ------------------- +1.0.1 (10/18/2015): +------------------- + +- Created uninstall-fixparts and uninstall-gdisk scripts for OS X. As the + names imply, these scripts remove the files installed by the fixparts and + gdisk packages, respectively. - Fixed bug that caused -N/--largest-new option to sgdisk to fail when fed a "0" option. @@ -16,9 +20,11 @@ working unless these features are disabled. To do so, you must boot to a Recovery HD system, open a Terminal, type "csrutil disable", and reboot into the normal system. You can re-enable the security features by - repeating the process, but specify "enable" rather than "disable". If you - know of a way around this (including code changes to gdisk), please - contact me. + repeating the process, but specify "enable" rather than "disable". I've + added a message pointing users to a Web page explaining how to disable + this feature when gdisk detects that it can't write to the disk under OS + X. If you know of a way around this (including code changes to gdisk), + please contact me. - I've updated the OS X installation location from the Unix-standard /usr/sbin (and related locations for documentation) to /usr/local/bin diff --git a/cgdisk.8 b/cgdisk.8 index 5a18bcb..ac3da9b 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "CGDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual" +.TH "CGDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" cgdisk \- Curses-based GUID partition table (GPT) manipulator .SH "SYNOPSIS" diff --git a/current.spec b/current.spec index 42f1d80..1587732 100644 --- a/current.spec +++ b/current.spec @@ -1,12 +1,12 @@ Summary: GPT partitioning and MBR repair software Name: gptfdisk -Version: 1.0.0 +Version: 1.0.1 Release: 1%{?dist} License: GPLv2 URL: http://www.rodsbooks.com/gdisk Group: Applications/System -Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.0.tar.gz +Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.1.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description @@ -81,5 +81,5 @@ provides a few additional partition manipulation features. %changelog -* Sun Mar 2 2014 R Smith - 1.0.0 -- Created spec file for 1.0.0 release +* Sun Mar 2 2014 R Smith - 1.0.1 +- Created spec file for 1.0.1 release diff --git a/fixparts.8 b/fixparts.8 index 157bd78..9c4312f 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "FIXPARTS" "8" "1.0.0" "Roderick W. Smith" "FixParts Manual" +.TH "FIXPARTS" "8" "1.0.1" "Roderick W. Smith" "FixParts Manual" .SH "NAME" fixparts \- MBR partition table repair utility .SH "SYNOPSIS" diff --git a/gdisk.8 b/gdisk.8 index b9dd330..c33ca5f 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "GDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual" +.TH "GDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" gdisk \- Interactive GUID partition table (GPT) manipulator .SH "SYNOPSIS" diff --git a/gpt.cc b/gpt.cc index 18247c5..d0a46c6 100644 --- a/gpt.cc +++ b/gpt.cc @@ -748,7 +748,12 @@ int GPTData::LoadPartitions(const string & deviceFilename) { << "'sysctl kern.geom.debugflags=16' at a shell prompt, and re-running this\n" << "program.\n"; #endif - cout << "\n"; +#if defined (__APPLE__) + cout << "You may need to deactivate System Integrity Protection to use this program. See\n" + << "https://www.quora.com/How-do-I-turn-off-the-rootless-in-OS-X-El-Capitan-10-11\n" + << "for more information.\n"; +#endif + cout << "\n"; } // if myDisk.Close(); // Close and re-open read-only in case of bugs } else allOK = 0; // if diff --git a/sgdisk.8 b/sgdisk.8 index a1d3b21..2c3fbfe 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2013 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "SGDISK" "8" "1.0.0" "Roderick W. Smith" "GPT fdisk Manual" +.TH "SGDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix .SH "SYNOPSIS" From c37c487bb91fd2b3b2d2f9cff8de4a7a960ae4fe Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 13 Apr 2016 09:12:10 -0400 Subject: [PATCH 21/56] Removed stray debugging message from "sgdisk -c" operation. --- Makefile | 493 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ NEWS | 6 + gptcl.cc | 1 - 3 files changed, 499 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 8c8f9fd..8c43169 100644 --- a/Makefile +++ b/Makefile @@ -45,3 +45,496 @@ $(OBJS): $(CRITICAL_CXX_FLAGS) # DO NOT DELETE + +attributes.o: /usr/include/stdint.h /usr/include/features.h +attributes.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +attributes.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +attributes.o: /usr/include/bits/wchar.h /usr/include/stdio.h +attributes.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +attributes.o: /usr/include/libio.h /usr/include/_G_config.h +attributes.o: /usr/include/wchar.h /usr/include/xlocale.h +attributes.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +attributes.o: attributes.h support.h /usr/include/stdlib.h +attributes.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +attributes.o: /usr/include/endian.h /usr/include/bits/endian.h +attributes.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +attributes.o: /usr/include/sys/types.h /usr/include/time.h +attributes.o: /usr/include/sys/select.h /usr/include/bits/select.h +attributes.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +attributes.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +attributes.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h +basicmbr.o: /usr/include/stdio.h /usr/include/features.h +basicmbr.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +basicmbr.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +basicmbr.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +basicmbr.o: /usr/include/libio.h /usr/include/_G_config.h +basicmbr.o: /usr/include/wchar.h /usr/include/bits/wchar.h +basicmbr.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h +basicmbr.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h +basicmbr.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +basicmbr.o: /usr/include/endian.h /usr/include/bits/endian.h +basicmbr.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +basicmbr.o: /usr/include/sys/types.h /usr/include/time.h +basicmbr.o: /usr/include/sys/select.h /usr/include/bits/select.h +basicmbr.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +basicmbr.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +basicmbr.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h +basicmbr.o: /usr/include/stdint.h /usr/include/fcntl.h +basicmbr.o: /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h +basicmbr.o: /usr/include/bits/stat.h /usr/include/string.h +basicmbr.o: /usr/include/sys/stat.h /usr/include/errno.h +basicmbr.o: /usr/include/bits/errno.h /usr/include/linux/errno.h mbr.h +basicmbr.o: gptpart.h support.h parttypes.h guid.h /usr/include/uuid/uuid.h +basicmbr.o: /usr/include/sys/time.h attributes.h diskio.h +basicmbr.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +basicmbr.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +basicmbr.o: basicmbr.h mbrpart.h +bsd.o: /usr/include/stdio.h /usr/include/features.h +bsd.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +bsd.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +bsd.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +bsd.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +bsd.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +bsd.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +bsd.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +bsd.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +bsd.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +bsd.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +bsd.o: /usr/include/time.h /usr/include/sys/select.h +bsd.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +bsd.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +bsd.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +bsd.o: /usr/include/bits/stdlib-float.h /usr/include/stdint.h +bsd.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h +bsd.o: /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h +bsd.o: /usr/include/sys/stat.h /usr/include/errno.h /usr/include/bits/errno.h +bsd.o: /usr/include/linux/errno.h support.h bsd.h gptpart.h parttypes.h +bsd.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h +bsd.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +bsd.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +cgdisk.o: /usr/include/string.h /usr/include/features.h +cgdisk.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +cgdisk.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +cgdisk.o: /usr/include/xlocale.h gptcurses.h gptpart.h /usr/include/stdint.h +cgdisk.o: /usr/include/bits/wchar.h /usr/include/sys/types.h +cgdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +cgdisk.o: /usr/include/time.h /usr/include/endian.h +cgdisk.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +cgdisk.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +cgdisk.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +cgdisk.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +cgdisk.o: /usr/include/bits/pthreadtypes.h support.h /usr/include/stdlib.h +cgdisk.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +cgdisk.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h +cgdisk.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h +cgdisk.o: attributes.h gpt.h mbr.h diskio.h /usr/include/sys/ioctl.h +cgdisk.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h +cgdisk.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h bsd.h +crc32.o: /usr/include/stdio.h /usr/include/features.h +crc32.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +crc32.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +crc32.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +crc32.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +crc32.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +crc32.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +crc32.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +crc32.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +crc32.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +crc32.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +crc32.o: /usr/include/time.h /usr/include/sys/select.h +crc32.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +crc32.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +crc32.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +crc32.o: /usr/include/bits/stdlib-float.h crc32.h /usr/include/stdint.h +diskio.o: /usr/include/sys/ioctl.h /usr/include/features.h +diskio.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +diskio.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +diskio.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h +diskio.o: /usr/include/sys/ttydefaults.h /usr/include/stdint.h +diskio.o: /usr/include/bits/wchar.h /usr/include/errno.h +diskio.o: /usr/include/bits/errno.h /usr/include/linux/errno.h +diskio.o: /usr/include/fcntl.h /usr/include/bits/types.h +diskio.o: /usr/include/bits/typesizes.h /usr/include/bits/fcntl.h +diskio.o: /usr/include/bits/fcntl-linux.h /usr/include/time.h +diskio.o: /usr/include/bits/stat.h /usr/include/sys/stat.h support.h +diskio.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +diskio.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +diskio.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +diskio.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +diskio.o: /usr/include/sys/select.h /usr/include/bits/select.h +diskio.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +diskio.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +diskio.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h diskio.h +diskio-unix.o: /usr/include/sys/ioctl.h /usr/include/features.h +diskio-unix.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +diskio-unix.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +diskio-unix.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h +diskio-unix.o: /usr/include/sys/ttydefaults.h /usr/include/string.h +diskio-unix.o: /usr/include/xlocale.h /usr/include/stdint.h +diskio-unix.o: /usr/include/bits/wchar.h /usr/include/unistd.h +diskio-unix.o: /usr/include/bits/posix_opt.h /usr/include/bits/types.h +diskio-unix.o: /usr/include/bits/typesizes.h /usr/include/bits/confname.h +diskio-unix.o: /usr/include/getopt.h /usr/include/errno.h +diskio-unix.o: /usr/include/bits/errno.h /usr/include/linux/errno.h +diskio-unix.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h +diskio-unix.o: /usr/include/bits/fcntl-linux.h /usr/include/time.h +diskio-unix.o: /usr/include/bits/stat.h /usr/include/sys/stat.h diskio.h +diskio-unix.o: /usr/include/sys/types.h /usr/include/endian.h +diskio-unix.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +diskio-unix.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +diskio-unix.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +diskio-unix.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +diskio-unix.o: /usr/include/bits/pthreadtypes.h support.h +diskio-unix.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +diskio-unix.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h +diskio-unix.o: /usr/include/bits/stdlib-float.h +diskio-unix-orig.o: /usr/include/sys/ioctl.h /usr/include/features.h +diskio-unix-orig.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +diskio-unix-orig.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +diskio-unix-orig.o: /usr/include/bits/ioctls.h +diskio-unix-orig.o: /usr/include/bits/ioctl-types.h +diskio-unix-orig.o: /usr/include/sys/ttydefaults.h /usr/include/string.h +diskio-unix-orig.o: /usr/include/xlocale.h /usr/include/stdint.h +diskio-unix-orig.o: /usr/include/bits/wchar.h /usr/include/unistd.h +diskio-unix-orig.o: /usr/include/bits/posix_opt.h /usr/include/bits/types.h +diskio-unix-orig.o: /usr/include/bits/typesizes.h +diskio-unix-orig.o: /usr/include/bits/confname.h /usr/include/getopt.h +diskio-unix-orig.o: /usr/include/errno.h /usr/include/bits/errno.h +diskio-unix-orig.o: /usr/include/linux/errno.h /usr/include/fcntl.h +diskio-unix-orig.o: /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h +diskio-unix-orig.o: /usr/include/time.h /usr/include/bits/stat.h +diskio-unix-orig.o: /usr/include/sys/stat.h diskio.h /usr/include/sys/types.h +diskio-unix-orig.o: /usr/include/endian.h /usr/include/bits/endian.h +diskio-unix-orig.o: /usr/include/bits/byteswap.h +diskio-unix-orig.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +diskio-unix-orig.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +diskio-unix-orig.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +diskio-unix-orig.o: /usr/include/bits/pthreadtypes.h support.h +diskio-unix-orig.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +diskio-unix-orig.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h +diskio-unix-orig.o: /usr/include/bits/stdlib-float.h +diskio-windows.o: /usr/include/stdio.h /usr/include/features.h +diskio-windows.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +diskio-windows.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +diskio-windows.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +diskio-windows.o: /usr/include/libio.h /usr/include/_G_config.h +diskio-windows.o: /usr/include/wchar.h /usr/include/bits/wchar.h +diskio-windows.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h +diskio-windows.o: /usr/include/bits/sys_errlist.h /usr/include/stdint.h +diskio-windows.o: /usr/include/errno.h /usr/include/bits/errno.h +diskio-windows.o: /usr/include/linux/errno.h /usr/include/fcntl.h +diskio-windows.o: /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h +diskio-windows.o: /usr/include/time.h /usr/include/bits/stat.h +diskio-windows.o: /usr/include/sys/stat.h support.h /usr/include/stdlib.h +diskio-windows.o: /usr/include/bits/waitflags.h +diskio-windows.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +diskio-windows.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +diskio-windows.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +diskio-windows.o: /usr/include/sys/select.h /usr/include/bits/select.h +diskio-windows.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +diskio-windows.o: /usr/include/sys/sysmacros.h +diskio-windows.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +diskio-windows.o: /usr/include/bits/stdlib-float.h diskio.h +diskio-windows.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +diskio-windows.o: /usr/include/bits/ioctl-types.h +diskio-windows.o: /usr/include/sys/ttydefaults.h +fixparts.o: /usr/include/stdio.h /usr/include/features.h +fixparts.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +fixparts.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +fixparts.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +fixparts.o: /usr/include/libio.h /usr/include/_G_config.h +fixparts.o: /usr/include/wchar.h /usr/include/bits/wchar.h +fixparts.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h +fixparts.o: /usr/include/bits/sys_errlist.h /usr/include/string.h basicmbr.h +fixparts.o: /usr/include/stdint.h /usr/include/sys/types.h +fixparts.o: /usr/include/time.h /usr/include/endian.h +fixparts.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +fixparts.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +fixparts.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +fixparts.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +fixparts.o: /usr/include/bits/pthreadtypes.h diskio.h +fixparts.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +fixparts.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +fixparts.o: support.h /usr/include/stdlib.h /usr/include/bits/waitflags.h +fixparts.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h +fixparts.o: /usr/include/bits/stdlib-float.h mbrpart.h +gdisk.o: /usr/include/string.h /usr/include/features.h +gdisk.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +gdisk.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +gdisk.o: /usr/include/xlocale.h gpttext.h gpt.h /usr/include/stdint.h +gdisk.o: /usr/include/bits/wchar.h /usr/include/sys/types.h +gdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +gdisk.o: /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h +gdisk.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +gdisk.o: /usr/include/sys/select.h /usr/include/bits/select.h +gdisk.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +gdisk.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +gdisk.o: gptpart.h support.h /usr/include/stdlib.h +gdisk.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +gdisk.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h +gdisk.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h +gdisk.o: mbr.h diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +gdisk.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +gdisk.o: basicmbr.h mbrpart.h bsd.h +gpt.o: /usr/include/stdio.h /usr/include/features.h +gpt.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +gpt.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +gpt.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +gpt.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +gpt.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +gpt.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +gpt.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +gpt.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +gpt.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +gpt.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +gpt.o: /usr/include/time.h /usr/include/sys/select.h +gpt.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +gpt.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +gpt.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +gpt.o: /usr/include/bits/stdlib-float.h /usr/include/stdint.h +gpt.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h +gpt.o: /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h +gpt.o: /usr/include/string.h /usr/include/math.h /usr/include/bits/huge_val.h +gpt.o: /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h +gpt.o: /usr/include/bits/inf.h /usr/include/bits/nan.h +gpt.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h +gpt.o: /usr/include/sys/stat.h /usr/include/errno.h /usr/include/bits/errno.h +gpt.o: /usr/include/linux/errno.h crc32.h gpt.h gptpart.h support.h +gpt.o: parttypes.h guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h +gpt.o: attributes.h mbr.h diskio.h /usr/include/sys/ioctl.h +gpt.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h +gpt.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h bsd.h +gptcl.o: /usr/include/string.h /usr/include/features.h +gptcl.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +gptcl.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +gptcl.o: /usr/include/xlocale.h /usr/include/errno.h +gptcl.o: /usr/include/bits/errno.h /usr/include/linux/errno.h +gptcl.o: /usr/include/popt.h /usr/include/stdio.h /usr/include/bits/types.h +gptcl.o: /usr/include/bits/typesizes.h /usr/include/libio.h +gptcl.o: /usr/include/_G_config.h /usr/include/wchar.h +gptcl.o: /usr/include/bits/wchar.h /usr/include/bits/stdio_lim.h +gptcl.o: /usr/include/bits/sys_errlist.h gptcl.h gpt.h /usr/include/stdint.h +gptcl.o: /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h +gptcl.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +gptcl.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +gptcl.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +gptcl.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +gptcl.o: /usr/include/bits/pthreadtypes.h gptpart.h support.h +gptcl.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +gptcl.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h +gptcl.o: /usr/include/bits/stdlib-float.h parttypes.h guid.h +gptcl.o: /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h mbr.h +gptcl.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +gptcl.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +gptcl.o: basicmbr.h mbrpart.h bsd.h +gptcurses.o: /usr/include/ncurses.h /usr/include/ncurses_dll.h +gptcurses.o: /usr/include/stdio.h /usr/include/features.h +gptcurses.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +gptcurses.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +gptcurses.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +gptcurses.o: /usr/include/libio.h /usr/include/_G_config.h +gptcurses.o: /usr/include/wchar.h /usr/include/bits/wchar.h +gptcurses.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h +gptcurses.o: /usr/include/bits/sys_errlist.h /usr/include/unctrl.h +gptcurses.o: /usr/include/curses.h gptcurses.h gptpart.h +gptcurses.o: /usr/include/stdint.h /usr/include/sys/types.h +gptcurses.o: /usr/include/time.h /usr/include/endian.h +gptcurses.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +gptcurses.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +gptcurses.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +gptcurses.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +gptcurses.o: /usr/include/bits/pthreadtypes.h support.h /usr/include/stdlib.h +gptcurses.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +gptcurses.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h +gptcurses.o: parttypes.h guid.h /usr/include/uuid/uuid.h +gptcurses.o: /usr/include/sys/time.h attributes.h gpt.h mbr.h diskio.h +gptcurses.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +gptcurses.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +gptcurses.o: basicmbr.h mbrpart.h bsd.h +gptpart.o: /usr/include/string.h /usr/include/features.h +gptpart.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +gptpart.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +gptpart.o: /usr/include/xlocale.h /usr/include/stdio.h +gptpart.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +gptpart.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +gptpart.o: /usr/include/bits/wchar.h /usr/include/bits/stdio_lim.h +gptpart.o: /usr/include/bits/sys_errlist.h gptpart.h /usr/include/stdint.h +gptpart.o: /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h +gptpart.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +gptpart.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +gptpart.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +gptpart.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +gptpart.o: /usr/include/bits/pthreadtypes.h support.h /usr/include/stdlib.h +gptpart.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +gptpart.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h +gptpart.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h +gptpart.o: attributes.h +gpttext.o: /usr/include/string.h /usr/include/features.h +gpttext.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +gpttext.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +gpttext.o: /usr/include/xlocale.h /usr/include/errno.h +gpttext.o: /usr/include/bits/errno.h /usr/include/linux/errno.h +gpttext.o: /usr/include/stdint.h /usr/include/bits/wchar.h +gpttext.o: /usr/include/limits.h /usr/include/bits/posix1_lim.h +gpttext.o: /usr/include/bits/local_lim.h /usr/include/linux/limits.h +gpttext.o: /usr/include/bits/posix2_lim.h attributes.h gpttext.h gpt.h +gpttext.o: /usr/include/sys/types.h /usr/include/bits/types.h +gpttext.o: /usr/include/bits/typesizes.h /usr/include/time.h +gpttext.o: /usr/include/endian.h /usr/include/bits/endian.h +gpttext.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +gpttext.o: /usr/include/sys/select.h /usr/include/bits/select.h +gpttext.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +gpttext.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +gpttext.o: gptpart.h support.h /usr/include/stdlib.h +gpttext.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +gpttext.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h +gpttext.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h mbr.h +gpttext.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +gpttext.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +gpttext.o: basicmbr.h mbrpart.h bsd.h +guid.o: /usr/include/stdio.h /usr/include/features.h +guid.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +guid.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +guid.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +guid.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +guid.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +guid.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +guid.o: /usr/include/time.h /usr/include/string.h guid.h +guid.o: /usr/include/stdint.h /usr/include/uuid/uuid.h +guid.o: /usr/include/sys/types.h /usr/include/endian.h +guid.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +guid.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +guid.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +guid.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +guid.o: /usr/include/bits/pthreadtypes.h /usr/include/sys/time.h support.h +guid.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +guid.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h +guid.o: /usr/include/bits/stdlib-float.h +mbr.o: /usr/include/stdio.h /usr/include/features.h +mbr.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +mbr.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +mbr.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +mbr.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +mbr.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +mbr.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +mbr.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +mbr.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +mbr.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +mbr.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +mbr.o: /usr/include/time.h /usr/include/sys/select.h +mbr.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +mbr.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +mbr.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +mbr.o: /usr/include/bits/stdlib-float.h /usr/include/stdint.h +mbr.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h +mbr.o: /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h +mbr.o: /usr/include/string.h /usr/include/sys/stat.h /usr/include/errno.h +mbr.o: /usr/include/bits/errno.h /usr/include/linux/errno.h mbr.h gptpart.h +mbr.o: support.h parttypes.h guid.h /usr/include/uuid/uuid.h +mbr.o: /usr/include/sys/time.h attributes.h diskio.h /usr/include/sys/ioctl.h +mbr.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h +mbr.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h +mbrpart.o: /usr/include/stdint.h /usr/include/features.h +mbrpart.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +mbrpart.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +mbrpart.o: /usr/include/bits/wchar.h support.h /usr/include/stdlib.h +mbrpart.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +mbrpart.o: /usr/include/endian.h /usr/include/bits/endian.h +mbrpart.o: /usr/include/bits/byteswap.h /usr/include/bits/types.h +mbrpart.o: /usr/include/bits/typesizes.h /usr/include/bits/byteswap-16.h +mbrpart.o: /usr/include/sys/types.h /usr/include/time.h +mbrpart.o: /usr/include/sys/select.h /usr/include/bits/select.h +mbrpart.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +mbrpart.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +mbrpart.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h mbrpart.h +parttypes.o: /usr/include/string.h /usr/include/features.h +parttypes.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +parttypes.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +parttypes.o: /usr/include/xlocale.h /usr/include/stdint.h +parttypes.o: /usr/include/bits/wchar.h /usr/include/stdio.h +parttypes.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +parttypes.o: /usr/include/libio.h /usr/include/_G_config.h +parttypes.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h +parttypes.o: /usr/include/bits/sys_errlist.h parttypes.h +parttypes.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +parttypes.o: /usr/include/bits/waitstatus.h /usr/include/endian.h +parttypes.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +parttypes.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h +parttypes.o: /usr/include/time.h /usr/include/sys/select.h +parttypes.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +parttypes.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +parttypes.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +parttypes.o: /usr/include/bits/stdlib-float.h support.h guid.h +parttypes.o: /usr/include/uuid/uuid.h /usr/include/sys/time.h +sgdisk.o: gptcl.h gpt.h /usr/include/stdint.h /usr/include/features.h +sgdisk.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +sgdisk.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +sgdisk.o: /usr/include/bits/wchar.h /usr/include/sys/types.h +sgdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +sgdisk.o: /usr/include/time.h /usr/include/endian.h +sgdisk.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h +sgdisk.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h +sgdisk.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +sgdisk.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +sgdisk.o: /usr/include/bits/pthreadtypes.h gptpart.h support.h +sgdisk.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h +sgdisk.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h +sgdisk.o: /usr/include/bits/stdlib-float.h parttypes.h guid.h +sgdisk.o: /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h mbr.h +sgdisk.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h +sgdisk.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h +sgdisk.o: basicmbr.h mbrpart.h bsd.h /usr/include/popt.h /usr/include/stdio.h +sgdisk.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +sgdisk.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h +sgdisk.o: /usr/include/bits/sys_errlist.h +support.o: /usr/include/stdio.h /usr/include/features.h +support.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +support.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +support.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +support.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +support.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +support.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +support.o: /usr/include/stdint.h /usr/include/errno.h +support.o: /usr/include/bits/errno.h /usr/include/linux/errno.h +support.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h +support.o: /usr/include/bits/fcntl-linux.h /usr/include/time.h +support.o: /usr/include/bits/stat.h /usr/include/string.h +support.o: /usr/include/sys/stat.h support.h /usr/include/stdlib.h +support.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +support.o: /usr/include/endian.h /usr/include/bits/endian.h +support.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +support.o: /usr/include/sys/types.h /usr/include/sys/select.h +support.o: /usr/include/bits/select.h /usr/include/bits/sigset.h +support.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h +support.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h +support.o: /usr/include/bits/stdlib-float.h +test.o: /usr/include/stdio.h /usr/include/features.h +test.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +test.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +test.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h +test.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h +test.o: /usr/include/bits/wchar.h /usr/include/xlocale.h +test.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h +test.o: support.h /usr/include/stdint.h /usr/include/stdlib.h +test.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +test.o: /usr/include/endian.h /usr/include/bits/endian.h +test.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +test.o: /usr/include/sys/types.h /usr/include/time.h +test.o: /usr/include/sys/select.h /usr/include/bits/select.h +test.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +test.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +test.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h +testguid.o: guid.h /usr/include/stdint.h /usr/include/features.h +testguid.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h +testguid.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h +testguid.o: /usr/include/bits/wchar.h /usr/include/uuid/uuid.h +testguid.o: /usr/include/sys/types.h /usr/include/bits/types.h +testguid.o: /usr/include/bits/typesizes.h /usr/include/time.h +testguid.o: /usr/include/endian.h /usr/include/bits/endian.h +testguid.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h +testguid.o: /usr/include/sys/select.h /usr/include/bits/select.h +testguid.o: /usr/include/bits/sigset.h /usr/include/bits/time.h +testguid.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h +testguid.o: /usr/include/sys/time.h parttypes.h /usr/include/stdlib.h +testguid.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h +testguid.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h support.h diff --git a/NEWS b/NEWS index 94c01f1..ab22049 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,9 @@ +1.0.2 (?/??/2016): +------------------ + +- Removed stray debug message ("REALLY setting name!") from sgdisk, + when setting new name via -c option. + 1.0.1 (10/18/2015): ------------------- diff --git a/gptcl.cc b/gptcl.cc index 7c1d5cf..920dd44 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -202,7 +202,6 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { partNum = newPartNum; cout << "partNum is " << partNum << "\n"; if ((partNum >= 0) && (partNum < (int) GetNumParts())) { - cout << "REALLY setting name!\n"; name = GetString(partName, 2); if (SetName(partNum, (UnicodeString) name.c_str())) { saveData = 1; From c554cf15bb8445fd3afd7633e83a35b7dbd0084d Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 19 Oct 2016 16:38:00 -0400 Subject: [PATCH 22/56] Added type codes for Android, ONIE, and QNX6. --- NEWS | 10 ++++++++++ parttypes.cc | 22 ++++++++++++++++++++++ support.h | 2 +- 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index ab22049..ae1a46d 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,16 @@ 1.0.2 (?/??/2016): ------------------ +- Added two type codes for the Open Network Install Environment (ONIE): + 0xe100 (7412F7D5-A156-4B13-81DC-867174929325) and 0xe101 + (D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149). + +- Added thirteen type codes for Android partitions (0xa000 through + 0xa00c). + +- Added type code for QNX6 (aka QNX Power-Safe) filesystem: 0xb300, for + CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1. + - Removed stray debug message ("REALLY setting name!") from sgdisk, when setting new name via -c option. diff --git a/parttypes.cc b/parttypes.cc index 175aca5..4207255 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -140,6 +140,21 @@ void PartType::AddAllTypes(void) { // Another Linux type code.... AddType(0x8e00, "E6D6D379-F507-44C2-A23C-238F2A3DF928", "Linux LVM"); + // Android type codes.... + AddType(0xa000, "2568845D-2332-4675-BC39-8FA5A4748D15", "Android bootloader"); + AddType(0xa001, "114EAFFE-1552-4022-B26E-9B053604CF84", "Android bootloader 2"); + AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot"); + AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery"); + AddType(0xa004, "EF32A33B-A409-486C-9141-9FFB711F6266", "Android misc"); + AddType(0xa005, "20AC26BE-20B7-11E3-84C5-6CFDB94711E9", "Android metadata"); + AddType(0xa006, "38F428E6-D326-425D-9140-6E0EA133647C", "Android system"); + AddType(0xa007, "A893EF21-E428-470A-9E55-0668FD91A2D9", "Android cache"); + AddType(0xa008, "DC76DDA9-5AC1-491C-AF42-A82591580C0D", "Android data"); + AddType(0xa009, "EBC597D0-2053-4B15-8B64-E0AAC75F4DB1", "Android persistent"); + AddType(0xa00a, "8F68CC74-C5E5-48DA-BE91-A0C8C15E9C80", "Android factory"); + AddType(0xa00b, "767941D0-2085-11E3-AD3B-6CFDB94711E9", "Android fastboot/tertiary"); + AddType(0xa00c, "AC6D7924-EB71-4DF8-B48D-E267B27148FF", "Android OEM"); + // FreeBSD partition types.... // Note: Rather than extract FreeBSD disklabel data, convert FreeBSD // partitions in-place, and let FreeBSD sort out the details.... @@ -183,6 +198,9 @@ void PartType::AddAllTypes(void) { AddType(0xaf04, "5265636F-7665-11AA-AA11-00306543ECAC", "AppleTV recovery"); AddType(0xaf05, "53746F72-6167-11AA-AA11-00306543ECAC", "Apple Core Storage"); + // QNX Power-Safe (QNX6) + AddType(0xb300, "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1", "QNX6 Power-Safe"); + // Acronis Secure Zone AddType(0xbc00, "0311FC50-01CA-4725-AD77-9ADBB20ACE98", "Acronis Secure Zone"); @@ -206,6 +224,10 @@ void PartType::AddAllTypes(void) { AddType(0xc001, "75894C1E-3AEB-11D3-B7C1-7B03A0000000", "HP-UX data"); AddType(0xc002, "E2A1E728-32E3-11D6-A682-7B03A0000000", "HP-UX service"); + // Open Network Install Environment (ONIE) partitions.... + AddType(0xe100, "7412F7D5-A156-4B13-81DC-867174929325", "ONIE boot"); + AddType(0xe101, "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", "ONIE config"); + // See http://www.freedesktop.org/wiki/Specifications/BootLoaderSpec AddType(0xea00, "BC13C2FF-59E6-4262-A352-B275FD6F7172", "Freedesktop $BOOT"); diff --git a/support.h b/support.h index b888d92..078fef2 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "1.0.1" +#define GPTFDISK_VERSION "1.0.1.1" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 From dafd2d1d03b597e91d478f36ac1248c74a3e1548 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Sun, 12 Feb 2017 10:57:04 -0500 Subject: [PATCH 23/56] Update gdisk.8 for new partition size recommendations. --- gdisk.8 | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/gdisk.8 b/gdisk.8 index c33ca5f..272da46 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -91,11 +91,12 @@ and in whatever sizes are desired. .TP .B * -Boot disks for EFI\-based systems require an \fIEFI System -Partition\fR (\fBgdisk\fR internal code 0xEF00) formatted as FAT\-32. -The recommended size of this partition is between 100 and 300 MiB. -Boot\-related files are stored here. (Note that GNU Parted identifies -such partitions as having the "boot flag" set.) +Boot disks for EFI\-based systems require an \fIEFI System Partition\fR +(\fBgdisk\fR internal code 0xEF00) formatted as FAT\-32. I recommended +making this partition 550 MiB. (Smaller ESPs are common, but some EFIs have +flaky FAT drivers that necessitate a larger partition for reliable +operation.) Boot\-related files are stored here. (Note that GNU Parted +identifies such partitions as having the "boot flag" set.) .TP .B * @@ -103,8 +104,8 @@ Some boot loaders for BIOS\-based systems make use of a \fIBIOS Boot Partition\fR (\fBgdisk\fR internal code 0xEF02), in which the secondary boot loader is stored, possibly without the benefit of a filesystem. (GRUB2 may optionally use such a partition.) This partition can typically be quite -small (roughly 32 to 200 KiB), but you should consult your boot loader -documentation for details. +small (roughly 32 to 200 KiB, although 1 MiB is more common in practice), +but you should consult your boot loader documentation for details. .TP .B * @@ -193,7 +194,7 @@ are unique to \fBgdisk\fR. .TP .B n -Create a new partition. This command is modelled after the equivalent +Create a new partition. This command is modeled after the equivalent \fBfdisk\fR option, although some differences exist. You enter a partition number, starting sector, and an ending sector. Both start and end sectors can be specified in absolute terms as sector numbers or as positions From 4fff65461baf2626f8379874c851c8261c168551 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Sun, 12 Feb 2017 10:59:32 -0500 Subject: [PATCH 24/56] Update sgdisk.8 for updated partition size recommendations. --- sgdisk.8 | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/sgdisk.8 b/sgdisk.8 index 2c3fbfe..d073f33 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -87,19 +87,21 @@ and in whatever sizes are desired. .TP .B * -Boot disks for EFI\-based systems require an \fIEFI System -Partition\fR (\fBsgdisk\fR internal code 0xEF00) formatted as FAT\-32. -The recommended size of this partition is between 100 and 300 MiB. -Boot\-related files are stored here. (Note that GNU Parted identifies -such partitions as having the "boot flag" set.) +Boot disks for EFI\-based systems require an \fIEFI System Partition\fR +(\fBgdisk\fR internal code 0xEF00) formatted as FAT\-32. I recommended +making this partition 550 MiB. (Smaller ESPs are common, but some EFIs have +flaky FAT drivers that necessitate a larger partition for reliable +operation.) Boot\-related files are stored here. (Note that GNU Parted +identifies such partitions as having the "boot flag" set.) .TP .B * Some boot loaders for BIOS\-based systems make use of a \fIBIOS Boot -Partition\fR (\fBsgdisk\fR internal code 0xEF02), in which the secondary -boot loader is stored, possibly without the benefit of a filesystem. This -partition can typically be quite small (roughly 32 to 200 KiB), but you -should consult your boot loader documentation for details. +Partition\fR (\fBgdisk\fR internal code 0xEF02), in which the secondary +boot loader is stored, possibly without the benefit of a filesystem. (GRUB2 +may optionally use such a partition.) This partition can typically be quite +small (roughly 32 to 200 KiB, although 1 MiB is more common in practice), +but you should consult your boot loader documentation for details. .TP .B * From e7452642ac5fa514bd359bc3f93b6b46b1714213 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Fri, 21 Jul 2017 09:33:18 -0400 Subject: [PATCH 25/56] Trivial documentation changes. --- NEWS | 3 +++ README | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ae1a46d..3e2f1cf 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 1.0.2 (?/??/2016): ------------------ +- Updated man pages with new recommendations for ESP and BIOS Boot Partition + sizes. + - Added two type codes for the Open Network Install Environment (ONIE): 0xe100 (7412F7D5-A156-4B13-81DC-867174929325) and 0xe101 (D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149). diff --git a/README b/README index 8a612ac..eda4060 100644 --- a/README +++ b/README @@ -235,9 +235,9 @@ virtual QEMU and VirtualBox disks. I've received user reports of success with RAID arrays over 2TiB in size, though. My main development platform is a system running the 64-bit version of -Gentoo Linux. I've also tested on several other 32- and 64-bit Linux -distributions, Intel-based Mac OS X 10.5 and 10.6, 64-bit FreeBSD 7.1, and -Windows 7. +Ubuntu Linux. I've also tested on several other 32- and 64-bit Linux +distributions, Intel-based Mac OS X 10.6 and several later versions, 64-bit +FreeBSD 7.1, and Windows 7 and 10. Redistribution -------------- From 503e9ada12d38394381442a944d5c9da847800b6 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Fri, 21 Jul 2017 21:48:13 -0400 Subject: [PATCH 26/56] Initial commit of support for moving main partition table to arbitrary location on disk (within limits based on existing partitions). --- NEWS | 12 +++++++++++- gdisk.8 | 8 ++++++++ gpt.cc | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++--- gpt.h | 4 ++++ gptcl.cc | 11 ++++++++++- gpttext.cc | 25 +++++++++++++++++++++++- gpttext.h | 1 + sgdisk.8 | 8 ++++++++ support.cc | 6 +++--- support.h | 2 +- 10 files changed, 123 insertions(+), 10 deletions(-) diff --git a/NEWS b/NEWS index 3e2f1cf..31e9a15 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,16 @@ -1.0.2 (?/??/2016): +1.0.2 (?/??/2017): ------------------ +- Added new option: 'j' on the experts' menu in gdisk; + '-j/--move-main-table={sector}' in sgdisk. This option enables relocating + the main partition table from sector 2 (the default location) to somewhere + else on the disk. The main reason I know of to do this is if the disk is + to be used with a system-on-chip (SoC) computer, some of which require the + boot loader to be located at sector 2. If you pass this option the default + value of 2, it has the effect of reducing the padding placed between the + main partition table and the first usable sector value created by the + Linux fdisk tool. + - Updated man pages with new recommendations for ESP and BIOS Boot Partition sizes. diff --git a/gdisk.8 b/gdisk.8 index 272da46..6a945e1 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -466,6 +466,14 @@ boot. Show detailed partition information. This option is identical to the 'i' option on the main menu. +.TP +.B j +Adjust the location of the main partition table. This value is normally 2, +but it may need to be increased in some cases, such as when a +system\-on\-chip (SoC) is hard\-coded to read boot code from sector 2. I +recommend against adjusting this value unless doing so is absolutely +necessary. + .TP .B l Change the sector alignment value. Disks with more logical sectors per diff --git a/gpt.cc b/gpt.cc index d0a46c6..44f5fb4 100644 --- a/gpt.cc +++ b/gpt.cc @@ -276,6 +276,23 @@ int GPTData::Verify(void) { << "The 'e' option on the experts' menu may fix this problem.\n"; } // if + // Check the main and backup partition tables for overlap with things + if (mainHeader.partitionEntriesLBA + GetTableSizeInSectors() > mainHeader.firstUsableLBA) { + problems++; + cout << "\nProblem: Main partition table extends past the first usable LBA.\n" + << "Using 'j' on the experts' menu may enable fixing this problem.\n"; + } // if + if (mainHeader.partitionEntriesLBA < 2) { + problems++; + cout << "\nProblem: Main partition table appears impossibly early on the disk.\n" + << "Using 'j' on the experts' menu may enable fixing this problem.\n"; + } // if + if (secondHeader.partitionEntriesLBA + GetTableSizeInSectors() > secondHeader.currentLBA) { + problems++; + cout << "\nProblem: The backup partition table overlaps the backup header.\n" + << "Using 'e' on the experts' menu may fix this problem.\n"; + } // if + if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) { problems++; cout << "\nProblem: GPT claims the disk is larger than it is! (Claimed last usable\n" @@ -552,8 +569,8 @@ void GPTData::RebuildMainHeader(void) { mainHeader.firstUsableLBA = secondHeader.firstUsableLBA; mainHeader.lastUsableLBA = secondHeader.lastUsableLBA; mainHeader.diskGUID = secondHeader.diskGUID; - mainHeader.partitionEntriesLBA = UINT64_C(2); mainHeader.numParts = secondHeader.numParts; + mainHeader.partitionEntriesLBA = secondHeader.firstUsableLBA - GetTableSizeInSectors(); mainHeader.sizeOfPartitionEntries = secondHeader.sizeOfPartitionEntries; mainHeader.partitionEntriesCRC = secondHeader.partitionEntriesCRC; memcpy(mainHeader.reserved2, secondHeader.reserved2, sizeof(mainHeader.reserved2)); @@ -658,7 +675,7 @@ int GPTData::FindInsanePartitions(void) { } // if if (partitions[i].GetLastLBA() >= diskSize) { problems++; - cout << "\nProblem: partition " << i + 1 << " is too big for the disk.\n"; + cout << "\nProblem: partition " << i + 1 << " is too big for the disk.\n"; } // if } // if } // for @@ -1441,6 +1458,8 @@ void GPTData::DisplayGPTData(void) { cout << "Logical sector size: " << blockSize << " bytes\n"; cout << "Disk identifier (GUID): " << mainHeader.diskGUID << "\n"; cout << "Partition table holds up to " << numParts << " entries\n"; + cout << "Main partition table begins at sector " << mainHeader.partitionEntriesLBA + << " and ends at sector " << mainHeader.partitionEntriesLBA + GetTableSizeInSectors() - 1 << "\n"; cout << "First usable sector is " << mainHeader.firstUsableLBA << ", last usable sector is " << mainHeader.lastUsableLBA << "\n"; totalFree = FindFreeBlocks(&i, &temp); @@ -1732,7 +1751,7 @@ int GPTData::SetGPTSize(uint32_t numEntries, int fillGPTSectors) { partitions = newParts; } // if/else existing partitions numParts = numEntries; - mainHeader.firstUsableLBA = ((numEntries * GPT_SIZE) / blockSize) + (((numEntries * GPT_SIZE) % blockSize) != 0) + 2 ; + mainHeader.firstUsableLBA = GetTableSizeInSectors() + mainHeader.partitionEntriesLBA; secondHeader.firstUsableLBA = mainHeader.firstUsableLBA; MoveSecondHeaderToEnd(); if (diskSize > 0) @@ -1747,6 +1766,23 @@ int GPTData::SetGPTSize(uint32_t numEntries, int fillGPTSectors) { return (allOK); } // GPTData::SetGPTSize() +// Change the start sector for the main partition table. +// Returns 1 on success, 0 on failure +int GPTData::MoveMainTable(uint64_t pteSector) { + uint64_t pteSize = GetTableSizeInSectors(); + int retval = 1; + + if ((pteSector >= 2) && ((pteSector + pteSize) <= FindFirstUsedLBA())) { + mainHeader.partitionEntriesLBA = pteSector; + mainHeader.firstUsableLBA = pteSector + pteSize; + RebuildSecondHeader(); + } else { + cerr << "Unable to set the main partition table's location to " << pteSector << "!\n"; + retval = 0; + } // if/else + return retval; +} // GPTData::MoveMainTable() + // Blank the partition array void GPTData::BlankPartitions(void) { uint32_t i; @@ -2121,6 +2157,20 @@ uint64_t GPTData::FindFirstAvailable(uint64_t start) { return (first); } // GPTData::FindFirstAvailable() +// Returns the LBA of the start of the first partition on the disk (by +// sector number), or 0 if there are no partitions defined. +uint64_t GPTData::FindFirstUsedLBA(void) { + uint32_t i; + uint64_t firstFound = UINT64_MAX; + + for (i = 0; i < numParts; i++) { + if ((partitions[i].IsUsed()) && (partitions[i].GetFirstLBA() < firstFound)) { + firstFound = partitions[i].GetFirstLBA(); + } // if + } // for + return firstFound; +} // GPTData::FindFirstUsedLBA() + // Finds the first available sector in the largest block of unallocated // space on the disk. Returns 0 if there are no available blocks left uint64_t GPTData::FindFirstInLargest(void) { diff --git a/gpt.h b/gpt.h index e9afd06..2528b92 100644 --- a/gpt.h +++ b/gpt.h @@ -140,6 +140,7 @@ public: // Adjust GPT structures WITHOUT user interaction... int SetGPTSize(uint32_t numEntries, int fillGPTSectors = 1); + int MoveMainTable(uint64_t pteSector); void BlankPartitions(void); int DeletePartition(uint32_t partNum); uint32_t CreatePartition(uint32_t partNum, uint64_t startSector, uint64_t endSector); @@ -162,6 +163,8 @@ public: int GetPartRange(uint32_t* low, uint32_t* high); int FindFirstFreePart(void); uint32_t GetNumParts(void) {return mainHeader.numParts;} + uint64_t GetTableSizeInSectors(void) {return (((numParts * GPT_SIZE) / blockSize) + + (((numParts * GPT_SIZE) % blockSize) != 0)); } uint64_t GetMainHeaderLBA(void) {return mainHeader.currentLBA;} uint64_t GetSecondHeaderLBA(void) {return secondHeader.currentLBA;} uint64_t GetMainPartsLBA(void) {return mainHeader.partitionEntriesLBA;} @@ -176,6 +179,7 @@ public: // Find information about free space uint64_t FindFirstAvailable(uint64_t start = 0); + uint64_t FindFirstUsedLBA(void); uint64_t FindFirstInLargest(void); uint64_t FindLastAvailable(); uint64_t FindLastInFree(uint64_t start); diff --git a/gptcl.cc b/gptcl.cc index 920dd44..243b4d9 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -64,7 +64,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { GPTData secondDevice; int opt, numOptions = 0, saveData = 0, neverSaveData = 0; int partNum = 0, newPartNum = -1, saveNonGPT = 1, retval = 0, pretend = 0; - uint64_t low, high, startSector, endSector, sSize; + uint64_t low, high, startSector, endSector, sSize, mainTableLBA; uint64_t temp; // temporary variable; free to use in any case char *device; string cmd, typeGUID, name; @@ -88,6 +88,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { {"randomize-guids", 'G', POPT_ARG_NONE, NULL, 'G', "randomize disk and partition GUIDs", ""}, {"hybrid", 'h', POPT_ARG_STRING, &hybrids, 'h', "create hybrid MBR", "partnum[:partnum...]"}, {"info", 'i', POPT_ARG_INT, &infoPartNum, 'i', "show detailed information on partition", "partnum"}, + {"move-main-table", 'j', POPT_ARG_INT, &mainTableLBA, 'j', "adjust the location of the main partition table", "sector"}, {"load-backup", 'l', POPT_ARG_STRING, &backupFile, 'l', "load GPT backup from file", "file"}, {"list-types", 'L', POPT_ARG_NONE, NULL, 'L', "list known partition types", ""}, {"gpttombr", 'm', POPT_ARG_STRING, &mbrParts, 'm', "convert GPT to MBR", "partnum[:partnum...]"}, @@ -262,6 +263,14 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { case 'i': ShowPartDetails(infoPartNum - 1); break; + case 'j': + if (MoveMainTable(mainTableLBA)) { + JustLooking(0); + saveData = 1; + } else { + neverSaveData = 1; + } // if/else + break; case 'l': LoadBackupFile(backupFile, saveData, neverSaveData); free(backupFile); diff --git a/gpttext.cc b/gpttext.cc index 718b99b..732d861 100644 --- a/gpttext.cc +++ b/gpttext.cc @@ -132,7 +132,7 @@ int GPTDataTextUI::XFormDisklabel(void) { numDone = GPTData::XFormDisklabel(partNum); return numDone; -} // GPTData::XFormDisklabel(void) +} // GPTDataTextUI::XFormDisklabel(void) /********************************************************************* @@ -179,6 +179,24 @@ void GPTDataTextUI::ResizePartitionTable(void) { SetGPTSize(newSize); } // GPTDataTextUI::ResizePartitionTable() +// Move the main partition table (to enable some SoC boot loaders to place +// code at sector 2, for instance). +void GPTDataTextUI::MoveMainTable(void) { + uint64_t newStart, pteSize = GetTableSizeInSectors(); + uint64_t maxValue = FindFirstUsedLBA() - pteSize; + ostringstream prompt; + + cout << "Currently, main partition table begins at sector " << mainHeader.partitionEntriesLBA + << " and ends at sector " << mainHeader.partitionEntriesLBA + pteSize - 1 << "\n"; + prompt << "Enter new starting location (2 to " << maxValue << "; default is 2; 1 to abort): "; + newStart = GetNumber(1, maxValue, 2, prompt.str()); + if (newStart != 1) { + GPTData::MoveMainTable(newStart); + } else { + cout << "Aborting change!\n"; + } // if +} // GPTDataTextUI::MoveMainTable() + // Interactively create a partition void GPTDataTextUI::CreatePartition(void) { uint64_t firstBlock, firstInLargest, lastBlock, sector, origSector; @@ -811,6 +829,9 @@ void GPTDataTextUI::ExpertsMenu(string filename) { case 'i': case 'I': ShowDetails(); break; + case 'j': case 'J': + MoveMainTable(); + break; case 'l': case 'L': prompt.seekp(0); prompt << "Enter the sector alignment value (1-" << MAX_ALIGNMENT << ", default = " @@ -878,9 +899,11 @@ void GPTDataTextUI::ShowExpertCommands(void) { cout << "c\tchange partition GUID\n"; cout << "d\tdisplay the sector alignment value\n"; cout << "e\trelocate backup data structures to the end of the disk\n"; + cout << "f\trandomize disk and partition unique GUIDs\n"; cout << "g\tchange disk GUID\n"; cout << "h\trecompute CHS values in protective/hybrid MBR\n"; cout << "i\tshow detailed information on a partition\n"; + cout << "j\tmove the main partition table\n"; cout << "l\tset the sector alignment value\n"; cout << "m\treturn to main menu\n"; cout << "n\tcreate a new protective MBR\n"; diff --git a/gpttext.h b/gpttext.h index 385fa27..98e59af 100644 --- a/gpttext.h +++ b/gpttext.h @@ -42,6 +42,7 @@ class GPTDataTextUI : public GPTData { // Request information from the user (& possibly do something with it) uint32_t GetPartNum(void); void ResizePartitionTable(void); + void MoveMainTable(void); void CreatePartition(void); void DeletePartition(void); void ChangePartType(void); diff --git a/sgdisk.8 b/sgdisk.8 index d073f33..274ceb3 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -280,6 +280,14 @@ unique GUID and the translation of \fBsgdisk\fR's internal partition type code to a plain type name. The \fI\-i\fR option displays this information for a single partition. +.TP +.B \-j, \-\-adjust\-main\-table=sector +Adjust the location of the main partition table. This value is normally 2, +but it may need to be increased in some cases, such as when a +system\-on\-chip (SoC) is hard\-coded to read boot code from sector 2. I +recommend against adjusting this value unless doing so is absolutely +necessary. + .TP .B \-l, \-\-load\-backup=file Load partition data from a backup file. This option is the reverse of the diff --git a/support.cc b/support.cc index 0ff3485..d96da2d 100644 --- a/support.cc +++ b/support.cc @@ -67,8 +67,8 @@ string ReadString(void) { // If user provides no input, def (default value) is returned. // (If def is outside of the low-high range, an explicit response // is required.) -int GetNumber(int low, int high, int def, const string & prompt) { - int response, num; +uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & prompt) { + uint64_t response, num; char line[255]; if (low != high) { // bother only if low and high differ... @@ -77,7 +77,7 @@ int GetNumber(int low, int high, int def, const string & prompt) { cin.getline(line, 255); if (!cin.good()) exit(5); - num = sscanf(line, "%d", &response); + num = sscanf(line, "%ld", &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) cout << "Value out of range\n"; diff --git a/support.h b/support.h index 078fef2..f607d4a 100644 --- a/support.h +++ b/support.h @@ -72,7 +72,7 @@ using namespace std; string ReadString(void); -int GetNumber(int low, int high, int def, const string & prompt); +uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & prompt); char GetYN(void); uint64_t GetSectorNum(uint64_t low, uint64_t high, uint64_t def, uint64_t sSize, const std::string& prompt); uint64_t IeeeToInt(string IeeeValue, uint64_t sSize, uint64_t low, uint64_t high, uint64_t def = 0); From 0dfa506ba6e999c511dd69b688e24ab8884f4a1a Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Sun, 23 Jul 2017 11:50:17 -0400 Subject: [PATCH 27/56] Added a couple of new verification checks and minor tweaks. --- Makefile | 1 + NEWS | 3 +++ gpt.cc | 24 +++++++++++++++++++++++- mbr.cc | 6 ------ support.cc | 2 +- 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 8c43169..b92104d 100644 --- a/Makefile +++ b/Makefile @@ -44,6 +44,7 @@ depend: $(SRCS) $(OBJS): $(CRITICAL_CXX_FLAGS) +# makedepend dependencies below -- type "makedepend *.cc" to regenerate.... # DO NOT DELETE attributes.o: /usr/include/stdint.h /usr/include/features.h diff --git a/NEWS b/NEWS index 31e9a15..d65ab59 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ 1.0.2 (?/??/2017): ------------------ +- Addition of new verification checks, mostly (but not exclusively) related + to the new j/-j/--move-main-table option. + - Added new option: 'j' on the experts' menu in gdisk; '-j/--move-main-table={sector}' in sgdisk. This option enables relocating the main partition table from sector 2 (the default location) to somewhere diff --git a/gpt.cc b/gpt.cc index 44f5fb4..015da65 100644 --- a/gpt.cc +++ b/gpt.cc @@ -276,7 +276,7 @@ int GPTData::Verify(void) { << "The 'e' option on the experts' menu may fix this problem.\n"; } // if - // Check the main and backup partition tables for overlap with things + // Check the main and backup partition tables for overlap with things and unusual gaps if (mainHeader.partitionEntriesLBA + GetTableSizeInSectors() > mainHeader.firstUsableLBA) { problems++; cout << "\nProblem: Main partition table extends past the first usable LBA.\n" @@ -292,6 +292,28 @@ int GPTData::Verify(void) { cout << "\nProblem: The backup partition table overlaps the backup header.\n" << "Using 'e' on the experts' menu may fix this problem.\n"; } // if + if (mainHeader.partitionEntriesLBA != 2) { + cout << "\nWarning: There is a gap between the main metadata (sector 1) and the main\n" + << "partition table (sector " << mainHeader.partitionEntriesLBA + << "). This is helpful in some exotic configurations,\n" + << "but is generally ill-advised. Using 'j' on the experts' menu can adjust this\n" + << "gap.\n"; + } // if + if (mainHeader.partitionEntriesLBA + GetTableSizeInSectors() != mainHeader.firstUsableLBA) { + cout << "\nWarning: There is a gap between the main partition table (ending sector " + << mainHeader.partitionEntriesLBA + GetTableSizeInSectors() - 1 << ")\n" + << "and the first usable sector (" << mainHeader.firstUsableLBA << "). This is helpful in some exotic configurations,\n" + << "but is unusual. The util-linux fdisk program often creates disks like this.\n" + << "Using 'j' on the experts' menu can adjust this gap.\n"; + } // if + + if (mainHeader.sizeOfPartitionEntries * mainHeader.numParts < 16384) { + cout << "\nWarning: The size of the partition table (" << mainHeader.sizeOfPartitionEntries * mainHeader.numParts + << " bytes) is less than the minimum\n" + << "required by the GPT specification. Most OSes and tools seem to work fine on\n" + << "such disks, but this is a violation of the GPT specification and so may cause\n" + << "problems.\n"; + } // if if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) { problems++; diff --git a/mbr.cc b/mbr.cc index 08c61be..c3483a0 100644 --- a/mbr.cc +++ b/mbr.cc @@ -31,12 +31,6 @@ using namespace std; MBRData::~MBRData(void) { } // MBRData destructor -/* // Assignment operator -- copy entire set of MBR data. -MBRData & MBRData::operator=(const MBRData & orig) { - BasicMBRData::operator=(orig); - return *this; -} // MBRData::operator=() */ - // Assignment operator -- copy entire set of MBR data. MBRData & MBRData::operator=(const BasicMBRData & orig) { BasicMBRData::operator=(orig); diff --git a/support.cc b/support.cc index d96da2d..bc91c6e 100644 --- a/support.cc +++ b/support.cc @@ -77,7 +77,7 @@ uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & pro cin.getline(line, 255); if (!cin.good()) exit(5); - num = sscanf(line, "%ld", &response); + num = sscanf(line, "%lld", &response); if (num == 1) { // user provided a response if ((response < low) || (response > high)) cout << "Value out of range\n"; From 2a6daafeda4876dc694b97a41f5b0d0626a6fa16 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Tue, 25 Jul 2017 12:53:52 -0400 Subject: [PATCH 28/56] Added four Apple SoftRAID partition type codes. --- NEWS | 3 +++ parttypes.cc | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index d65ab59..6ff81cc 100644 --- a/NEWS +++ b/NEWS @@ -17,6 +17,9 @@ - Updated man pages with new recommendations for ESP and BIOS Boot Partition sizes. +- Added four type codes (AF06 through AF09) for Apple SoftRAID (Status, + Scratch, Volume, and Cache). + - Added two type codes for the Open Network Install Environment (ONIE): 0xe100 (7412F7D5-A156-4B13-81DC-867174929325) and 0xe101 (D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149). diff --git a/parttypes.cc b/parttypes.cc index 4207255..59d00ab 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -93,7 +93,7 @@ void PartType::AddAllTypes(void) { // Open Network Install Environment (ONIE) specific types. // See http://www.onie.org/ and - // https://github.com/onie/onie/blob/master/rootconf/x86_64/sysroot-lib-onie/onie-blkdev-common + // https://github.com/opencomputeproject/onie/blob/master/patches/gptfdisk/add-onie-partition-types.patch AddType(0x3000, "7412F7D5-A156-4B13-81DC-867174929325", "ONIE boot"); AddType(0x3001, "D4E6E2CD-4469-46F3-B5CB-1BFF57AFC149", "ONIE config"); @@ -197,6 +197,10 @@ void PartType::AddAllTypes(void) { AddType(0xaf03, "4C616265-6C00-11AA-AA11-00306543ECAC", "Apple label"); AddType(0xaf04, "5265636F-7665-11AA-AA11-00306543ECAC", "AppleTV recovery"); AddType(0xaf05, "53746F72-6167-11AA-AA11-00306543ECAC", "Apple Core Storage"); + AddType(0xaf06, "B6FA30DA-92D2-4A9A-96F1-871EC6486200", "Apple SoftRAID Status"); + AddType(0xaf07, "2E313465-19B9-463F-8126-8A7993773801", "Apple SoftRAID Scratch"); + AddType(0xaf08, "FA709C7E-65B1-4593-BFD5-E71D61DE9B02", "Apple SoftRAID Volume"); + AddType(0xaf09, "BBBA6DF5-F46F-4A89-8F59-8765B2727503", "Apple SoftRAID Cache"); // QNX Power-Safe (QNX6) AddType(0xb300, "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1", "QNX6 Power-Safe"); From fc0e014beaa6935576e93cf440f8b3d960b2d3f7 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Tue, 25 Jul 2017 21:33:18 -0400 Subject: [PATCH 29/56] Added code to read physical block size on Linux. --- NEWS | 6 ++++++ diskio-unix.cc | 21 +++++++++++++++++++++ diskio-windows.cc | 7 +++++++ diskio.h | 1 + gpt.cc | 29 ++++++++++++++++++++++++----- gpt.h | 5 +++-- 6 files changed, 62 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 6ff81cc..5771634 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,12 @@ 1.0.2 (?/??/2017): ------------------ +- GPT fdisk can now report both the physical and logical sector sizes of + disks, but only on 2.6.32 and later Linux kernels. The verify feature now + uses the larger of the set alignment and physical/logical block sizes for + testing alignment, and setting alignment to something other than an exact + multiple of the physical/logical block size results in a warning. + - Addition of new verification checks, mostly (but not exclusively) related to the new j/-j/--move-main-table option. diff --git a/diskio-unix.cc b/diskio-unix.cc index af71cdb..a7c4724 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -177,6 +177,27 @@ int DiskIO::GetBlockSize(void) { return (blockSize); } // DiskIO::GetBlockSize() +// Returns the physical block size of the device, if possible. If this is +// not supported, or if an error occurs, this function returns 0. +// TODO: Get this working in more OSes than Linux. +int DiskIO::GetPhysBlockSize(void) { + int err = -1, physBlockSize = 0; + + // If disk isn't open, try to open it.... + if (!isOpen) { + OpenForRead(); + } // if + + if (isOpen) { +#if defined __linux__ && !defined(EFI) + err = ioctl(fd, BLKPBSZGET, &physBlockSize); +#endif + } // if (isOpen) + if (err == -1) + physBlockSize = 0; + return (physBlockSize); +} // DiskIO::GetPhysBlockSize(void) + // Returns the number of heads, according to the kernel, or 255 if the // correct value can't be determined. uint32_t DiskIO::GetNumHeads(void) { diff --git a/diskio-windows.cc b/diskio-windows.cc index 5535f49..9cff0d7 100644 --- a/diskio-windows.cc +++ b/diskio-windows.cc @@ -144,6 +144,13 @@ int DiskIO::GetBlockSize(void) { return (blockSize); } // DiskIO::GetBlockSize() +// In theory, returns the physical block size. In practice, this is only +// supported in Linux, as of yet. +// TODO: Get this working in Windows. +int DiskIO:GetPhysBlockSize(void) { + return 0; +} // DiskIO::GetPhysBlockSize() + // Returns the number of heads, according to the kernel, or 255 if the // correct value can't be determined. uint32_t DiskIO::GetNumHeads(void) { diff --git a/diskio.h b/diskio.h index 631a43a..26f113d 100644 --- a/diskio.h +++ b/diskio.h @@ -71,6 +71,7 @@ class DiskIO { int Write(void* buffer, int numBytes); int DiskSync(void); // resync disk caches to use new partitions int GetBlockSize(void); + int GetPhysBlockSize(void); uint32_t GetNumHeads(void); uint32_t GetNumSecsPerTrack(void); int IsOpen(void) {return isOpen;} diff --git a/gpt.cc b/gpt.cc index 015da65..a86dd2e 100644 --- a/gpt.cc +++ b/gpt.cc @@ -64,6 +64,7 @@ static inline uint32_t log2_32(uint32_t v) { // Default constructor GPTData::GPTData(void) { blockSize = SECTOR_SIZE; // set a default + physBlockSize = 0; // 0 = can't be determined diskSize = 0; partitions = NULL; state = gpt_valid; @@ -125,6 +126,7 @@ GPTData & GPTData::operator=(const GPTData & orig) { protectiveMBR = orig.protectiveMBR; device = orig.device; blockSize = orig.blockSize; + physBlockSize = orig.physBlockSize; diskSize = orig.diskSize; state = orig.state; justLooking = orig.justLooking; @@ -166,7 +168,7 @@ GPTData & GPTData::operator=(const GPTData & orig) { // problems identified. int GPTData::Verify(void) { int problems = 0, alignProbs = 0; - uint32_t i, numSegments; + uint32_t i, numSegments, testAlignment = sectorAlignment; uint64_t totalFree, largestSegment; // First, check for CRC errors in the GPT data.... @@ -355,10 +357,15 @@ int GPTData::Verify(void) { // Check that partitions are aligned on proper boundaries (for WD Advanced // Format and similar disks).... + if ((physBlockSize != 0) && (blockSize != 0)) + testAlignment = physBlockSize / blockSize; + testAlignment = max(testAlignment, sectorAlignment); + if (testAlignment == 0) // Should not happen; just being paranoid. + testAlignment = sectorAlignment; for (i = 0; i < numParts; i++) { - if ((partitions[i].IsUsed()) && (partitions[i].GetFirstLBA() % sectorAlignment) != 0) { + if ((partitions[i].IsUsed()) && (partitions[i].GetFirstLBA() % testAlignment) != 0) { cout << "\nCaution: Partition " << i + 1 << " doesn't begin on a " - << sectorAlignment << "-sector boundary. This may\nresult " + << testAlignment << "-sector boundary. This may\nresult " << "in degraded performance on some modern (2009 and later) hard disks.\n"; alignProbs++; } // if @@ -722,6 +729,7 @@ int GPTData::SetDisk(const string & deviceFilename) { // store disk information.... diskSize = myDisk.DiskSize(&err); blockSize = (uint32_t) myDisk.GetBlockSize(); + physBlockSize = (uint32_t) myDisk.GetPhysBlockSize(); } // if protectiveMBR.SetDisk(&myDisk); protectiveMBR.SetDiskSize(diskSize); @@ -801,6 +809,7 @@ int GPTData::LoadPartitions(const string & deviceFilename) { // store disk information.... diskSize = myDisk.DiskSize(&err); blockSize = (uint32_t) myDisk.GetBlockSize(); + physBlockSize = (uint32_t) myDisk.GetPhysBlockSize(); device = deviceFilename; PartitionScan(); // Check for partition types, load GPT, & print summary @@ -1478,6 +1487,8 @@ void GPTData::DisplayGPTData(void) { cout << "Disk " << device << ": " << diskSize << " sectors, " << BytesToIeee(diskSize, blockSize) << "\n"; cout << "Logical sector size: " << blockSize << " bytes\n"; + if (physBlockSize > 0) + cout << "Physical sector size: " << physBlockSize << " bytes\n"; cout << "Disk identifier (GUID): " << mainHeader.diskGUID << "\n"; cout << "Partition table holds up to " << numParts << " entries\n"; cout << "Main partition table begins at sector " << mainHeader.partitionEntriesLBA @@ -2334,10 +2345,18 @@ int GPTData::IsUsedPartNum(uint32_t partNum) { // Set partition alignment value; partitions will begin on multiples of // the specified value void GPTData::SetAlignment(uint32_t n) { - if (n > 0) + if (n > 0) { sectorAlignment = n; - else + if ((physBlockSize > 0) && (n % (physBlockSize / blockSize) != 0)) { + cout << "Warning: Setting alignment to a value that does not match the disk's\n" + << "physical block size! Performance degradation may result!\n" + << "Physical block size = " << physBlockSize << "\n" + << "Logical block size = " << blockSize << "\n" + << "Optimal alignment = " << physBlockSize / blockSize << " or multiples thereof.\n"; + } // if + } else { cerr << "Attempt to set partition alignment to 0!\n"; + } // if/else } // GPTData::SetAlignment() // Compute sector alignment based on the current partitions (if any). Each diff --git a/gpt.h b/gpt.h index 2528b92..2d7a1ce 100644 --- a/gpt.h +++ b/gpt.h @@ -68,8 +68,9 @@ protected: MBRData protectiveMBR; string device; // device filename DiskIO myDisk; - uint32_t blockSize; // device block size - uint64_t diskSize; // size of device, in blocks + uint32_t blockSize; // device logical block size + uint32_t physBlockSize; // device physical block size (or 0 if it can't be determined) + uint64_t diskSize; // size of device, in logical blocks GPTValidity state; // is GPT valid? int justLooking; // Set to 1 if program launched with "-l" or if read-only int mainCrcOk; From 7dfc89673419e9c45ec63b517f2b060189592f5f Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 26 Jul 2017 19:45:51 -0400 Subject: [PATCH 30/56] Added support for showing the disk's model name under Linux. --- NEWS | 11 +++++++++-- diskio-unix.cc | 13 +++++++++++++ diskio-windows.cc | 2 +- diskio.cc | 1 + diskio.h | 2 ++ gpt.cc | 7 +++++-- support.h | 2 +- 7 files changed, 32 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 5771634..2e60015 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,18 @@ -1.0.2 (?/??/2017): +1.0.2 (7/26/2017): ------------------ +- On Linux, the p/-p/--print command now shows the disk's model name, as + reported in /sys/block/sda/device/model (or equivalent filenames for other + disks). This feature does not yet work on other platforms, on which the + model name line is omitted from the output. This line is also not shown + when accessing disk image files, even on Linux. + - GPT fdisk can now report both the physical and logical sector sizes of disks, but only on 2.6.32 and later Linux kernels. The verify feature now uses the larger of the set alignment and physical/logical block sizes for testing alignment, and setting alignment to something other than an exact - multiple of the physical/logical block size results in a warning. + multiple of the ratio of the physical to logical block size results in a + warning. - Addition of new verification checks, mostly (but not exclusively) related to the new j/-j/--move-main-table option. diff --git a/diskio-unix.cc b/diskio-unix.cc index a7c4724..d9f8b8d 100644 --- a/diskio-unix.cc +++ b/diskio-unix.cc @@ -30,6 +30,8 @@ #endif #include +#include +#include #include "diskio.h" @@ -66,6 +68,7 @@ int DiskIO::OpenForRead(void) { cerr << "The specified file does not exist!\n"; realFilename = ""; userFilename = ""; + modelName = ""; isOpen = 0; openForWrite = 0; } else { @@ -86,6 +89,16 @@ int DiskIO::OpenForRead(void) { else isOpen = 1; } // if (fstat64()...) +#if defined(__linux__) && !defined(EFI) + if (isOpen && realFilename.substr(0,4) == "/dev") { + ostringstream modelNameFilename; + modelNameFilename << "/sys/block" << realFilename.substr(4,512) << "/device/model"; + ifstream modelNameFile(modelNameFilename.str().c_str()); + if (modelNameFile.is_open()) { + getline(modelNameFile, modelName); + } // if + } // if +#endif } // if/else } // if diff --git a/diskio-windows.cc b/diskio-windows.cc index 9cff0d7..80cd7f2 100644 --- a/diskio-windows.cc +++ b/diskio-windows.cc @@ -147,7 +147,7 @@ int DiskIO::GetBlockSize(void) { // In theory, returns the physical block size. In practice, this is only // supported in Linux, as of yet. // TODO: Get this working in Windows. -int DiskIO:GetPhysBlockSize(void) { +int DiskIO::GetPhysBlockSize(void) { return 0; } // DiskIO::GetPhysBlockSize() diff --git a/diskio.cc b/diskio.cc index baf235b..556138e 100644 --- a/diskio.cc +++ b/diskio.cc @@ -41,6 +41,7 @@ using namespace std; DiskIO::DiskIO(void) { userFilename = ""; realFilename = ""; + modelName = ""; isOpen = 0; openForWrite = 0; } // constructor diff --git a/diskio.h b/diskio.h index 26f113d..0bdaba4 100644 --- a/diskio.h +++ b/diskio.h @@ -49,6 +49,7 @@ class DiskIO { protected: string userFilename; string realFilename; + string modelName; int isOpen; int openForWrite; #ifdef _WIN32 @@ -72,6 +73,7 @@ class DiskIO { int DiskSync(void); // resync disk caches to use new partitions int GetBlockSize(void); int GetPhysBlockSize(void); + string GetModel(void) {return modelName;} uint32_t GetNumHeads(void); uint32_t GetNumSecsPerTrack(void); int IsOpen(void) {return isOpen;} diff --git a/gpt.cc b/gpt.cc index a86dd2e..4f37323 100644 --- a/gpt.cc +++ b/gpt.cc @@ -1486,9 +1486,12 @@ void GPTData::DisplayGPTData(void) { cout << "Disk " << device << ": " << diskSize << " sectors, " << BytesToIeee(diskSize, blockSize) << "\n"; - cout << "Logical sector size: " << blockSize << " bytes\n"; + if (myDisk.GetModel() != "") + cout << "Model: " << myDisk.GetModel() << "\n"; if (physBlockSize > 0) - cout << "Physical sector size: " << physBlockSize << " bytes\n"; + cout << "Sector size (logical/physical): " << blockSize << "/" << physBlockSize << " bytes\n"; + else + cout << "Sector size (logical): " << blockSize << " bytes\n"; cout << "Disk identifier (GUID): " << mainHeader.diskGUID << "\n"; cout << "Partition table holds up to " << numParts << " entries\n"; cout << "Main partition table begins at sector " << mainHeader.partitionEntriesLBA diff --git a/support.h b/support.h index f607d4a..f8957aa 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "1.0.1.1" +#define GPTFDISK_VERSION "1.0.2" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 From eed1122809cb7c509e808c1e76853af23f8652c8 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 26 Jul 2017 21:15:59 -0400 Subject: [PATCH 31/56] Version 1.0.2 release. --- Makefile | 493 --------------------------------------------------- basicmbr.cc | 12 +- cgdisk.8 | 4 +- current.spec | 8 +- fixparts.8 | 4 +- gdisk.8 | 4 +- gptcl.cc | 2 +- sgdisk.8 | 4 +- 8 files changed, 19 insertions(+), 512 deletions(-) diff --git a/Makefile b/Makefile index b92104d..a3576b3 100644 --- a/Makefile +++ b/Makefile @@ -46,496 +46,3 @@ $(OBJS): # makedepend dependencies below -- type "makedepend *.cc" to regenerate.... # DO NOT DELETE - -attributes.o: /usr/include/stdint.h /usr/include/features.h -attributes.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -attributes.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -attributes.o: /usr/include/bits/wchar.h /usr/include/stdio.h -attributes.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -attributes.o: /usr/include/libio.h /usr/include/_G_config.h -attributes.o: /usr/include/wchar.h /usr/include/xlocale.h -attributes.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -attributes.o: attributes.h support.h /usr/include/stdlib.h -attributes.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -attributes.o: /usr/include/endian.h /usr/include/bits/endian.h -attributes.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -attributes.o: /usr/include/sys/types.h /usr/include/time.h -attributes.o: /usr/include/sys/select.h /usr/include/bits/select.h -attributes.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -attributes.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -attributes.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h -basicmbr.o: /usr/include/stdio.h /usr/include/features.h -basicmbr.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -basicmbr.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -basicmbr.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -basicmbr.o: /usr/include/libio.h /usr/include/_G_config.h -basicmbr.o: /usr/include/wchar.h /usr/include/bits/wchar.h -basicmbr.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h -basicmbr.o: /usr/include/bits/sys_errlist.h /usr/include/stdlib.h -basicmbr.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -basicmbr.o: /usr/include/endian.h /usr/include/bits/endian.h -basicmbr.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -basicmbr.o: /usr/include/sys/types.h /usr/include/time.h -basicmbr.o: /usr/include/sys/select.h /usr/include/bits/select.h -basicmbr.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -basicmbr.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -basicmbr.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h -basicmbr.o: /usr/include/stdint.h /usr/include/fcntl.h -basicmbr.o: /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h -basicmbr.o: /usr/include/bits/stat.h /usr/include/string.h -basicmbr.o: /usr/include/sys/stat.h /usr/include/errno.h -basicmbr.o: /usr/include/bits/errno.h /usr/include/linux/errno.h mbr.h -basicmbr.o: gptpart.h support.h parttypes.h guid.h /usr/include/uuid/uuid.h -basicmbr.o: /usr/include/sys/time.h attributes.h diskio.h -basicmbr.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -basicmbr.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -basicmbr.o: basicmbr.h mbrpart.h -bsd.o: /usr/include/stdio.h /usr/include/features.h -bsd.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -bsd.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -bsd.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -bsd.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -bsd.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -bsd.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -bsd.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -bsd.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -bsd.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -bsd.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -bsd.o: /usr/include/time.h /usr/include/sys/select.h -bsd.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -bsd.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -bsd.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -bsd.o: /usr/include/bits/stdlib-float.h /usr/include/stdint.h -bsd.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h -bsd.o: /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h -bsd.o: /usr/include/sys/stat.h /usr/include/errno.h /usr/include/bits/errno.h -bsd.o: /usr/include/linux/errno.h support.h bsd.h gptpart.h parttypes.h -bsd.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h -bsd.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -bsd.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -cgdisk.o: /usr/include/string.h /usr/include/features.h -cgdisk.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -cgdisk.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -cgdisk.o: /usr/include/xlocale.h gptcurses.h gptpart.h /usr/include/stdint.h -cgdisk.o: /usr/include/bits/wchar.h /usr/include/sys/types.h -cgdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -cgdisk.o: /usr/include/time.h /usr/include/endian.h -cgdisk.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -cgdisk.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -cgdisk.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -cgdisk.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -cgdisk.o: /usr/include/bits/pthreadtypes.h support.h /usr/include/stdlib.h -cgdisk.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -cgdisk.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h -cgdisk.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h -cgdisk.o: attributes.h gpt.h mbr.h diskio.h /usr/include/sys/ioctl.h -cgdisk.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h -cgdisk.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h bsd.h -crc32.o: /usr/include/stdio.h /usr/include/features.h -crc32.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -crc32.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -crc32.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -crc32.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -crc32.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -crc32.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -crc32.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -crc32.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -crc32.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -crc32.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -crc32.o: /usr/include/time.h /usr/include/sys/select.h -crc32.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -crc32.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -crc32.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -crc32.o: /usr/include/bits/stdlib-float.h crc32.h /usr/include/stdint.h -diskio.o: /usr/include/sys/ioctl.h /usr/include/features.h -diskio.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -diskio.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -diskio.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h -diskio.o: /usr/include/sys/ttydefaults.h /usr/include/stdint.h -diskio.o: /usr/include/bits/wchar.h /usr/include/errno.h -diskio.o: /usr/include/bits/errno.h /usr/include/linux/errno.h -diskio.o: /usr/include/fcntl.h /usr/include/bits/types.h -diskio.o: /usr/include/bits/typesizes.h /usr/include/bits/fcntl.h -diskio.o: /usr/include/bits/fcntl-linux.h /usr/include/time.h -diskio.o: /usr/include/bits/stat.h /usr/include/sys/stat.h support.h -diskio.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -diskio.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -diskio.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -diskio.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -diskio.o: /usr/include/sys/select.h /usr/include/bits/select.h -diskio.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -diskio.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -diskio.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h diskio.h -diskio-unix.o: /usr/include/sys/ioctl.h /usr/include/features.h -diskio-unix.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -diskio-unix.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -diskio-unix.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h -diskio-unix.o: /usr/include/sys/ttydefaults.h /usr/include/string.h -diskio-unix.o: /usr/include/xlocale.h /usr/include/stdint.h -diskio-unix.o: /usr/include/bits/wchar.h /usr/include/unistd.h -diskio-unix.o: /usr/include/bits/posix_opt.h /usr/include/bits/types.h -diskio-unix.o: /usr/include/bits/typesizes.h /usr/include/bits/confname.h -diskio-unix.o: /usr/include/getopt.h /usr/include/errno.h -diskio-unix.o: /usr/include/bits/errno.h /usr/include/linux/errno.h -diskio-unix.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h -diskio-unix.o: /usr/include/bits/fcntl-linux.h /usr/include/time.h -diskio-unix.o: /usr/include/bits/stat.h /usr/include/sys/stat.h diskio.h -diskio-unix.o: /usr/include/sys/types.h /usr/include/endian.h -diskio-unix.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -diskio-unix.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -diskio-unix.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -diskio-unix.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -diskio-unix.o: /usr/include/bits/pthreadtypes.h support.h -diskio-unix.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -diskio-unix.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h -diskio-unix.o: /usr/include/bits/stdlib-float.h -diskio-unix-orig.o: /usr/include/sys/ioctl.h /usr/include/features.h -diskio-unix-orig.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -diskio-unix-orig.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -diskio-unix-orig.o: /usr/include/bits/ioctls.h -diskio-unix-orig.o: /usr/include/bits/ioctl-types.h -diskio-unix-orig.o: /usr/include/sys/ttydefaults.h /usr/include/string.h -diskio-unix-orig.o: /usr/include/xlocale.h /usr/include/stdint.h -diskio-unix-orig.o: /usr/include/bits/wchar.h /usr/include/unistd.h -diskio-unix-orig.o: /usr/include/bits/posix_opt.h /usr/include/bits/types.h -diskio-unix-orig.o: /usr/include/bits/typesizes.h -diskio-unix-orig.o: /usr/include/bits/confname.h /usr/include/getopt.h -diskio-unix-orig.o: /usr/include/errno.h /usr/include/bits/errno.h -diskio-unix-orig.o: /usr/include/linux/errno.h /usr/include/fcntl.h -diskio-unix-orig.o: /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h -diskio-unix-orig.o: /usr/include/time.h /usr/include/bits/stat.h -diskio-unix-orig.o: /usr/include/sys/stat.h diskio.h /usr/include/sys/types.h -diskio-unix-orig.o: /usr/include/endian.h /usr/include/bits/endian.h -diskio-unix-orig.o: /usr/include/bits/byteswap.h -diskio-unix-orig.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -diskio-unix-orig.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -diskio-unix-orig.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -diskio-unix-orig.o: /usr/include/bits/pthreadtypes.h support.h -diskio-unix-orig.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -diskio-unix-orig.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h -diskio-unix-orig.o: /usr/include/bits/stdlib-float.h -diskio-windows.o: /usr/include/stdio.h /usr/include/features.h -diskio-windows.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -diskio-windows.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -diskio-windows.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -diskio-windows.o: /usr/include/libio.h /usr/include/_G_config.h -diskio-windows.o: /usr/include/wchar.h /usr/include/bits/wchar.h -diskio-windows.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h -diskio-windows.o: /usr/include/bits/sys_errlist.h /usr/include/stdint.h -diskio-windows.o: /usr/include/errno.h /usr/include/bits/errno.h -diskio-windows.o: /usr/include/linux/errno.h /usr/include/fcntl.h -diskio-windows.o: /usr/include/bits/fcntl.h /usr/include/bits/fcntl-linux.h -diskio-windows.o: /usr/include/time.h /usr/include/bits/stat.h -diskio-windows.o: /usr/include/sys/stat.h support.h /usr/include/stdlib.h -diskio-windows.o: /usr/include/bits/waitflags.h -diskio-windows.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -diskio-windows.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -diskio-windows.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -diskio-windows.o: /usr/include/sys/select.h /usr/include/bits/select.h -diskio-windows.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -diskio-windows.o: /usr/include/sys/sysmacros.h -diskio-windows.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -diskio-windows.o: /usr/include/bits/stdlib-float.h diskio.h -diskio-windows.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -diskio-windows.o: /usr/include/bits/ioctl-types.h -diskio-windows.o: /usr/include/sys/ttydefaults.h -fixparts.o: /usr/include/stdio.h /usr/include/features.h -fixparts.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -fixparts.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -fixparts.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -fixparts.o: /usr/include/libio.h /usr/include/_G_config.h -fixparts.o: /usr/include/wchar.h /usr/include/bits/wchar.h -fixparts.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h -fixparts.o: /usr/include/bits/sys_errlist.h /usr/include/string.h basicmbr.h -fixparts.o: /usr/include/stdint.h /usr/include/sys/types.h -fixparts.o: /usr/include/time.h /usr/include/endian.h -fixparts.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -fixparts.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -fixparts.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -fixparts.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -fixparts.o: /usr/include/bits/pthreadtypes.h diskio.h -fixparts.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -fixparts.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -fixparts.o: support.h /usr/include/stdlib.h /usr/include/bits/waitflags.h -fixparts.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h -fixparts.o: /usr/include/bits/stdlib-float.h mbrpart.h -gdisk.o: /usr/include/string.h /usr/include/features.h -gdisk.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -gdisk.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -gdisk.o: /usr/include/xlocale.h gpttext.h gpt.h /usr/include/stdint.h -gdisk.o: /usr/include/bits/wchar.h /usr/include/sys/types.h -gdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -gdisk.o: /usr/include/time.h /usr/include/endian.h /usr/include/bits/endian.h -gdisk.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -gdisk.o: /usr/include/sys/select.h /usr/include/bits/select.h -gdisk.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -gdisk.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -gdisk.o: gptpart.h support.h /usr/include/stdlib.h -gdisk.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -gdisk.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h -gdisk.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h -gdisk.o: mbr.h diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -gdisk.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -gdisk.o: basicmbr.h mbrpart.h bsd.h -gpt.o: /usr/include/stdio.h /usr/include/features.h -gpt.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -gpt.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -gpt.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -gpt.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -gpt.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -gpt.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -gpt.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -gpt.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -gpt.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -gpt.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -gpt.o: /usr/include/time.h /usr/include/sys/select.h -gpt.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -gpt.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -gpt.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -gpt.o: /usr/include/bits/stdlib-float.h /usr/include/stdint.h -gpt.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h -gpt.o: /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h -gpt.o: /usr/include/string.h /usr/include/math.h /usr/include/bits/huge_val.h -gpt.o: /usr/include/bits/huge_valf.h /usr/include/bits/huge_vall.h -gpt.o: /usr/include/bits/inf.h /usr/include/bits/nan.h -gpt.o: /usr/include/bits/mathdef.h /usr/include/bits/mathcalls.h -gpt.o: /usr/include/sys/stat.h /usr/include/errno.h /usr/include/bits/errno.h -gpt.o: /usr/include/linux/errno.h crc32.h gpt.h gptpart.h support.h -gpt.o: parttypes.h guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h -gpt.o: attributes.h mbr.h diskio.h /usr/include/sys/ioctl.h -gpt.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h -gpt.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h bsd.h -gptcl.o: /usr/include/string.h /usr/include/features.h -gptcl.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -gptcl.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -gptcl.o: /usr/include/xlocale.h /usr/include/errno.h -gptcl.o: /usr/include/bits/errno.h /usr/include/linux/errno.h -gptcl.o: /usr/include/popt.h /usr/include/stdio.h /usr/include/bits/types.h -gptcl.o: /usr/include/bits/typesizes.h /usr/include/libio.h -gptcl.o: /usr/include/_G_config.h /usr/include/wchar.h -gptcl.o: /usr/include/bits/wchar.h /usr/include/bits/stdio_lim.h -gptcl.o: /usr/include/bits/sys_errlist.h gptcl.h gpt.h /usr/include/stdint.h -gptcl.o: /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h -gptcl.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -gptcl.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -gptcl.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -gptcl.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -gptcl.o: /usr/include/bits/pthreadtypes.h gptpart.h support.h -gptcl.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -gptcl.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h -gptcl.o: /usr/include/bits/stdlib-float.h parttypes.h guid.h -gptcl.o: /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h mbr.h -gptcl.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -gptcl.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -gptcl.o: basicmbr.h mbrpart.h bsd.h -gptcurses.o: /usr/include/ncurses.h /usr/include/ncurses_dll.h -gptcurses.o: /usr/include/stdio.h /usr/include/features.h -gptcurses.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -gptcurses.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -gptcurses.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -gptcurses.o: /usr/include/libio.h /usr/include/_G_config.h -gptcurses.o: /usr/include/wchar.h /usr/include/bits/wchar.h -gptcurses.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h -gptcurses.o: /usr/include/bits/sys_errlist.h /usr/include/unctrl.h -gptcurses.o: /usr/include/curses.h gptcurses.h gptpart.h -gptcurses.o: /usr/include/stdint.h /usr/include/sys/types.h -gptcurses.o: /usr/include/time.h /usr/include/endian.h -gptcurses.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -gptcurses.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -gptcurses.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -gptcurses.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -gptcurses.o: /usr/include/bits/pthreadtypes.h support.h /usr/include/stdlib.h -gptcurses.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -gptcurses.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h -gptcurses.o: parttypes.h guid.h /usr/include/uuid/uuid.h -gptcurses.o: /usr/include/sys/time.h attributes.h gpt.h mbr.h diskio.h -gptcurses.o: /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -gptcurses.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -gptcurses.o: basicmbr.h mbrpart.h bsd.h -gptpart.o: /usr/include/string.h /usr/include/features.h -gptpart.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -gptpart.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -gptpart.o: /usr/include/xlocale.h /usr/include/stdio.h -gptpart.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -gptpart.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -gptpart.o: /usr/include/bits/wchar.h /usr/include/bits/stdio_lim.h -gptpart.o: /usr/include/bits/sys_errlist.h gptpart.h /usr/include/stdint.h -gptpart.o: /usr/include/sys/types.h /usr/include/time.h /usr/include/endian.h -gptpart.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -gptpart.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -gptpart.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -gptpart.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -gptpart.o: /usr/include/bits/pthreadtypes.h support.h /usr/include/stdlib.h -gptpart.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -gptpart.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h -gptpart.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h -gptpart.o: attributes.h -gpttext.o: /usr/include/string.h /usr/include/features.h -gpttext.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -gpttext.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -gpttext.o: /usr/include/xlocale.h /usr/include/errno.h -gpttext.o: /usr/include/bits/errno.h /usr/include/linux/errno.h -gpttext.o: /usr/include/stdint.h /usr/include/bits/wchar.h -gpttext.o: /usr/include/limits.h /usr/include/bits/posix1_lim.h -gpttext.o: /usr/include/bits/local_lim.h /usr/include/linux/limits.h -gpttext.o: /usr/include/bits/posix2_lim.h attributes.h gpttext.h gpt.h -gpttext.o: /usr/include/sys/types.h /usr/include/bits/types.h -gpttext.o: /usr/include/bits/typesizes.h /usr/include/time.h -gpttext.o: /usr/include/endian.h /usr/include/bits/endian.h -gpttext.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -gpttext.o: /usr/include/sys/select.h /usr/include/bits/select.h -gpttext.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -gpttext.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -gpttext.o: gptpart.h support.h /usr/include/stdlib.h -gpttext.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -gpttext.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h parttypes.h -gpttext.o: guid.h /usr/include/uuid/uuid.h /usr/include/sys/time.h mbr.h -gpttext.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -gpttext.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -gpttext.o: basicmbr.h mbrpart.h bsd.h -guid.o: /usr/include/stdio.h /usr/include/features.h -guid.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -guid.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -guid.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -guid.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -guid.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -guid.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -guid.o: /usr/include/time.h /usr/include/string.h guid.h -guid.o: /usr/include/stdint.h /usr/include/uuid/uuid.h -guid.o: /usr/include/sys/types.h /usr/include/endian.h -guid.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -guid.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -guid.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -guid.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -guid.o: /usr/include/bits/pthreadtypes.h /usr/include/sys/time.h support.h -guid.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -guid.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h -guid.o: /usr/include/bits/stdlib-float.h -mbr.o: /usr/include/stdio.h /usr/include/features.h -mbr.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -mbr.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -mbr.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -mbr.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -mbr.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -mbr.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -mbr.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -mbr.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -mbr.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -mbr.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -mbr.o: /usr/include/time.h /usr/include/sys/select.h -mbr.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -mbr.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -mbr.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -mbr.o: /usr/include/bits/stdlib-float.h /usr/include/stdint.h -mbr.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h -mbr.o: /usr/include/bits/fcntl-linux.h /usr/include/bits/stat.h -mbr.o: /usr/include/string.h /usr/include/sys/stat.h /usr/include/errno.h -mbr.o: /usr/include/bits/errno.h /usr/include/linux/errno.h mbr.h gptpart.h -mbr.o: support.h parttypes.h guid.h /usr/include/uuid/uuid.h -mbr.o: /usr/include/sys/time.h attributes.h diskio.h /usr/include/sys/ioctl.h -mbr.o: /usr/include/bits/ioctls.h /usr/include/bits/ioctl-types.h -mbr.o: /usr/include/sys/ttydefaults.h basicmbr.h mbrpart.h -mbrpart.o: /usr/include/stdint.h /usr/include/features.h -mbrpart.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -mbrpart.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -mbrpart.o: /usr/include/bits/wchar.h support.h /usr/include/stdlib.h -mbrpart.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -mbrpart.o: /usr/include/endian.h /usr/include/bits/endian.h -mbrpart.o: /usr/include/bits/byteswap.h /usr/include/bits/types.h -mbrpart.o: /usr/include/bits/typesizes.h /usr/include/bits/byteswap-16.h -mbrpart.o: /usr/include/sys/types.h /usr/include/time.h -mbrpart.o: /usr/include/sys/select.h /usr/include/bits/select.h -mbrpart.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -mbrpart.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -mbrpart.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h mbrpart.h -parttypes.o: /usr/include/string.h /usr/include/features.h -parttypes.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -parttypes.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -parttypes.o: /usr/include/xlocale.h /usr/include/stdint.h -parttypes.o: /usr/include/bits/wchar.h /usr/include/stdio.h -parttypes.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -parttypes.o: /usr/include/libio.h /usr/include/_G_config.h -parttypes.o: /usr/include/wchar.h /usr/include/bits/stdio_lim.h -parttypes.o: /usr/include/bits/sys_errlist.h parttypes.h -parttypes.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -parttypes.o: /usr/include/bits/waitstatus.h /usr/include/endian.h -parttypes.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -parttypes.o: /usr/include/bits/byteswap-16.h /usr/include/sys/types.h -parttypes.o: /usr/include/time.h /usr/include/sys/select.h -parttypes.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -parttypes.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -parttypes.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -parttypes.o: /usr/include/bits/stdlib-float.h support.h guid.h -parttypes.o: /usr/include/uuid/uuid.h /usr/include/sys/time.h -sgdisk.o: gptcl.h gpt.h /usr/include/stdint.h /usr/include/features.h -sgdisk.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -sgdisk.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -sgdisk.o: /usr/include/bits/wchar.h /usr/include/sys/types.h -sgdisk.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -sgdisk.o: /usr/include/time.h /usr/include/endian.h -sgdisk.o: /usr/include/bits/endian.h /usr/include/bits/byteswap.h -sgdisk.o: /usr/include/bits/byteswap-16.h /usr/include/sys/select.h -sgdisk.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -sgdisk.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -sgdisk.o: /usr/include/bits/pthreadtypes.h gptpart.h support.h -sgdisk.o: /usr/include/stdlib.h /usr/include/bits/waitflags.h -sgdisk.o: /usr/include/bits/waitstatus.h /usr/include/alloca.h -sgdisk.o: /usr/include/bits/stdlib-float.h parttypes.h guid.h -sgdisk.o: /usr/include/uuid/uuid.h /usr/include/sys/time.h attributes.h mbr.h -sgdisk.o: diskio.h /usr/include/sys/ioctl.h /usr/include/bits/ioctls.h -sgdisk.o: /usr/include/bits/ioctl-types.h /usr/include/sys/ttydefaults.h -sgdisk.o: basicmbr.h mbrpart.h bsd.h /usr/include/popt.h /usr/include/stdio.h -sgdisk.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -sgdisk.o: /usr/include/xlocale.h /usr/include/bits/stdio_lim.h -sgdisk.o: /usr/include/bits/sys_errlist.h -support.o: /usr/include/stdio.h /usr/include/features.h -support.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -support.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -support.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -support.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -support.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -support.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -support.o: /usr/include/stdint.h /usr/include/errno.h -support.o: /usr/include/bits/errno.h /usr/include/linux/errno.h -support.o: /usr/include/fcntl.h /usr/include/bits/fcntl.h -support.o: /usr/include/bits/fcntl-linux.h /usr/include/time.h -support.o: /usr/include/bits/stat.h /usr/include/string.h -support.o: /usr/include/sys/stat.h support.h /usr/include/stdlib.h -support.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -support.o: /usr/include/endian.h /usr/include/bits/endian.h -support.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -support.o: /usr/include/sys/types.h /usr/include/sys/select.h -support.o: /usr/include/bits/select.h /usr/include/bits/sigset.h -support.o: /usr/include/bits/time.h /usr/include/sys/sysmacros.h -support.o: /usr/include/bits/pthreadtypes.h /usr/include/alloca.h -support.o: /usr/include/bits/stdlib-float.h -test.o: /usr/include/stdio.h /usr/include/features.h -test.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -test.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -test.o: /usr/include/bits/types.h /usr/include/bits/typesizes.h -test.o: /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h -test.o: /usr/include/bits/wchar.h /usr/include/xlocale.h -test.o: /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h -test.o: support.h /usr/include/stdint.h /usr/include/stdlib.h -test.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -test.o: /usr/include/endian.h /usr/include/bits/endian.h -test.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -test.o: /usr/include/sys/types.h /usr/include/time.h -test.o: /usr/include/sys/select.h /usr/include/bits/select.h -test.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -test.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -test.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h -testguid.o: guid.h /usr/include/stdint.h /usr/include/features.h -testguid.o: /usr/include/stdc-predef.h /usr/include/sys/cdefs.h -testguid.o: /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h -testguid.o: /usr/include/bits/wchar.h /usr/include/uuid/uuid.h -testguid.o: /usr/include/sys/types.h /usr/include/bits/types.h -testguid.o: /usr/include/bits/typesizes.h /usr/include/time.h -testguid.o: /usr/include/endian.h /usr/include/bits/endian.h -testguid.o: /usr/include/bits/byteswap.h /usr/include/bits/byteswap-16.h -testguid.o: /usr/include/sys/select.h /usr/include/bits/select.h -testguid.o: /usr/include/bits/sigset.h /usr/include/bits/time.h -testguid.o: /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h -testguid.o: /usr/include/sys/time.h parttypes.h /usr/include/stdlib.h -testguid.o: /usr/include/bits/waitflags.h /usr/include/bits/waitstatus.h -testguid.o: /usr/include/alloca.h /usr/include/bits/stdlib-float.h support.h diff --git a/basicmbr.cc b/basicmbr.cc index 5661487..8fbffd1 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -1497,11 +1497,11 @@ uint64_t BasicMBRData::GetFirstSector(int i) { uint64_t retval; thePart = GetPartition(i); - if (thePart != NULL) { + if (thePart != NULL) retval = thePart->GetStartLBA(); - } else + else retval = UINT32_C(0); - return retval; + return retval; } // BasicMBRData::GetFirstSector() uint64_t BasicMBRData::GetLength(int i) { @@ -1509,11 +1509,11 @@ uint64_t BasicMBRData::GetLength(int i) { uint64_t retval; thePart = GetPartition(i); - if (thePart != NULL) { + if (thePart != NULL) retval = thePart->GetLengthLBA(); - } else + else retval = UINT64_C(0); - return retval; + return retval; } // BasicMBRData::GetLength() /*********************** diff --git a/cgdisk.8 b/cgdisk.8 index ac3da9b..b09f6bf 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "CGDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual" +.TH "CGDISK" "8" "1.0.2" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" cgdisk \- Curses-based GUID partition table (GPT) manipulator .SH "SYNOPSIS" diff --git a/current.spec b/current.spec index 1587732..25f2333 100644 --- a/current.spec +++ b/current.spec @@ -1,12 +1,12 @@ Summary: GPT partitioning and MBR repair software Name: gptfdisk -Version: 1.0.1 +Version: 1.0.2 Release: 1%{?dist} License: GPLv2 URL: http://www.rodsbooks.com/gdisk Group: Applications/System -Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.1.tar.gz +Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.2.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description @@ -81,5 +81,5 @@ provides a few additional partition manipulation features. %changelog -* Sun Mar 2 2014 R Smith - 1.0.1 -- Created spec file for 1.0.1 release +* Wed Jul 26 2017 R Smith - 1.0.2 +- Created spec file for 1.0.2 release diff --git a/fixparts.8 b/fixparts.8 index 9c4312f..dd3cdf7 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "FIXPARTS" "8" "1.0.1" "Roderick W. Smith" "FixParts Manual" +.TH "FIXPARTS" "8" "1.0.2" "Roderick W. Smith" "FixParts Manual" .SH "NAME" fixparts \- MBR partition table repair utility .SH "SYNOPSIS" diff --git a/gdisk.8 b/gdisk.8 index 6a945e1..f4cef83 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "GDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual" +.TH "GDISK" "8" "1.0.2" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" gdisk \- Interactive GUID partition table (GPT) manipulator .SH "SYNOPSIS" diff --git a/gptcl.cc b/gptcl.cc index 243b4d9..6c36738 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -158,7 +158,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { if (LoadPartitions((string) device)) { if ((WhichWasUsed() == use_mbr) || (WhichWasUsed() == use_bsd)) saveNonGPT = 0; // flag so we don't overwrite unless directed to do so - sSize = GetBlockSize(); + sSize = GetBlockSize(); while ((opt = poptGetNextOpt(poptCon)) > 0) { switch (opt) { case 'A': { diff --git a/sgdisk.8 b/sgdisk.8 index 274ceb3..586b4ce 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2015 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "SGDISK" "8" "1.0.1" "Roderick W. Smith" "GPT fdisk Manual" +.TH "SGDISK" "8" "1.0.2" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix .SH "SYNOPSIS" From f1f6236fb44392bfe5673bc3889a2b17b1696b90 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Thu, 27 Jul 2017 21:59:14 -0400 Subject: [PATCH 32/56] Fixed a major bug that caused improper partition tables to be created. Version 1.0.3 release. --- NEWS | 7 +++++++ cgdisk.8 | 2 +- current.spec | 8 ++++---- fixparts.8 | 2 +- gdisk.8 | 2 +- gpt.cc | 1 + sgdisk.8 | 2 +- support.h | 2 +- 8 files changed, 17 insertions(+), 9 deletions(-) diff --git a/NEWS b/NEWS index 2e60015..88c72b2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,10 @@ +1.0.3 (7/27/2017): +------------------ + +- Fixed a major bug that caused invalid partition tables to be generated + when creating a new partition table (that is, partitioning a blank disk or + converting from MBR). + 1.0.2 (7/26/2017): ------------------ diff --git a/cgdisk.8 b/cgdisk.8 index b09f6bf..1eb0453 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "CGDISK" "8" "1.0.2" "Roderick W. Smith" "GPT fdisk Manual" +.TH "CGDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" cgdisk \- Curses-based GUID partition table (GPT) manipulator .SH "SYNOPSIS" diff --git a/current.spec b/current.spec index 25f2333..b16fbad 100644 --- a/current.spec +++ b/current.spec @@ -1,12 +1,12 @@ Summary: GPT partitioning and MBR repair software Name: gptfdisk -Version: 1.0.2 +Version: 1.0.3 Release: 1%{?dist} License: GPLv2 URL: http://www.rodsbooks.com/gdisk Group: Applications/System -Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.2.tar.gz +Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.3.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description @@ -81,5 +81,5 @@ provides a few additional partition manipulation features. %changelog -* Wed Jul 26 2017 R Smith - 1.0.2 -- Created spec file for 1.0.2 release +* Thu Jul 27 2017 R Smith - 1.0.3 +- Created spec file for 1.0.3 release diff --git a/fixparts.8 b/fixparts.8 index dd3cdf7..de30b6a 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "FIXPARTS" "8" "1.0.2" "Roderick W. Smith" "FixParts Manual" +.TH "FIXPARTS" "8" "1.0.3" "Roderick W. Smith" "FixParts Manual" .SH "NAME" fixparts \- MBR partition table repair utility .SH "SYNOPSIS" diff --git a/gdisk.8 b/gdisk.8 index f4cef83..c2cf83d 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "GDISK" "8" "1.0.2" "Roderick W. Smith" "GPT fdisk Manual" +.TH "GDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" gdisk \- Interactive GUID partition table (GPT) manipulator .SH "SYNOPSIS" diff --git a/gpt.cc b/gpt.cc index 4f37323..03a2156 100644 --- a/gpt.cc +++ b/gpt.cc @@ -1924,6 +1924,7 @@ int GPTData::ClearGPTData(void) { mainHeader.currentLBA = UINT64_C(1); mainHeader.partitionEntriesLBA = (uint64_t) 2; mainHeader.sizeOfPartitionEntries = GPT_SIZE; + mainHeader.firstUsableLBA = GetTableSizeInSectors() + mainHeader.partitionEntriesLBA; for (i = 0; i < GPT_RESERVED; i++) { mainHeader.reserved2[i] = '\0'; } // for diff --git a/sgdisk.8 b/sgdisk.8 index 586b4ce..2cb18b9 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -1,6 +1,6 @@ .\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "SGDISK" "8" "1.0.2" "Roderick W. Smith" "GPT fdisk Manual" +.TH "SGDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix .SH "SYNOPSIS" diff --git a/support.h b/support.h index f8957aa..85324f6 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "1.0.2" +#define GPTFDISK_VERSION "1.0.3" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 From 643126a53c3213ad8ae5c787836c1ec074d14eba Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Tue, 3 Oct 2017 11:32:12 -0400 Subject: [PATCH 33/56] New type code for APFS. --- parttypes.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/parttypes.cc b/parttypes.cc index 59d00ab..c6aed7f 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -201,6 +201,7 @@ void PartType::AddAllTypes(void) { AddType(0xaf07, "2E313465-19B9-463F-8126-8A7993773801", "Apple SoftRAID Scratch"); AddType(0xaf08, "FA709C7E-65B1-4593-BFD5-E71D61DE9B02", "Apple SoftRAID Volume"); AddType(0xaf09, "BBBA6DF5-F46F-4A89-8F59-8765B2727503", "Apple SoftRAID Cache"); + AddType(0xaf0a, "7C3457EF-0000-11AA-AA11-00306543ECAC", "Apple APFS"); // QNX Power-Safe (QNX6) AddType(0xb300, "CEF5A9AD-73BC-4601-89F3-CDEEEEE321A1", "QNX6 Power-Safe"); From 349c11e19dd8390b21551ac91b79d29352915706 Mon Sep 17 00:00:00 2001 From: Claudia Pellegrino Date: Fri, 13 Oct 2017 11:31:09 +0200 Subject: [PATCH 34/56] Fix ncurses path mismatch introduced in a9630e3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, macOS comes with the ncurses library installed at /usr/lib/libncurses.dylib; however with commit a9630e3 in late 2015, gptfdisk has added a line to Makefile.mac that references `/opt/local/lib/libncurses.a`. For most OS X/macOS users, this breaks the build because the file does not ship with macOS. For more info on the issue, see the relevant discussion on the Homebrew project. [1] The commit at hand changes that reference to /usr/lib/libncurses.dylib, which has shipped with OS X/macOS for many years, and is guaranteed to exist. [1]: https://github.com/Homebrew/legacy-homebrew/pull/46398#issuecomment–160473325 --- Makefile.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile.mac b/Makefile.mac index ac5e773..6c0fa25 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -19,7 +19,7 @@ gdisk: $(LIB_OBJS) gpttext.o gdisk.o # $(CXX) $(LIB_OBJS) -L/usr/lib -licucore gpttext.o gdisk.o -o gdisk cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o - $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o /opt/local/lib/libncurses.a $(LDFLAGS) $(FATBINFLAGS) -o cgdisk + $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o /usr/lib/libncurses.dylib $(LDFLAGS) $(FATBINFLAGS) -o cgdisk # $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licucore -lncurses -o cgdisk sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o From a5381e8aaa67647a4ba0fb41b951125ae309b078 Mon Sep 17 00:00:00 2001 From: Shea Levy Date: Sat, 24 Feb 2018 08:35:54 -0500 Subject: [PATCH 35/56] Makefile: Don't hard-code CC and CXX. These variables should be provided by the Make implementation and the build environment. In particular, this fixes cross-compilation of gptfdisk. --- Makefile | 2 -- 1 file changed, 2 deletions(-) diff --git a/Makefile b/Makefile index a3576b3..d76fab4 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,3 @@ -CC=gcc -CXX=g++ CFLAGS+=-D_FILE_OFFSET_BITS=64 #CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 CXXFLAGS+=-Wall -D_FILE_OFFSET_BITS=64 From 5e490b279f313bf2138d99a12f3fbed299d4ac2e Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Sun, 29 Apr 2018 16:23:49 -0400 Subject: [PATCH 36/56] Changed "Creating new GPT entries" message to "Creating new GPT entries in memory" because the latter is clearer and more precise. --- NEWS | 10 ++++++++++ gpt.cc | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 88c72b2..553e4d1 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,13 @@ +1.0.4 (?/??/2018): +------------------ + +- Added type code for Apple APFS (7C3457EF-0000-11AA-AA11-00306543ECAC, + 0xaf0a). + +- Changed "Creating new GPT entries" message to read "Creating new + GPT entries in memory" because the latter is clearer, particularly when + using sgdisk with a non-destructive option, like "-p". + 1.0.3 (7/27/2017): ------------------ diff --git a/gpt.cc b/gpt.cc index 03a2156..28c52a7 100644 --- a/gpt.cc +++ b/gpt.cc @@ -1593,7 +1593,7 @@ WhichToUse GPTData::UseWhichPartitions(void) { } // if GPT corrupt if (which == use_new) - cout << "Creating new GPT entries.\n"; + cout << "Creating new GPT entries in memory.\n"; return which; } // UseWhichPartitions() From 2fb79510f0452e91b72cefa704268a569b9885e9 Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Fri, 18 May 2018 23:44:40 +0200 Subject: [PATCH 37/56] Reset struct alignment back to standard after each #pragma pack (n) When using #pragma pack (n) to change the alignment for a struct to n bytes, it is necessary to reset the alignment to the standard value as otherwise the changed alignment is used throughout the whole program code which causes other structs to become unaligned. --- basicmbr.h | 1 + bsd.h | 1 + gpt.h | 1 + mbrpart.h | 1 + 4 files changed, 4 insertions(+) diff --git a/basicmbr.h b/basicmbr.h index b809856..21f962e 100644 --- a/basicmbr.h +++ b/basicmbr.h @@ -34,6 +34,7 @@ struct TempMBR { struct MBRRecord partitions[4]; uint16_t MBRSignature; }; // struct TempMBR +#pragma pack () // Possible states of the MBR enum MBRValidity {invalid, gpt, hybrid, mbr}; diff --git a/bsd.h b/bsd.h index ffbe5cc..cbd3588 100644 --- a/bsd.h +++ b/bsd.h @@ -89,5 +89,6 @@ class BSDData { int GetNumParts(void); GPTPart AsGPT(int i); // Return BSD part. as GPT part. }; // struct MBRData +#pragma pack () #endif diff --git a/gpt.h b/gpt.h index 2d7a1ce..f4bf470 100644 --- a/gpt.h +++ b/gpt.h @@ -57,6 +57,7 @@ struct GPTHeader { uint32_t partitionEntriesCRC; unsigned char reserved2[GPT_RESERVED]; }; // struct GPTHeader +#pragma pack () // Data in GPT format class GPTData { diff --git a/mbrpart.h b/mbrpart.h index f5892e7..0de365f 100644 --- a/mbrpart.h +++ b/mbrpart.h @@ -50,6 +50,7 @@ struct MBRRecord { uint32_t firstLBA; // see above uint32_t lengthLBA; }; // struct MBRRecord +#pragma pack () class MBRPart { protected: From c41db9e6908d3b756efd47534720c7da095abd19 Mon Sep 17 00:00:00 2001 From: Weiping Zhang Date: Thu, 21 Jun 2018 23:47:10 +0800 Subject: [PATCH 38/56] load main partition table if main header crc is ok mainCrcOk and secondCrcOk were overwritten by header rebuilding. Signed-off-by: Weiping Zhang --- gpt.cc | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gpt.cc b/gpt.cc index 28c52a7..5a14594 100644 --- a/gpt.cc +++ b/gpt.cc @@ -899,9 +899,8 @@ int GPTData::ForceLoadGPTData(void) { } // if/else/if // Figure out which partition table to load.... - // Load the main partition table, since either its header's CRC is OK or the - // backup header's CRC is not OK.... - if (mainCrcOk || !secondCrcOk) { + // Load the main partition table, if its header's CRC is OK + if (validHeaders != 2) { if (LoadMainTable() == 0) allOK = 0; } else { // bad main header CRC and backup header CRC is OK From 826f8a0d53c2cc0512e2c717793660a87ce63009 Mon Sep 17 00:00:00 2001 From: Weiping Zhang Date: Fri, 22 Jun 2018 00:20:49 +0800 Subject: [PATCH 39/56] Show detail status of header and table Signed-off-by: Weiping Zhang --- gpt.cc | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/gpt.cc b/gpt.cc index 5a14594..163e81e 100644 --- a/gpt.cc +++ b/gpt.cc @@ -934,9 +934,27 @@ int GPTData::ForceLoadGPTData(void) { } // if */ // Check for valid CRCs and warn if there are problems - if ((mainCrcOk == 0) || (secondCrcOk == 0) || (mainPartsCrcOk == 0) || + if ((validHeaders != 3) || (mainPartsCrcOk == 0) || (secondPartsCrcOk == 0)) { - cerr << "Warning! One or more CRCs don't match. You should repair the disk!\n\n"; + cerr << "Warning! One or more CRCs don't match. You should repair the disk!\n"; + // Show detail status of header and table + if (validHeaders & 0x1) + cerr << "Main header: OK\n"; + else + cerr << "Main header: ERROR\n"; + if (validHeaders & 0x2) + cerr << "Backup header: OK\n"; + else + cerr << "Backup header: ERROR\n"; + if (mainPartsCrcOk) + cerr << "Main partition table: OK\n"; + else + cerr << "Main partition table: ERROR\n"; + if (secondPartsCrcOk) + cerr << "Backup partition table: OK\n"; + else + cerr << "Backup partition table: ERROR\n"; + cerr << "\n"; state = gpt_corrupt; } // if } else { From b1707b9c13752426435448c512d85a8a4b9d0f09 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 4 Jul 2018 18:01:57 -0400 Subject: [PATCH 40/56] Updated NEWS files to record effects of recent merges. --- NEWS | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/NEWS b/NEWS index 553e4d1..5ef1976 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,13 @@ 1.0.4 (?/??/2018): ------------------ +- Change to Makefile.mac to use standard libncurses rather than a 3rd-party + version; should help with cgdisk compatibility. + +- Minor bug fix in alignment of internal data structures. + +- Minor bug fix in handling of damaged disks. + - Added type code for Apple APFS (7C3457EF-0000-11AA-AA11-00306543ECAC, 0xaf0a). From 45f012b6f8d73a16b5e59891f5f9891fbfda0e54 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Wed, 4 Jul 2018 22:27:40 -0400 Subject: [PATCH 41/56] Added 52 Android partition type codes. --- NEWS | 2 ++ parttypes.cc | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 57 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 5ef1976..c37f47a 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,8 @@ - Added type code for Apple APFS (7C3457EF-0000-11AA-AA11-00306543ECAC, 0xaf0a). +- Added 52 (yes, 52!) Android partition type codes. + - Changed "Creating new GPT entries" message to read "Creating new GPT entries in memory" because the latter is clearer, particularly when using sgdisk with a non-destructive option, like "-p". diff --git a/parttypes.cc b/parttypes.cc index c6aed7f..1acb14c 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -141,19 +141,73 @@ void PartType::AddAllTypes(void) { AddType(0x8e00, "E6D6D379-F507-44C2-A23C-238F2A3DF928", "Linux LVM"); // Android type codes.... + // from Wikipedia, https://gist.github.com/culots/704afd126dec2f45c22d0c9d42cb7fab, + // and my own Android devices' partition tables AddType(0xa000, "2568845D-2332-4675-BC39-8FA5A4748D15", "Android bootloader"); AddType(0xa001, "114EAFFE-1552-4022-B26E-9B053604CF84", "Android bootloader 2"); AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot"); AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery"); AddType(0xa004, "EF32A33B-A409-486C-9141-9FFB711F6266", "Android misc"); AddType(0xa005, "20AC26BE-20B7-11E3-84C5-6CFDB94711E9", "Android metadata"); - AddType(0xa006, "38F428E6-D326-425D-9140-6E0EA133647C", "Android system"); + AddType(0xa006, "38F428E6-D326-425D-9140-6E0EA133647C", "Android system 1"); AddType(0xa007, "A893EF21-E428-470A-9E55-0668FD91A2D9", "Android cache"); AddType(0xa008, "DC76DDA9-5AC1-491C-AF42-A82591580C0D", "Android data"); AddType(0xa009, "EBC597D0-2053-4B15-8B64-E0AAC75F4DB1", "Android persistent"); AddType(0xa00a, "8F68CC74-C5E5-48DA-BE91-A0C8C15E9C80", "Android factory"); AddType(0xa00b, "767941D0-2085-11E3-AD3B-6CFDB94711E9", "Android fastboot/tertiary"); AddType(0xa00c, "AC6D7924-EB71-4DF8-B48D-E267B27148FF", "Android OEM"); + AddType(0xa00d, "C5A0AEEC-13EA-11E5-A1B1-001E67CA0C3C", "Android vendor"); + AddType(0xa00e, "BD59408B-4514-490D-BF12-9878D963F378", "Android config"); + AddType(0xa00f, "9FDAA6EF-4B3F-40D2-BA8D-BFF16BFB887B", "Android factory (alt)"); + AddType(0xa010, "19A710A2-B3CA-11E4-B026-10604B889DCF", "Android meta"); + AddType(0xa011, "193D1EA4-B3CA-11E4-B075-10604B889DCF", "Android EXT"); + AddType(0xa012, "DEA0BA2C-CBDD-4805-B4F9-F428251C3E98", "Android SBL1"); + AddType(0xa013, "8C6B52AD-8A9E-4398-AD09-AE916E53AE2D", "Android SBL2"); + AddType(0xa014, "05E044DF-92F1-4325-B69E-374A82E97D6E", "Android SBL3"); + AddType(0xa015, "400FFDCD-22E0-47E7-9A23-F16ED9382388", "Android APPSBL"); + AddType(0xa016, "A053AA7F-40B8-4B1C-BA08-2F68AC71A4F4", "Android QSEE/tz"); + AddType(0xa017, "E1A6A689-0C8D-4CC6-B4E8-55A4320FBD8A", "Android QHEE/hyp"); + AddType(0xa018, "098DF793-D712-413D-9D4E-89D711772228", "Android RPM"); + AddType(0xa019, "D4E0D938-B7FA-48C1-9D21-BC5ED5C4B203", "Android WDOG debug/sdi"); + AddType(0xa01a, "20A0C19C-286A-42FA-9CE7-F64C3226A794", "Android DDR"); + AddType(0xa01b, "A19F205F-CCD8-4B6D-8F1E-2D9BC24CFFB1", "Android CDT"); + AddType(0xa01c, "66C9B323-F7FC-48B6-BF96-6F32E335A428", "Android RAM dump"); + AddType(0xa01d, "303E6AC3-AF15-4C54-9E9B-D9A8FBECF401", "Android SEC"); + AddType(0xa01e, "C00EEF24-7709-43D6-9799-DD2B411E7A3C", "Android PMIC"); + AddType(0xa01f, "82ACC91F-357C-4A68-9C8F-689E1B1A23A1", "Android misc 1"); + AddType(0xa020, "E2802D54-0545-E8A1-A1E8-C7A3E245ACD4", "Android misc 2"); + AddType(0xa021, "65ADDCF4-0C5C-4D9A-AC2D-D90B5CBFCD03", "Android device info"); + AddType(0xa022, "E6E98DA2-E22A-4D12-AB33-169E7DEAA507", "Android APDP"); + AddType(0xa023, "ED9E8101-05FA-46B7-82AA-8D58770D200B", "Android MSADP"); + AddType(0xa024, "11406F35-1173-4869-807B-27DF71802812", "Android DPO"); + AddType(0xa025, "9D72D4E4-9958-42DA-AC26-BEA7A90B0434", "Android recovery"); + AddType(0xa026, "6C95E238-E343-4BA8-B489-8681ED22AD0B", "Android persist"); + AddType(0xa027, "EBBEADAF-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST1"); + AddType(0xa028, "0A288B1F-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST2"); + AddType(0xa029, "57B90A16-22C9-E33B-8F5D-0E81686A68CB", "Android FSC"); + AddType(0xa02a, "638FF8E2-22C9-E33B-8F5D-0E81686A68CB", "Android FSG 1"); + AddType(0xa02b, "2013373E-1AC4-4131-BFD8-B6A7AC638772", "Android FSG 2"); + AddType(0xa02c, "2C86E742-745E-4FDD-BFD8-B6A7AC638772", "Android SSD"); + AddType(0xa02d, "DE7D4029-0F5B-41C8-AE7E-F6C023A02B33", "Android keystore"); + AddType(0xa02e, "323EF595-AF7A-4AFA-8060-97BE72841BB9", "Android encrypt"); + AddType(0xa02f, "45864011-CF89-46E6-A445-85262E065604", "Android EKSST"); + AddType(0xa030, "8ED8AE95-597F-4C8A-A5BD-A7FF8E4DFAA9", "Android RCT"); + AddType(0xa031, "DF24E5ED-8C96-4B86-B00B-79667DC6DE11", "Android spare1"); + AddType(0xa032, "7C29D3AD-78B9-452E-9DEB-D098D542F092", "Android spare2"); + AddType(0xa033, "379D107E-229E-499D-AD4F-61F5BCF87BD4", "Android spare3"); + AddType(0xa034, "0DEA65E5-A676-4CDF-823C-77568B577ED5", "Android spare4"); + AddType(0xa035, "4627AE27-CFEF-48A1-88FE-99C3509ADE26", "Android raw resources"); + AddType(0xa036, "20117F86-E985-4357-B9EE-374BC1D8487D", "Android boot"); + AddType(0xa037, "86A7CB80-84E1-408C-99AB-694F1A410FC7", "Android FOTA"); + AddType(0xa038, "97D7B011-54DA-4835-B3C4-917AD6E73D74", "Android system 2"); + AddType(0xa039, "5594C694-C871-4B5F-90B1-690A6F68E0F7", "Android cache"); + AddType(0xa03a, "1B81E7E6-F50D-419B-A739-2AEEF8DA3335", "Android user data"); + AddType(0xa03b, "98523EC6-90FE-4C67-B50A-0FC59ED6F56D", "LG advanced flasher"); + AddType(0xa03c, "2644BCC0-F36A-4792-9533-1738BED53EE3", "Android PG1FS"); + AddType(0xa03d, "DD7C91E9-38C9-45C5-8A12-4A80F7E14057", "Android PG2FS"); + AddType(0xa03e, "7696D5B6-43FD-4664-A228-C563C4A1E8CC", "Android board info"); + AddType(0xa03f, "0D802D54-058D-4A20-AD2D-C7A362CEACD4", "Android MFG"); + AddType(0xa040, "10A0C19C-516A-5444-5CE3-664C3226A794", "Android limits"); // FreeBSD partition types.... // Note: Rather than extract FreeBSD disklabel data, convert FreeBSD From 44cda477dfe10ced50fdd585252e396dc86501c3 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Thu, 5 Jul 2018 09:07:58 -0400 Subject: [PATCH 42/56] Added search/filter feature to "L" function to display partition type codes. --- NEWS | 8 ++++++++ cgdisk.8 | 8 ++++++-- fixparts.8 | 4 ++-- gdisk.8 | 19 +++++++++++-------- gpt.cc | 2 +- gptcurses.cc | 2 +- gptcurses.h | 2 +- gptpart.cc | 2 +- gpttext.cc | 2 +- gpttext.h | 2 +- parttypes.cc | 30 +++++++++++++++++++++--------- parttypes.h | 2 +- sgdisk.8 | 4 ++-- support.cc | 2 +- support.h | 2 +- 15 files changed, 59 insertions(+), 32 deletions(-) diff --git a/NEWS b/NEWS index c37f47a..3c4ce82 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,14 @@ 1.0.4 (?/??/2018): ------------------ +- Added search feature to partition type list functions ("L" on main menu of + gdisk and "L" when entered in response to the "Hex code or GUID" prompt in + gdisk and sgdisk). This feature filters the partition type list to those + which include the search term in their GPT fdisk descriptions. For + instance, typing "Linux" shows only partitions with "Linux" in their + descriptions. Note that the search/filter is case-sensitive. If is + pressed, no filter is applied. + - Change to Makefile.mac to use standard libncurses rather than a 3rd-party version; should help with cgdisk compatibility. diff --git a/cgdisk.8 b/cgdisk.8 index 1eb0453..ef982b4 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "CGDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual" +.TH "CGDISK" "8" "1.0.4" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" cgdisk \- Curses-based GUID partition table (GPT) manipulator .SH "SYNOPSIS" @@ -262,6 +262,10 @@ Change a single partition's type code. You enter the type code using a two\-byte hexadecimal number. You may also enter a GUID directly, if you have one and \fBcgdisk\fR doesn't know it. If you don't know the type code for your partition, you can type \fBL\fR to see a list of known type codes. +The type code list may optionally be filtered by a search string; for +instance, entering \fI\fBLinux\fR\fR shows only partition type codes with +descriptions that include the string \fILinux\fR. This search is performed +case\-sensitively. .TP .B Verify diff --git a/fixparts.8 b/fixparts.8 index de30b6a..163c247 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "FIXPARTS" "8" "1.0.3" "Roderick W. Smith" "FixParts Manual" +.TH "FIXPARTS" "8" "1.0.4" "Roderick W. Smith" "FixParts Manual" .SH "NAME" fixparts \- MBR partition table repair utility .SH "SYNOPSIS" diff --git a/gdisk.8 b/gdisk.8 index c2cf83d..fcd07e2 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "GDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual" +.TH "GDISK" "8" "1.0.4" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" gdisk \- Interactive GUID partition table (GPT) manipulator .SH "SYNOPSIS" @@ -185,12 +185,15 @@ related to their equivalent MBR codes. Specifically, the MBR code is multiplied by hexadecimal 0x0100. For instance, the code for Linux swap space in MBR is 0x82, and it's 0x8200 in \fBgdisk\fR. A one\-to\-one correspondence is impossible, though. Most notably, the codes for all -varieties of FAT and NTFS partition correspond to a single GPT code -(entered as 0x0700 in \fBsgdisk\fR). Some OSes use a single MBR code but -employ many more codes in GPT. For these, \fBgdisk\fR adds code numbers -sequentially, such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD -boot, 0xa502 for FreeBSD swap, and so on. Note that these two\-byte codes -are unique to \fBgdisk\fR. +varieties of FAT and NTFS partition correspond to a single GPT code (entered +as 0x0700 in \fBgdisk\fR). Some OSes use a single MBR code but employ many +more codes in GPT. For these, \fBgdisk\fR adds code numbers sequentially, +such as 0xa500 for a FreeBSD disklabel, 0xa501 for FreeBSD boot, 0xa502 for +FreeBSD swap, and so on. Note that these two\-byte codes are unique to +\fBgdisk\fR. The type code list may optionally be filtered by a search +string; for instance, entering \fI\fBLinux\fR\fR shows only partition type +codes with descriptions that include the string \fILinux\fR. This search is +performed case\-sensitively. .TP .B n diff --git a/gpt.cc b/gpt.cc index 163e81e..c054460 100644 --- a/gpt.cc +++ b/gpt.cc @@ -3,7 +3,7 @@ /* By Rod Smith, initial coding January to February, 2009 */ -/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed +/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ #define __STDC_LIMIT_MACROS diff --git a/gptcurses.cc b/gptcurses.cc index 0e18f8f..a9f466c 100644 --- a/gptcurses.cc +++ b/gptcurses.cc @@ -1,7 +1,7 @@ /* * Implementation of GPTData class derivative with curses-based text-mode * interaction - * Copyright (C) 2011-2013 Roderick W. Smith + * Copyright (C) 2011-2018 Roderick W. Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/gptcurses.h b/gptcurses.h index 9a14f7e..f153de2 100644 --- a/gptcurses.h +++ b/gptcurses.h @@ -1,7 +1,7 @@ /* * Implementation of GPTData class derivative with curses-based text-mode * interaction - * Copyright (C) 2011-2013 Roderick W. Smith + * Copyright (C) 2011-2018 Roderick W. Smith * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/gptpart.cc b/gptpart.cc index 17d6f15..40a90a3 100644 --- a/gptpart.cc +++ b/gptpart.cc @@ -4,7 +4,7 @@ // Description: Class to implement a SINGLE GPT partition // // -// Author: Rod Smith , (C) 2009-2013 +// Author: Rod Smith , (C) 2009-2018 // // Copyright: See COPYING file that comes with this distribution // diff --git a/gpttext.cc b/gpttext.cc index 732d861..ea34444 100644 --- a/gpttext.cc +++ b/gpttext.cc @@ -1,5 +1,5 @@ /* - Copyright (C) 2010-2013 + Copyright (C) 2010-2018 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/gpttext.h b/gpttext.h index 98e59af..afe4651 100644 --- a/gpttext.h +++ b/gpttext.h @@ -1,6 +1,6 @@ /* Implementation of GPTData class derivative with basic text-mode interaction - Copyright (C) 2010-2013 Roderick W. Smith + Copyright (C) 2010-2018 Roderick W. Smith This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by diff --git a/parttypes.cc b/parttypes.cc index 1acb14c..f3ad9bc 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -2,7 +2,7 @@ // Class to manage partition type codes -- a slight variant on MBR type // codes, GUID type codes, and associated names. -/* This program is copyright (c) 2009-2015 by Roderick W. Smith. It is distributed +/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ #define __STDC_LIMIT_MACROS @@ -145,8 +145,8 @@ void PartType::AddAllTypes(void) { // and my own Android devices' partition tables AddType(0xa000, "2568845D-2332-4675-BC39-8FA5A4748D15", "Android bootloader"); AddType(0xa001, "114EAFFE-1552-4022-B26E-9B053604CF84", "Android bootloader 2"); - AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot"); - AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery"); + AddType(0xa002, "49A4D17F-93A3-45C1-A0DE-F50B2EBE2599", "Android boot 1"); + AddType(0xa003, "4177C722-9E92-4AAB-8644-43502BFD5506", "Android recovery 1"); AddType(0xa004, "EF32A33B-A409-486C-9141-9FFB711F6266", "Android misc"); AddType(0xa005, "20AC26BE-20B7-11E3-84C5-6CFDB94711E9", "Android metadata"); AddType(0xa006, "38F428E6-D326-425D-9140-6E0EA133647C", "Android system 1"); @@ -180,7 +180,7 @@ void PartType::AddAllTypes(void) { AddType(0xa022, "E6E98DA2-E22A-4D12-AB33-169E7DEAA507", "Android APDP"); AddType(0xa023, "ED9E8101-05FA-46B7-82AA-8D58770D200B", "Android MSADP"); AddType(0xa024, "11406F35-1173-4869-807B-27DF71802812", "Android DPO"); - AddType(0xa025, "9D72D4E4-9958-42DA-AC26-BEA7A90B0434", "Android recovery"); + AddType(0xa025, "9D72D4E4-9958-42DA-AC26-BEA7A90B0434", "Android recovery 2"); AddType(0xa026, "6C95E238-E343-4BA8-B489-8681ED22AD0B", "Android persist"); AddType(0xa027, "EBBEADAF-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST1"); AddType(0xa028, "0A288B1F-22C9-E33B-8F5D-0E81686A68CB", "Android modem ST2"); @@ -197,18 +197,21 @@ void PartType::AddAllTypes(void) { AddType(0xa033, "379D107E-229E-499D-AD4F-61F5BCF87BD4", "Android spare3"); AddType(0xa034, "0DEA65E5-A676-4CDF-823C-77568B577ED5", "Android spare4"); AddType(0xa035, "4627AE27-CFEF-48A1-88FE-99C3509ADE26", "Android raw resources"); - AddType(0xa036, "20117F86-E985-4357-B9EE-374BC1D8487D", "Android boot"); + AddType(0xa036, "20117F86-E985-4357-B9EE-374BC1D8487D", "Android boot 2"); AddType(0xa037, "86A7CB80-84E1-408C-99AB-694F1A410FC7", "Android FOTA"); AddType(0xa038, "97D7B011-54DA-4835-B3C4-917AD6E73D74", "Android system 2"); AddType(0xa039, "5594C694-C871-4B5F-90B1-690A6F68E0F7", "Android cache"); AddType(0xa03a, "1B81E7E6-F50D-419B-A739-2AEEF8DA3335", "Android user data"); - AddType(0xa03b, "98523EC6-90FE-4C67-B50A-0FC59ED6F56D", "LG advanced flasher"); + AddType(0xa03b, "98523EC6-90FE-4C67-B50A-0FC59ED6F56D", "LG (Android) advanced flasher"); AddType(0xa03c, "2644BCC0-F36A-4792-9533-1738BED53EE3", "Android PG1FS"); AddType(0xa03d, "DD7C91E9-38C9-45C5-8A12-4A80F7E14057", "Android PG2FS"); AddType(0xa03e, "7696D5B6-43FD-4664-A228-C563C4A1E8CC", "Android board info"); AddType(0xa03f, "0D802D54-058D-4A20-AD2D-C7A362CEACD4", "Android MFG"); AddType(0xa040, "10A0C19C-516A-5444-5CE3-664C3226A794", "Android limits"); + // Atari TOS partition type + AddType(0xa200, "734E5AFE-F61A-11E6-BC64-92361F002671", "Atari TOS basic data"); + // FreeBSD partition types.... // Note: Rather than extract FreeBSD disklabel data, convert FreeBSD // partitions in-place, and let FreeBSD sort out the details.... @@ -471,16 +474,25 @@ uint16_t PartType::GetHexType() const { // it stops at under 80 columns; on narrower displays, lines will wrap // in an ugly way. The maxLines value is the maximum number of lines // to display before prompting to continue, or 0 (or a negative value) -// for no limit. +// for no limit. If (maxLines > 0), this function will prompt for a +// substring to search for in the partition type description, so it's +// imperative that maxLines be set to 0 in non-interactive contexts +// (namely, sgdisk). void PartType::ShowAllTypes(int maxLines) const { int colCount = 1, lineCount = 1; size_t i; AType* thisType = allTypes; - string line; + string line, matchString = ""; + size_t found; cout.unsetf(ios::uppercase); + if (maxLines > 0) { + cout << "Type search string, or to show all codes: "; + matchString = ReadString(); + } // if while (thisType != NULL) { - if (thisType->display == 1) { // show it + found = thisType->name.find(matchString); + if ((thisType->display == 1) && (found != string::npos)) { // show it cout.fill('0'); cout.width(4); cout << hex << thisType->MBRType << " "; diff --git a/parttypes.h b/parttypes.h index dd23e94..c108a17 100644 --- a/parttypes.h +++ b/parttypes.h @@ -1,4 +1,4 @@ -/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed +/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ #include diff --git a/sgdisk.8 b/sgdisk.8 index 2cb18b9..0d281d3 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -1,6 +1,6 @@ -.\" Copyright 2011-2017 Roderick W. Smith (rodsmith@rodsbooks.com) +.\" Copyright 2011-2018 Roderick W. Smith (rodsmith@rodsbooks.com) .\" May be distributed under the GNU General Public License -.TH "SGDISK" "8" "1.0.3" "Roderick W. Smith" "GPT fdisk Manual" +.TH "SGDISK" "8" "1.0.4" "Roderick W. Smith" "GPT fdisk Manual" .SH "NAME" sgdisk \- Command\-line GUID partition table (GPT) manipulator for Linux and Unix .SH "SYNOPSIS" diff --git a/support.cc b/support.cc index bc91c6e..d47965a 100644 --- a/support.cc +++ b/support.cc @@ -3,7 +3,7 @@ // Primarily by Rod Smith, February 2009, but with a few functions // copied from other sources (see attributions below). -/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed +/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ #define __STDC_LIMIT_MACROS diff --git a/support.h b/support.h index 85324f6..d0a5145 100644 --- a/support.h +++ b/support.h @@ -1,4 +1,4 @@ -/* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed +/* This program is copyright (c) 2009-2018 by Roderick W. Smith. It is distributed under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ #include From 8dab6f22ee54e63d98cf303d16702794d091bcbb Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Thu, 5 Jul 2018 10:51:45 -0400 Subject: [PATCH 43/56] Added Ceph and Linux encrypted (LUKS and dm-crypt) partition type codes. --- NEWS | 13 +++++++++++-- current.spec | 8 ++++---- parttypes.cc | 21 +++++++++++++++++++++ support.h | 2 +- 4 files changed, 37 insertions(+), 7 deletions(-) diff --git a/NEWS b/NEWS index 3c4ce82..9972074 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,5 @@ -1.0.4 (?/??/2018): ------------------- +1.0.4 (7/5/2018): +----------------- - Added search feature to partition type list functions ("L" on main menu of gdisk and "L" when entered in response to the "Hex code or GUID" prompt in @@ -19,6 +19,15 @@ - Added type code for Apple APFS (7C3457EF-0000-11AA-AA11-00306543ECAC, 0xaf0a). +- Added type code for Atari TOS basic data (0xa200, + 734E5AFE-F61A-11E6-BC64-92361F002671). + +- Added type codes for Linux dm-crypt (0x8308, + 7FFEC5C9-2D00-49B7-8941-3EA10A5586B7) and LUKS (0x8309, + CA7D7CCB-63ED-4C53-861C-1742536059CC) partitions. + +- Added 18 Ceph partition type codes. + - Added 52 (yes, 52!) Android partition type codes. - Changed "Creating new GPT entries" message to read "Creating new diff --git a/current.spec b/current.spec index b16fbad..e61a0ae 100644 --- a/current.spec +++ b/current.spec @@ -1,12 +1,12 @@ Summary: GPT partitioning and MBR repair software Name: gptfdisk -Version: 1.0.3 +Version: 1.0.4 Release: 1%{?dist} License: GPLv2 URL: http://www.rodsbooks.com/gdisk Group: Applications/System -Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.3.tar.gz +Source: http://www.rodsbooks.com/gdisk/gptfdisk-1.0.4.tar.gz BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) %description @@ -81,5 +81,5 @@ provides a few additional partition manipulation features. %changelog -* Thu Jul 27 2017 R Smith - 1.0.3 -- Created spec file for 1.0.3 release +* Thu Jul 5 2018 R Smith - 1.0.4 +- Created spec file for 1.0.4 release diff --git a/parttypes.cc b/parttypes.cc index f3ad9bc..24af338 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -133,6 +133,8 @@ void PartType::AddAllTypes(void) { AddType(0x8305, "B921B045-1DF0-41C3-AF44-4C6F280D3FAE", "Linux ARM64 root (/)"); // Linux / on 64-bit ARM (auto-mounted by systemd) AddType(0x8306, "3B8F8425-20E0-4F3B-907F-1A25A76F98E8", "Linux /srv"); // Linux /srv (auto-mounted by systemd) AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)"); // Linux / on 32-bit ARM (auto-mounted by systemd) + AddType(0x8308, "7FFEC5C9-2D00-49B7-8941-3EA10A5586B7", "Linux dm-crypt"); + AddType(0x8309, "CA7D7CCB-63ED-4C53-861C-1742536059CC", "Linux LUKS"); // Used by Intel Rapid Start technology AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start"); @@ -306,12 +308,31 @@ void PartType::AddAllTypes(void) { AddType(0xef02, "21686148-6449-6E6F-744E-656564454649", "BIOS boot partition"); // Used by GRUB // Ceph type codes; see https://github.com/ceph/ceph/blob/9bcc42a3e6b08521694b5c0228b2c6ed7b3d312e/src/ceph-disk#L76-L81 + // and Wikipedia AddType(0xf800, "4FBD7E29-9D25-41B8-AFD0-062C0CEFF05D", "Ceph OSD"); // Ceph Object Storage Daemon AddType(0xf801, "4FBD7E29-9D25-41B8-AFD0-5EC00CEFF05D", "Ceph dm-crypt OSD"); // Ceph Object Storage Daemon (encrypted) AddType(0xf802, "45B0969E-9B03-4F30-B4C6-B4B80CEFF106", "Ceph journal"); AddType(0xf803, "45B0969E-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt journal"); AddType(0xf804, "89C57F98-2FE5-4DC0-89C1-F3AD0CEFF2BE", "Ceph disk in creation"); AddType(0xf805, "89C57F98-2FE5-4DC0-89C1-5EC00CEFF2BE", "Ceph dm-crypt disk in creation"); + AddType(0xf806, "CAFECAFE-9B03-4F30-B4C6-B4B80CEFF106", "Ceph block"); + AddType(0xf807, "30CD0809-C2B2-499C-8879-2D6B78529876", "Ceph block DB"); + AddType(0xf808, "5CE17FCE-4087-4169-B7FF-056CC58473F9", "Ceph block write-ahead log"); + AddType(0xf809, "FB3AABF9-D25F-47CC-BF5E-721D1816496B", "Ceph lockbox for dm-crypt keys"); + AddType(0xf80a, "4FBD7E29-8AE0-4982-BF9D-5A8D867AF560", "Ceph multipath OSD"); + AddType(0xf80b, "45B0969E-8AE0-4982-BF9D-5A8D867AF560", "Ceph multipath journal"); + AddType(0xf80c, "CAFECAFE-8AE0-4982-BF9D-5A8D867AF560", "Ceph multipath block 1"); + AddType(0xf80d, "7F4A666A-16F3-47A2-8445-152EF4D03F6C", "Ceph multipath block 2"); + AddType(0xf80e, "EC6D6385-E346-45DC-BE91-DA2A7C8B3261", "Ceph multipath block DB"); + AddType(0xf80f, "01B41E1B-002A-453C-9F17-88793989FF8F", "Ceph multipath block write-ahead log"); + AddType(0xf810, "CAFECAFE-9B03-4F30-B4C6-5EC00CEFF106", "Ceph dm-crypt block"); + AddType(0xf811, "93B0052D-02D9-4D8A-A43B-33A3EE4DFBC3", "Ceph dm-crypt block DB"); + AddType(0xf812, "306E8683-4FE2-4330-B7C0-00A917C16966", "Ceph dm-crypt block write-ahead log"); + AddType(0xf813, "45B0969E-9B03-4F30-B4C6-35865CEFF106", "Ceph dm-crypt LUKS journal"); + AddType(0xf814, "CAFECAFE-9B03-4F30-B4C6-35865CEFF106", "Ceph dm-crypt LUKS block"); + AddType(0xf815, "166418DA-C469-4022-ADF4-B30AFD37F176", "Ceph dm-crypt LUKS block DB"); + AddType(0xf816, "86A32090-3647-40B9-BBBD-38D8C573AA86", "Ceph dm-crypt LUKS block write-ahead log"); + AddType(0xf817, "4FBD7E29-9D25-41B8-AFD0-35865CEFF05D", "Ceph dm-crypt LUKS OSD"); // VMWare ESX partition types codes AddType(0xfb00, "AA31E02A-400F-11DB-9590-000C2911D1B8", "VMWare VMFS"); diff --git a/support.h b/support.h index d0a5145..8f976da 100644 --- a/support.h +++ b/support.h @@ -8,7 +8,7 @@ #ifndef __GPTSUPPORT #define __GPTSUPPORT -#define GPTFDISK_VERSION "1.0.3" +#define GPTFDISK_VERSION "1.0.4" #if defined (__FreeBSD__) || defined (__FreeBSD_kernel__) || defined (__APPLE__) // Darwin (Mac OS) & FreeBSD: disk IOCTLs are different, and there is no lseek64 From 9ae60195b9d24c01f535ade5b7bcf0e63c0600be Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Thu, 5 Jul 2018 16:50:13 -0400 Subject: [PATCH 44/56] Added explicit copy constructors and made other tweaks to avoid compiler complaints. --- Makefile.mac | 3 +- NEWS | 11 ++++++ basicmbr.cc | 74 ++++++++++++++++++++++++++++----------- basicmbr.h | 1 + gpt.cc | 99 +++++++++++++++++++++++++++++++++++++--------------- gpt.h | 1 + gptcurses.cc | 3 +- gptpart.cc | 9 +++++ gptpart.h | 1 + 9 files changed, 150 insertions(+), 52 deletions(-) diff --git a/Makefile.mac b/Makefile.mac index 6c0fa25..27f95b7 100644 --- a/Makefile.mac +++ b/Makefile.mac @@ -1,6 +1,7 @@ CC=gcc CXX=clang++ FATBINFLAGS=-arch x86_64 -arch i386 -mmacosx-version-min=10.4 +THINBINFLAGS=-arch x86_64 -mmacosx-version-min=10.4 CFLAGS=$(FATBINFLAGS) -O2 -D_FILE_OFFSET_BITS=64 -g #CXXFLAGS=-O2 -Wall -D_FILE_OFFSET_BITS=64 -D USE_UTF16 -I/opt/local/include -I/usr/local/include -I/opt/local/include -g CXXFLAGS=$(FATBINFLAGS) -O2 -Wall -D_FILE_OFFSET_BITS=64 -I/opt/local/include -I /usr/local/include -I/opt/local/include -g @@ -24,7 +25,7 @@ cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o sgdisk: $(LIB_OBJS) gptcl.o sgdisk.o # $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o /opt/local/lib/libiconv.a /opt/local/lib/libintl.a /opt/local/lib/libpopt.a $(FATBINFLAGS) -o sgdisk - $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/opt/local/lib -lpopt $(FATBINFLAGS) -o sgdisk + $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/usr/local/lib -lpopt $(THINBINFLAGS) -o sgdisk # $(CXX) $(LIB_OBJS) gptcl.o sgdisk.o -L/sw/lib -licucore -lpopt -o sgdisk fixparts: $(MBR_LIB_OBJS) fixparts.o diff --git a/NEWS b/NEWS index 9972074..2a82658 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,17 @@ 1.0.4 (7/5/2018): ----------------- +- Added some explicit copy constructors and made some other tweaks to avoid + compiler warnings. + +- The macOS binary for sgdisk is now a pure 64-bit build; I'm no longer + supporting 32-bit builds of sgdisk. The gdisk and cgdisk binaries remain + "fat" 32-/64-bit builds. The reason for dropping the 32-bit support from + sgdisk is that I've re-built my macOS development system, and I had + trouble building a "fat" binary with the fresh install of the popt + libraries upon which sgdisk relies. 32-bit support for the other binaries + is now officially deprecated, too. + - Added search feature to partition type list functions ("L" on main menu of gdisk and "L" when entered in response to the "Hex code or GUID" prompt in gdisk and sgdisk). This feature filters the partition type list to those diff --git a/basicmbr.cc b/basicmbr.cc index 8fbffd1..dd48706 100644 --- a/basicmbr.cc +++ b/basicmbr.cc @@ -43,6 +43,36 @@ BasicMBRData::BasicMBRData(void) { EmptyMBR(); } // BasicMBRData default constructor +BasicMBRData::BasicMBRData(const BasicMBRData & orig) { + int i; + + if (&orig != this) { + memcpy(code, orig.code, 440); + diskSignature = orig.diskSignature; + nulls = orig.nulls; + MBRSignature = orig.MBRSignature; + blockSize = orig.blockSize; + diskSize = orig.diskSize; + numHeads = orig.numHeads; + numSecspTrack = orig.numSecspTrack; + canDeleteMyDisk = orig.canDeleteMyDisk; + device = orig.device; + state = orig.state; + + myDisk = new DiskIO; + if (myDisk == NULL) { + cerr << "Unable to allocate memory in BasicMBRData copy constructor! Terminating!\n"; + exit(1); + } // if + if (orig.myDisk != NULL) + myDisk->OpenForRead(orig.myDisk->GetName()); + + for (i = 0; i < MAX_MBR_PARTS; i++) { + partitions[i] = orig.partitions[i]; + } // for + } // if +} // BasicMBRData copy constructor + BasicMBRData::BasicMBRData(string filename) { blockSize = SECTOR_SIZE; diskSize = 0; @@ -73,29 +103,31 @@ BasicMBRData::~BasicMBRData(void) { BasicMBRData & BasicMBRData::operator=(const BasicMBRData & orig) { int i; - memcpy(code, orig.code, 440); - diskSignature = orig.diskSignature; - nulls = orig.nulls; - MBRSignature = orig.MBRSignature; - blockSize = orig.blockSize; - diskSize = orig.diskSize; - numHeads = orig.numHeads; - numSecspTrack = orig.numSecspTrack; - canDeleteMyDisk = orig.canDeleteMyDisk; - device = orig.device; - state = orig.state; + if (&orig != this) { + memcpy(code, orig.code, 440); + diskSignature = orig.diskSignature; + nulls = orig.nulls; + MBRSignature = orig.MBRSignature; + blockSize = orig.blockSize; + diskSize = orig.diskSize; + numHeads = orig.numHeads; + numSecspTrack = orig.numSecspTrack; + canDeleteMyDisk = orig.canDeleteMyDisk; + device = orig.device; + state = orig.state; - myDisk = new DiskIO; - if (myDisk == NULL) { - cerr << "Unable to allocate memory in BasicMBRData::operator=()! Terminating!\n"; - exit(1); + myDisk = new DiskIO; + if (myDisk == NULL) { + cerr << "Unable to allocate memory in BasicMBRData::operator=()! Terminating!\n"; + exit(1); + } // if + if (orig.myDisk != NULL) + myDisk->OpenForRead(orig.myDisk->GetName()); + + for (i = 0; i < MAX_MBR_PARTS; i++) { + partitions[i] = orig.partitions[i]; + } // for } // if - if (orig.myDisk != NULL) - myDisk->OpenForRead(orig.myDisk->GetName()); - - for (i = 0; i < MAX_MBR_PARTS; i++) { - partitions[i] = orig.partitions[i]; - } // for return *this; } // BasicMBRData::operator=() diff --git a/basicmbr.h b/basicmbr.h index 21f962e..504e039 100644 --- a/basicmbr.h +++ b/basicmbr.h @@ -63,6 +63,7 @@ protected: public: BasicMBRData(void); BasicMBRData(string deviceFilename); + BasicMBRData(const BasicMBRData &); ~BasicMBRData(void); BasicMBRData & operator=(const BasicMBRData & orig); diff --git a/gpt.cc b/gpt.cc index c054460..fe8e956 100644 --- a/gpt.cc +++ b/gpt.cc @@ -86,6 +86,45 @@ GPTData::GPTData(void) { chksum_crc32gentab(); } // GPTData default constructor +GPTData::GPTData(const GPTData & orig) { + uint32_t i; + + if (&orig != this) { + mainHeader = orig.mainHeader; + numParts = orig.numParts; + secondHeader = orig.secondHeader; + protectiveMBR = orig.protectiveMBR; + device = orig.device; + blockSize = orig.blockSize; + physBlockSize = orig.physBlockSize; + diskSize = orig.diskSize; + state = orig.state; + justLooking = orig.justLooking; + mainCrcOk = orig.mainCrcOk; + secondCrcOk = orig.secondCrcOk; + mainPartsCrcOk = orig.mainPartsCrcOk; + secondPartsCrcOk = orig.secondPartsCrcOk; + apmFound = orig.apmFound; + bsdFound = orig.bsdFound; + sectorAlignment = orig.sectorAlignment; + beQuiet = orig.beQuiet; + whichWasUsed = orig.whichWasUsed; + + myDisk.OpenForRead(orig.myDisk.GetName()); + + delete[] partitions; + partitions = new GPTPart [numParts]; + if (partitions == NULL) { + cerr << "Error! Could not allocate memory for partitions in GPTData::operator=()!\n" + << "Terminating!\n"; + exit(1); + } // if + for (i = 0; i < numParts; i++) { + partitions[i] = orig.partitions[i]; + } // for + } // if +} // GPTData copy constructor + // The following constructor loads GPT data from a device file GPTData::GPTData(string filename) { blockSize = SECTOR_SIZE; // set a default @@ -120,38 +159,40 @@ GPTData::~GPTData(void) { GPTData & GPTData::operator=(const GPTData & orig) { uint32_t i; - mainHeader = orig.mainHeader; - numParts = orig.numParts; - secondHeader = orig.secondHeader; - protectiveMBR = orig.protectiveMBR; - device = orig.device; - blockSize = orig.blockSize; - physBlockSize = orig.physBlockSize; - diskSize = orig.diskSize; - state = orig.state; - justLooking = orig.justLooking; - mainCrcOk = orig.mainCrcOk; - secondCrcOk = orig.secondCrcOk; - mainPartsCrcOk = orig.mainPartsCrcOk; - secondPartsCrcOk = orig.secondPartsCrcOk; - apmFound = orig.apmFound; - bsdFound = orig.bsdFound; - sectorAlignment = orig.sectorAlignment; - beQuiet = orig.beQuiet; - whichWasUsed = orig.whichWasUsed; + if (&orig != this) { + mainHeader = orig.mainHeader; + numParts = orig.numParts; + secondHeader = orig.secondHeader; + protectiveMBR = orig.protectiveMBR; + device = orig.device; + blockSize = orig.blockSize; + physBlockSize = orig.physBlockSize; + diskSize = orig.diskSize; + state = orig.state; + justLooking = orig.justLooking; + mainCrcOk = orig.mainCrcOk; + secondCrcOk = orig.secondCrcOk; + mainPartsCrcOk = orig.mainPartsCrcOk; + secondPartsCrcOk = orig.secondPartsCrcOk; + apmFound = orig.apmFound; + bsdFound = orig.bsdFound; + sectorAlignment = orig.sectorAlignment; + beQuiet = orig.beQuiet; + whichWasUsed = orig.whichWasUsed; - myDisk.OpenForRead(orig.myDisk.GetName()); + myDisk.OpenForRead(orig.myDisk.GetName()); - delete[] partitions; - partitions = new GPTPart [numParts]; - if (partitions == NULL) { - cerr << "Error! Could not allocate memory for partitions in GPTData::operator=()!\n" - << "Terminating!\n"; - exit(1); + delete[] partitions; + partitions = new GPTPart [numParts]; + if (partitions == NULL) { + cerr << "Error! Could not allocate memory for partitions in GPTData::operator=()!\n" + << "Terminating!\n"; + exit(1); + } // if + for (i = 0; i < numParts; i++) { + partitions[i] = orig.partitions[i]; + } // for } // if - for (i = 0; i < numParts; i++) { - partitions[i] = orig.partitions[i]; - } // for return *this; } // GPTData::operator=() diff --git a/gpt.h b/gpt.h index f4bf470..a5be961 100644 --- a/gpt.h +++ b/gpt.h @@ -92,6 +92,7 @@ protected: public: // Basic necessary functions.... GPTData(void); + GPTData(const GPTData &); GPTData(string deviceFilename); virtual ~GPTData(void); GPTData & operator=(const GPTData & orig); diff --git a/gptcurses.cc b/gptcurses.cc index a9f466c..3e9b240 100644 --- a/gptcurses.cc +++ b/gptcurses.cc @@ -394,6 +394,7 @@ void GPTDataCurses::ChangeType(int partNum) { // Sets the partition alignment value void GPTDataCurses::SetAlignment(void) { int alignment; + char conversion_specifier[] = "%d"; move(LINES - 4, 0); clrtobot(); @@ -402,7 +403,7 @@ void GPTDataCurses::SetAlignment(void) { move(LINES - 3, 0); printw("Type new alignment value, in sectors: "); echo(); - scanw("%d", &alignment); + scanw(conversion_specifier, &alignment); noecho(); } while ((alignment == 0) || (alignment > MAX_ALIGNMENT)); GPTData::SetAlignment(alignment); diff --git a/gptpart.cc b/gptpart.cc index 40a90a3..666263b 100644 --- a/gptpart.cc +++ b/gptpart.cc @@ -38,6 +38,15 @@ GPTPart::GPTPart(void) { memset(name, 0, NAME_SIZE * sizeof(name[0]) ); } // Default constructor +GPTPart::GPTPart(const GPTPart & orig) { + partitionType = orig.partitionType; + uniqueGUID = orig.uniqueGUID; + firstLBA = orig.firstLBA; + lastLBA = orig.lastLBA; + attributes = orig.attributes; + memcpy(name, orig.name, NAME_SIZE * sizeof( name[ 0 ] ) ); +} // Copy constructor + GPTPart::~GPTPart(void) { } // destructor diff --git a/gptpart.h b/gptpart.h index 657b3f9..fac514e 100644 --- a/gptpart.h +++ b/gptpart.h @@ -53,6 +53,7 @@ class GPTPart { uint16_t name[NAME_SIZE]; public: GPTPart(void); + GPTPart(const GPTPart &); ~GPTPart(void); // Simple data retrieval: From 0c15ad9015db90c856f9a4301c66af13be93935c Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Thu, 5 Jul 2018 17:39:14 -0400 Subject: [PATCH 45/56] Final changes for 1.0.4 release --- NEWS | 4 +++- README | 11 ++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 2a82658..790dac5 100644 --- a/NEWS +++ b/NEWS @@ -25,7 +25,9 @@ - Minor bug fix in alignment of internal data structures. -- Minor bug fix in handling of damaged disks. +- Minor bug fix in handling of damaged disks. Also, GPT fdisk now reports + more information on what data structures are damaged when a damaged disk + is detected. - Added type code for Apple APFS (7C3457EF-0000-11AA-AA11-00306543ECAC, 0xaf0a). diff --git a/README b/README index eda4060..f1a091d 100644 --- a/README +++ b/README @@ -201,11 +201,12 @@ be used instead. In addition, note these requirements: need to install a package called popt-dev, popt-devel, or something similar to obtain the header files. Mac OS users can find a version of popt for Mac OS from Darwin Ports (http://popt.darwinports.com), MacPorts - (https://trac.macports.org/browser/trunk/dports/devel/popt/Portfile), or - Fink (http://www.finkproject.org); however, you'll first need to install - DarwinPorts, MacPorts, or Fink (instructions exist on the relevant - projects' pages). Alternatively, you can compile gdisk and/or cgdisk - alone, without sgdisk; gdisk doesn't require popt. + (https://trac.macports.org/browser/trunk/dports/devel/popt/Portfile), Fink + (http://www.finkproject.org), or brew (http://macappstore.org/popt/); + however, you'll first need to install the relevant environment + (instructions exist on the relevant projects' pages). Alternatively, you + can compile gdisk and/or cgdisk alone, without sgdisk; gdisk doesn't + require popt. When all the necessary development tools and libraries are installed, you can uncompress the package and type "make" at the command prompt in the From 4cd84deb7af7683d44efa79b4896bc04946311c6 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Tue, 10 Jul 2018 11:52:02 +0300 Subject: [PATCH 46/56] Use the same ESP label as Windows --- parttypes.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parttypes.cc b/parttypes.cc index 24af338..cd225d1 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -303,7 +303,7 @@ void PartType::AddAllTypes(void) { AddType(0xed01, "BFBFAFE7-A34F-448A-9A5B-6213EB736C22", "Lenovo system partition"); // EFI system and related partitions - AddType(0xef00, "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "EFI System"); // Parted identifies these as having the "boot flag" set + AddType(0xef00, "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", "EFI system partition"); // Parted identifies these as having the "boot flag" set AddType(0xef01, "024DEE41-33E7-11D3-9D69-0008C781F39F", "MBR partition scheme"); // Used to nest MBR in GPT AddType(0xef02, "21686148-6449-6E6F-744E-656564454649", "BIOS boot partition"); // Used by GRUB From 53710d8b51904bd34298ff987b0cbbd89a394b4d Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Fri, 15 Mar 2019 15:36:41 -0400 Subject: [PATCH 47/56] Fixed typo in sgdisk man page. --- NEWS | 5 +++++ sgdisk.8 | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 790dac5..bca65c0 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,8 @@ +1.0.5 (?/?/2019): +----------------- + +- Fixed minor typo in sgdisk man page + 1.0.4 (7/5/2018): ----------------- diff --git a/sgdisk.8 b/sgdisk.8 index 0d281d3..adae352 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -219,7 +219,7 @@ of the sector value reported by this option. You can change the alignment value with the \-a option. .TP -.B e, \-\-move\-second\-header +.B \-e, \-\-move\-second\-header Move backup GPT data structures to the end of the disk. Use this option if you've added disks to a RAID array, thus creating a virtual disk with space that follows the backup GPT data structures. This command moves the backup From b93e29de3cbc975e724f8893ea71a1715f19edda Mon Sep 17 00:00:00 2001 From: nl6720 Date: Sun, 12 Aug 2018 12:43:02 +0300 Subject: [PATCH 48/56] Improve man pages Fix links to other manuals. Change one MB to MiB. Add space between number and unit. --- cgdisk.8 | 18 +++++++++--------- fixparts.8 | 16 ++++++++-------- gdisk.8 | 20 ++++++++++---------- sgdisk.8 | 18 +++++++++--------- 4 files changed, 36 insertions(+), 36 deletions(-) diff --git a/cgdisk.8 b/cgdisk.8 index ef982b4..3dbddff 100644 --- a/cgdisk.8 +++ b/cgdisk.8 @@ -181,7 +181,7 @@ Change the sector alignment value. Disks with more logical sectors than physical sectors (such as modern Advanced Format drives), some RAID configurations, and many SSD devices, can suffer performance problems if partitions are not aligned properly for their internal data structures. On -new disks, GPT fdisk attempts to align partitions on 1MiB boundaries +new disks, GPT fdisk attempts to align partitions on 1 MiB boundaries (2048\-sectors on disks with 512-byte sectors) by default, which optimizes performance for all of these disk types. On pre\-partitioned disks, GPT fdisk attempts to identify the alignment value used on that disk, but will @@ -375,14 +375,14 @@ Contributors: .SH "SEE ALSO" -\fBcfdisk (8)\fR, -\fBfdisk (8)\fR, -\fBgdisk (8)\fR, -\fBmkfs (8)\fR, -\fBparted (8)\fR, -\fBsfdisk (8)\fR -\fBsgdisk (8)\fR -\fBfixparts (8)\fR +.BR cfdisk (8), +.BR fdisk (8), +.BR gdisk (8), +.BR mkfs (8), +.BR parted (8), +.BR sfdisk (8), +.BR sgdisk (8), +.BR fixparts (8). \fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR diff --git a/fixparts.8 b/fixparts.8 index 163c247..9857b24 100644 --- a/fixparts.8 +++ b/fixparts.8 @@ -264,14 +264,14 @@ Contributors: .SH "SEE ALSO" -\fBcfdisk (8)\fR, -\fBcgdisk (8)\fR, -\fBfdisk (8)\fR, -\fBmkfs (8)\fR, -\fBparted (8)\fR, -\fBsfdisk (8)\fR -\fBgdisk (8)\fR -\fBsgdisk (8)\fR +.BR cfdisk (8), +.BR cgdisk (8), +.BR fdisk (8), +.BR mkfs (8), +.BR parted (8), +.BR sfdisk (8), +.BR gdisk (8), +.BR sgdisk (8). \fIhttp://en.wikipedia.org/wiki/Master_boot_record\fR diff --git a/gdisk.8 b/gdisk.8 index fcd07e2..dfdaa2c 100644 --- a/gdisk.8 +++ b/gdisk.8 @@ -216,7 +216,7 @@ sector. .B o Clear out all partition data. This includes GPT header data, all partition definitions, and the protective MBR. The sector alignment -is reset to the default (1MB, or 2048 sectors on a disk with 512-byte +is reset to the default (1 MiB, or 2048 sectors on a disk with 512-byte sectors). .TP @@ -483,7 +483,7 @@ Change the sector alignment value. Disks with more logical sectors per physical sectors (such as modern Advanced Format drives), some RAID configurations, and many SSD devices, can suffer performance problems if partitions are not aligned properly for their internal data structures. On -new disks, GPT fdisk attempts to align partitions on 1MiB boundaries +new disks, GPT fdisk attempts to align partitions on 1 MiB boundaries (2048\-sectors on disks with 512-byte sectors) by default, which optimizes performance for all of these disk types. On pre\-partitioned disks, GPT fdisk attempts to identify the alignment value used on that disk, but will @@ -679,14 +679,14 @@ Contributors: .SH "SEE ALSO" -\fBcfdisk (8)\fR, -\fBcgdisk (8)\fR, -\fBfdisk (8)\fR, -\fBmkfs (8)\fR, -\fBparted (8)\fR, -\fBsfdisk (8)\fR -\fBsgdisk (8)\fR -\fBfixparts (8)\fR +.BR cfdisk (8), +.BR cgdisk (8), +.BR fdisk (8), +.BR mkfs (8), +.BR parted (8), +.BR sfdisk (8), +.BR sgdisk (8), +.BR fixparts (8). \fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR diff --git a/sgdisk.8 b/sgdisk.8 index adae352..8bc1d46 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -150,7 +150,7 @@ sibling. Options available in \fBsgdisk\fR are: .TP .B \-a, \-\-set\-alignment=value Set the sector alignment multiple. GPT fdisk aligns the start of partitions -to sectors that are multiples of this value, which defaults to 1MiB (2048 +to sectors that are multiples of this value, which defaults to 1 MiB (2048 on disks with 512-byte sectors) on freshly formatted disks. This alignment value is necessary to obtain optimum performance with Western Digital Advanced Format and similar drives with larger physical than logical sector @@ -599,14 +599,14 @@ Contributors: .SH "SEE ALSO" -\fBcfdisk (8)\fR, -\fBcgdisk (8)\fR, -\fBfdisk (8)\fR, -\fBgdisk (8)\fR, -\fBmkfs (8)\fR, -\fBparted (8)\fR, -\fBsfdisk (8)\fR -\fBfixparts (8)\fR +.BR cfdisk (8), +.BR cgdisk (8), +.BR fdisk (8), +.BR gdisk (8), +.BR mkfs (8), +.BR parted (8), +.BR sfdisk (8), +.BR fixparts (8). \fIhttp://en.wikipedia.org/wiki/GUID_Partition_Table\fR From ba02671e812acb9d804217da5622cc7084fb2ebe Mon Sep 17 00:00:00 2001 From: Fabrice Fontaine Date: Fri, 19 Apr 2019 16:06:39 +0200 Subject: [PATCH 49/56] Add $(LDLIBS) support to enable clean static builds (for libintl). Signed-off-by: Gustavo Zacarias [Retrieved from: https://git.buildroot.net/buildroot/tree/package/gptfdisk/0001-ldlibs.patch] Signed-off-by: Fabrice Fontaine --- Makefile | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index d76fab4..0d7309c 100644 --- a/Makefile +++ b/Makefile @@ -12,19 +12,19 @@ DEPEND= makedepend $(CXXFLAGS) all: cgdisk gdisk sgdisk fixparts gdisk: $(LIB_OBJS) gdisk.o gpttext.o - $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -luuid -o gdisk + $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -luuid $(LDLIBS) -o gdisk # $(CXX) $(LIB_OBJS) gdisk.o gpttext.o $(LDFLAGS) -licuio -licuuc -luuid -o gdisk cgdisk: $(LIB_OBJS) cgdisk.o gptcurses.o - $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -luuid -lncursesw -o cgdisk + $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -luuid -lncursesw $(LDLIBS) -o cgdisk # $(CXX) $(LIB_OBJS) cgdisk.o gptcurses.o $(LDFLAGS) -licuio -licuuc -luuid -lncurses -o cgdisk sgdisk: $(LIB_OBJS) sgdisk.o gptcl.o - $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -luuid -lpopt -o sgdisk + $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -luuid -lpopt $(LDLIBS) -o sgdisk # $(CXX) $(LIB_OBJS) sgdisk.o gptcl.o $(LDFLAGS) -licuio -licuuc -luuid -lpopt -o sgdisk fixparts: $(MBR_LIB_OBJS) fixparts.o - $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) -o fixparts + $(CXX) $(MBR_LIB_OBJS) fixparts.o $(LDFLAGS) $(LDLIBS) -o fixparts test: ./gdisk_test.sh From d4e560771b8a0fc72538d50b4510a31ab1e00a64 Mon Sep 17 00:00:00 2001 From: Geoff Williams Date: Sun, 22 Sep 2019 17:04:42 +1000 Subject: [PATCH 50/56] Support placing GPT last when for hybrid MBR Some hardware (notably Raspberry PI) requires a small FAT partition be listed as the first MBR partition to boot. At the moment hybrid MBR disks allowing this can only be made using the interactive `gdisk` program by choosing `h` from the recovery menu and answering `N` when asked: ``` Place EFI GPT (0xEE) partition first in MBR (good for GRUB)? ``` This commit brings feature parity to `sgdisk` by changing `-h` to support an optional final partition `EE` indicating that the GPT partition should be listed last in the MBR instead of first. **Examples**: GPT first (current behaviour) ```shell sgdisk -h 1:2 sdcard.img ``` GPT last ```shell sgdisk -h 1:2:EE sdcard.img ``` --- gptcl.cc | 20 +++++++++++++++++--- sgdisk.8 | 14 +++++++------- 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/gptcl.cc b/gptcl.cc index 6c36738..70c3352 100644 --- a/gptcl.cc +++ b/gptcl.cc @@ -86,7 +86,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { {"first-aligned-in-largest", 'F', POPT_ARG_NONE, NULL, 'F', "show start of the largest free block, aligned", ""}, {"mbrtogpt", 'g', POPT_ARG_NONE, NULL, 'g', "convert MBR to GPT", ""}, {"randomize-guids", 'G', POPT_ARG_NONE, NULL, 'G', "randomize disk and partition GUIDs", ""}, - {"hybrid", 'h', POPT_ARG_STRING, &hybrids, 'h', "create hybrid MBR", "partnum[:partnum...]"}, + {"hybrid", 'h', POPT_ARG_STRING, &hybrids, 'h', "create hybrid MBR", "partnum[:partnum...][:EE]"}, {"info", 'i', POPT_ARG_INT, &infoPartNum, 'i', "show detailed information on partition", "partnum"}, {"move-main-table", 'j', POPT_ARG_INT, &mainTableLBA, 'j', "adjust the location of the main partition table", "sector"}, {"load-backup", 'l', POPT_ARG_STRING, &backupFile, 'l', "load GPT backup from file", "file"}, @@ -490,33 +490,47 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) { // Create a hybrid or regular MBR from GPT data structures int GPTDataCL::BuildMBR(char* argument, int isHybrid) { int numParts, allOK = 1, i, origPartNum; + int eeLast, mbrNum = 0; MBRPart newPart; BasicMBRData newMBR; if (argument != NULL) { numParts = CountColons(argument) + 1; + if (isHybrid) { + eeLast = GetString(argument, numParts) == "EE"; + if (eeLast) { + numParts--; + } + } + if (numParts <= (4 - isHybrid)) { newMBR.SetDisk(GetDisk()); for (i = 0; i < numParts; i++) { origPartNum = GetInt(argument, i + 1) - 1; if (IsUsedPartNum(origPartNum) && (partitions[origPartNum].IsSizedForMBR() == MBR_SIZED_GOOD)) { + mbrNum = i + (isHybrid && ! eeLast); newPart.SetInclusion(PRIMARY); newPart.SetLocation(operator[](origPartNum).GetFirstLBA(), operator[](origPartNum).GetLengthLBA()); newPart.SetStatus(0); newPart.SetType((uint8_t)(operator[](origPartNum).GetHexType() / 0x0100)); - newMBR.AddPart(i + isHybrid, newPart); + newMBR.AddPart(mbrNum, newPart); } else { cerr << "Original partition " << origPartNum + 1 << " does not exist or is too big! Aborting operation!\n"; allOK = 0; } // if/else } // for if (isHybrid) { + if (eeLast) { + mbrNum = i; + } else { + mbrNum = 0; + } newPart.SetInclusion(PRIMARY); newPart.SetLocation(1, newMBR.FindLastInFree(1)); newPart.SetStatus(0); newPart.SetType(0xEE); - newMBR.AddPart(0, newPart); + newMBR.AddPart(mbrNum, newPart); } // if if (allOK) SetProtectiveMBR(newMBR); diff --git a/sgdisk.8 b/sgdisk.8 index adae352..f682944 100644 --- a/sgdisk.8 +++ b/sgdisk.8 @@ -264,13 +264,13 @@ in order to render all GUIDs once again unique. .TP .B \-h, \-\-hybrid Create a hybrid MBR. This option takes from one to three partition numbers, -separated by colons, as arguments. The created hybrid MBR places an EFI GPT -(type 0xEE) partition first in the table, followed by the partition(s) you -specify. Their type codes are based on the GPT fdisk type codes divided by -0x0100, which is usually correct for Windows partitions. If the -active/bootable flag should be set, you must do so in another program, such -as \fBfdisk\fR. The \fBgdisk\fR program offers additional hybrid MBR -creation options. +separated by colons, as arguments. You may optionally specify a final partition +"EE" to indicate that the EFI GPT (type 0xEE) should be placed last in the table, +otherwise it will be placed first, followed by the partition(s) you specify. +Their type codes are based on the GPT fdisk type codes divided by 0x0100, which +is usually correct for Windows partitions. If the active/bootable flag should +be set, you must do so in another program, such as \fBfdisk\fR. The \fBgdisk\fR +program offers additional hybrid MBR creation options. .TP .B \-i, \-\-info=partnum From 9e6016b07ff6d1de5143d3dfefb58fb4268a78e1 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 7 Oct 2019 15:34:43 -0700 Subject: [PATCH 51/56] gptcurses: Add missing header Needed with uClibc++ as it doesn't implicitly include it. Signed-off-by: Rosen Penev --- gptcurses.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/gptcurses.cc b/gptcurses.cc index 3e9b240..4ebfde1 100644 --- a/gptcurses.cc +++ b/gptcurses.cc @@ -19,6 +19,7 @@ * */ +#include #include #include #include From 5542b160fa73e5e81e83c2d8dd1b79c3023094ee Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 7 Oct 2019 15:36:31 -0700 Subject: [PATCH 52/56] support: Flush cout in GetYN uClibc++ does not implicitly flush cout before getline. Signed-off-by: Rosen Penev --- support.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support.cc b/support.cc index d47965a..5ab8a23 100644 --- a/support.cc +++ b/support.cc @@ -101,7 +101,7 @@ char GetYN(void) { do { if ( again ) { cout << "Your option? " ; } again = 1 ; - cout << "(Y/N): "; + cout << "(Y/N): " << flush; line = ReadString(); response = toupper(line[0]); } while ((response != 'Y') && (response != 'N')); From 31d1f45cd63ec142fc559ea4f8a70bd4a1151c42 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 7 Oct 2019 15:39:14 -0700 Subject: [PATCH 53/56] support: flush cout in GetNumber uClibc++ does not implicitly do this before getline. Signed-off-by: Rosen Penev --- support.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support.cc b/support.cc index 5ab8a23..1107993 100644 --- a/support.cc +++ b/support.cc @@ -73,7 +73,7 @@ uint64_t GetNumber(uint64_t low, uint64_t high, uint64_t def, const string & pro if (low != high) { // bother only if low and high differ... do { - cout << prompt; + cout << prompt << flush; cin.getline(line, 255); if (!cin.good()) exit(5); From 185f73b1084936f85beddd4523a302cb1f906234 Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Mon, 7 Oct 2019 15:41:53 -0700 Subject: [PATCH 54/56] support: flush cout in ReadString uClibc++ does not implicitly do this. Signed-off-by: Rosen Penev --- support.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/support.cc b/support.cc index 1107993..891caad 100644 --- a/support.cc +++ b/support.cc @@ -55,6 +55,7 @@ string ReadString(void) { string ReadString(void) { string inString; + cout << flush; getline(cin, inString); if (!cin.good()) exit(5); From 34fc3ab283074fe827121cda5ef9bbbdc3caa080 Mon Sep 17 00:00:00 2001 From: Rod Smith Date: Sun, 9 Feb 2020 10:34:44 -0500 Subject: [PATCH 55/56] Change number of columns in type code output from 3 to 2. --- NEWS | 8 ++++++-- parttypes.cc | 10 +++++++--- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/NEWS b/NEWS index bca65c0..ff54c6c 100644 --- a/NEWS +++ b/NEWS @@ -1,7 +1,11 @@ -1.0.5 (?/?/2019): +1.0.5 (?/?/2020): ----------------- -- Fixed minor typo in sgdisk man page +- Fixed typos and minor formatting issues in man pages + +- Changed number of columns in type code output ("sgdisk -L" and equivalents + in gdisk and cgdisk) from 3 to 2, since some descriptions are long enough + that they're ambiguous with three columns. 1.0.4 (7/5/2018): ----------------- diff --git a/parttypes.cc b/parttypes.cc index cd225d1..5106f1b 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -20,6 +20,10 @@ int PartType::numInstances = 0; AType* PartType::allTypes = NULL; AType* PartType::lastType = NULL; +#define SCREEN_WIDTH 80 +#define NUM_COLUMNS 2 +#define DESC_LENGTH (SCREEN_WIDTH - (6 * NUM_COLUMNS)) / NUM_COLUMNS + // Constructor. Its main task is to initialize the data list, but only // if this is the first instance, since it's a static linked list. // Partition type codes are MBR type codes multiplied by 0x0100, with @@ -517,10 +521,10 @@ void PartType::ShowAllTypes(int maxLines) const { cout.fill('0'); cout.width(4); cout << hex << thisType->MBRType << " "; - cout << thisType->name.substr(0, 20); - for (i = 0; i < (20 - (thisType->name.substr(0, 20).length())); i++) + cout << thisType->name.substr(0, DESC_LENGTH); + for (i = 0; i < (DESC_LENGTH - (thisType->name.substr(0, DESC_LENGTH).length())); i++) cout << " "; - if ((colCount % 3) == 0) { + if ((colCount % NUM_COLUMNS) == 0) { if (thisType->next) { cout << "\n"; if ((maxLines > 0) && (lineCount++ % maxLines) == 0) { From 7c7c85412dc493b01fd1448555c2140b8f35a0d9 Mon Sep 17 00:00:00 2001 From: nl6720 Date: Thu, 26 Dec 2019 11:08:12 +0200 Subject: [PATCH 56/56] Add more Linux partition type codes See https://github.com/systemd/systemd/pull/14390 . --- parttypes.cc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/parttypes.cc b/parttypes.cc index 5106f1b..1f3de0e 100644 --- a/parttypes.cc +++ b/parttypes.cc @@ -129,8 +129,8 @@ void PartType::AddAllTypes(void) { AddType(0x8200, "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", "Linux swap"); // Linux swap (or Solaris on MBR) AddType(0x8300, "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "Linux filesystem"); // Linux native AddType(0x8301, "8DA63339-0007-60C0-C436-083AC8230908", "Linux reserved"); - // See http://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html - // and http://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/ + // See https://www.freedesktop.org/software/systemd/man/systemd-gpt-auto-generator.html + // and https://systemd.io/DISCOVERABLE_PARTITIONS AddType(0x8302, "933AC7E1-2EB4-4F13-B844-0E14E2AEF915", "Linux /home"); // Linux /home (auto-mounted by systemd) AddType(0x8303, "44479540-F297-41B2-9AF7-D131D5F0458A", "Linux x86 root (/)"); // Linux / on x86 (auto-mounted by systemd) AddType(0x8304, "4F68BCE3-E8CD-4DB1-96E7-FBCAF984B709", "Linux x86-64 root (/)"); // Linux / on x86-64 (auto-mounted by systemd) @@ -139,6 +139,14 @@ void PartType::AddAllTypes(void) { AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)"); // Linux / on 32-bit ARM (auto-mounted by systemd) AddType(0x8308, "7FFEC5C9-2D00-49B7-8941-3EA10A5586B7", "Linux dm-crypt"); AddType(0x8309, "CA7D7CCB-63ED-4C53-861C-1742536059CC", "Linux LUKS"); + AddType(0x830A, "993D8D3D-F80E-4225-855A-9DAF8ED7EA97", "Linux IA-64 root (/)"); // Linux / on Itanium (auto-mounted by systemd) + AddType(0x830B, "D13C5D3B-B5D1-422A-B29F-9454FDC89D76", "Linux x86 root verity"); + AddType(0x830C, "2C7357ED-EBD2-46D9-AEC1-23D437EC2BF5", "Linux x86-64 root verity"); + AddType(0x830D, "7386CDF2-203C-47A9-A498-F2ECCE45A2D6", "Linux ARM32 root verity"); + AddType(0x830E, "DF3300CE-D69F-4C92-978C-9BFB0F38D820", "Linux ARM64 root verity"); + AddType(0x830F, "86ED10D5-B607-45BB-8957-D350F23D0571", "Linux IA-64 root verity"); + AddType(0x8310, "4D21B016-B534-45C2-A9FB-5C16E091FD2D", "Linux /var"); // Linux /var (auto-mounted by systemd) + AddType(0x8311, "7EC6F557-3BC5-4ACA-B293-16EF5DF639D1", "Linux /var/tmp"); // Linux /var/tmp (auto-mounted by systemd) // Used by Intel Rapid Start technology AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start");