summaryrefslogtreecommitdiff
path: root/gpt.cc
diff options
context:
space:
mode:
authorsrs5694 <srs5694@users.sourceforge.net>2009-11-24 15:43:49 -0500
committersrs5694 <srs5694@users.sourceforge.net>2009-11-24 15:43:49 -0500
commit8bb7876224e60a00f0b7f39e4624ee0961b2f27c (patch)
treec26ee4933e7ef396e52e72d99eb9283f663a6b06 /gpt.cc
parent978041ca613dcb881763b36cf53639d924e52a56 (diff)
downloadsgdisk-8bb7876224e60a00f0b7f39e4624ee0961b2f27c.tar.gz
0.5.1-pre1, with new code to enable moving the backup GPT data
structures, for the benefit of those who add disks to a RAID array.
Diffstat (limited to 'gpt.cc')
-rw-r--r--gpt.cc10
1 files changed, 9 insertions, 1 deletions
diff --git a/gpt.cc b/gpt.cc
index 5885486..3a98037 100644
--- a/gpt.cc
+++ b/gpt.cc
@@ -900,7 +900,7 @@ int GPTData::SaveGPTBackup(char* filename) {
printf("The operation has completed successfully.\n");
} else {
printf("Warning! An error was reported when writing the backup file.\n");
- printf("It may not be useable!\n");
+ printf("It may not be usable!\n");
} // if/else
close(fd);
@@ -1817,6 +1817,14 @@ int GPTData::ClearGPTData(void) {
return (goOn);
} // GPTData::ClearGPTData()
+// Set the location of the second GPT header data to the correct location.
+// Intended to help users of RAID arrays that have been resized.
+void GPTData::FixSecondHeaderLocation() {
+ mainHeader.backupLBA = secondHeader.currentLBA = diskSize - UINT64_C(1);
+ mainHeader.lastUsableLBA = secondHeader.lastUsableLBA = diskSize - mainHeader.firstUsableLBA;
+ secondHeader.partitionEntriesLBA = secondHeader.lastUsableLBA + UINT64_C(1);
+} // GPTData::FixSecondHeaderLocation()
+
void GPTData::SetName(uint32_t partNum, char* theName) {
if ((partNum >= 0) && (partNum < mainHeader.numParts))
if (partitions[partNum].GetFirstLBA() > 0)