mirror of https://github.com/FDOS/kernel.git
Merge "suspect partition" copy/paste code into functions.
git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@790 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
parent
d06b147cb0
commit
a779a14070
|
@ -806,6 +806,25 @@ BOOL ConvPartTableEntryToIntern(struct PartTableEntry * pEntry,
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL is_suspect(struct CHS *chs, struct CHS *pEntry_chs)
|
||||||
|
{
|
||||||
|
return !((chs->Cylinder & 0x3ff) == pEntry_chs->Cylinder ||
|
||||||
|
1023 == pEntry_chs->Cylinder ||
|
||||||
|
(chs->Cylinder == pEntry_chs->Cylinder &&
|
||||||
|
chs->Head == pEntry_chs->Head &&
|
||||||
|
chs->Sector == pEntry_chs->Sector));
|
||||||
|
}
|
||||||
|
|
||||||
|
void print_warning_suspect(char *partitionName, UBYTE fs, struct CHS *chs,
|
||||||
|
struct CHS *pEntry_chs)
|
||||||
|
{
|
||||||
|
printf("WARNING: using suspect partition %s FS %02x:", partitionName, fs);
|
||||||
|
printCHS(" with calculated values ", chs);
|
||||||
|
printCHS(" instead of ", pEntry_chs);
|
||||||
|
printf("\n");
|
||||||
|
memcpy(pEntry_chs, chs, sizeof(struct CHS));
|
||||||
|
}
|
||||||
|
|
||||||
BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
|
BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
|
||||||
struct PartTableEntry * pEntry, ULONG startSector,
|
struct PartTableEntry * pEntry, ULONG startSector,
|
||||||
int partitionsToIgnore, int extendedPartNo)
|
int partitionsToIgnore, int extendedPartNo)
|
||||||
|
@ -852,41 +871,21 @@ BOOL ScanForPrimaryPartitions(struct DriveParamS * driveParam, int scan_type,
|
||||||
> 8 GB cyl = 1023, other (cyl&1023)
|
> 8 GB cyl = 1023, other (cyl&1023)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!((chs.Cylinder & 0x3ff) == pEntry->Begin.Cylinder ||
|
if (is_suspect(&chs, &pEntry->Begin))
|
||||||
1023 == pEntry->Begin.Cylinder ||
|
|
||||||
(chs.Cylinder == pEntry->Begin.Cylinder &&
|
|
||||||
chs.Head == pEntry->Begin.Head &&
|
|
||||||
chs.Sector == pEntry->Begin.Sector)))
|
|
||||||
{
|
{
|
||||||
printf("WARNING: using suspect partition %s FS %02x:",
|
print_warning_suspect(partitionName, pEntry->FileSystem, &chs,
|
||||||
partitionName, pEntry->FileSystem);
|
&pEntry->Begin);
|
||||||
printCHS(" with calculated values ", &chs);
|
|
||||||
printCHS(" instead of ", &pEntry->Begin);
|
|
||||||
printf("\n");
|
|
||||||
memcpy(&pEntry->Begin, &chs, sizeof(struct CHS));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!((end.Cylinder & 0x3ff) == pEntry->End.Cylinder ||
|
if (is_suspect(&end, &pEntry->End))
|
||||||
1023 == pEntry->End.Cylinder ||
|
|
||||||
(end.Cylinder == pEntry->End.Cylinder &&
|
|
||||||
end.Head == pEntry->End.Head &&
|
|
||||||
end.Sector == pEntry->End.Sector)))
|
|
||||||
{
|
{
|
||||||
if (pEntry->NumSect == 0)
|
if (pEntry->NumSect == 0)
|
||||||
{
|
{
|
||||||
printf("Not using partition %s with 0 sectors\n", partitionName);
|
printf("Not using partition %s with 0 sectors\n", partitionName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
print_warning_suspect(partitionName, pEntry->FileSystem, &end,
|
||||||
printf("WARNING: using suspect partition %s FS %02x:",
|
&pEntry->End);
|
||||||
partitionName, pEntry->FileSystem);
|
|
||||||
|
|
||||||
printCHS(" with calculated values ", &end);
|
|
||||||
printCHS(" instead of ", &pEntry->End);
|
|
||||||
printf("\n");
|
|
||||||
memcpy(&pEntry->End, &end, sizeof(struct CHS));
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chs.Cylinder > 1023 || end.Cylinder > 1023)
|
if (chs.Cylinder > 1023 || end.Cylinder > 1023)
|
||||||
|
|
Loading…
Reference in New Issue