Print DFX msg for create partition func

Signed-off-by: jiangqianrong <jiangqianrong1@huawei.com>
This commit is contained in:
jiangqianrong
2026-03-06 19:35:59 +08:00
parent 94c4541f5c
commit 36d6f176cd
3 changed files with 24 additions and 5 deletions
+19 -4
View File
@@ -1991,9 +1991,21 @@ uint32_t GPTData::CreatePartition(uint32_t partNum, uint64_t startSector, uint64
partitions[partNum].SetLastLBA(endSector);
partitions[partNum].SetType(DEFAULT_GPT_TYPE);
partitions[partNum].RandomizeUniqueGUID();
} else retval = 0; // if free space until endSector
} else retval = 0; // if startSector is free
} else retval = 0; // if legal partition number
} else {
cerr << "Insufficent space: startSector: " << startSector << ", endSector: " << endSector
<< ", maxSector: " << FindLastInFree(startSector) << ".\n";
retval = 0; // if free space until endSector
}
} else {
cerr << "startSector: " << startSector << ", endSector: " << endSector
<< ", free startSector: "<< (IsFree(startSector) ? "true" : "false") << ".\n";
retval = 0; // if startSector is free
}
} else {
cerr << "partNum: " << (partNum + 1) << ", numParts: " << numParts
<< ", IsFreePartNum: " << (IsFreePartNum(partNum) ? "true" : "false") << ".\n";
retval = 0; // if legal partition number
}
return retval;
} // GPTData::CreatePartition(partNum, startSector, endSector)
@@ -2152,7 +2164,10 @@ int GPTData::ChangePartType(uint32_t partNum, PartType theGUID) {
if (!IsFreePartNum(partNum)) {
partitions[partNum].SetType(theGUID);
} else retval = 0;
} else {
cerr << "partNum: " << partNum << ", numParts: " << numParts << ".\n";
retval = 0;
}
return retval;
} // GPTData::ChangePartType()
+2
View File
@@ -319,6 +319,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
break;
case 'n':
JustLooking(0);
cout << "Create partition option: " << newPartInfo << ".\n";
newPartNum = (int) GetInt(newPartInfo, 1) - 1;
if (newPartNum < 0)
newPartNum = FindFirstFreePart();
@@ -398,6 +399,7 @@ int GPTDataCL::DoOptions(int argc, char* argv[]) {
break;
case 't':
JustLooking(0);
cout << "Change typecode option: " << (typeCode ? typeCode : "NULL") << ".\n";
partNum = (int) GetInt(typeCode, 1) - 1;
if (partNum < 0)
partNum = newPartNum;
+3 -1
View File
@@ -223,8 +223,10 @@ uint64_t IeeeToInt(string inValue, uint64_t sSize, uint64_t low, uint64_t high,
response = high - response;
} // if
if (badInput)
if (badInput) {
cerr << "Invalid input: '" << inValue << "', response: " << response << ".\n";
response = UINT64_C(0);
}
return response;
} // IeeeToInt()