Home | History | Annotate | Download | only in gptfdisk

Lines Matching refs:mainHeader

81    mainHeader.numParts = 0;
105 mainHeader.numParts = 0;
122 mainHeader = orig.mainHeader;
202 if (mainHeader.currentLBA != 1) {
207 mainHeader.currentLBA = 1;
218 if (mainHeader.currentLBA != secondHeader.backupLBA) {
220 cout << "\nProblem: main GPT header's current LBA pointer (" << mainHeader.currentLBA
224 if (mainHeader.backupLBA != secondHeader.currentLBA) {
226 cout << "\nProblem: main GPT header's backup LBA pointer (" << mainHeader.backupLBA
231 if (mainHeader.firstUsableLBA != secondHeader.firstUsableLBA) {
233 cout << "\nProblem: main GPT header's first usable LBA pointer (" << mainHeader.firstUsableLBA
237 if (mainHeader.lastUsableLBA != secondHeader.lastUsableLBA) {
239 cout << "\nProblem: main GPT header's last usable LBA pointer (" << mainHeader.lastUsableLBA
244 if ((mainHeader.diskGUID != secondHeader.diskGUID)) {
246 cout << "\nProblem: main header's disk GUID (" << mainHeader.diskGUID
252 if (mainHeader.numParts != secondHeader.numParts) {
254 cout << "\nProblem: main GPT header's number of partitions (" << mainHeader.numParts
259 if (mainHeader.sizeOfPartitionEntries != secondHeader.sizeOfPartitionEntries) {
262 << mainHeader.sizeOfPartitionEntries << ") doesn't\n"
271 if (mainHeader.backupLBA >= diskSize) {
275 << mainHeader.backupLBA + UINT64_C(1) << " sectors.)\n"
279 if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) {
282 << "sector is " << mainHeader.lastUsableLBA << ", but backup header is at\n"
283 << mainHeader.backupLBA << " and disk size is " << diskSize << " sectors.\n"
372 if (mainHeader.firstUsableLBA > firstUsedBlock) {
373 overlap = mainHeader.firstUsableLBA - firstUsedBlock;
384 if (mainHeader.lastUsableLBA < lastUsedBlock) {
385 overlap = lastUsedBlock - mainHeader.lastUsableLBA;
412 if ((mainHeadermainHeader, 1))) {
414 } else if ((mainHeader.revision != 0x00010000) && valid) {
418 cout << hex << mainHeader.revision << ", should be\n0x";
435 if (((mainHeader.signature << 32) == APM_SIGNATURE1) ||
436 (mainHeader.signature << 32) == APM_SIGNATURE2) {
502 if (mainHeader.headerSize > sizeof(GPTHeader))
503 hSize = secondHeader.headerSize = mainHeader.headerSize = HEADER_SIZE;
505 hSize = secondHeader.headerSize = mainHeader.headerSize;
509 ReverseHeaderBytes(&mainHeader);
515 mainHeader.partitionEntriesCRC = crc;
518 ReverseBytes(&mainHeader.partitionEntriesCRC, 4);
523 mainHeader.headerCRC = 0;
526 crc = chksum_crc32((unsigned char*) &mainHeader, hSize);
529 mainHeader.headerCRC = crc;
536 ReverseHeaderBytes(&mainHeader);
545 mainHeader.signature = GPT_SIGNATURE;
546 mainHeader.revision = secondHeader.revision;
547 mainHeader.headerSize = secondHeader.headerSize;
548 mainHeader.headerCRC = UINT32_C(0);
549 mainHeader.reserved = secondHeader.reserved;
550 mainHeader.currentLBA = secondHeader.backupLBA;
551 mainHeader.backupLBA = secondHeader.currentLBA;
552 mainHeader.firstUsableLBA = secondHeader.firstUsableLBA;
553 mainHeader.lastUsableLBA = secondHeader.lastUsableLBA;
554 mainHeader.diskGUID = secondHeader.diskGUID;
555 mainHeader.partitionEntriesLBA = UINT64_C(2);
556 mainHeader.numParts = secondHeader.numParts;
557 mainHeader.sizeOfPartitionEntries = secondHeader.sizeOfPartitionEntries;
558 mainHeader.partitionEntriesCRC = secondHeader.partitionEntriesCRC;
559 memcpy(mainHeader.reserved2, secondHeader.reserved2, sizeof(mainHeader.reserved2));
561 SetGPTSize(mainHeader.numParts, 0);
567 secondHeader.revision = mainHeader.revision;
568 secondHeader.headerSize = mainHeader.headerSize;
570 secondHeader.reserved = mainHeader.reserved;
571 secondHeader.currentLBA = mainHeader.backupLBA;
572 secondHeader.backupLBA = mainHeader.currentLBA;
573 secondHeader.firstUsableLBA = mainHeader.firstUsableLBA;
574 secondHeader.lastUsableLBA = mainHeader.lastUsableLBA;
575 secondHeader.diskGUID = mainHeader.diskGUID;
577 secondHeader.numParts = mainHeader.numParts;
578 secondHeader.sizeOfPartitionEntries = mainHeader.sizeOfPartitionEntries;
579 secondHeader.partitionEntriesCRC = mainHeader.partitionEntriesCRC;
580 memcpy(secondHeader.reserved2, mainHeader.reserved2, sizeof(secondHeader.reserved2));
805 allOK = LoadHeader(&mainHeader, myDisk, 1, &mainCrcOk);
807 if (mainCrcOk && (mainHeader.backupLBA < diskSize)) {
808 allOK = LoadHeader(&secondHeader, myDisk, mainHeader.backupLBA, &secondCrcOk) && allOK;
811 if (mainCrcOk && (mainHeader.backupLBA >= diskSize))
871 mainPartsCrcOk = CheckTable(&mainHeader);
901 return LoadPartitionTable(mainHeader, myDisk);
1007 if (header == &mainHeader)
1010 otherHeader = &mainHeader;
1041 if (mainHeader.backupLBA >= diskSize) {
1055 if (mainHeader.backupLBA < (diskSize - UINT64_C(1))) {
1070 if ((mainHeader.lastUsableLBA >= diskSize) || (mainHeader.lastUsableLBA > mainHeader.backupLBA)) {
1126 allOK = allOK && SaveHeader(&secondHeader, myDisk, mainHeader.backupLBA);
1129 allOK = allOK && SavePartitionTable(myDisk, mainHeader.partitionEntriesLBA);
1132 allOK = allOK && SaveHeader(&mainHeader, myDisk, 1);
1191 allOK = SaveHeader(&mainHeader, backupFile, 1);
1246 if (disk.Write(partitions, mainHeader.sizeOfPartitionEntries * numParts) == -1)
1268 LoadHeader(&mainHeader, backupFile, 1, &mainCrcOk);
1275 (mainHeader.numParts * mainHeader.sizeOfPartitionEntries) + 1024);
1292 SetGPTSize(mainHeader.numParts, 0);
1301 if (!LoadPartitionTable(mainHeader, backupFile, (uint64_t) (3 - shortBackup)))
1337 if (!myDisk.Seek(mainHeader.currentLBA))
1343 if (!myDisk.Seek(mainHeader.partitionEntriesLBA))
1345 tableSize = numParts * mainHeader.sizeOfPartitionEntries;
1437 cout << "Disk identifier (GUID): " << mainHeader.diskGUID << "\n";
1439 cout << "First usable sector is " << mainHeader.firstUsableLBA
1440 << ", last usable sector is " << mainHeader.lastUsableLBA << "\n";
1730 mainHeader.firstUsableLBA = ((numEntries * GPT_SIZE) / blockSize) + (((numEntries * GPT_SIZE) % blockSize) != 0) + 2 ;
1731 secondHeader.firstUsableLBA = mainHeader.firstUsableLBA;
1740 mainHeader.numParts = numParts;
1843 mainHeader.signature = GPT_SIGNATURE;
1844 mainHeader.revision = 0x00010000;
1845 mainHeader.headerSize = HEADER_SIZE;
1846 mainHeader.reserved = 0;
1847 mainHeader.currentLBA = UINT64_C(1);
1848 mainHeader.partitionEntriesLBA = (uint64_t) 2;
1849 mainHeader.sizeOfPartitionEntries = GPT_SIZE;
1851 mainHeader.reserved2[i] = '\0';
1859 mainHeader.backupLBA = diskSize - UINT64_C(1);
1860 mainHeader.lastUsableLBA = diskSize - mainHeader.firstUsableLBA;
1863 mainHeader.diskGUID.Randomize();
1888 mainHeader.backupLBA = secondHeader.currentLBA = diskSize - UINT64_C(1);
1889 if (mainHeader.lastUsableLBA != diskSize - mainHeader.firstUsableLBA) {
1897 mainHeader.lastUsableLBA = secondHeader.lastUsableLBA = diskSize - mainHeader.firstUsableLBA;
1918 mainHeader.diskGUID = newGUID;
1942 mainHeader.diskGUID.Randomize();
1943 secondHeader.diskGUID = mainHeader.diskGUID;
1991 if (earlier >= mainHeader.firstUsableLBA) {
2004 if ((sectorOK != 1) && (later <= mainHeader.lastUsableLBA)) {
2094 if (start < mainHeader.firstUsableLBA)
2095 first = mainHeader.firstUsableLBA;
2114 if (first > mainHeader.lastUsableLBA)
2148 last = mainHeader.lastUsableLBA;
2164 if (last < mainHeader.firstUsableLBA)
2174 nearestStart = mainHeader.lastUsableLBA;
2230 if ((sector < mainHeader.firstUsableLBA) ||
2231 (sector > mainHeader.lastUsableLBA)) {
2363 return mainHeader.diskGUID;