Home | History | Annotate | Download | only in gptfdisk

Lines Matching refs:partitions

70    partitions = NULL;
81 sectorAlignment = MIN_AF_ALIGNMENT; // Align partitions on 4096-byte boundaries by default
95 partitions = NULL;
106 sectorAlignment = MIN_AF_ALIGNMENT; // Align partitions on 4096-byte boundaries by default
119 delete[] partitions;
148 delete[] partitions;
149 partitions = new GPTPart [numParts];
150 if (partitions == NULL) {
151 cerr << "Error! Could not allocate memory for partitions in GPTData::operator=()!\n"
156 partitions[i] = orig.partitions[i];
203 << "table when you save your partitions.\n";
259 cout << "\nProblem: main GPT header's number of partitions (" << mainHeader.numParts
260 << ") doesn't\nmatch the backup GPT header's number of partitions ("
292 // Check for overlapping partitions....
295 // Check for insane partitions (start after end, hugely big, etc.)
298 // Check for mismatched MBR and GPT partitions...
313 // Verify that partitions don't run into GPT data areas....
322 // Check that partitions are aligned on proper boundaries (for WD Advanced
325 if ((partitions[i].IsUsed()) && (partitions[i].GetFirstLBA() % sectorAlignment) != 0) {
352 // Checks to see if the GPT tables overrun existing partitions; if they
364 if (partitions[i].IsUsed()) {
365 if (partitions[i].GetFirstLBA() < firstUsedBlock)
366 firstUsedBlock = partitions[i].GetFirstLBA();
367 if (partitions[i].GetLastLBA() > lastUsedBlock) {
368 lastUsedBlock = partitions[i].GetLastLBA();
519 crc = chksum_crc32((unsigned char*) partitions, numParts * GPT_SIZE);
604 if ((j < numParts) && (partitions[j].GetFirstLBA() == mbrFirst) &&
605 (partitions[j].GetLastLBA() == mbrLast) && (partitions[j].IsUsed()))
626 // Find overlapping partitions and warn user about them. Returns number of
627 // overlapping partitions.
635 if ((partitions[i].IsUsed()) && (partitions[j].IsUsed()) &&
636 (partitions[i].DoTheyOverlap(partitions[j]))) {
638 cout << "\nProblem: partitions " << i + 1 << " and " << j + 1 << " overlap:\n";
639 cout << " Partition " << i + 1 << ": " << partitions[i].GetFirstLBA()
640 << " to " << partitions[i].GetLastLBA() << "\n";
641 cout << " Partition " << j + 1 << ": " << partitions[j].GetFirstLBA()
642 << " to " << partitions[j].GetLastLBA() << "\n";
649 // Find partitions that are insane -- they start after they end or are too
659 if (partitions[i].IsUsed()) {
660 if (partitions[i].GetFirstLBA() > partitions[i].GetLastLBA()) {
664 if (partitions[i].GetLastLBA() >= diskSize) {
831 // Read partitions (from primary array)
965 if (disk.Read(partitions, sizeOfParts) != (int) sizeOfParts) {
969 newCRC = chksum_crc32((unsigned char*) partitions, sizeOfParts);
974 cout << "Caution! After loading partitions, the CRC doesn't check out!\n";
1090 // Check for overlapping or insane partitions....
1110 << "PARTITIONS!!\n\nDo you want to proceed? ";
1239 // Save the partitions to the specified sector. Used by both the SaveGPTData()
1251 if (disk.Write(partitions, mainHeader.sizeOfPartitionEntries * numParts) == -1)
1262 // set of partitions.
1312 // Something went badly wrong, so blank out partitions
1449 cout << "Partitions will be aligned on " << sectorAlignment << "-sector boundaries\n";
1454 partitions[i].ShowSummary(i, blockSize);
1461 partitions[partNum].ShowDetails(blockSize);
1476 // a new set of partitions (use_new). A return value of use_abort indicates
1491 << "typing 'q' if you don't want to convert your MBR partitions\n"
1505 << "want to convert your BSD partitions to GPT format!";
1556 // Convert the smaller of the # of GPT or MBR partitions
1565 // null (non-existent) partitions
1568 partitions[i] = protectiveMBR.AsGPT(i);
1581 // Returns the number of new partitions created.
1589 cout << "No partitions!\n";
1598 goOn = disklabel.ReadBSDData(&myDisk, partitions[partNum].GetFirstLBA(),
1599 partitions[partNum].GetLastLBA());
1605 cout << "Converted " << numDone << " BSD partitions.\n";
1607 cout << "Unable to convert partitions! Unrecognized BSD disklabel.\n";
1610 if (numDone > 0) { // converted partitions; delete carrier
1611 partitions[partNum].BlankPartition();
1616 // Transform the partitions on an already-loaded BSD disklabel...
1624 partitions[partNum] = disklabel->AsGPT(i);
1625 if (partitions[partNum].IsUsed())
1630 cerr << "Warning! Too many partitions to convert!\n";
1656 if (allOK && (partitions[gptPart].GetLastLBA() == UINT64_C(0))) {
1660 if (allOK && (partitions[gptPart].GetFirstLBA() <= UINT32_MAX) &&
1661 (partitions[gptPart].GetLengthLBA() <= UINT32_MAX)) {
1662 if (partitions[gptPart].GetLastLBA() > UINT32_MAX) {
1666 protectiveMBR.MakePart(mbrPart, (uint32_t) partitions[gptPart].GetFirstLBA(),
1667 (uint32_t) partitions[gptPart].GetLengthLBA(),
1668 partitions[gptPart].GetHexType() / 256, 0);
1672 << "partitions, or is\n too big; omitting it.\n";
1705 // Do the work only if the # of partitions is changing. Along with being
1710 if (((numEntries != numParts) || (partitions == NULL)) && (numEntries > 0)) {
1713 if (partitions != NULL) { // existing partitions; copy them over
1728 newParts[i] = partitions[i];
1730 delete[] partitions;
1731 partitions = newParts;
1734 partitions = newParts;
1735 } // if/else existing partitions
1757 partitions[i].BlankPartition();
1772 startSector = partitions[partNum].GetFirstLBA();
1773 length = partitions[partNum].GetLengthLBA();
1777 partitions[partNum].BlankPartition();
1799 partitions[partNum].SetFirstLBA(startSector);
1800 partitions[partNum].SetLastLBA(endSector);
1801 partitions[partNum].SetType(DEFAULT_GPT_TYPE);
1802 partitions[partNum].RandomizeUniqueGUID();
1813 sort(partitions, partitions + numParts);
1816 // Swap the contents of two partitions.
1827 temp = partitions[partNum1];
1828 partitions[partNum1] = partitions[partNum2];
1829 partitions[partNum2] = temp;
1835 // Set up data structures for entirely new set of partitions on the
1838 // structure, since it may hold the original MBR partitions if the
1845 delete[] partitions;
1846 partitions = NULL;
1875 // Blank out the partitions array....
1915 partitions[partNum].SetName(theName);
1936 if (partitions[pn].IsUsed()) {
1937 partitions[pn].SetUniqueGUID(theGUID);
1944 // Set new random GUIDs for the disk and all partitions. Intended to be used
1952 if (partitions[i].IsUsed())
1953 partitions[i].RandomizeUniqueGUID();
1962 partitions[partNum].SetType(theGUID);
1967 // Recompute the CHS values of all the MBR partitions. Used to reset
1982 // benefit of the OS. If partitions aren't properly aligned on these
2034 // Return value is the number of partitions found. Note that the
2035 // *low and *high values are both set to 0 when no partitions
2038 // tell when no partitions exist.
2046 if (partitions[i].IsUsed()) { // it exists
2054 // Above will leave *low pointing to its "not found" value if no partitions
2066 if (partitions != NULL) {
2067 while ((i < (int) numParts) && (partitions[i].IsUsed()))
2075 // Returns the number of defined partitions.
2080 if (partitions[i].IsUsed())
2106 // ...now search through all partitions; if first is within an
2110 // cases where partitions are out of sequential order....
2114 if ((partitions[i].IsUsed()) && (first >= partitions[i].GetFirstLBA()) &&
2115 (first <= partitions[i].GetLastLBA())) { // in existing part.
2116 first = partitions[i].GetLastLBA() + 1;
2158 // through all partitions, moving last when it's in an existing
2160 // where partitions are out of logical order.
2164 if ((last >= partitions[i].GetFirstLBA()) &&
2165 (last <= partitions[i].GetLastLBA())) { // in existing part.
2166 last = partitions[i].GetFirstLBA() - 1;
2183 if ((nearestStart > partitions[i].GetFirstLBA()) &&
2184 (partitions[i].GetFirstLBA() > start)) {
2185 nearestStart = partitions[i].GetFirstLBA() - 1;
2230 if ((sector >= partitions[i].GetFirstLBA()) &&
2231 (sector <= partitions[i].GetLastLBA())) {
2248 return ((partNum < numParts) && (partitions != NULL) &&
2249 (!partitions[partNum].IsUsed()));
2254 return ((partNum < numParts) && (partitions != NULL) &&
2255 (partitions[partNum].IsUsed()));
2264 // Set partition alignment value; partitions will begin on multiples of
2273 // Compute sector alignment based on the current partitions (if any). Each
2279 // is a safety measure for Advanced Format drives. If no partitions are
2294 if (partitions[i].IsUsed()) {
2298 if ((partitions[i].GetFirstLBA() % align) == 0) {
2335 // Reverse byte order for all partitions.
2340 partitions[i].ReversePartBytes();
2361 if (partitions == NULL) {
2362 cerr << "No partitions defined in GPTData::operator[]; fatal error!\n";
2365 return partitions[partNum];
2390 theAttr = partitions[partNum].GetAttributes();
2392 partitions[partNum].SetAttributes(theAttr.GetAttributes());
2405 if ((partNum < numParts) && partitions[partNum].IsUsed())
2406 partitions[partNum].ShowAttributes(partNum);
2412 partitions[partNum].GetAttributes().OperateOnAttributes(partNum, "get", attributeBits);