mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 04:20:46 +00:00
[USETUP]
- Fix indenttation fof comments. - Replace SectorsPerTrack by SectorAlignment in partition size and location calculations. svn path=/trunk/; revision=67951
This commit is contained in:
parent
3eb7effa38
commit
38b7201227
1 changed files with 46 additions and 37 deletions
|
@ -656,9 +656,10 @@ ScanForUnpartitionedDiskSpace(
|
|||
NewPartEntry->DiskEntry = DiskEntry;
|
||||
|
||||
NewPartEntry->IsPartitioned = FALSE;
|
||||
NewPartEntry->StartSector.QuadPart = (ULONGLONG)DiskEntry->SectorsPerTrack;
|
||||
NewPartEntry->StartSector.QuadPart = (ULONGLONG)DiskEntry->SectorAlignment;
|
||||
NewPartEntry->SectorCount.QuadPart = Align(DiskEntry->SectorCount.QuadPart, DiskEntry->SectorAlignment) -
|
||||
DiskEntry->SectorsPerTrack;
|
||||
NewPartEntry->StartSector.QuadPart;
|
||||
|
||||
DPRINT1("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT1("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
||||
|
@ -672,7 +673,7 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
}
|
||||
|
||||
/* Start partition at head 1, cylinder 0 */
|
||||
LastStartSector = DiskEntry->SectorsPerTrack;
|
||||
LastStartSector = DiskEntry->SectorAlignment;
|
||||
LastSectorCount = 0ULL;
|
||||
LastUnusedSectorCount = 0ULL;
|
||||
|
||||
|
@ -704,6 +705,7 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
NewPartEntry->StartSector.QuadPart = LastStartSector + LastSectorCount;
|
||||
NewPartEntry->SectorCount.QuadPart = Align(NewPartEntry->StartSector.QuadPart + LastUnusedSectorCount, DiskEntry->SectorAlignment) -
|
||||
NewPartEntry->StartSector.QuadPart;
|
||||
|
||||
DPRINT1("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT1("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
||||
|
@ -743,6 +745,7 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
NewPartEntry->StartSector.QuadPart = LastStartSector + LastSectorCount;
|
||||
NewPartEntry->SectorCount.QuadPart = Align(NewPartEntry->StartSector.QuadPart + LastUnusedSectorCount, DiskEntry->SectorAlignment) -
|
||||
NewPartEntry->StartSector.QuadPart;
|
||||
|
||||
DPRINT("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
DPRINT("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
||||
|
@ -772,8 +775,8 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
NewPartEntry->LogicalPartition = TRUE;
|
||||
|
||||
NewPartEntry->IsPartitioned = FALSE;
|
||||
NewPartEntry->StartSector.QuadPart = DiskEntry->ExtendedPartition->StartSector.QuadPart + (ULONGLONG)DiskEntry->SectorsPerTrack;
|
||||
NewPartEntry->SectorCount.QuadPart = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (ULONGLONG)DiskEntry->SectorsPerTrack;
|
||||
NewPartEntry->StartSector.QuadPart = DiskEntry->ExtendedPartition->StartSector.QuadPart + (ULONGLONG)DiskEntry->SectorAlignment;
|
||||
NewPartEntry->SectorCount.QuadPart = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (ULONGLONG)DiskEntry->SectorAlignment;
|
||||
|
||||
DPRINT1("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT1("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
|
@ -788,7 +791,7 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
}
|
||||
|
||||
/* Start partition at head 1, cylinder 0 */
|
||||
LastStartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (ULONGLONG)DiskEntry->SectorsPerTrack;
|
||||
LastStartSector = DiskEntry->ExtendedPartition->StartSector.QuadPart + (ULONGLONG)DiskEntry->SectorAlignment;
|
||||
LastSectorCount = 0ULL;
|
||||
LastUnusedSectorCount = 0ULL;
|
||||
|
||||
|
@ -801,9 +804,9 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
PartEntry->SectorCount.QuadPart != 0ULL)
|
||||
{
|
||||
LastUnusedSectorCount =
|
||||
PartEntry->StartSector.QuadPart - (ULONGLONG)DiskEntry->SectorsPerTrack - (LastStartSector + LastSectorCount);
|
||||
PartEntry->StartSector.QuadPart - (ULONGLONG)DiskEntry->SectorAlignment - (LastStartSector + LastSectorCount);
|
||||
|
||||
if ((PartEntry->StartSector.QuadPart - (ULONGLONG)DiskEntry->SectorsPerTrack) > (LastStartSector + LastSectorCount) &&
|
||||
if ((PartEntry->StartSector.QuadPart - (ULONGLONG)DiskEntry->SectorAlignment) > (LastStartSector + LastSectorCount) &&
|
||||
LastUnusedSectorCount >= (ULONGLONG)DiskEntry->SectorAlignment)
|
||||
{
|
||||
DPRINT("Unpartitioned disk space %I64u sectors\n", LastUnusedSectorCount);
|
||||
|
@ -821,6 +824,7 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
NewPartEntry->StartSector.QuadPart = LastStartSector + LastSectorCount;
|
||||
NewPartEntry->SectorCount.QuadPart = Align(NewPartEntry->StartSector.QuadPart + LastUnusedSectorCount, DiskEntry->SectorAlignment) -
|
||||
NewPartEntry->StartSector.QuadPart;
|
||||
|
||||
DPRINT("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
DPRINT("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
||||
|
@ -861,6 +865,7 @@ DPRINT1("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
|||
NewPartEntry->StartSector.QuadPart = LastStartSector + LastSectorCount;
|
||||
NewPartEntry->SectorCount.QuadPart = Align(NewPartEntry->StartSector.QuadPart + LastUnusedSectorCount, DiskEntry->SectorAlignment) -
|
||||
NewPartEntry->StartSector.QuadPart;
|
||||
|
||||
DPRINT("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
DPRINT("Total Sectors: %I64u\n", NewPartEntry->SectorCount.QuadPart);
|
||||
|
@ -2261,6 +2266,7 @@ DPRINT1("UpdateDiskLayout()\n");
|
|||
if (!IsSamePrimaryLayoutEntry(PartitionInfo, DiskEntry, PartEntry))
|
||||
{
|
||||
DPRINT1("Updating partition entry %lu\n", Index);
|
||||
|
||||
PartitionInfo->StartingOffset.QuadPart = PartEntry->StartSector.QuadPart * DiskEntry->BytesPerSector;
|
||||
PartitionInfo->PartitionLength.QuadPart = PartEntry->SectorCount.QuadPart * DiskEntry->BytesPerSector;
|
||||
PartitionInfo->HiddenSectors = 0;
|
||||
|
@ -2293,6 +2299,7 @@ DPRINT1("Updating partition entry %lu\n", Index);
|
|||
if (!IsEmptyLayoutEntry(PartitionInfo))
|
||||
{
|
||||
DPRINT1("Wiping partition entry %lu\n", Index);
|
||||
|
||||
PartitionInfo->StartingOffset.QuadPart = 0;
|
||||
PartitionInfo->PartitionLength.QuadPart = 0;
|
||||
PartitionInfo->HiddenSectors = 0;
|
||||
|
@ -2381,6 +2388,7 @@ DPRINT1("Current partition sector count: %I64u\n", PartEntry->SectorCount.QuadPa
|
|||
Align(PartEntry->StartSector.QuadPart + SectorCount, DiskEntry->SectorAlignment) - PartEntry->StartSector.QuadPart == PartEntry->SectorCount.QuadPart)
|
||||
{
|
||||
DPRINT1("Convert existing partition entry\n");
|
||||
|
||||
/* Convert current entry to 'new (unformatted)' */
|
||||
PartEntry->IsPartitioned = TRUE;
|
||||
PartEntry->PartitionType = PARTITION_ENTRY_UNUSED;
|
||||
|
@ -2458,8 +2466,8 @@ AddLogicalDiskSpace(
|
|||
NewPartEntry->LogicalPartition = TRUE;
|
||||
|
||||
NewPartEntry->IsPartitioned = FALSE;
|
||||
NewPartEntry->StartSector.QuadPart = DiskEntry->ExtendedPartition->StartSector.QuadPart + (ULONGLONG)DiskEntry->SectorsPerTrack;
|
||||
NewPartEntry->SectorCount.QuadPart = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (ULONGLONG)DiskEntry->SectorsPerTrack;
|
||||
NewPartEntry->StartSector.QuadPart = DiskEntry->ExtendedPartition->StartSector.QuadPart + (ULONGLONG)DiskEntry->SectorAlignment;
|
||||
NewPartEntry->SectorCount.QuadPart = DiskEntry->ExtendedPartition->SectorCount.QuadPart - (ULONGLONG)DiskEntry->SectorAlignment;
|
||||
|
||||
DPRINT1("First Sector: %I64u\n", NewPartEntry->StartSector.QuadPart);
|
||||
DPRINT1("Last Sector: %I64u\n", NewPartEntry->StartSector.QuadPart + NewPartEntry->SectorCount.QuadPart - 1);
|
||||
|
@ -2499,6 +2507,7 @@ DPRINT1("Current partition sector count: %I64u\n", PartEntry->SectorCount.QuadPa
|
|||
if (Align(PartEntry->StartSector.QuadPart + SectorCount, DiskEntry->SectorAlignment) - PartEntry->StartSector.QuadPart == PartEntry->SectorCount.QuadPart)
|
||||
{
|
||||
DPRINT1("Convert existing partition entry\n");
|
||||
|
||||
/* Convert current entry to 'new (unformatted)' */
|
||||
PartEntry->IsPartitioned = TRUE;
|
||||
PartEntry->FormatState = Formatted;
|
||||
|
|
Loading…
Reference in a new issue