Author: hbelusca
Date: Sun Feb 28 15:25:22 2016
New Revision: 70797

URL: http://svn.reactos.org/svn/reactos?rev=70797&view=rev
Log:
[USETUP]
- Remove some unused structure members.
- Consistently use the vocable "system partition" and "boot partition" (using 
MS aka. hardware-oriented definition) according to:
  https://en.wikipedia.org/wiki/System_partition_and_boot_partition
  
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
  in few words:
  "system partition": the one that will be started by the platform firmware, 
and where the bootloader is found (only one per computer);
  "boot partition": the one where the OS of your choice resides (any number).

Modified:
    trunk/reactos/base/setup/usetup/bootsup.c
    trunk/reactos/base/setup/usetup/interface/usetup.c
    trunk/reactos/base/setup/usetup/partlist.c
    trunk/reactos/base/setup/usetup/partlist.h

Modified: trunk/reactos/base/setup/usetup/bootsup.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/bootsup.c?rev=70797&r1=70796&r2=70797&view=diff
==============================================================================
--- trunk/reactos/base/setup/usetup/bootsup.c   [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/bootsup.c   [iso-8859-1] Sun Feb 28 
15:25:22 2016
@@ -1270,9 +1270,9 @@
     }
 
     /* Copy partition table from old MBR to new */
-    RtlCopyMemory (&NewBootSector->Signature,
-                   &OrigBootSector->Signature,
-                   sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR, 
Signature) /* Length of partition table */);
+    RtlCopyMemory(&NewBootSector->Signature,
+                  &OrigBootSector->Signature,
+                  sizeof(PARTITION_SECTOR) - offsetof(PARTITION_SECTOR, 
Signature) /* Length of partition table */);
 
     /* Free the original boot sector */
     RtlFreeHeap(ProcessHeap, 0, OrigBootSector);
@@ -2262,7 +2262,7 @@
     /* FAT or FAT32 partition */
     DPRINT("System path: '%wZ'\n", SystemRootPath);
 
-    /* Copy FreeLoader to the boot partition */
+    /* Copy FreeLoader to the system partition */
     wcscpy(SrcPath, SourceRootPath->Buffer);
     wcscat(SrcPath, L"\\loader\\freeldr.sys");
     wcscpy(DstPath, SystemRootPath->Buffer);
@@ -2520,7 +2520,7 @@
     /* EXT2 partition */
     DPRINT("System path: '%wZ'\n", SystemRootPath);
 
-    /* Copy FreeLoader to the boot partition */
+    /* Copy FreeLoader to the system partition */
     wcscpy(SrcPath, SourceRootPath->Buffer);
     wcscat(SrcPath, L"\\loader\\freeldr.sys");
     wcscpy(DstPath, SystemRootPath->Buffer);

Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interface/usetup.c?rev=70797&r1=70796&r2=70797&view=diff
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c  [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c  [iso-8859-1] Sun Feb 28 
15:25:22 2016
@@ -66,15 +66,27 @@
 
 static UNICODE_STRING InstallPath;
 
-/* Path to the install directory */
+/*
+ * Path to the system partition, where the boot manager resides.
+ * On x86 PCs, this is usually the active partition.
+ * On ARC, (u)EFI, ... platforms, this is a dedicated partition.
+ *
+ * For more information, see:
+ * https://en.wikipedia.org/wiki/System_partition_and_boot_partition
+ * 
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/boot-and-system-volumes.html
+ * 
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/arc-boot-process.html
+ * 
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/efi-boot-process.html
+ * 
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-system-volume.html
+ * 
http://homepage.ntlworld.com/jonathan.deboynepollard/FGA/determining-boot-volume.html
+ */
+static UNICODE_STRING SystemRootPath;
+
+/* Path to the install directory inside the ReactOS boot partition */
 static UNICODE_STRING DestinationPath;
 static UNICODE_STRING DestinationArcPath;
 static UNICODE_STRING DestinationRootPath;
 
 static WCHAR DestinationDriveLetter;
-
-/* Path to the active partition (boot manager) */
-static UNICODE_STRING SystemRootPath;
 
 static HINF SetupInf;
 
@@ -2525,7 +2537,7 @@
  *
  * SIDEEFFECTS
  *  Sets 
PartEntry->DiskEntry->LayoutBuffer->PartitionEntry[PartEntry->PartitionIndex].PartitionType
 (via UpdatePartitionType)
- *  Calls CheckActiveBootPartition()
+ *  Calls CheckActiveSystemPartition()
  *
  * RETURNS
  *   Number of the next page.
@@ -2551,11 +2563,11 @@
         return QUIT_PAGE;
     }
 
-    /* Find or set the active partition */
-    CheckActiveBootPartition(PartitionList);
-
-    if (PartitionList->BootDisk == NULL ||
-        PartitionList->BootPartition == NULL)
+    /* Find or set the active system partition */
+    CheckActiveSystemPartition(PartitionList);
+
+    if (PartitionList->SystemDisk == NULL ||
+        PartitionList->SystemPartition == NULL)
     {
         /* FIXME: show an error dialog */
         return QUIT_PAGE;
@@ -2564,10 +2576,10 @@
     switch (PartitionList->FormatState)
     {
         case Start:
-            if (PartitionList->CurrentPartition != 
PartitionList->BootPartition)
-            {
-                PartitionList->TempDisk = PartitionList->BootDisk;
-                PartitionList->TempPartition = PartitionList->BootPartition;
+            if (PartitionList->CurrentPartition != 
PartitionList->SystemPartition)
+            {
+                PartitionList->TempDisk = PartitionList->SystemDisk;
+                PartitionList->TempPartition = PartitionList->SystemPartition;
                 PartitionList->TempPartition->NeedsCheck = TRUE;
 
                 PartitionList->FormatState = FormatSystemPartition;
@@ -3224,8 +3236,7 @@
 
     /* Create 'InstallPath' string */
     RtlFreeUnicodeString(&InstallPath);
-    RtlCreateUnicodeString(&InstallPath,
-                           InstallDir);
+    RtlCreateUnicodeString(&InstallPath, InstallDir);
 
     /* Create 'DestinationRootPath' string */
     RtlFreeUnicodeString(&DestinationRootPath);
@@ -4174,13 +4185,12 @@
     RtlFreeUnicodeString(&SystemRootPath);
     swprintf(PathBuffer,
              L"\\Device\\Harddisk%lu\\Partition%lu",
-             PartitionList->BootDisk->DiskNumber,
-             PartitionList->BootPartition->PartitionNumber);
-    RtlCreateUnicodeString(&SystemRootPath,
-                           PathBuffer);
+             PartitionList->SystemDisk->DiskNumber,
+             PartitionList->SystemPartition->PartitionNumber);
+    RtlCreateUnicodeString(&SystemRootPath, PathBuffer);
     DPRINT("SystemRootPath: %wZ\n", &SystemRootPath);
 
-    PartitionType = PartitionList->BootPartition->PartitionType;
+    PartitionType = PartitionList->SystemPartition->PartitionType;
 
     if (IsUnattendedSetup)
     {
@@ -4196,7 +4206,7 @@
 
     if (PartitionType == PARTITION_ENTRY_UNUSED)
     {
-        DPRINT("Error: active partition invalid (unused)\n");
+        DPRINT("Error: system partition invalid (unused)\n");
         InstallOnFloppy = TRUE;
     }
     else if (PartitionType == PARTITION_OS2BOOTMGR)
@@ -4207,8 +4217,8 @@
     }
     else if (PartitionType == PARTITION_EXT2)
     {
-        /* Linux ext2 partition */
-        DPRINT("Found Linux ext2 partition\n");
+        /* Linux EXT2 partition */
+        DPRINT("Found Linux EXT2 partition\n");
         InstallOnFloppy = FALSE;
     }
     else if (PartitionType == PARTITION_IFS)
@@ -4393,7 +4403,7 @@
     UCHAR PartitionType;
     NTSTATUS Status;
 
-    PartitionType = PartitionList->BootPartition->PartitionType;
+    PartitionType = PartitionList->SystemPartition->PartitionType;
 
     Status = InstallVBRToPartition(&SystemRootPath,
                                    &SourceRootPath,
@@ -4432,7 +4442,7 @@
     WCHAR SourceMbrPathBuffer[MAX_PATH];
 
     /* Step 1: Write the VBR */
-    PartitionType = PartitionList->BootPartition->PartitionType;
+    PartitionType = PartitionList->SystemPartition->PartitionType;
 
     Status = InstallVBRToPartition(&SystemRootPath,
                                    &SourceRootPath,
@@ -4447,7 +4457,7 @@
     /* Step 2: Write the MBR */
     swprintf(DestinationDevicePathBuffer,
              L"\\Device\\Harddisk%d\\Partition0",
-             PartitionList->BootDisk->DiskNumber);
+             PartitionList->SystemDisk->DiskNumber);
 
     wcscpy(SourceMbrPathBuffer, SourceRootPath.Buffer);
     wcscat(SourceMbrPathBuffer, L"\\loader\\dosmbr.bin");

Modified: trunk/reactos/base/setup/usetup/partlist.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist.c?rev=70797&r1=70796&r2=70797&view=diff
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.c  [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.c  [iso-8859-1] Sun Feb 28 
15:25:22 2016
@@ -1434,14 +1434,11 @@
     List->Line = 0;
     List->Offset = 0;
 
-    List->TopDisk = (ULONG)-1;
-    List->TopPartition = (ULONG)-1;
-
     List->CurrentDisk = NULL;
     List->CurrentPartition = NULL;
 
-    List->BootDisk = NULL;
-    List->BootPartition = NULL;
+    List->SystemDisk = NULL;
+    List->SystemPartition = NULL;
 
     List->TempDisk = NULL;
     List->TempPartition = NULL;
@@ -1495,9 +1492,6 @@
     UpdateDiskSignatures(List);
 
     AssignDriveLetters(List);
-
-    List->TopDisk = 0;
-    List->TopPartition = 0;
 
     /* Search for first usable disk and partition */
     if (IsListEmpty(&List->DiskListHead))
@@ -3130,7 +3124,7 @@
 
 
 VOID
-CheckActiveBootPartition(
+CheckActiveSystemPartition(
     PPARTLIST List)
 {
     PDISKENTRY DiskEntry;
@@ -3138,18 +3132,18 @@
     PLIST_ENTRY ListEntry;
 
     /* Check for empty disk list */
-    if (IsListEmpty (&List->DiskListHead))
-    {
-        List->BootDisk = NULL;
-        List->BootPartition = NULL;
+    if (IsListEmpty(&List->DiskListHead))
+    {
+        List->SystemDisk = NULL;
+        List->SystemPartition = NULL;
         return;
     }
 
 #if 0
-    if (List->BootDisk != NULL &&
-        List->BootPartition != NULL)
-    {
-        /* We already have an active boot partition */
+    if (List->SystemDisk != NULL &&
+        List->SystemPartition != NULL)
+    {
+        /* We already have an active system partition */
         return;
     }
 #endif
@@ -3158,18 +3152,23 @@
     DiskEntry = List->CurrentDisk;
 
     /* Check for empty partition list */
-    if (IsListEmpty (&DiskEntry->PrimaryPartListHead))
-    {
-        List->BootDisk = NULL;
-        List->BootPartition = NULL;
+    if (IsListEmpty(&DiskEntry->PrimaryPartListHead))
+    {
+        List->SystemDisk = NULL;
+        List->SystemPartition = NULL;
         return;
     }
+
+    /*
+     * Check the first partition of the disk in case it is fresh new,
+     * and if so, use it as the system partition.
+     */
 
     PartEntry = CONTAINING_RECORD(DiskEntry->PrimaryPartListHead.Flink,
                                   PARTENTRY,
                                   ListEntry);
 
-    /* Set active boot partition */
+    /* Set active system partition */
     if ((DiskEntry->NewDisk == TRUE) ||
         (PartEntry->BootIndicator == FALSE))
     {
@@ -3179,15 +3178,15 @@
         DiskEntry->Dirty = TRUE;
 
         /* FIXME: Might be incorrect if partitions were created by Linux FDISK 
*/
-        List->BootDisk = DiskEntry;
-        List->BootPartition = PartEntry;
+        List->SystemDisk = DiskEntry;
+        List->SystemPartition = PartEntry;
 
         return;
     }
 
     /* Disk is not new, scan all partitions to find a bootable one */
-    List->BootDisk = NULL;
-    List->BootPartition = NULL;
+    List->SystemDisk = NULL;
+    List->SystemPartition = NULL;
 
     ListEntry = DiskEntry->PrimaryPartListHead.Flink;
     while (ListEntry != &DiskEntry->PrimaryPartListHead)
@@ -3203,8 +3202,8 @@
                 PartEntry->BootIndicator)
             {
                 /* Yes, we found it */
-                List->BootDisk = DiskEntry;
-                List->BootPartition = PartEntry;
+                List->SystemDisk = DiskEntry;
+                List->SystemPartition = PartEntry;
 
                 DPRINT("Found bootable partition disk %d, drive letter %c\n",
                        DiskEntry->DiskNumber, PartEntry->DriveLetter);

Modified: trunk/reactos/base/setup/usetup/partlist.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/partlist.h?rev=70797&r1=70796&r2=70797&view=diff
==============================================================================
--- trunk/reactos/base/setup/usetup/partlist.h  [iso-8859-1] (original)
+++ trunk/reactos/base/setup/usetup/partlist.h  [iso-8859-1] Sun Feb 28 
15:25:22 2016
@@ -71,10 +71,10 @@
     /* Partition is partitioned disk space */
     BOOLEAN IsPartitioned;
 
-    /* Partition is new. Table does not exist on disk yet */
+    /* Partition is new, table does not exist on disk yet */
     BOOLEAN New;
 
-    /* Partition was created automatically. */
+    /* Partition was created automatically */
     BOOLEAN AutoCreate;
 
     FORMATSTATE FormatState;
@@ -149,14 +149,12 @@
     SHORT Line;
     SHORT Offset;
 
-    ULONG TopDisk;
-    ULONG TopPartition;
-
     PDISKENTRY CurrentDisk;
     PPARTENTRY CurrentPartition;
 
-    PDISKENTRY BootDisk;
-    PPARTENTRY BootPartition;
+    /* The system disk and partition where the boot manager resides */
+    PDISKENTRY SystemDisk;
+    PPARTENTRY SystemPartition;
 
     PDISKENTRY TempDisk;
     PPARTENTRY TempPartition;
@@ -259,7 +257,7 @@
     PPARTLIST List);
 
 VOID
-CheckActiveBootPartition(
+CheckActiveSystemPartition(
     PPARTLIST List);
 
 BOOLEAN


Reply via email to