Removed 0x8302 type code, since the Red Hat parted developers have

decided against using it.
This commit is contained in:
Roderick W. Smith
2013-09-24 12:56:11 -04:00
parent 427c799b61
commit e3ee733ff8
19 changed files with 49 additions and 38 deletions

11
NEWS
View File

@@ -1,6 +1,12 @@
0.8.8 (?/??/2013): 0.8.8 (?/??/2013):
------------------ ------------------
- The number of partition type codes has grown large enough that it fills
an 80x24 display. I've therefore added a pause (with a prompt to hit
<Enter>) to display more items after showing 21 lines in gdisk or after
the screen has nearly filled with entries in cgdisk. There's no such
pause/prompt in sgdisk, though.
- Fine-tuned verification ('v') check for 0xEE partition that doesn't begin - Fine-tuned verification ('v') check for 0xEE partition that doesn't begin
on sector 1: Previously, a disk with multiple 0xEE partitions would on sector 1: Previously, a disk with multiple 0xEE partitions would
always trigger this warning. Now, the warning occurs only if NONE of the always trigger this warning. Now, the warning occurs only if NONE of the
@@ -10,11 +16,6 @@
opted to create an extra partition to cover unused space following opted to create an extra partition to cover unused space following
hybridized partitions, gdisk would hang. hybridized partitions, gdisk would hang.
- Added support for new partition type code,
47CB5633-7E3E-408B-B7B8-2D915B7B21B1 (0x8302), which parted (git versions
leading up to 3.2) uses for HFS+ partitions that hold Linux boot files on
Macs. This type code corresponds to the "hfs_esp" flag in parted.
- Added check for an active/bootable 0xEE protective partition to the - Added check for an active/bootable 0xEE protective partition to the
verify ('v') function. If found, this is not counted as an error, but verify ('v') function. If found, this is not counted as an error, but
it is called out to the user, since it can cause some EFIs (such as it is called out to the user, since it can cause some EFIs (such as

View File

@@ -3,7 +3,7 @@
// of which only four are currently (2/2011) documented on Wikipedia, and // of which only four are currently (2/2011) documented on Wikipedia, and
// two others found from other sources. // two others found from other sources.
/* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS

View File

@@ -3,7 +3,7 @@
/* Initial coding by Rod Smith, January to February, 2009 */ /* Initial coding by Rod Smith, January to February, 2009 */
/* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS
@@ -907,7 +907,7 @@ int BasicMBRData::SpaceBeforeAllLogicals(void) {
} // BasicMBRData::SpaceBeforeAllLogicals() } // BasicMBRData::SpaceBeforeAllLogicals()
// Returns 1 if the partitions describe a legal layout -- all logicals // Returns 1 if the partitions describe a legal layout -- all logicals
// are contiguous and have at least one preceding empty partitions, // are contiguous and have at least one preceding empty sector,
// the number of primaries is under 4 (or under 3 if there are any // the number of primaries is under 4 (or under 3 if there are any
// logicals), there are no overlapping partitions, etc. // logicals), there are no overlapping partitions, etc.
// Does NOT assume that primaries are numbered 1-4; uses the // Does NOT assume that primaries are numbered 1-4; uses the
@@ -928,11 +928,11 @@ int BasicMBRData::IsLegal(void) {
// Returns 1 if the 0xEE partition in the protective/hybrid MBR is marked as // Returns 1 if the 0xEE partition in the protective/hybrid MBR is marked as
// active/bootable. // active/bootable.
int BasicMBRData::IsEEActive(void) { int BasicMBRData::IsEEActive(void) {
int i, IsActive = FALSE; int i, IsActive = 0;
for (i = 0; i < MAX_MBR_PARTS; i++) { for (i = 0; i < MAX_MBR_PARTS; i++) {
if ((partitions[i].GetStatus() & 0x80) && (partitions[i].GetType() == 0xEE)) if ((partitions[i].GetStatus() & 0x80) && (partitions[i].GetType() == 0xEE))
IsActive = TRUE; IsActive = 1;
} }
return IsActive; return IsActive;
} // BasicMBRData::IsEEActive() } // BasicMBRData::IsEEActive()

View File

@@ -1,6 +1,6 @@
/* basicmbr.h -- MBR data structure definitions, types, and functions */ /* basicmbr.h -- MBR data structure definitions, types, and functions */
/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <stdint.h> #include <stdint.h>

View File

@@ -4,7 +4,7 @@
// //
// by Rod Smith, project began February 2009 // by Rod Smith, project began February 2009
/* This program is copyright (c) 2009-2011 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <string.h> #include <string.h>

2
gpt.cc
View File

@@ -3,7 +3,7 @@
/* By Rod Smith, initial coding January to February, 2009 */ /* By Rod Smith, initial coding January to February, 2009 */
/* This program is copyright (c) 2009-2012 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS

View File

@@ -1,7 +1,7 @@
/* /*
Implementation of GPTData class derivative with popt-based command Implementation of GPTData class derivative with popt-based command
line processing line processing
Copyright (C) 2010-2011 Roderick W. Smith Copyright (C) 2010-2013 Roderick W. Smith
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by
@@ -131,7 +131,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
Attributes::ListAttributes(); Attributes::ListAttributes();
break; break;
case 'L': case 'L':
typeHelper.ShowAllTypes(); typeHelper.ShowAllTypes(0);
break; break;
case 'P': case 'P':
pretend = 1; pretend = 1;

View File

@@ -1,7 +1,7 @@
/* /*
Implementation of GPTData class derivative with popt-based command Implementation of GPTData class derivative with popt-based command
line processing line processing
Copyright (C) 2010-2011 Roderick W. Smith Copyright (C) 2010-2013 Roderick W. Smith
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,7 +1,7 @@
/* /*
* Implementation of GPTData class derivative with curses-based text-mode * Implementation of GPTData class derivative with curses-based text-mode
* interaction * interaction
* Copyright (C) 2011 Roderick W. Smith * Copyright (C) 2011-2013 Roderick W. Smith
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@@ -737,6 +737,7 @@ void GPTDataCurses::DrawMenu(void) {
string drive="Disk Drive: "; string drive="Disk Drive: ";
drive += device; drive += device;
ostringstream size; ostringstream size;
size << "Size: " << diskSize << ", " << BytesToIeee(diskSize, blockSize); size << "Size: " << diskSize << ", " << BytesToIeee(diskSize, blockSize);
clear(); clear();
@@ -811,7 +812,7 @@ void ShowTypes(void) {
def_prog_mode(); def_prog_mode();
endwin(); endwin();
tempType.ShowAllTypes(); tempType.ShowAllTypes(LINES - 3);
cout << "\nPress the <Enter> key to continue: "; cout << "\nPress the <Enter> key to continue: ";
cin.get(junk); cin.get(junk);
reset_prog_mode(); reset_prog_mode();

View File

@@ -1,7 +1,7 @@
/* /*
* Implementation of GPTData class derivative with curses-based text-mode * Implementation of GPTData class derivative with curses-based text-mode
* interaction * interaction
* Copyright (C) 2011 Roderick W. Smith * Copyright (C) 2011-2013 Roderick W. Smith
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by

View File

@@ -4,7 +4,7 @@
// Description: Class to implement a SINGLE GPT partition // Description: Class to implement a SINGLE GPT partition
// //
// //
// Author: Rod Smith <rodsmith@rodsbooks.com>, (C) 2009-2011 // Author: Rod Smith <rodsmith@rodsbooks.com>, (C) 2009-2013
// //
// Copyright: See COPYING file that comes with this distribution // Copyright: See COPYING file that comes with this distribution
// //

View File

@@ -1,5 +1,5 @@
/* /*
Copyright (C) 2010-2011 <Roderick W. Smith> Copyright (C) 2010-2013 <Roderick W. Smith>
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

View File

@@ -1,6 +1,6 @@
/* /*
Implementation of GPTData class derivative with basic text-mode interaction Implementation of GPTData class derivative with basic text-mode interaction
Copyright (C) 2010-2011 Roderick W. Smith Copyright (C) 2010-2013 Roderick W. Smith
This program is free software; you can redistribute it and/or modify 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 it under the terms of the GNU General Public License as published by

2
mbr.cc
View File

@@ -3,7 +3,7 @@
/* Initial coding by Rod Smith, January to February, 2009 */ /* Initial coding by Rod Smith, January to February, 2009 */
/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS

2
mbr.h
View File

@@ -1,6 +1,6 @@
/* mbr.h -- MBR data structure definitions, types, and functions */ /* mbr.h -- MBR data structure definitions, types, and functions */
/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <stdint.h> #include <stdint.h>

View File

@@ -2,7 +2,7 @@
// Class to manage partition type codes -- a slight variant on MBR type // Class to manage partition type codes -- a slight variant on MBR type
// codes, GUID type codes, and associated names. // codes, GUID type codes, and associated names.
/* This program is copyright (c) 2009-2012 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS
@@ -110,7 +110,6 @@ void PartType::AddAllTypes(void) {
AddType(0x8200, "0657FD6D-A4AB-43C4-84E5-0933C84B4F4F", "Linux swap"); // Linux swap (or Solaris on MBR) 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(0x8300, "0FC63DAF-8483-4772-8E79-3D69D8477DE4", "Linux filesystem"); // Linux native
AddType(0x8301, "8DA63339-0007-60C0-C436-083AC8230908", "Linux reserved"); AddType(0x8301, "8DA63339-0007-60C0-C436-083AC8230908", "Linux reserved");
AddType(0x8302, "47CB5633-7E3E-408B-B7B8-2D915B7B21B1", "Linux HFS+"); // Used by Fedora on Macs
// Used by Intel Rapid Start technology // Used by Intel Rapid Start technology
AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start"); AddType(0x8400, "D3BFE2DE-3DAF-11DF-BA40-E3A556D89593", "Intel Rapid Start");
@@ -349,11 +348,14 @@ uint16_t PartType::GetHexType() const {
// Displays the available types and my extended MBR codes for same.... // Displays the available types and my extended MBR codes for same....
// Note: This function assumes an 80-column display. On wider displays, // Note: This function assumes an 80-column display. On wider displays,
// it stops at under 80 columns; on narrower displays, lines will wrap // it stops at under 80 columns; on narrower displays, lines will wrap
// in an ugly way. // in an ugly way. The maxLines value is the maximum number of lines
void PartType::ShowAllTypes(void) const { // to display before prompting to continue, or 0 (or a negative value)
int colCount = 1; // column count // for no limit.
void PartType::ShowAllTypes(int maxLines) const {
int colCount = 1, lineCount = 1;
size_t i; size_t i;
AType* thisType = allTypes; AType* thisType = allTypes;
string line;
cout.unsetf(ios::uppercase); cout.unsetf(ios::uppercase);
while (thisType != NULL) { while (thisType != NULL) {
@@ -364,17 +366,24 @@ void PartType::ShowAllTypes(void) const {
cout << thisType->name.substr(0, 20); cout << thisType->name.substr(0, 20);
for (i = 0; i < (20 - (thisType->name.substr(0, 20).length())); i++) for (i = 0; i < (20 - (thisType->name.substr(0, 20).length())); i++)
cout << " "; cout << " ";
if ((colCount % 3) == 0) if ((colCount % 3) == 0) {
if (thisType->next) {
cout << "\n"; cout << "\n";
else if ((maxLines > 0) && (lineCount++ % maxLines) == 0) {
cout << "Press the <Enter> key to see more codes: ";
getline(cin, line);
} // if reached screen line limit
} // if there's another entry following this one
} else {
cout << " "; cout << " ";
}
colCount++; colCount++;
} // if } // if
thisType = thisType->next; thisType = thisType->next;
} // while } // while
cout.fill(' '); cout.fill(' ');
cout << "\n" << dec; cout << "\n" << dec;
} // PartType::ShowTypes() } // PartType::ShowAllTypes(int maxLines)
// Returns 1 if code is a valid extended MBR code, 0 if it's not // Returns 1 if code is a valid extended MBR code, 0 if it's not
int PartType::Valid(uint16_t code) const { int PartType::Valid(uint16_t code) const {

View File

@@ -1,4 +1,4 @@
/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <stdint.h> #include <stdint.h>
@@ -60,7 +60,7 @@ public:
uint16_t GetHexType() const; uint16_t GetHexType() const;
// Information relating to all type data // Information relating to all type data
void ShowAllTypes(void) const; void ShowAllTypes(int maxLines = 21) const;
int Valid(uint16_t code) const; int Valid(uint16_t code) const;
}; };

View File

@@ -3,7 +3,7 @@
// Primarily by Rod Smith, February 2009, but with a few functions // Primarily by Rod Smith, February 2009, but with a few functions
// copied from other sources (see attributions below). // copied from other sources (see attributions below).
/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#define __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS

View File

@@ -1,4 +1,4 @@
/* This program is copyright (c) 2009 by Roderick W. Smith. It is distributed /* This program is copyright (c) 2009-2013 by Roderick W. Smith. It is distributed
under the terms of the GNU GPL version 2, as detailed in the COPYING file. */ under the terms of the GNU GPL version 2, as detailed in the COPYING file. */
#include <stdint.h> #include <stdint.h>