Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

arcinst.h File Reference

#include <ntos.h>
#include <ntdddisk.h>
#include <arc.h>
#include <arccodes.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

Go to the source code of this file.

Classes

struct  _tagDISKGEOM
struct  _tagPARTITION
struct  _tagREGION_DATA
struct  _tagREGION_DESCRIPTOR

Defines

#define ASCI_NUL   0x00
#define ASCI_BEL   0x07
#define ASCI_BS   0x08
#define ASCI_HT   0x09
#define ASCI_LF   0x0A
#define ASCI_VT   0x0B
#define ASCI_FF   0x0C
#define ASCI_CR   0x0D
#define ASCI_CSI   0x9B
#define ASCI_ESC   0x1B
#define ASCI_SYSRQ   0x80
#define EBADSYNTAX   EMAXIMUM
#define MAX_COMPONENTS   20
#define INVALID_TOKEN_TYPE   ~0L
#define INVALID_TOKEN_VALUE   ~1L
#define AlClearScreen()   AlPrint("%c2J", ASCI_CSI)
#define AlClearLine()   AlPrint("%c2K", ASCI_CSI)
#define AlSetScreenColor(FgColor, BgColor)
#define AlSetScreenAttributes(HighIntensity, Underscored, ReverseVideo)
#define AlSetPosition(Row, Column)   AlPrint("%c%d;%dH", ASCI_CSI, Row, Column)
#define AllocateMemory(size)   AlAllocateHeap(size)
#define ReallocateMemory(block, size)   AlReallocateHeap(block,size)
#define FreeMemory(block)   AlDeallocateHeap(block)
#define OK_STATUS   ESUCCESS
#define RETURN_OUT_OF_MEMORY   return(ENOMEM)
#define LOWPART(x)   ((x).LowPart)
#define ONE_MEG   (1024*1024)
#define ENTRIES_PER_BOOTSECTOR   4
#define ASRT(x)
#define GetAllDiskRegions(disk, regions, count)   GetDiskRegions(disk,TRUE,TRUE,TRUE,TRUE,regions,count)
#define GetFreeDiskRegions(disk, regions, count)   GetDiskRegions(disk,FALSE,TRUE,TRUE,TRUE,regions,count)
#define GetUsedDiskRegions(disk, regions, count)   GetDiskRegions(disk,TRUE,FALSE,TRUE,TRUE,regions,count)
#define GetPrimaryDiskRegions(disk, regions, count)   GetDiskRegions(disk,TRUE,TRUE,TRUE,FALSE,regions,count)
#define GetLogicalDiskRegions(disk, regions, count)   GetDiskRegions(disk,TRUE,TRUE,FALSE,TRUE,regions,count)
#define GetUsedPrimaryDiskRegions(disk, regions, count)   GetDiskRegions(disk,TRUE,FALSE,TRUE,FALSE,regions,count)
#define GetUsedLogicalDiskRegions(disk, regions, count)   GetDiskRegions(disk,TRUE,FALSE,FALSE,TRUE,regions,count)
#define GetFreePrimaryDiskRegions(disk, regions, count)   GetDiskRegions(disk,FALSE,TRUE,TRUE,FALSE,regions,count)
#define GetFreeLogicalDiskRegions(disk, regions, count)   GetDiskRegions(disk,FALSE,TRUE,FALSE,TRUE,regions,count)
#define MAXIMUM_ENVIRONMENT_VALUE   256

Typedefs

typedef enum _ADAPTER_TYPES ADAPTER_TYPES
typedef enum _CONTROLLER_TYPES CONTROLLER_TYPES
typedef enum _PERIPHERAL_TYPES PERIPHERAL_TYPES
typedef enum _TOKEN_TYPES TOKEN_TYPES
typedef _tagDISKGEOM DISKGEOM
typedef _tagDISKGEOMPDISKGEOM
typedef _tagPARTITION PARTITION
typedef _tagPARTITIONPPARTITION
typedef _tagREGION_DATA REGION_DATA
typedef _tagREGION_DATAPREGION_DATA
typedef _tagREGION_DESCRIPTOR REGION_DESCRIPTOR
typedef _tagREGION_DESCRIPTORPREGION_DESCRIPTOR
typedef enum _BOOT_VARIABLES BOOT_VARIABLE

Enumerations

enum  _ADAPTER_TYPES { AdapterEisa, AdapterScsi, AdapterMulti, AdapterMaximum }
enum  _CONTROLLER_TYPES { ControllerDisk, ControllerCdrom, ControllerMaximum }
enum  _PERIPHERAL_TYPES { PeripheralRigidDisk, PeripheralFloppyDisk, PeripheralMaximum }
enum  _TOKEN_TYPES { AdaptType, ControllerType, PeripheralType }
enum  REGION_TYPE { REGION_PRIMARY, REGION_EXTENDED, REGION_LOGICAL }
enum  { SYSID_UNUSED = 0, SYSID_EXTENDED = 5, SYSID_BIGFAT = 6, SYSID_IFS = 7 }
enum  _BOOT_VARIABLES {
  LoadIdentifierVariable, SystemPartitionVariable, OsLoaderVariable, OsLoadPartitionVariable,
  OsLoadFilenameVariable, OsLoadOptionsVariable, MaximumBootVariable
}

Functions

ARC_STATUS AlGetEnvVarComponents (IN PCHAR EnvValue, OUT PCHAR **EnvVarComponents, OUT PULONG PNumComponents)
ARC_STATUS AlFreeEnvVarComponents (IN PCHAR *EnvVarComponents)
BOOLEAN AlFindNextMatchComponent (IN PCHAR EnvValue, IN PCHAR MatchValue, IN ULONG StartComponent, OUT PULONG MatchComponent OPTIONAL)
ARC_STATUS AlAddSystemPartition (IN PCHAR NewSystemPartition)
ARC_STATUS AlMemoryInitialize (ULONG StackPages, ULONG HeapPages)
PVOID AlAllocateHeap (IN ULONG Size)
PVOID AlDeallocateHeap (IN PVOID HeapAddress)
PVOID AlReallocateHeap (IN PVOID HeapAddress, IN ULONG NewSize)
BOOLEAN AlValidateHeap (IN BOOLEAN DumpHeap)
BOOLEAN AlInitializeMenuPackage (VOID)
BOOLEAN AlNewMenu (PVOID *MenuID)
VOID AlFreeMenu (PVOID MenuID)
BOOLEAN AlAddMenuItem (PVOID MenuID, PCHAR Text, ULONG AssociatedData, ULONG Attributes)
BOOLEAN AlAddMenuItems (PVOID MenuID, PCHAR Text[], ULONG ItemCount)
BOOLEAN AlDisplayMenu (PVOID MenuID, BOOLEAN PrintOnly, ULONG AssociatedDataOfDefaultChoice, ULONG *AssociatedDataOfChoice, ULONG Row, PCHAR MenuName)
ULONG AlGetMenuNumberItems (PVOID MenuID)
ULONG AlGetMenuAssociatedData (PVOID MenuID, ULONG n)
ARC_STATUS AlGetMenuSelection (IN PCHAR szTitle, IN PCHAR *rgszSelections, IN ULONG crgsz, IN ULONG crow, IN ULONG irgszDefault, OUT PULONG pirgsz, OUT PCHAR *pszSelection)
VOID AlWaitKey (PCHAR Prompt)
VOID vAlStatusMsg (IN ULONG Row, IN BOOLEAN Error, IN PCHAR FormatString, IN va_list ArgumentList)
VOID AlStatusMsg (IN ULONG TopRow, IN ULONG BottomRow, IN BOOLEAN Error, IN PCHAR FormatString,...)
VOID AlStatusMsgNoWait (IN ULONG TopRow, IN ULONG BottomRow, IN BOOLEAN Error, IN PCHAR FormatString,...)
VOID AlClearStatusArea (IN ULONG TopRow, IN ULONG BottomRow)
PCHAR AlStrDup (IN PCHAR szString)
PCHAR AlCombinePaths (IN PCHAR szPath1, IN PCHAR szPath2)
VOID AlFreeArray (IN BOOLEAN fFreeArray, IN PCHAR *rgsz, IN ULONG csz)
ARC_STATUS AlGetBase (IN PCHAR szPath, OUT PCHAR *pszBase)
PCHAR AlGetNextArcNameToken (IN PCHAR TokenString, OUT PCHAR OutputToken, OUT PULONG UnitNumber)
ULONG AlMatchArcNameToken (IN PCHAR TokenValue, IN TOKEN_TYPES TokenType)
ARC_STATUS FdiskInitialize (VOID)
VOID FdiskCleanUp (VOID)
VOID ConfigureSystemPartitions (VOID)
VOID ConfigureOSPartitions (VOID)
ULONG AlPrint (PCHAR Format,...)
BOOLEAN AlGetString (OUT PCHAR String, IN ULONG StringLength)
ULONG SIZEMB (IN LARGE_INTEGER ByteCount)
ARC_STATUS FmtIsFatPartition (IN ULONG PartitionId, IN ULONG SectorSize, OUT PBOOLEAN IsFatPartition)
ARC_STATUS FmtIsFat (IN PCHAR PartitionPath, OUT PBOOLEAN IsFatPartition)
ARC_STATUS FmtFatFormat (IN PCHAR PartitionPath, IN ULONG HiddenSectorCount)
ARC_STATUS FmtQueryFatPartitionList (OUT PCHAR **FatPartitionList, OUT PULONG ListLength)
ARC_STATUS FmtFreeFatPartitionList (IN OUT PCHAR *FatPartitionList, IN ULONG ListLength)
ARC_STATUS LowOpenDisk (IN PCHAR DevicePath, OUT PULONG DiskId)
ARC_STATUS LowCloseDisk (IN ULONG DiskId)
ARC_STATUS LowGetDriveGeometry (IN PCHAR DevicePath, OUT PULONG TotalSectorCount, OUT PULONG SectorSize, OUT PULONG SectorsPerTrack, OUT PULONG Heads)
ARC_STATUS LowGetPartitionGeometry (IN PCHAR PartitionPath, OUT PULONG TotalSectorCount, OUT PULONG SectorSize, OUT PULONG SectorsPerTrack, OUT PULONG Heads)
ARC_STATUS LowReadSectors (IN ULONG VolumeId, IN ULONG SectorSize, IN ULONG StartingSector, IN ULONG NumberOfSectors, OUT PVOID Buffer)
ARC_STATUS LowWriteSectors (IN ULONG VolumeId, IN ULONG SectorSize, IN ULONG StartingSector, IN ULONG NumberOfSectors, IN PVOID Buffer)
ARC_STATUS LowQueryPathFromComponent (IN PCONFIGURATION_COMPONENT Component, OUT PCHAR *Path)
ARC_STATUS LowQueryComponentList (IN CONFIGURATION_CLASS *ConfigClass OPTIONAL, IN CONFIGURATION_TYPE *ConfigType OPTIONAL, OUT PCONFIGURATION_COMPONENT **ComponentList, OUT PULONG ListLength)
ARC_STATUS LowQueryPathList (IN CONFIGURATION_CLASS *ConfigClass OPTIONAL, IN CONFIGURATION_TYPE *ConfigType OPTIONAL, OUT PCHAR **PathList, OUT PULONG ListLength)
ARC_STATUS LowFreePathList (IN PCHAR *PathList, IN ULONG ListLength)
ARC_STATUS LowQueryFdiskPathList (OUT PCHAR **PathList, OUT PULONG ListLength)
ARC_STATUS LowFreeFdiskPathList (IN OUT PCHAR *PathList, IN ULONG ListLength)
ARC_STATUS LowGetDiskLayout (IN PCHAR Path, OUT PDRIVE_LAYOUT_INFORMATION *DriveLayout)
ARC_STATUS LowSetDiskLayout (IN PCHAR Path, IN PDRIVE_LAYOUT_INFORMATION DriveLayout)
ULONG GetDiskCount (VOID)
PCHAR GetDiskName (ULONG Disk)
ULONG DiskSizeMB (IN ULONG Disk)
ARC_STATUS GetDiskRegions (IN ULONG Disk, IN BOOLEAN WantUsedRegions, IN BOOLEAN WantFreeRegions, IN BOOLEAN WantPrimaryRegions, IN BOOLEAN WantLogicalRegions, OUT PREGION_DESCRIPTOR *Region, OUT ULONG *RegionCount)
VOID FreeRegionArray (IN PREGION_DESCRIPTOR Region, IN ULONG RegionCount)
ARC_STATUS IsAnyCreationAllowed (IN ULONG Disk, IN BOOLEAN AllowMultiplePrimaries, OUT PBOOLEAN AnyAllowed, OUT PBOOLEAN PrimaryAllowed, OUT PBOOLEAN ExtendedAllowed, OUT PBOOLEAN LogicalAllowed)
ARC_STATUS IsCreationOfPrimaryAllowed (IN ULONG Disk, IN BOOLEAN AllowMultiplePrimaries, OUT PBOOLEAN Allowed)
ARC_STATUS IsCreationOfExtendedAllowed (IN ULONG Disk, OUT PBOOLEAN Allowed)
ARC_STATUS IsCreationOfLogicalAllowed (IN ULONG Disk, OUT PBOOLEAN Allowed)
ARC_STATUS DoesAnyPartitionExist (IN ULONG Disk, OUT PBOOLEAN AnyExists, OUT PBOOLEAN PrimaryExists, OUT PBOOLEAN ExtendedExists, OUT PBOOLEAN LogicalExists)
ARC_STATUS DoesAnyPrimaryExist (IN ULONG Disk, OUT PBOOLEAN Exists)
ARC_STATUS DoesExtendedExist (IN ULONG Disk, OUT PBOOLEAN Exists)
ARC_STATUS DoesAnyLogicalExist (IN ULONG Disk, OUT PBOOLEAN Exists)
BOOLEAN IsExtended (IN UCHAR SysID)
VOID SetPartitionActiveFlag (IN PREGION_DESCRIPTOR Region, IN UCHAR value)
ARC_STATUS CreatePartition (IN PREGION_DESCRIPTOR Region, IN ULONG CreationSizeMB, IN REGION_TYPE Type)
ARC_STATUS CreatePartitionEx (IN PREGION_DESCRIPTOR Region, IN LARGE_INTEGER MinimumSize, IN ULONG CreationSizeMB, IN REGION_TYPE Type, IN UCHAR SysId)
ARC_STATUS DeletePartition (IN PREGION_DESCRIPTOR Region)
ULONG GetHiddenSectorCount (ULONG Disk, ULONG Partition)
VOID SetSysID (IN ULONG Disk, IN ULONG Partition, IN UCHAR SysID)
VOID SetSysID2 (IN PREGION_DESCRIPTOR Region, IN UCHAR SysID)
PCHAR GetSysIDName (UCHAR SysID)
ARC_STATUS CommitPartitionChanges (IN ULONG Disk)
BOOLEAN HavePartitionsBeenChanged (IN ULONG Disk)
VOID FdMarkDiskDirty (IN ULONG Disk)
VOID FdSetPersistentData (IN PREGION_DESCRIPTOR Region, IN ULONG Data)
ULONG FdGetMinimumSizeMB (IN ULONG Disk)
ULONG FdGetMaximumSizeMB (IN PREGION_DESCRIPTOR Region, IN REGION_TYPE CreationType)
LARGE_INTEGER FdGetExactSize (IN PREGION_DESCRIPTOR Region, IN BOOLEAN ForExtended)
LARGE_INTEGER FdGetExactOffset (IN PREGION_DESCRIPTOR Region)
BOOLEAN FdCrosses1024Cylinder (IN PREGION_DESCRIPTOR Region, IN ULONG CreationSizeMB, IN REGION_TYPE RegionType)
ULONG FdGetDiskSignature (IN ULONG Disk)
VOID FdSetDiskSignature (IN ULONG Disk, IN ULONG Signature)
BOOLEAN IsDiskOffLine (IN ULONG Disk)
VOID JzDeleteVariableSegment (PCHAR VariableName, ULONG Selection)

Variables

char MSGMARGIN []
PCHAR BootString []


Define Documentation

 
#define AlClearLine  )     AlPrint("%c2K", ASCI_CSI)
 

Definition at line 302 of file arcinst.h.

Referenced by AlClearStatusArea().

 
#define AlClearScreen  )     AlPrint("%c2J", ASCI_CSI)
 

Definition at line 299 of file arcinst.h.

Referenced by main().

#define AllocateMemory size   )     AlAllocateHeap(size)
 

Definition at line 330 of file arcinst.h.

Referenced by AddRegionEntry(), AllocatePartitionStructure(), FdiskInitialize(), FmtFatFormat(), FmtIsFatPartition(), FmtQueryFatPartitionList(), FmtVerifySectors(), GetDiskRegions(), LowQueryComponentList(), LowQueryPathFromComponent(), LowQueryPathList(), WriteDriveLayout(), and ZapSector().

#define AlSetPosition Row,
Column   )     AlPrint("%c%d;%dH", ASCI_CSI, Row, Column)
 

Definition at line 321 of file arcinst.h.

Referenced by AlClearStatusArea(), CommonMenuDisplay(), main(), MarkLine(), and vAlStatusMsg().

#define AlSetScreenAttributes HighIntensity,
Underscored,
ReverseVideo   ) 
 

Value:

AlPrint("%c0m", ASCI_CSI); \ if (HighIntensity) { \ AlPrint("%c1m", ASCI_CSI); \ } \ if (Underscored) { \ AlPrint("%c4m", ASCI_CSI); \ } \ if (ReverseVideo) { \ AlPrint("%c7m", ASCI_CSI); \ }

Definition at line 309 of file arcinst.h.

Referenced by CommonMenuDisplay(), MarkLine(), and vAlStatusMsg().

#define AlSetScreenColor FgColor,
BgColor   ) 
 

Value:

AlPrint("%c3%dm", ASCI_CSI, (UCHAR)FgColor); \ AlPrint("%c4%dm", ASCI_CSI, (UCHAR)BgColor)

Definition at line 305 of file arcinst.h.

Referenced by CommonMenuDisplay(), and vAlStatusMsg().

#define ASCI_BEL   0x07
 

Definition at line 15 of file arcinst.h.

#define ASCI_BS   0x08
 

Definition at line 16 of file arcinst.h.

#define ASCI_CR   0x0D
 

Definition at line 21 of file arcinst.h.

Referenced by CommonMenuDisplay().

#define ASCI_CSI   0x9B
 

Definition at line 22 of file arcinst.h.

Referenced by CommonMenuDisplay(), and GetChar().

#define ASCI_ESC   0x1B
 

Definition at line 23 of file arcinst.h.

Referenced by AlGetString(), CommonMenuDisplay(), and Confirm().

#define ASCI_FF   0x0C
 

Definition at line 20 of file arcinst.h.

#define ASCI_HT   0x09
 

Definition at line 17 of file arcinst.h.

#define ASCI_LF   0x0A
 

Definition at line 18 of file arcinst.h.

Referenced by CommonMenuDisplay().

#define ASCI_NUL   0x00
 

Definition at line 14 of file arcinst.h.

#define ASCI_SYSRQ   0x80
 

Definition at line 24 of file arcinst.h.

#define ASCI_VT   0x0B
 

Definition at line 19 of file arcinst.h.

#define ASRT  ) 
 

Definition at line 411 of file arcinst.h.

Referenced by CommitPartitionChanges(), CreatePartitionEx(), DeletePartition(), DetermineCreateSizeAndOffset(), DoesAnyPrimaryExist(), DoesExtendedExist(), FdGetMaximumSizeMB(), FdMarkDiskDirty(), FindPartitionElement(), GetHiddenSectorCount(), HavePartitionsBeenChanged(), IsCreationOfExtendedAllowed(), IsCreationOfLogicalAllowed(), IsCreationOfPrimaryAllowed(), LowSetDiskLayout(), SetSysID(), and WriteDriveLayout().

#define EBADSYNTAX   EMAXIMUM
 

Definition at line 29 of file arcinst.h.

Referenced by AlGetBase().

#define ENTRIES_PER_BOOTSECTOR   4
 

Definition at line 346 of file arcinst.h.

Referenced by InitializeLogicalVolumeList(), InitializePrimaryPartitionList(), IsCreationOfExtendedAllowed(), IsCreationOfPrimaryAllowed(), LowSetDiskLayout(), MakeBootRec(), WriteDriveLayout(), and ZeroPartitionTable().

#define FreeMemory block   )     AlDeallocateHeap(block)
 

Definition at line 332 of file arcinst.h.

Referenced by FdiskCleanUp(), FmtFatFormat(), FmtIsFatPartition(), FmtQueryFatPartitionList(), FmtVerifySectors(), FreeLinkedPartitionList(), FreeRegionArray(), InitializePartitionLists(), LowFreePathList(), LowQueryPathList(), MergeFreePartitions(), WriteDriveLayout(), and ZapSector().

#define GetAllDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,TRUE,TRUE,TRUE,TRUE,regions,count)
 

Definition at line 596 of file arcinst.h.

#define GetFreeDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,FALSE,TRUE,TRUE,TRUE,regions,count)
 

Definition at line 599 of file arcinst.h.

Referenced by DoPartitionCreate().

#define GetFreeLogicalDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,FALSE,TRUE,FALSE,TRUE,regions,count)
 

Definition at line 620 of file arcinst.h.

Referenced by DoPartitionCreate().

#define GetFreePrimaryDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,FALSE,TRUE,TRUE,FALSE,regions,count)
 

Definition at line 617 of file arcinst.h.

#define GetLogicalDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,TRUE,TRUE,FALSE,TRUE,regions,count)
 

Definition at line 608 of file arcinst.h.

Referenced by IsCreationOfLogicalAllowed().

#define GetPrimaryDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,TRUE,TRUE,TRUE,FALSE,regions,count)
 

Definition at line 605 of file arcinst.h.

Referenced by IsCreationOfExtendedAllowed(), and IsCreationOfPrimaryAllowed().

#define GetUsedDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,TRUE,FALSE,TRUE,TRUE,regions,count)
 

Definition at line 602 of file arcinst.h.

Referenced by DoMakePartitionSystemPartition(), and DoPartitionDelete().

#define GetUsedLogicalDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,TRUE,FALSE,FALSE,TRUE,regions,count)
 

Definition at line 614 of file arcinst.h.

Referenced by DoesAnyLogicalExist().

#define GetUsedPrimaryDiskRegions disk,
regions,
count   )     GetDiskRegions(disk,TRUE,FALSE,TRUE,FALSE,regions,count)
 

Definition at line 611 of file arcinst.h.

Referenced by DoesAnyPrimaryExist(), and DoesExtendedExist().

#define INVALID_TOKEN_TYPE   ~0L
 

Definition at line 248 of file arcinst.h.

Referenced by AlMatchArcNamToken().

#define INVALID_TOKEN_VALUE   ~1L
 

Definition at line 249 of file arcinst.h.

Referenced by AlMatchArcNamToken().

#define LOWPART  )     ((x).LowPart)
 

Definition at line 337 of file arcinst.h.

Referenced by GetHiddenSectorCount(), and ZapSector().

#define MAX_COMPONENTS   20
 

Definition at line 31 of file arcinst.h.

Referenced by AlGetEnvVarComponents().

#define MAXIMUM_ENVIRONMENT_VALUE   256
 

Definition at line 827 of file arcinst.h.

Referenced by AlAddSystemPartition(), JzDeleteVariableSegment(), and NtQuerySystemEnvironmentValue().

#define OK_STATUS   ESUCCESS
 

Definition at line 334 of file arcinst.h.

Referenced by CheckIfDiskIsOffLine(), CommitPartitionChanges(), CreatePartitionEx(), DeletePartition(), DoesAnyLogicalExist(), DoesAnyPartitionExist(), DoesAnyPrimaryExist(), DoesExtendedExist(), FdiskInitialize(), GetDiskRegions(), GetGeometry(), GetRegions(), InitializeFreeSpace(), InitializeLogicalVolumeList(), InitializePartitionLists(), IsAnyCreationAllowed(), IsCreationOfExtendedAllowed(), IsCreationOfLogicalAllowed(), IsCreationOfPrimaryAllowed(), WriteDriveLayout(), and ZapSector().

#define ONE_MEG   (1024*1024)
 

Definition at line 339 of file arcinst.h.

Referenced by DetermineCreateSizeAndOffset(), and SIZEMB().

#define ReallocateMemory block,
size   )     AlReallocateHeap(block,size)
 

Definition at line 331 of file arcinst.h.

Referenced by AddRegionEntry(), and FmtVerifySectors().

#define RETURN_OUT_OF_MEMORY   return(ENOMEM)
 

Definition at line 335 of file arcinst.h.

Referenced by CreatePartitionEx(), FdiskInitialize(), GetRegions(), InitializeFreeSpace(), InitializeLogicalVolumeList(), InitializePrimaryPartitionList(), WriteDriveLayout(), and ZapSector().


Typedef Documentation

typedef enum _ADAPTER_TYPES ADAPTER_TYPES
 

typedef enum _BOOT_VARIABLES BOOT_VARIABLE
 

typedef enum _CONTROLLER_TYPES CONTROLLER_TYPES
 

typedef struct _tagDISKGEOM DISKGEOM
 

typedef struct _tagPARTITION PARTITION
 

Referenced by UdfInitializePcb().

typedef struct _tagDISKGEOM* PDISKGEOM
 

typedef enum _PERIPHERAL_TYPES PERIPHERAL_TYPES
 

typedef struct _tagPARTITION* PPARTITION
 

Referenced by FdiskInitialize(), and UdfDeletePcb().

typedef struct _tagREGION_DATA* PREGION_DATA
 

typedef struct _tagREGION_DESCRIPTOR* PREGION_DESCRIPTOR
 

Referenced by DoPartitionCreate().

typedef struct _tagREGION_DATA REGION_DATA
 

typedef struct _tagREGION_DESCRIPTOR REGION_DESCRIPTOR
 

typedef enum _TOKEN_TYPES TOKEN_TYPES
 


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
SYSID_UNUSED 
SYSID_EXTENDED 
SYSID_BIGFAT 
SYSID_IFS 

Definition at line 550 of file arcinst.h.

00550 { 00551 SYSID_UNUSED = 0, 00552 SYSID_EXTENDED = 5, 00553 SYSID_BIGFAT = 6, 00554 SYSID_IFS = 7 00555 };

enum _ADAPTER_TYPES
 

Enumeration values:
AdapterEisa 
AdapterScsi 
AdapterMulti 
AdapterMaximum 

Definition at line 211 of file arcinst.h.

00211 { 00212 AdapterEisa, 00213 AdapterScsi, 00214 AdapterMulti, 00215 AdapterMaximum 00216 } ADAPTER_TYPES;

enum _BOOT_VARIABLES
 

Enumeration values:
LoadIdentifierVariable 
SystemPartitionVariable 
OsLoaderVariable 
OsLoadPartitionVariable 
OsLoadFilenameVariable 
OsLoadOptionsVariable 
MaximumBootVariable 

Definition at line 809 of file arcinst.h.

enum _CONTROLLER_TYPES
 

Enumeration values:
ControllerDisk 
ControllerCdrom 
ControllerMaximum 

Definition at line 221 of file arcinst.h.

enum _PERIPHERAL_TYPES
 

Enumeration values:
PeripheralRigidDisk 
PeripheralFloppyDisk 
PeripheralMaximum 

Definition at line 230 of file arcinst.h.

enum _TOKEN_TYPES
 

Enumeration values:
AdaptType 
ControllerType 
PeripheralType 

Definition at line 239 of file arcinst.h.

00239 { 00240 AdaptType, 00241 ControllerType, 00242 PeripheralType 00243 } TOKEN_TYPES;

enum REGION_TYPE
 

Enumeration values:
REGION_PRIMARY 
REGION_EXTENDED 
REGION_LOGICAL 

Definition at line 545 of file arcinst.h.


Function Documentation

BOOLEAN AlAddMenuItem PVOID  MenuID,
PCHAR  Text,
ULONG  AssociatedData,
ULONG  Attributes
 

Definition at line 684 of file almisc.c.

References AlAllocateHeap(), AlReallocateHeap(), _tagMENUITEM::AssociatedData, FALSE, _tagMENUCOOKIE::ItemCount, _tagMENUCOOKIE::Items, NULL, PMENUCOOKIE, PMENUITEM, strlen(), _tagMENUITEM::Text, and TRUE.

Referenced by AlAddMenuItems(), ChooseDisk(), DoMakePartitionSystemPartition(), DoPartitionCreate(), and DoPartitionDelete().

00690 { 00691 PMENUCOOKIE Menu = MenuID; 00692 PMENUITEM p; 00693 00694 DBG_UNREFERENCED_PARAMETER(Attributes); 00695 00696 if(!Menu->ItemCount) { 00697 if((Menu->Items = AlAllocateHeap(sizeof(MENUITEM))) == NULL) { 00698 return(FALSE); 00699 } 00700 Menu->ItemCount = 1; 00701 p = Menu->Items; 00702 } else { 00703 if((p = AlReallocateHeap(Menu->Items,sizeof(MENUITEM)*(Menu->ItemCount+1))) == NULL) { 00704 return(FALSE); 00705 } 00706 Menu->Items = p; 00707 p = &Menu->Items[Menu->ItemCount++]; 00708 } 00709 00710 if((p->Text = AlAllocateHeap(strlen(Text)+1)) == NULL) { 00711 return(FALSE); 00712 } 00713 strcpy(p->Text,Text); 00714 p->AssociatedData = AssociatedData; 00715 return(TRUE); 00716 }

BOOLEAN AlAddMenuItems PVOID  MenuID,
PCHAR  Text[],
ULONG  ItemCount
 

Definition at line 720 of file almisc.c.

References AlAddMenuItem(), AlGetMenuNumberItems(), FALSE, and TRUE.

Referenced by AlGetMenuSelection(), ConfigureSystemPartitions(), and main().

00725 { 00726 ULONG base,i; 00727 00728 base = AlGetMenuNumberItems(MenuID); 00729 00730 for(i=0; i<ItemCount; i++) { 00731 if(!AlAddMenuItem(MenuID,Text[i],i+base,0)) { 00732 return(FALSE); 00733 } 00734 } 00735 return(TRUE); 00736 }

ARC_STATUS AlAddSystemPartition IN PCHAR  NewSystemPartition  ) 
 

Definition at line 424 of file almisc.c.

References ARC_STATUS, ArcGetEnvironmentVariable, ArcSetEnvironmentVariable, CHAR, E2BIG, ESUCCESS, MAXIMUM_ENVIRONMENT_VALUE, NULL, Status, and strlen().

Referenced by DoMakePartitionSystemPartition(), and DoSystemPartitionCreate().

00430 : 00431 00432 This routine adds a system partition to the SystemPartition environment 00433 variable, and updates the Osloader, OsloadPartition, OsloadFilename, 00434 and OsloadOptions variables. 00435 00436 Arguments: 00437 00438 SystemPartition - Supplies a pointer to the pathname of the system 00439 partition to add. 00440 00441 Return Value: 00442 00443 If the system partition was successfully added, ESUCCESS is returned, 00444 otherwise an error code is returned. 00445 00446 BUGBUG - This program is simplistic and doesn't attempt to make sure all 00447 the variables are consistent. It also doesn't fail gracefully. 00448 00449 --*/ 00450 00451 { 00452 ARC_STATUS Status; 00453 PCHAR SystemPartition; 00454 CHAR TempValue[MAXIMUM_ENVIRONMENT_VALUE]; 00455 //PCHAR Osloader; 00456 //PCHAR OsloadPartition; 00457 //PCHAR OsloadFilename; 00458 //PCHAR OsloadOptions; 00459 00460 // 00461 // Get the system partition environment variable. 00462 // 00463 00464 SystemPartition = ArcGetEnvironmentVariable("SystemPartition"); 00465 00466 // 00467 // If the variable doesn't exist, add it and exit. 00468 // 00469 00470 if (SystemPartition == NULL) { 00471 if(strlen(NewSystemPartition) < MAXIMUM_ENVIRONMENT_VALUE) { 00472 Status = ArcSetEnvironmentVariable("SystemPartition", 00473 NewSystemPartition); 00474 } else { 00475 Status = E2BIG; 00476 } 00477 return Status; 00478 } 00479 00480 // 00481 // If the variable exists, add the new partition to the end. 00482 // 00483 if(strlen(SystemPartition)+strlen(NewSystemPartition)+2 > MAXIMUM_ENVIRONMENT_VALUE) { 00484 return(E2BIG); 00485 } 00486 00487 strcpy(TempValue, SystemPartition); 00488 strcat(TempValue, ";"); 00489 strcat(TempValue, NewSystemPartition); 00490 Status = ArcSetEnvironmentVariable("SystemPartition", 00491 TempValue); 00492 00493 if (Status != ESUCCESS) { 00494 return Status; 00495 } 00496 00497 #if 0 00498 // 00499 // Add semicolons to the end of each of the associated variables. 00500 // If they don't exist add them. 00501 // 00502 00503 // 00504 // Get the Osloader environment variable and add a semicolon to the end. 00505 // 00506 00507 Osloader = ArcGetEnvironmentVariable("Osloader"); 00508 if (Osloader == NULL) { 00509 *TempValue = 0; 00510 } else { 00511 strcpy(TempValue, Osloader); 00512 } 00513 strcat(TempValue, ";"); 00514 Status = ArcSetEnvironmentVariable("Osloader",TempValue); 00515 00516 if (Status != ESUCCESS) { 00517 return Status; 00518 } 00519 00520 // 00521 // Get the OsloadPartition environment variable and add a semicolon to the end. 00522 // 00523 00524 OsloadPartition = ArcGetEnvironmentVariable("OsloadPartition"); 00525 if (OsloadPartition == NULL) { 00526 *TempValue = 0; 00527 } else { 00528 strcpy(TempValue, OsloadPartition); 00529 } 00530 strcat(TempValue, ";"); 00531 Status = ArcSetEnvironmentVariable("OsloadPartition",TempValue); 00532 00533 if (Status != ESUCCESS) { 00534 return Status; 00535 } 00536 00537 // 00538 // Get the OsloadFilename environment variable and add a semicolon to the end. 00539 // 00540 00541 OsloadFilename = ArcGetEnvironmentVariable("OsloadFilename"); 00542 if (OsloadFilename == NULL) { 00543 *TempValue = 0; 00544 } else { 00545 strcpy(TempValue, OsloadFilename); 00546 } 00547 strcat(TempValue, ";"); 00548 Status = ArcSetEnvironmentVariable("OsloadFilename",TempValue); 00549 00550 if (Status != ESUCCESS) { 00551 return Status; 00552 } 00553 00554 // 00555 // Get the OsloadOptions environment variable and add a semicolon to the end. 00556 // 00557 00558 OsloadOptions = ArcGetEnvironmentVariable("OsloadOptions"); 00559 if (OsloadOptions == NULL) { 00560 *TempValue = 0; 00561 } else { 00562 strcpy(TempValue, OsloadOptions); 00563 } 00564 strcat(TempValue, ";"); 00565 Status = ArcSetEnvironmentVariable("OsloadOptions",TempValue); 00566 #endif 00567 return Status; 00568 }

PVOID AlAllocateHeap IN ULONG  Size  ) 
 

Definition at line 1113 of file memory.c.

References AlRtAllocateHeap(), HeapHandle, and Size.

Referenced by AlAddMenuItem(), AlCombinePaths(), AlGetEnvVarComponents(), AlNewMenu(), AlStrDup(), LowGetDiskLayout(), and LowSetDiskLayout().

01116 { 01117 return (AlRtAllocateHeap 01118 ( 01119 HeapHandle, 01120 Size 01121 )); 01122 01123 }

VOID AlClearStatusArea IN ULONG  TopRow,
IN ULONG  BottomRow
 

Definition at line 1010 of file almisc.c.

References AlClearLine, and AlSetPosition.

Referenced by AlStatusMsg(), AlStatusMsgNoWait(), Confirm(), DoPartitionCreate(), PrintError(), PrintErrorMsg(), and PrintMsg().

01014 { 01015 ULONG i; 01016 01017 for(i=BottomRow; i>=TopRow; --i) { 01018 AlSetPosition(i,0); 01019 AlClearLine(); 01020 } 01021 }

PCHAR AlCombinePaths IN PCHAR  szPath1,
IN PCHAR  szPath2
 

Definition at line 1150 of file almisc.c.

References AlAllocateHeap(), NULL, and strlen().

01158 : 01159 01160 This routine combines to strings. It allocate a new string 01161 to hold both strings. 01162 01163 Arguments: 01164 01165 pointer to combined path. NULL if failed to allocate. 01166 01167 Return Value: 01168 01169 01170 --*/ 01171 { 01172 01173 PCHAR szT; 01174 01175 if (szT = AlAllocateHeap(strlen(szPath1) + strlen(szPath2) + 1)) { 01176 01177 strcpy(szT, szPath1); 01178 strcat(szT, szPath2); 01179 return( szT ); 01180 01181 } else { 01182 01183 return ( NULL ); 01184 01185 } 01186 01187 }

PVOID AlDeallocateHeap IN PVOID  HeapAddress  ) 
 

Definition at line 1134 of file memory.c.

References AlRtFreeHeap(), and HeapHandle.

Referenced by AlFreeArray(), AlFreeEnvVarComponents(), AlFreeMenu(), AlGetBase(), AlpFreeComponents(), LowGetDiskLayout(), and LowSetDiskLayout().

01137 { 01138 return (AlRtFreeHeap 01139 ( 01140 HeapHandle, 01141 HeapAddress 01142 )); 01143 }

BOOLEAN AlDisplayMenu PVOID  MenuID,
BOOLEAN  PrintOnly,
ULONG  AssociatedDataOfDefaultChoice,
ULONG *  AssociatedDataOfChoice,
ULONG  Row,
PCHAR  MenuName
 

Definition at line 740 of file almisc.c.

References CommonMenuDisplay(), FALSE, NULL, and PMENUCOOKIE.

Referenced by AlGetMenuSelection(), ChooseDisk(), ConfigureSystemPartitions(), DoMakePartitionSystemPartition(), DoPartitionCreate(), DoPartitionDelete(), and main().

00748 { 00749 return(CommonMenuDisplay((PMENUCOOKIE)MenuID, 00750 FALSE, 00751 NULL, 00752 ((PMENUCOOKIE)MenuID)->ItemCount, 00753 PrintOnly, 00754 AssociatedDataOfDefaultChoice, 00755 AssociatedDataOfChoice, 00756 MenuName, 00757 Row 00758 ) 00759 ); 00760 }

BOOLEAN AlFindNextMatchComponent IN PCHAR  EnvValue,
IN PCHAR  MatchValue,
IN ULONG  StartComponent,
OUT PULONG MatchComponent  OPTIONAL
 

Definition at line 361 of file almisc.c.

References AlFreeEnvVarComponents(), AlGetEnvVarComponents(), AlpMatchComponent(), ARC_STATUS, ESUCCESS, FALSE, Index, Status, and TRUE.

Referenced by IsBootSelectionPartition().

00370 : 00371 00372 This routine compares each component of EnvValue, starting with 00373 StartComponent, until a match is found or there are no more components. 00374 00375 Arguments: 00376 00377 EnvValue - Supplies a pointer to the environment variable value. 00378 00379 MatchValue - Supplies a pointer to the value to match. 00380 00381 StartComponent - Supplies the component number to start the match. 00382 00383 MatchComponent - Supplies an optional pointer to a variable to receive 00384 the number of the component that matched. 00385 00386 Return Value: 00387 00388 If a match is found, TRUE is returned, otherwise FALSE is returned. 00389 00390 --*/ 00391 00392 { 00393 ARC_STATUS Status; 00394 PCHAR *EnvVarComponents; 00395 ULONG NumComponents; 00396 ULONG Index; 00397 BOOLEAN Match; 00398 00399 00400 Status = AlGetEnvVarComponents(EnvValue, &EnvVarComponents, &NumComponents); 00401 00402 if (Status != ESUCCESS) { 00403 return FALSE; 00404 } 00405 00406 Match = FALSE; 00407 for (Index = StartComponent ; Index < NumComponents ; Index++ ) { 00408 if (AlpMatchComponent(EnvVarComponents[Index], MatchValue)) { 00409 Match = TRUE; 00410 break; 00411 } 00412 } 00413 00414 if (ARGUMENT_PRESENT(MatchComponent)) { 00415 *MatchComponent = Index; 00416 } 00417 00418 AlFreeEnvVarComponents(EnvVarComponents); 00419 return Match; 00420 }

VOID AlFreeArray IN BOOLEAN  fFreeArray,
IN PCHAR *  rgsz,
IN ULONG  csz
 

Definition at line 1190 of file almisc.c.

References AlDeallocateHeap().

01198 : 01199 01200 This routine iterates through an array of pointers to strings freeing 01201 each string and finally the array itself. 01202 01203 Arguments: 01204 01205 fFreeArray - flag wither to free the array itself. 01206 rgsz - pointer to array of strings. 01207 csz - size of array. 01208 01209 Return Value: 01210 01211 01212 --*/ 01213 01214 { 01215 01216 ULONG irgsz; 01217 01218 if (!csz) { 01219 01220 return; 01221 01222 } 01223 01224 for( irgsz = 0; irgsz < csz; irgsz++ ) { 01225 01226 if (rgsz[irgsz]) { 01227 01228 AlDeallocateHeap(rgsz[irgsz]); 01229 01230 } else { 01231 01232 break; 01233 01234 } 01235 01236 } 01237 if (fFreeArray) { 01238 AlDeallocateHeap( rgsz ); 01239 } 01240 01241 }

ARC_STATUS AlFreeEnvVarComponents IN PCHAR *  EnvVarComponents  ) 
 

Definition at line 209 of file almisc.c.

References AlDeallocateHeap(), AlpFreeComponents(), ARC_STATUS, EACCES, ESUCCESS, NULL, and Status.

Referenced by AlFindNextMatchComponent().

00214 : 00215 00216 This routine frees up all the components in the ptr array and frees 00217 up the storage for the ptr array itself too 00218 00219 Arguments: 00220 00221 EnvVarComponents: the ptr to the PCHAR * Buffer 00222 00223 Return Value: 00224 00225 ESUCCESS if freeing successful 00226 EACCES if memory ptr invalid 00227 00228 00229 00230 --*/ 00231 00232 00233 { 00234 ARC_STATUS Status; 00235 00236 // 00237 // if the pointer is NULL just return success 00238 // 00239 if (EnvVarComponents == NULL) { 00240 return (ESUCCESS); 00241 } 00242 00243 // 00244 // free all the components first, if error in freeing return 00245 // 00246 Status = AlpFreeComponents(EnvVarComponents); 00247 if (Status != ESUCCESS) { 00248 return Status; 00249 } 00250 00251 // 00252 // free the component holder too 00253 // 00254 if( AlDeallocateHeap(EnvVarComponents) != NULL) { 00255 return (EACCES); 00256 } 00257 else { 00258 return (ESUCCESS); 00259 } 00260 00261 }

VOID AlFreeMenu PVOID  MenuID  ) 
 

Definition at line 664 of file almisc.c.

References AlDeallocateHeap(), _tagMENUCOOKIE::ItemCount, _tagMENUCOOKIE::Items, NULL, PMENUCOOKIE, and _tagMENUITEM::Text.

Referenced by AlGetMenuSelection(), ConfigureSystemPartitions(), DoMakePartitionSystemPartition(), DoPartitionCreate(), and DoPartitionDelete().

00667 { 00668 PMENUCOOKIE p = MenuID; 00669 ULONG i; 00670 00671 for(i=0; i<p->ItemCount; i++) { 00672 if(p->Items[i].Text != NULL) { 00673 AlDeallocateHeap(p->Items[i].Text); 00674 } 00675 } 00676 if(p->Items) { 00677 AlDeallocateHeap(p->Items); 00678 } 00679 AlDeallocateHeap(p); 00680 }

ARC_STATUS AlGetBase IN PCHAR  szPath,
OUT PCHAR *  pszBase
 

Definition at line 1244 of file almisc.c.

References AlDeallocateHeap(), AlStrDup(), EBADSYNTAX, ENOMEM, ESUCCESS, and NULL.

01251 : 01252 01253 01254 This routine strips the filename off a path. 01255 01256 Arguments: 01257 01258 szPath - path to strip. 01259 01260 Return Value: 01261 01262 pszBaseh - pointer to buffer holding new base. (this is a copy) 01263 01264 --*/ 01265 01266 { 01267 01268 PCHAR szPathT; 01269 01270 // 01271 // Make local copy of szArcInstPath so we can alter it 01272 // 01273 *pszBase = AlStrDup(szPath); 01274 if ( *pszBase == NULL ) { 01275 01276 return( ENOMEM ); 01277 } 01278 01279 // 01280 // The start of the path part should be either a \ or a ) where 01281 // ) is the end of the arc name 01282 // 01283 if ((szPathT = strrchr(*pszBase,'\\')) == 0) { 01284 if ((szPathT = strrchr(*pszBase, ')')) == 0) { 01285 01286 AlDeallocateHeap(*pszBase); 01287 return( EBADSYNTAX ); 01288 } 01289 } 01290 01291 01292 // 01293 // Cut filename out 01294 // 01295 // szPath points to either ')' or '\' so need to move over that 01296 // onto actual name 01297 // 01298 *(szPathT + 1) = 0; 01299 return( ESUCCESS ); 01300 01301 01302 }

ARC_STATUS AlGetEnvVarComponents IN PCHAR  EnvValue,
OUT PCHAR **  EnvVarComponents,
OUT PULONG  PNumComponents
 

Definition at line 26 of file almisc.c.

References AlAllocateHeap(), AlpFreeComponents(), EACCES, ENOMEM, ESUCCESS, MAX_COMPONENTS, and NULL.

Referenced by AlFindNextMatchComponent().

00034 : 00035 00036 This routine takes an environment variable string and turns it into 00037 the constituent value strings: 00038 00039 Example EnvValue = "Value1;Value2;Value3" is turned into: 00040 00041 "Value1", "Value2", "Value3" 00042 00043 The following are valid value strings: 00044 00045 1. " " :one null value is found 00046 2. ";;;; " :five null values are found 00047 3. " ;Value1 ; Value2;Value3;;;;;;; ;" :12 value strings are found, 00048 :9 of which are null 00049 00050 If an invalid component (contains embedded white space) is found in the 00051 string then this routine attempts to resynch to the next value, no error 00052 is returned, and a the first part of the invalid value is returned for the 00053 bad component. 00054 00055 1. " Value1;Bad Value2; Value3" : 2 value strings are found 00056 00057 The value strings returned suppress all whitespace before and after the 00058 value. 00059 00060 00061 Arguments: 00062 00063 EnvValue: ptr to zero terminated environment value string 00064 00065 EnvVarComponents: ptr to a PCHAR * variable to receive the buffer of 00066 ptrs to the constituent value strings. 00067 00068 PNumComponents: ptr to a ULONG to receive the number of value strings found 00069 00070 Return Value: 00071 00072 The function returns the following error codes: 00073 EACCES if EnvValue is NULL 00074 ENOMEM if the memory allocation fails 00075 00076 00077 The function returns the following success codes: 00078 ESUCCESS. 00079 00080 When the function returns ESUCCESS: 00081 - *PNumComponent field gets the number of value strings found 00082 - if the number is non zero the *EnvVarComponents field gets the 00083 ptr to the buffer containing ptrs to value strings 00084 00085 --*/ 00086 00087 00088 { 00089 PCHAR pchStart, pchEnd, pchNext; 00090 PCHAR pchComponents[MAX_COMPONENTS + 1]; 00091 ULONG NumComponents, i; 00092 PCHAR pch; 00093 ULONG size; 00094 00095 // 00096 // Validate the EnvValue 00097 // 00098 if (EnvValue == NULL) { 00099 return (EACCES); 00100 } 00101 00102 // 00103 // Initialise the ptr array with nulls 00104 // 00105 for (i = 0; i < (MAX_COMPONENTS+1); i++) { 00106 pchComponents[i] = NULL; 00107 } 00108 00109 // 00110 // Initialise ptrs to search components 00111 // 00112 pchStart = EnvValue; 00113 NumComponents = 0; 00114 00115 00116 // 00117 // search till either pchStart reaches the end or till max components 00118 // is reached, the below has been programmed from a dfsa. 00119 // 00120 while (*pchStart && NumComponents < MAX_COMPONENTS) { 00121 00122 // 00123 // STATE 1: find the beginning of next variable value 00124 // 00125 while (*pchStart!=0 && isspace(*pchStart)) { 00126 pchStart++; 00127 } 00128 00129 00130 if (*pchStart == 0) { 00131 break; 00132 } 00133 00134 // 00135 // STATE 2: In the midst of a value 00136 // 00137 pchEnd = pchStart; 00138 while (*pchEnd!=0 && !isspace(*pchEnd) && *pchEnd!=';') { 00139 pchEnd++; 00140 } 00141 00142 // 00143 // STATE 3: spit out the value found 00144 // 00145 00146 size = pchEnd - pchStart; 00147 if ((pch = AlAllocateHeap(size+1)) == NULL) { 00148 AlpFreeComponents(pchComponents); 00149 return (ENOMEM); 00150 } 00151 strncpy (pch, pchStart, size); 00152 pch[size]=0; 00153 pchComponents[NumComponents++]=pch; 00154 00155 // 00156 // STATE 4: variable value end has been reached, find the beginning 00157 // of the next value 00158 // 00159 if ((pchNext = strchr(pchEnd, ';')) == NULL) { 00160 break; // out of the big while loop because we are done 00161 } 00162 00163 // 00164 // Advance beyond the semicolon. 00165 // 00166 00167 pchNext++; 00168 00169 // 00170 // reinitialise to begin STATE 1 00171 // 00172 pchStart = pchNext; 00173 00174 } // end while. 00175 00176 // 00177 // Get memory to hold an environment pointer and return that 00178 // 00179 00180 if ( NumComponents!=0 ) { 00181 PCHAR *pch; 00182 00183 if ((pch = (PCHAR *)AlAllocateHeap((NumComponents+1)*sizeof(PCHAR))) == NULL) { 00184 AlpFreeComponents(pchComponents); 00185 return (ENOMEM); 00186 } 00187 00188 // 00189 // the last one is NULL because we initialised the array with NULLs 00190 // 00191 00192 for ( i = 0; i <= NumComponents; i++) { 00193 pch[i] = pchComponents[i]; 00194 } 00195 00196 00197 *EnvVarComponents = pch; 00198 } 00199 00200 // 00201 // Update the number of elements field and return success 00202 // 00203 *PNumComponents = NumComponents; 00204 return (ESUCCESS); 00205 }

ULONG AlGetMenuAssociatedData PVOID  MenuID,
ULONG  n
 

Definition at line 638 of file almisc.c.

References n, and PMENUCOOKIE.

00642 { 00643 return(((PMENUCOOKIE)MenuID)->Items[n].AssociatedData); 00644 }

ULONG AlGetMenuNumberItems PVOID  MenuID  ) 
 

Definition at line 629 of file almisc.c.

References PMENUCOOKIE.

Referenced by AlAddMenuItems().

00632 { 00633 return(((PMENUCOOKIE)MenuID)->ItemCount); 00634 }

ARC_STATUS AlGetMenuSelection IN PCHAR  szTitle,
IN PCHAR *  rgszSelections,
IN ULONG  crgsz,
IN ULONG  crow,
IN ULONG  irgszDefault,
OUT PULONG  pirgsz,
OUT PCHAR *  pszSelection
 

Definition at line 1025 of file almisc.c.

References AlAddMenuItems(), AlDisplayMenu(), AlFreeMenu(), AlNewMenu(), ENOMEM, ESUCCESS, FALSE, NULL, and szTitle.

01037 : 01038 01039 This routine takes an array of strings, turns them into a menu 01040 and gets a selection. If ESC hit then ESUCCESS is returned with 01041 the *pszSelection NULL. 01042 01043 crgsz is assume to be 1 or greater. 01044 01045 01046 Arguments: 01047 01048 szTitle - Pointer to menu title to pass to AlDisplayMenu 01049 prgszSelection - pointer to an array of strings for menu 01050 crgsz - count of strings 01051 irgszDefault - index in rgszSelection to use as default selection 01052 01053 Return Value: 01054 01055 irgsz - index to selection 01056 pszSelection - pointer int rgszSelection for selection. Note that 01057 this is not a dup and should not be freed seperately 01058 then rgszSelections. 01059 01060 Note: if ARC_STATUS == ESUCCESS and pszSelection == NULL then the 01061 menu was successfully displayed but the user hit ESC to select 01062 nothing from the menu. 01063 01064 --*/ 01065 01066 01067 { 01068 01069 PVOID hdMenuId; 01070 01071 *pszSelection = NULL; 01072 if (!AlNewMenu(&hdMenuId)) { 01073 01074 return( ENOMEM ); 01075 01076 } 01077 01078 // 01079 // BUGBUG for now 1 selection will also build a menu, in the 01080 // future once this is working we should just return that selection 01081 // 01082 01083 if (!AlAddMenuItems(hdMenuId, rgszSelections, crgsz)) { 01084 01085 AlFreeMenu(hdMenuId); 01086 return( ENOMEM ); 01087 01088 } 01089 01090 if (!AlDisplayMenu(hdMenuId, 01091 FALSE, 01092 irgszDefault, 01093 pirgsz, 01094 crow, 01095 szTitle)) { 01096 01097 // 01098 // User did not pick a system partition. return NULL 01099 // can caller should abort 01100 // 01101 AlFreeMenu(hdMenuId); 01102 return( ESUCCESS ); 01103 01104 } 01105 01106 AlFreeMenu(hdMenuId); 01107 *pszSelection = rgszSelections[*pirgsz]; 01108 return( ESUCCESS ); 01109 01110 }

PCHAR AlGetNextArcNameToken IN PCHAR  TokenString,
OUT PCHAR  OutputToken,
OUT PULONG  UnitNumber
 

BOOLEAN AlGetString OUT PCHAR  String,
IN ULONG  StringLength
 

Definition at line 1508 of file almisc.c.

References ARC_CONSOLE_INPUT, ARC_CONSOLE_OUTPUT, ArcRead, ArcWrite, ASCI_ESC, Buffer, c, CHAR, Count, ESUCCESS, FALSE, String, StringLength(), and TRUE.

Referenced by AlWaitKey(), CommonMenuDisplay(), and DoPartitionCreate().

01515 : 01516 01517 This routine reads a string from standardin until a 01518 carriage return or escape is found or StringLength is reached. 01519 01520 Arguments: 01521 01522 String - Supplies a pointer to where the string will be stored. 01523 01524 StringLength - Supplies the Max Length to read. 01525 01526 Return Value: 01527 01528 FALSE if user pressed esc, TRUE otherwise. 01529 01530 --*/ 01531 01532 { 01533 CHAR c; 01534 ULONG Count; 01535 PCHAR Buffer; 01536 01537 Buffer = String; 01538 while (ArcRead(ARC_CONSOLE_INPUT,&c,1,&Count)==ESUCCESS) { 01539 if(c == ASCI_ESC) { 01540 return(FALSE); 01541 } 01542 if ((c=='\r') || (c=='\n') || ((ULONG)(Buffer-String) == StringLength)) { 01543 *Buffer='\0'; 01544 ArcWrite(ARC_CONSOLE_OUTPUT,"\r\n",2,&Count); 01545 return(TRUE); 01546 } 01547 // 01548 // Check for backspace; 01549 // 01550 if (c=='\b') { 01551 if (((ULONG)Buffer > (ULONG)String)) { 01552 Buffer--; 01553 ArcWrite(ARC_CONSOLE_OUTPUT,"\b \b",3,&Count); 01554 } 01555 } else { 01556 // 01557 // If it's a printable char store it and display it. 01558 // 01559 if (isprint(c)) { 01560 *Buffer++ = c; 01561 ArcWrite(ARC_CONSOLE_OUTPUT,&c,1,&Count); 01562 } 01563 } 01564 } 01565 } }

BOOLEAN AlInitializeMenuPackage VOID   ) 
 

Definition at line 620 of file almisc.c.

References TRUE.

Referenced by main().

00623 { 00624 return(TRUE); 00625 }

ULONG AlMatchArcNameToken IN PCHAR  TokenValue,
IN TOKEN_TYPES  TokenType
 

ARC_STATUS AlMemoryInitialize ULONG  StackPages,
ULONG  HeapPages
 

Definition at line 991 of file memory.c.

References AlHeapFree, AlHeapLimit, AlRtCreateHeap(), ArcGetMemoryDescriptor, _MEMORY_DESCRIPTOR::BasePage, ENOMEM, ESUCCESS, HEAP_ZERO_EXTRA_MEMORY, HeapHandle, KSEG0_BASE, MemoryFree, MemoryLoadedProgram, _MEMORY_DESCRIPTOR::MemoryType, NULL, PAGE_SHIFT, _MEMORY_DESCRIPTOR::PageCount, and PMEMORY_DESCRIPTOR.

Referenced by main().

00998 : 00999 01000 This routine allocates stack space for the OS loader, initializes 01001 heap storage, and initializes the memory allocation list. 01002 01003 Arguments: 01004 01005 None. 01006 01007 Return Value: 01008 01009 ESUCCESS is returned if the initialization is successful. Otherwise, 01010 ENOMEM is returned. 01011 01012 --*/ 01013 01014 { 01015 01016 PMEMORY_DESCRIPTOR FreeDescriptor; 01017 PMEMORY_DESCRIPTOR ProgramDescriptor; 01018 01019 // 01020 // Find the memory descriptor that describes the allocation for the OS 01021 // loader itself. 01022 // 01023 01024 ProgramDescriptor = NULL; 01025 while ((ProgramDescriptor = ArcGetMemoryDescriptor(ProgramDescriptor)) != NULL) { 01026 if (ProgramDescriptor->MemoryType == MemoryLoadedProgram) { 01027 break; 01028 } 01029 } 01030 01031 // 01032 // If a loaded program memory descriptor was found, then it must be 01033 // for the OS loader since that is the only program that can be loaded. 01034 // If a loaded program memory descriptor was not found, then firmware 01035 // is not functioning properly and an unsuccessful status is returned. 01036 // 01037 01038 if (ProgramDescriptor == NULL) { 01039 return ENOMEM; 01040 } 01041 01042 // 01043 // Find the free memory descriptor that is just below the loaded 01044 // program in memory. There should be several megabytes of free 01045 // memory just preceeding the OS loader. 01046 // 01047 01048 FreeDescriptor = NULL; 01049 while ((FreeDescriptor = ArcGetMemoryDescriptor(FreeDescriptor)) != NULL) { 01050 if ((FreeDescriptor->MemoryType == MemoryFree) && 01051 (FreeDescriptor->PageCount >= (StackPages+HeapPages))) { 01052 break; 01053 } 01054 } 01055 01056 // 01057 // If a free memory descriptor was not found that describes the free 01058 // memory just below the OS loader, then firmware is not functioning 01059 // properly and an unsuccessful status is returned. 01060 // 01061 01062 if (FreeDescriptor == NULL) { 01063 return ENOMEM; 01064 } 01065 01066 // 01067 // Check to determine if enough free memory is available for the OS 01068 // loader stack and the heap area. If enough memory is not available, 01069 // then return an unsuccessful status. 01070 // 01071 01072 if (FreeDescriptor->PageCount < (StackPages + HeapPages)) { 01073 return ENOMEM; 01074 } 01075 01076 // 01077 // Compute the address of the loader heap, initialize the heap 01078 // allocation variables, and zero the heap memory. 01079 // 01080 01081 AlHeapFree = KSEG0_BASE | ((ProgramDescriptor->BasePage - 01082 (StackPages + HeapPages)) << PAGE_SHIFT); 01083 01084 AlHeapLimit = AlHeapFree + (HeapPages << PAGE_SHIFT); 01085 01086 memset((PVOID)AlHeapFree, 0,HeapPages << PAGE_SHIFT); 01087 01088 01089 // 01090 // Changed to new heap allocater 01091 // 01092 01093 if ((HeapHandle = AlRtCreateHeap 01094 ( 01095 HEAP_ZERO_EXTRA_MEMORY, 01096 (PVOID)AlHeapFree, 01097 HeapPages << PAGE_SHIFT 01098 )) 01099 == NULL) 01100 return ENOMEM; 01101 else 01102 return ESUCCESS; 01103 01104 }

BOOLEAN AlNewMenu PVOID *  MenuID  ) 
 

Definition at line 647 of file almisc.c.

References AlAllocateHeap(), FALSE, _tagMENUCOOKIE::ItemCount, _tagMENUCOOKIE::Items, NULL, PMENUCOOKIE, and TRUE.

Referenced by AlGetMenuSelection(), ChooseDisk(), ConfigureSystemPartitions(), DoMakePartitionSystemPartition(), DoPartitionCreate(), DoPartitionDelete(), and main().

00650 { 00651 PMENUCOOKIE p; 00652 00653 if(!(p = AlAllocateHeap(sizeof(MENUCOOKIE)))) { 00654 return(FALSE); 00655 } 00656 p->ItemCount = 0; 00657 p->Items = NULL; 00658 *MenuID = p; 00659 return(TRUE); 00660 }

ULONG AlPrint PCHAR  Format,
  ...
 

Definition at line 1483 of file almisc.c.

References ARC_CONSOLE_OUTPUT, ArcWrite, Buffer, and Count.

Referenced by AlRtAllocateHeap(), AlRtFreeHeap(), AlRtReAllocateHeap(), AlWaitKey(), CommonMenuDisplay(), Confirm(), DoPartitionCreate(), FdiskInitialize(), FmtVerifySectors(), main(), MarkLine(), and vAlStatusMsg().

01488 { 01489 01490 va_list arglist; 01491 UCHAR Buffer[256]; 01492 ULONG Count; 01493 ULONG Length; 01494 01495 // 01496 // Format the output into a buffer and then print it. 01497 // 01498 01499 va_start(arglist, Format); 01500 Length = vsprintf(Buffer, Format, arglist); 01501 ArcWrite( ARC_CONSOLE_OUTPUT, Buffer, Length, &Count); 01502 va_end(arglist); 01503 return 0; 01504 }

PVOID AlReallocateHeap IN PVOID  HeapAddress,
IN ULONG  NewSize
 

Definition at line 1153 of file memory.c.

References AlRtReAllocateHeap(), and HeapHandle.

Referenced by AlAddMenuItem(), and LowGetDiskLayout().

01157 { 01158 return (AlRtReAllocateHeap 01159 ( 01160 HeapHandle, 01161 HeapAddress, 01162 NewSize 01163 )); 01164 }

VOID AlStatusMsg IN ULONG  TopRow,
IN ULONG  BottomRow,
IN BOOLEAN  Error,
IN PCHAR  FormatString,
  ...
 

Definition at line 974 of file almisc.c.

References AlClearStatusArea(), AlWaitKey(), Error, NULL, and vAlStatusMsg().

00981 { 00982 va_list ArgList; 00983 00984 va_start(ArgList,FormatString); 00985 vAlStatusMsg(TopRow,Error,FormatString,ArgList); 00986 00987 AlWaitKey(NULL); 00988 AlClearStatusArea(TopRow,BottomRow); 00989 }

VOID AlStatusMsgNoWait IN ULONG  TopRow,
IN ULONG  BottomRow,
IN BOOLEAN  Error,
IN PCHAR  FormatString,
  ...
 

Definition at line 993 of file almisc.c.

References AlClearStatusArea(), Error, and vAlStatusMsg().

Referenced by DoSystemPartitionCreate().

01000 { 01001 va_list ArgList; 01002 01003 AlClearStatusArea(TopRow,BottomRow); 01004 va_start(ArgList,FormatString); 01005 vAlStatusMsg(TopRow,Error,FormatString,ArgList); 01006 }

PCHAR AlStrDup IN PCHAR  szString  ) 
 

Definition at line 1113 of file almisc.c.

References AlAllocateHeap(), NULL, and strlen().

Referenced by AlGetBase().

01120 : 01121 01122 This routine makes a copy of the passed in string. I do not use 01123 the CRT strdup since it uses malloc. 01124 01125 Arguments: 01126 01127 szString - pointer of string to dup. 01128 01129 Return Value: 01130 01131 pointer to dup'd string. NULL if could not allocate 01132 01133 --*/ 01134 { 01135 01136 PCHAR szT; 01137 01138 if (szT = AlAllocateHeap(strlen(szString) + 1)) { 01139 01140 strcpy(szT, szString); 01141 return(szT); 01142 01143 } 01144 return( NULL ); 01145 01146 }

BOOLEAN AlValidateHeap IN BOOLEAN  DumpHeap  ) 
 

Definition at line 1174 of file memory.c.

References AlRtValidateHeap(), and HeapHandle.

01177 { 01178 return (AlRtValidateHeap 01179 ( 01180 HeapHandle, 01181 DumpHeap 01182 )); 01183 }

VOID AlWaitKey PCHAR  Prompt  ) 
 

Definition at line 934 of file almisc.c.

References AlGetString(), AlPrint(), and MSGMARGIN.

Referenced by AlStatusMsg(), PrintError(), PrintErrorMsg(), and PrintMsg().

00937 { 00938 char buff[1]; 00939 00940 AlPrint(MSGMARGIN); 00941 AlPrint(Prompt ? Prompt : "Press any key to continue..."); 00942 AlGetString(buff,0); 00943 }

ARC_STATUS CommitPartitionChanges IN ULONG  Disk  ) 
 

Definition at line 3063 of file fdengine.c.

References ARC_STATUS, ASRT, ChangesMade, FALSE, HavePartitionsBeenChanged(), LogicalVolumes, _tagPARTITION::Next, OffLine, OK_STATUS, _tagPARTITION::OriginalPartitionNumber, _tagPARTITION::PartitionNumber, PrimaryPartitions, _tagPARTITION::Update, and WriteDriveLayout().

Referenced by DoPartitionCreate(), and DoPartitionDelete().

03069 : 03070 03071 This routine is the entry point for updating the on-disk partition 03072 structures of a disk. The disk is only written to if the partition 03073 structure has been changed by adding or deleting partitions. 03074 03075 Arguments: 03076 03077 Disk - index of disk whose on-disk partition structure is to be updated. 03078 03079 Return Value: 03080 03081 OK_STATUS or error code. 03082 03083 --*/ 03084 03085 { 03086 PPARTITION p; 03087 ARC_STATUS status; 03088 03089 ASRT(!OffLine[Disk]); 03090 03091 if(!HavePartitionsBeenChanged(Disk)) { 03092 return(OK_STATUS); 03093 } 03094 03095 if((status = WriteDriveLayout(Disk)) != OK_STATUS) { 03096 return(status); 03097 } 03098 03099 // BUGBUG for ARC and NT MIPS, update NVRAM vars so partitions are right. 03100 // Do that here, before partition numbers are reassigned. 03101 03102 p = PrimaryPartitions[Disk]; 03103 while(p) { 03104 p->Update = FALSE; 03105 p->OriginalPartitionNumber = p->PartitionNumber; 03106 p = p->Next; 03107 } 03108 p = LogicalVolumes[Disk]; 03109 while(p) { 03110 p->Update = FALSE; 03111 p->OriginalPartitionNumber = p->PartitionNumber; 03112 p = p->Next; 03113 } 03114 03115 ChangesMade[Disk] = FALSE; 03116 return(OK_STATUS); 03117 }

VOID ConfigureOSPartitions VOID   ) 
 

VOID ConfigureSystemPartitions VOID   ) 
 

Definition at line 681 of file partit.c.

References AlAddMenuItems(), AlDisplayMenu(), AlFreeMenu(), AlNewMenu(), DoMakePartitionSystemPartition(), DoPartitionDelete(), DoSystemPartitionCreate(), FALSE, GetDiskCount(), MENU_ROW, MsgNoMem, SysPartMenu, SYSPARTMENU_ADD, SYSPARTMENU_CREATE, SYSPARTMENU_DELETE, and SYSPARTMENU_EXIT.

Referenced by main().

00684 { 00685 ULONG Choice=0,DiskCount=GetDiskCount(); 00686 PVOID MenuID; 00687 00688 if (!AlNewMenu(&MenuID)) { 00689 MsgNoMem(); 00690 return; 00691 } 00692 00693 if (!AlAddMenuItems(MenuID,SysPartMenu,sizeof(SysPartMenu)/sizeof(PCHAR))) { 00694 MsgNoMem(); 00695 AlFreeMenu(MenuID); 00696 return; 00697 } 00698 00699 while(1) { 00700 00701 if ((!AlDisplayMenu(MenuID,FALSE,Choice,&Choice,MENU_ROW,"Configure System Partitions")) 00702 || (Choice == SYSPARTMENU_EXIT)) 00703 { 00704 break; 00705 } 00706 00707 switch(Choice) { 00708 00709 case SYSPARTMENU_CREATE: 00710 // create system partition. 00711 DoSystemPartitionCreate(); 00712 break; 00713 00714 case SYSPARTMENU_DELETE: 00715 // delete partition 00716 DoPartitionDelete(); 00717 break; 00718 00719 case SYSPARTMENU_ADD: 00720 // make existing into a system partition 00721 DoMakePartitionSystemPartition(); 00722 break; 00723 } 00724 } 00725 00726 AlFreeMenu(MenuID); 00727 }

ARC_STATUS CreatePartition IN PREGION_DESCRIPTOR  Region,
IN ULONG  CreationSizeMB,
IN REGION_TYPE  Type
 

Definition at line 698 of file fdengine.c.

References CreatePartitionEx(), REGION_EXTENDED, SYSID_BIGFAT, and SYSID_EXTENDED.

Referenced by DoPartitionCreate().

00703 { 00704 LARGE_INTEGER LargeZero; 00705 00706 LargeZero.QuadPart = 0; 00707 return(CreatePartitionEx(Region, 00708 LargeZero, 00709 CreationSizeMB, 00710 Type, 00711 (UCHAR)((Type == REGION_EXTENDED) ? SYSID_EXTENDED 00712 : SYSID_BIGFAT 00713 ) 00714 ) 00715 ); 00716 }

ARC_STATUS CreatePartitionEx IN PREGION_DESCRIPTOR  Region,
IN LARGE_INTEGER  MinimumSize,
IN ULONG  CreationSizeMB,
IN REGION_TYPE  Type,
IN UCHAR  SysId
 

Definition at line 549 of file fdengine.c.

References AddPartitionToLinkedList(), AllocatePartitionStructure(), ASRT, ChangesMade, DetermineCreateSizeAndOffset(), _tagPARTITION::Disk, FALSE, _tagPARTITION::Length, LogicalVolumes, MergeFreePartitions(), NULL, _tagPARTITION::Offset, OK_STATUS, _tagREGION_DATA::Partition, PrimaryPartitions, _tagPARTITION::Recognized, REGION_EXTENDED, REGION_LOGICAL, RenumberPartitions(), RETURN_OUT_OF_MEMORY, _tagPARTITION::SysID, SYSID_UNUSED, TRUE, and _tagPARTITION::Update.

Referenced by CreatePartition().

00559 : 00560 00561 This routine creates a partition from a free region on the disk. The 00562 partition is always created at the beginning of the free space, and any 00563 left over space at the end is kept on the free space list. 00564 00565 Arguments: 00566 00567 Region - a region descriptor returned by GetDiskRegions(). Must 00568 be an unused region. 00569 00570 CreationSizeMB - size of partition to create, in MB. 00571 00572 Type - REGION_PRIMARY, REGION_EXTENDED, or REGION_LOGICAL, for 00573 creating a primary partition, extended pasrtition, or 00574 logical volume, respectively. 00575 00576 SysId - system ID byte to be assigned to the partition 00577 00578 Return Value: 00579 00580 OK_STATUS or error code. 00581 00582 --*/ 00583 00584 { 00585 PPARTITION p1,p2,p3; 00586 PREGION_DATA CreateData = Region->Reserved; 00587 LARGE_INTEGER CreationStart,CreationSize,LeftOver; 00588 PPARTITION *PartitionList; 00589 00590 ASRT(Region->SysID == SYSID_UNUSED); 00591 00592 DetermineCreateSizeAndOffset( Region, 00593 MinimumSize, 00594 CreationSizeMB, 00595 Type, 00596 &CreationStart, 00597 &CreationSize 00598 ); 00599 00600 // 00601 // now we've got the start and size of the partition to be created. 00602 // If there's left-over at the beginning of the free space (after 00603 // alignment), make a new PARTITION structure. 00604 00605 p1 = NULL; 00606 LeftOver.QuadPart = (CreationStart.QuadPart - CreateData->Partition->Offset.QuadPart); 00607 00608 if(LeftOver.QuadPart > 0) { 00609 00610 p1 = AllocatePartitionStructure(Region->Disk, 00611 CreateData->Partition->Offset, 00612 LeftOver, 00613 SYSID_UNUSED, 00614 FALSE, 00615 FALSE, 00616 FALSE 00617 ); 00618 if(p1 == NULL) { 00619 RETURN_OUT_OF_MEMORY; 00620 } 00621 } 00622 00623 // make a new partition structure for space being left free as 00624 // a result of this creation. 00625 00626 p2 = NULL; 00627 LeftOver.QuadPart = (CreateData->Partition->Offset.QuadPart + CreateData->Partition->Length.QuadPart) - 00628 (CreationStart.QuadPart + CreationSize.QuadPart); 00629 00630 if(LeftOver.QuadPart != 0) { 00631 00632 LARGE_INTEGER TmpResult; 00633 00634 TmpResult.QuadPart = CreationStart.QuadPart + CreationSize.QuadPart; 00635 p2 = AllocatePartitionStructure(Region->Disk, 00636 TmpResult, 00637 LeftOver, 00638 SYSID_UNUSED, 00639 FALSE, 00640 FALSE, 00641 FALSE 00642 ); 00643 if(p2 == NULL) { 00644 RETURN_OUT_OF_MEMORY; 00645 } 00646 } 00647 00648 // adjust the free partition's fields. 00649 00650 CreateData->Partition->Offset = CreationStart; 00651 CreateData->Partition->Length = CreationSize; 00652 CreateData->Partition->SysID = SysId; 00653 CreateData->Partition->Update = TRUE; 00654 CreateData->Partition->Recognized = TRUE; 00655 00656 // if we just created an extended partition, show the whole thing 00657 // as one free logical region. 00658 00659 if(Type == REGION_EXTENDED) { 00660 00661 ASRT(LogicalVolumes[Region->Disk] == NULL); 00662 00663 p3 = AllocatePartitionStructure(Region->Disk, 00664 CreationStart, 00665 CreationSize, 00666 SYSID_UNUSED, 00667 FALSE, 00668 FALSE, 00669 FALSE 00670 ); 00671 if(p3 == NULL) { 00672 RETURN_OUT_OF_MEMORY; 00673 } 00674 AddPartitionToLinkedList(&LogicalVolumes[Region->Disk],p3); 00675 } 00676 00677 PartitionList = (Type == REGION_LOGICAL) 00678 ? &LogicalVolumes[Region->Disk] 00679 : &PrimaryPartitions[Region->Disk]; 00680 00681 if(p1) { 00682 AddPartitionToLinkedList(PartitionList,p1); 00683 } 00684 if(p2) { 00685 AddPartitionToLinkedList(PartitionList,p2); 00686 } 00687 00688 MergeFreePartitions(*PartitionList); 00689 RenumberPartitions(Region->Disk); 00690 00691 ChangesMade[Region->Disk] = TRUE; 00692 00693 return(OK_STATUS); 00694 }

ARC_STATUS DeletePartition IN PREGION_DESCRIPTOR  Region  ) 
 

Definition at line 721 of file fdengine.c.

References _tagPARTITION::Active, ASRT, ChangesMade, _tagPARTITION::Disk, FALSE, FreeLinkedPartitionList(), IsExtended(), IsInLogicalList(), IsInPartitionList(), LogicalVolumes, MergeFreePartitions(), OK_STATUS, _tagPARTITION::OriginalPartitionNumber, _tagREGION_DATA::Partition, PrimaryPartitions, REGION_LOGICAL, RenumberPartitions(), _tagPARTITION::SysID, SYSID_UNUSED, TRUE, and _tagPARTITION::Update.

Referenced by DoPartitionDelete().

00727 : 00728 00729 This routine deletes a partition, returning its space to the 00730 free space on the disk. If deleting the extended partition, 00731 all logical volumes within it are also deleted. 00732 00733 Arguments: 00734 00735 Region - a region descriptor returned by GetDiskRegions(). Must 00736 be a used region. 00737 00738 Return Value: 00739 00740 OK_STATUS or error code. 00741 00742 --*/ 00743 00744 { 00745 PREGION_DATA RegionData = Region->Reserved; 00746 PPARTITION *PartitionList; 00747 00748 ASRT( IsInPartitionList(Region->Disk,RegionData->Partition) 00749 || IsInLogicalList (Region->Disk,RegionData->Partition) 00750 ); 00751 00752 if(IsExtended(Region->SysID)) { 00753 00754 ASRT(IsInPartitionList(Region->Disk,RegionData->Partition)); 00755 00756 // Deleting extended partition. Also delete all logical volumes. 00757 00758 FreeLinkedPartitionList(&LogicalVolumes[Region->Disk]); 00759 } 00760 00761 RegionData->Partition->SysID = SYSID_UNUSED; 00762 RegionData->Partition->Update = TRUE; 00763 RegionData->Partition->Active = FALSE; 00764 RegionData->Partition->OriginalPartitionNumber = 0; 00765 00766 PartitionList = (Region->RegionType == REGION_LOGICAL) 00767 ? &LogicalVolumes[Region->Disk] 00768 : &PrimaryPartitions[Region->Disk]; 00769 00770 MergeFreePartitions(*PartitionList); 00771 RenumberPartitions(Region->Disk); 00772 00773 ChangesMade[Region->Disk] = TRUE; 00774 00775 return(OK_STATUS); 00776 }

ULONG DiskSizeMB IN ULONG  Disk  ) 
 

Definition at line 2011 of file fdengine.c.

References DiskLengthBytes(), and SIZEMB().

02017 : 02018 02019 This routine determines the disk length in megabytes. The returned 02020 value is rounded down after division by 1024*1024. 02021 02022 Arguments: 02023 02024 Disk - index of disk whose size is desired 02025 02026 Return Value: 02027 02028 Size of Disk. 02029 02030 --*/ 02031 02032 { 02033 return(SIZEMB(DiskLengthBytes(Disk))); 02034 }

ARC_STATUS DoesAnyLogicalExist IN ULONG  Disk,
OUT PBOOLEAN  Exists
 

ARC_STATUS DoesAnyPartitionExist IN ULONG  Disk,
OUT PBOOLEAN  AnyExists,
OUT PBOOLEAN  PrimaryExists,
OUT PBOOLEAN  ExtendedExists,
OUT PBOOLEAN  LogicalExists
 

Definition at line 2394 of file fdengine.c.

References ARC_STATUS, DoesAnyLogicalExist(), DoesAnyPrimaryExist(), DoesExtendedExist(), and OK_STATUS.

Referenced by DoPartitionDelete().

02404 : 02405 02406 This routine determines whether any partition exists on a given disk. 02407 This is based on three sub queries: whether there are any primary or 02408 extended partitions, or logical volumes on the disk. 02409 02410 Arguments: 02411 02412 Disk - index of disk to check 02413 02414 AnyExists - returns whether any partitions exist on Disk 02415 02416 PrimaryExists - returns whether any primary partitions exist on Disk 02417 02418 ExtendedExists - returns whether there is an extended partition on Disk 02419 02420 LogicalExists - returns whether any logical volumes exist on Disk 02421 02422 Return Value: 02423 02424 OK_STATUS or error code 02425 02426 --*/ 02427 02428 { 02429 ARC_STATUS status; 02430 02431 if((status = DoesAnyPrimaryExist(Disk,PrimaryExists )) != OK_STATUS) { 02432 return(status); 02433 } 02434 if((status = DoesExtendedExist (Disk,ExtendedExists)) != OK_STATUS) { 02435 return(status); 02436 } 02437 if((status = DoesAnyLogicalExist(Disk,LogicalExists )) != OK_STATUS) { 02438 return(status); 02439 } 02440 *AnyExists = (BOOLEAN)(*PrimaryExists || *ExtendedExists || *LogicalExists); 02441 return(OK_STATUS); 02442 }

ARC_STATUS DoesAnyPrimaryExist IN ULONG  Disk,
OUT PBOOLEAN  Exists
 

ARC_STATUS DoesExtendedExist IN ULONG  Disk,
OUT PBOOLEAN  Exists
 

BOOLEAN FdCrosses1024Cylinder IN PREGION_DESCRIPTOR  Region,
IN ULONG  CreationSizeMB,
IN REGION_TYPE  RegionType
 

Definition at line 3324 of file fdengine.c.

References _tagDISKGEOM::BytesPerCylinder, DetermineCreateSizeAndOffset(), DiskGeometryArray, End, Size, Start, and SYSID_UNUSED.

03332 : 03333 03334 Determine whether a used region corsses the 1024th cylinder, or whether 03335 a partition created within a free space will cross the 1024th cylinder. 03336 03337 Arguments: 03338 03339 Region - region describing the partition to check. 03340 03341 CreationSizeMB - if the Region is for a free space, this is the size of 03342 the partition to be checked. 03343 03344 RegionType - one of REGION_PRIMARY, REGION_EXTENDED, or REGION_LOGICAL 03345 03346 Return Value: 03347 03348 TRUE if the end cylinder >= 1024. 03349 03350 --*/ 03351 03352 { 03353 LARGE_INTEGER Start,Size,End, LargeZero; 03354 03355 if(Region->SysID == SYSID_UNUSED) { 03356 03357 // 03358 // Determine the exact size and offset of the partition, according 03359 // to how CreatePartitionEx() will do it. 03360 // 03361 03362 LargeZero.QuadPart = 0; 03363 DetermineCreateSizeAndOffset( Region, 03364 LargeZero, 03365 CreationSizeMB, 03366 RegionType, 03367 &Start, 03368 &Size 03369 ); 03370 03371 } else { 03372 03373 Start = ((PREGION_DATA)(Region->Reserved))->Partition->Offset; 03374 Size = ((PREGION_DATA)(Region->Reserved))->Partition->Length; 03375 } 03376 03377 End.QuadPart = (Start.QuadPart + Size.QuadPart) - 1; 03378 03379 // 03380 // End is the last byte in the partition. Divide by the number of 03381 // bytes in a cylinder and see whether the result is > 1023. 03382 // 03383 03384 return( (End.QuadPart / DiskGeometryArray[Region->Disk].BytesPerCylinder) > 1023 ); 03385 }

ULONG FdGetDiskSignature IN ULONG  Disk  ) 
 

LARGE_INTEGER FdGetExactOffset IN PREGION_DESCRIPTOR  Region  ) 
 

Definition at line 3281 of file fdengine.c.

References _tagDISKGEOM::BytesPerTrack, DiskGeometryArray, Offset, REGION_LOGICAL, and SYSID_UNUSED.

03287 : 03288 03289 Determine where a given partition _actually_ starts, which may be 03290 different than where is appears because of EBR reserved tracks, etc. 03291 03292 NOTE: This routine is not meant to operate on unused regions or 03293 extended partitions. In these cases, it just returns the apparant offset. 03294 03295 Arguments: 03296 03297 Region - region describing the partition to check. 03298 03299 Return Value: 03300 03301 Actual offset 03302 03303 --*/ 03304 03305 { 03306 LARGE_INTEGER Offset = ((PREGION_DATA)(Region->Reserved))->Partition->Offset; 03307 03308 if((Region->SysID != SYSID_UNUSED) && (Region->RegionType == REGION_LOGICAL)) { 03309 03310 // 03311 // The region is a logical volume. 03312 // Account for the reserved EBR track. 03313 // 03314 03315 Offset.QuadPart = Offset.QuadPart + 03316 DiskGeometryArray[Region->Disk].BytesPerTrack; 03317 } 03318 03319 return(Offset); 03320 }

LARGE_INTEGER FdGetExactSize IN PREGION_DESCRIPTOR  Region,
IN BOOLEAN  ForExtended
 

Definition at line 3231 of file fdengine.c.

References _tagREGION_DATA::AlignedRegionOffset, _tagREGION_DATA::AlignedRegionSize, _tagDISKGEOM::BytesPerCylinder, _tagDISKGEOM::BytesPerTrack, DiskGeometryArray, REGION_LOGICAL, and SYSID_UNUSED.

03235 { 03236 PREGION_DATA RegionData = Region->Reserved; 03237 LARGE_INTEGER LargeSize = RegionData->AlignedRegionSize; 03238 LARGE_INTEGER BytesPerTrack; 03239 LARGE_INTEGER BytesPerCylinder; 03240 03241 BytesPerTrack.QuadPart = (DiskGeometryArray[Region->Disk].BytesPerTrack); 03242 BytesPerCylinder.QuadPart = (DiskGeometryArray[Region->Disk].BytesPerCylinder); 03243 03244 if(Region->RegionType == REGION_LOGICAL) { 03245 03246 // 03247 // The region is within the extended partition. It doesn't matter 03248 // whether it's free space or used -- in either case, we need to 03249 // account for the reserved EBR track. 03250 // 03251 03252 LargeSize.QuadPart = LargeSize.QuadPart - BytesPerTrack.QuadPart; 03253 03254 } else if(Region->SysID == SYSID_UNUSED) { 03255 03256 // 03257 // The region is unused space not inside the extended partition. 03258 // We must know whether the caller will put a primary or extended 03259 // partition there -- a primary partition can use all the space, but 03260 // a logical volume in the extended partition won't include the first 03261 // track. If the free space starts at offset 0 on the disk, a special 03262 // calculation must be used to move the start of the partition to 03263 // skip a track for a primary or a cylinder and a track for an 03264 // extended+logical. 03265 // 03266 03267 if((RegionData->AlignedRegionOffset.QuadPart == 0) || ForExtended) { 03268 LargeSize.QuadPart = LargeSize.QuadPart - BytesPerTrack.QuadPart; 03269 } 03270 03271 if((RegionData->AlignedRegionOffset.QuadPart == 0) && ForExtended) { 03272 LargeSize.QuadPart = LargeSize.QuadPart - BytesPerCylinder.QuadPart; 03273 } 03274 } 03275 03276 return(LargeSize); 03277 }

ULONG FdGetMaximumSizeMB IN PREGION_DESCRIPTOR  Region,
IN REGION_TYPE  CreationType
 

Definition at line 3203 of file fdengine.c.

References _tagREGION_DATA::AlignedRegionOffset, _tagREGION_DATA::AlignedRegionSize, ASRT, _tagDISKGEOM::BytesPerCylinder, _tagDISKGEOM::BytesPerTrack, DiskGeometryArray, REGION_EXTENDED, REGION_PRIMARY, SIZEMB(), and SYSID_UNUSED.

03207 { 03208 PREGION_DATA CreateData = Region->Reserved; 03209 LARGE_INTEGER MaxSize = CreateData->AlignedRegionSize; 03210 03211 ASRT(Region->SysID == SYSID_UNUSED); 03212 03213 if(CreateData->AlignedRegionOffset.QuadPart == 0) { 03214 03215 ULONG Delta; 03216 03217 ASRT((CreationType == REGION_EXTENDED) || (CreationType == REGION_PRIMARY)) 03218 03219 Delta = (CreationType == REGION_EXTENDED) 03220 ? DiskGeometryArray[Region->Disk].BytesPerCylinder 03221 : DiskGeometryArray[Region->Disk].BytesPerTrack; 03222 03223 MaxSize.QuadPart = MaxSize.QuadPart - Delta; 03224 } 03225 03226 return(SIZEMB(MaxSize)); 03227 }

ULONG FdGetMinimumSizeMB IN ULONG  Disk  ) 
 

Definition at line 3172 of file fdengine.c.

References _tagDISKGEOM::BytesPerCylinder, DiskGeometryArray, max, and SIZEMB().

03178 : 03179 03180 Return the minimum size for a partition on a given disk. 03181 03182 This is the rounded size of one cylinder or 1, whichever is greater. 03183 03184 Arguments: 03185 03186 Region - region describing the partition to check. 03187 03188 Return Value: 03189 03190 Actual offset 03191 03192 --*/ 03193 03194 { 03195 LARGE_INTEGER LargeInteger; 03196 03197 LargeInteger.QuadPart = DiskGeometryArray[Disk].BytesPerCylinder; 03198 return(max(SIZEMB(LargeInteger),1)); 03199 }

VOID FdiskCleanUp VOID   ) 
 

Definition at line 258 of file fdengine.c.

References ChangesMade, CountOfDisks, DiskGeometryArray, DiskNames, FreeMemory, FreePartitionInfoLinkedLists(), LogicalVolumes, LowFreeFdiskPathList(), NULL, OffLine, and PrimaryPartitions.

00264 : 00265 00266 This routine deallocates storage used by the partitioning engine. 00267 00268 Arguments: 00269 00270 None. 00271 00272 Return Value: 00273 00274 None. 00275 00276 --*/ 00277 00278 { 00279 LowFreeFdiskPathList(DiskNames,CountOfDisks); 00280 00281 if(DiskGeometryArray != NULL) { 00282 FreeMemory(DiskGeometryArray); 00283 } 00284 if(PrimaryPartitions != NULL) { 00285 FreePartitionInfoLinkedLists(PrimaryPartitions); 00286 FreeMemory(PrimaryPartitions); 00287 } 00288 if(LogicalVolumes != NULL) { 00289 FreePartitionInfoLinkedLists(LogicalVolumes); 00290 FreeMemory(LogicalVolumes); 00291 } 00292 if(ChangesMade != NULL) { 00293 FreeMemory(ChangesMade); 00294 } 00295 if(OffLine != NULL) { 00296 FreeMemory(OffLine); 00297 } 00298 }

ARC_STATUS FdiskInitialize VOID   ) 
 

Definition at line 183 of file fdengine.c.

References AllocateMemory, AlPrint(), ARC_STATUS, ChangesMade, CheckIfDiskIsOffLine(), CountOfDisks, DiskGeometryArray, DiskNames, ENODEV, FALSE, GetGeometry(), InitializePartitionLists(), LogicalVolumes, LowQueryFdiskPathList(), NULL, OffLine, OK_STATUS, PPARTITION, PrimaryPartitions, and RETURN_OUT_OF_MEMORY.

Referenced by main().

00189 : 00190 00191 This routine initializes the partitioning engine, including allocating 00192 arrays, determining attached disk devices, and reading their 00193 partition tables. 00194 00195 Arguments: 00196 00197 None. 00198 00199 Return Value: 00200 00201 OK_STATUS or error code. 00202 00203 --*/ 00204 00205 { 00206 ARC_STATUS status; 00207 ULONG i; 00208 00209 00210 if((status = LowQueryFdiskPathList(&DiskNames,&CountOfDisks)) != OK_STATUS) { 00211 return(status); 00212 } 00213 00214 #if 0 00215 #ifdef ARCDBG 00216 AlPrint("Disk count = %u\r\n",CountOfDisks); 00217 for(i=0; i<CountOfDisks; i++) { 00218 AlPrint("Disk %u: %s\r\n",i,DiskNames[i]); 00219 } 00220 WaitKey(); 00221 #endif 00222 #endif 00223 00224 DiskGeometryArray = NULL; 00225 PrimaryPartitions = NULL; 00226 LogicalVolumes = NULL; 00227 00228 if(((DiskGeometryArray = AllocateMemory(CountOfDisks * sizeof(DISKGEOM ))) == NULL) 00229 || ((ChangesMade = AllocateMemory(CountOfDisks * sizeof(BOOLEAN ))) == NULL) 00230 || ((PrimaryPartitions = AllocateMemory(CountOfDisks * sizeof(PPARTITION))) == NULL) 00231 || ((OffLine = AllocateMemory(CountOfDisks * sizeof(BOOLEAN ))) == NULL) 00232 || ((LogicalVolumes = AllocateMemory(CountOfDisks * sizeof(PPARTITION))) == NULL)) 00233 { 00234 RETURN_OUT_OF_MEMORY; 00235 } 00236 00237 for(i=0; i<CountOfDisks; i++) { 00238 PrimaryPartitions[i] = NULL; 00239 LogicalVolumes[i] = NULL; 00240 ChangesMade[i] = FALSE; 00241 OffLine[i] = CheckIfDiskIsOffLine(i); 00242 if(OffLine[i]) { 00243 return(ENODEV); 00244 } 00245 } 00246 00247 if(((status = GetGeometry() ) != OK_STATUS) 00248 || ((status = InitializePartitionLists()) != OK_STATUS)) 00249 { 00250 return(status); 00251 } 00252 00253 return(OK_STATUS); 00254 }

VOID FdMarkDiskDirty IN ULONG  Disk  ) 
 

Definition at line 3152 of file fdengine.c.

References ASRT, ChangesMade, OffLine, and TRUE.

03155 { 03156 ASRT(!OffLine[Disk]); 03157 03158 ChangesMade[Disk] = TRUE; 03159 }

VOID FdSetDiskSignature IN ULONG  Disk,
IN ULONG  Signature
 

VOID FdSetPersistentData IN PREGION_DESCRIPTOR  Region,
IN ULONG  Data
 

Definition at line 3162 of file fdengine.c.

03166 { 03167 ((PREGION_DATA)(Region->Reserved))->Partition->PersistentData = Data; 03168 }

ARC_STATUS FmtFatFormat IN PCHAR  PartitionPath,
IN ULONG  HiddenSectorCount
 

Definition at line 601 of file fmtexp.c.

References AllocateMemory, ARC_STATUS, ArcClose, ArcGetTime, ArcOpen, ArcOpenReadWrite, ENOMEM, ESUCCESS, FmtFillFormatBuffer(), FmtVerifySectors(), FreeMemory, LowGetPartitionGeometry(), LowWriteSectors(), and NULL.

Referenced by DoMakePartitionSystemPartition(), and DoSystemPartitionCreate().

00607 : 00608 00609 This routine does a FAT format on the given partition. 00610 00611 Arguments: 00612 00613 PartitionPath - Supplies a path to the partition to format. 00614 00615 Return Value: 00616 00617 LowGetPartitionGeometry, ArcOpen, 00618 FmtVerifySectors, FmtFillFormatBuffer, LowWriteSectors, 00619 ArcClose, ENOMEM 00620 00621 --*/ 00622 { 00623 ULONG num_sectors; 00624 ULONG sector_size; 00625 ULONG sec_per_track; 00626 ULONG heads; 00627 ULONG hidden_sectors; 00628 PULONG bad_sectors; 00629 ULONG num_bad_sectors; 00630 PVOID format_buffer; 00631 ULONG max_sec_per_sa; 00632 ULONG super_area_size; 00633 ARC_STATUS r; 00634 ULONG partition_id; 00635 ULONG time_seed; 00636 PTIME_FIELDS ptime_fields; 00637 00638 00639 r = LowGetPartitionGeometry(PartitionPath, &num_sectors, 00640 &sector_size, &sec_per_track, &heads); 00641 00642 if (r != ESUCCESS) { 00643 return r; 00644 } 00645 00646 hidden_sectors = HiddenSectorCount; 00647 00648 r = ArcOpen(PartitionPath, ArcOpenReadWrite, &partition_id); 00649 00650 if (r != ESUCCESS) { 00651 return r; 00652 } 00653 00654 bad_sectors = NULL; 00655 00656 r = FmtVerifySectors(partition_id, num_sectors, sector_size, 00657 &bad_sectors, &num_bad_sectors); 00658 00659 if (r != ESUCCESS) { 00660 ArcClose(partition_id); 00661 return r; 00662 } 00663 00664 max_sec_per_sa = 1 + 00665 2*((2*65536 - 1)/sector_size + 1) + 00666 ((512*32 - 1)/sector_size + 1); 00667 00668 ptime_fields = ArcGetTime(); 00669 00670 time_seed = (ptime_fields->Year - 1970)*366*24*60*60 + 00671 (ptime_fields->Month)*31*24*60*60 + 00672 (ptime_fields->Day)*24*60*60 + 00673 (ptime_fields->Hour)*60*60 + 00674 (ptime_fields->Minute)*60 + 00675 (ptime_fields->Second); 00676 00677 if (!(format_buffer = AllocateMemory(max_sec_per_sa*sector_size))) { 00678 00679 if (bad_sectors) { 00680 FreeMemory(bad_sectors); 00681 } 00682 ArcClose(partition_id); 00683 return ENOMEM; 00684 } 00685 00686 r = FmtFillFormatBuffer(num_sectors, 00687 sector_size, 00688 sec_per_track, 00689 heads, 00690 hidden_sectors, 00691 format_buffer, 00692 max_sec_per_sa*sector_size, 00693 &super_area_size, 00694 time_seed, 00695 bad_sectors, 00696 num_bad_sectors); 00697 00698 00699 if (bad_sectors) { 00700 FreeMemory(bad_sectors); 00701 } 00702 00703 if (r != ESUCCESS) { 00704 ArcClose(partition_id); 00705 FreeMemory(format_buffer); 00706 return r; 00707 } 00708 00709 r = LowWriteSectors(partition_id, sector_size, 0, 00710 super_area_size/sector_size, format_buffer); 00711 00712 FreeMemory(format_buffer); 00713 00714 if (r != ESUCCESS) { 00715 ArcClose(partition_id); 00716 return r; 00717 } 00718 00719 return ArcClose(partition_id); 00720 }

ARC_STATUS FmtFreeFatPartitionList IN OUT PCHAR *  FatPartitionList,
IN ULONG  ListLength
 

Definition at line 919 of file fmtexp.c.

References LowFreePathList().

00925 : 00926 00927 This routine frees up the heap space taken by the FAT partition 00928 list. 00929 00930 Arguments: 00931 00932 FatPartitionList - Supplies the buffer to free. 00933 ListLength - Supplies the buffer length. 00934 00935 Return Value: 00936 00937 LowFreePathList 00938 00939 --*/ 00940 { 00941 return LowFreePathList(FatPartitionList, ListLength); 00942 } }

ARC_STATUS FmtIsFat IN PCHAR  PartitionPath,
OUT PBOOLEAN  IsFatPartition
 

Definition at line 93 of file fmtexp.c.

References ARC_STATUS, ArcClose, ArcOpen, ArcOpenReadOnly, ESUCCESS, FmtIsFatPartition(), and LowGetPartitionGeometry().

Referenced by DoMakePartitionSystemPartition(), and FmtQueryFatPartitionList().

00099 : 00100 00101 This routine computes whether or not the given partition is a FAT 00102 partition. 00103 00104 Arguments: 00105 00106 PartitionPath - Supplies a path to the partition. 00107 IsFatPartition - Returns whether or not the partition is FAT. 00108 00109 Return Value: 00110 00111 ArcOpen, ArcClose, LowGetPartitionGeometry, FmtIsFatPartition 00112 00113 --*/ 00114 { 00115 ULONG partition_id; 00116 ARC_STATUS r; 00117 ULONG total_sectors, sector_size, sec_per_track, heads; 00118 00119 r = LowGetPartitionGeometry(PartitionPath, &total_sectors, &sector_size, 00120 &sec_per_track, &heads); 00121 00122 if (r != ESUCCESS) { 00123 return r; 00124 } 00125 00126 r = ArcOpen(PartitionPath, ArcOpenReadOnly, &partition_id); 00127 00128 if (r != ESUCCESS) { 00129 return r; 00130 } 00131 00132 r = FmtIsFatPartition(partition_id, sector_size, IsFatPartition); 00133 00134 if (r != ESUCCESS) { 00135 ArcClose(partition_id); 00136 return r; 00137 } 00138 00139 return ArcClose(partition_id); 00140 }

ARC_STATUS FmtIsFatPartition IN ULONG  PartitionId,
IN ULONG  SectorSize,
OUT PBOOLEAN  IsFatPartition
 

Definition at line 42 of file fmtexp.c.

References AllocateMemory, ARC_STATUS, Buffer, ENOMEM, ESUCCESS, FreeMemory, LowReadSectors(), and SectorSize.

Referenced by FmtIsFat().

00049 : 00050 00051 This routine computes whether or not the given partition is a FAT 00052 partition. 00053 00054 Arguments: 00055 00056 VolumeId - Supplies the volume to check. 00057 SectorSize - Supplies the number of bytes per sector. 00058 IsFatPartition - Returns whether or not the partition is FAT. 00059 00060 Return Value: 00061 00062 LowReadSectors, ENOMEM, ESUCCESS 00063 00064 --*/ 00065 { 00066 PUCHAR Buffer; 00067 ARC_STATUS r; 00068 00069 if (!(Buffer = AllocateMemory(SectorSize*2))) { 00070 return ENOMEM; 00071 } 00072 00073 r = LowReadSectors(PartitionId, SectorSize, 0, 2, Buffer); 00074 00075 if (r != ESUCCESS) { 00076 FreeMemory(Buffer); 00077 return r; 00078 } 00079 00080 *IsFatPartition = Buffer[510] == 0x55 && 00081 Buffer[511] == 0xAA && 00082 Buffer[0x10] != 0 && 00083 Buffer[0x15] == Buffer[SectorSize] && 00084 Buffer[SectorSize + 1] == 0xFF && 00085 Buffer[SectorSize + 2] == 0xFF; 00086 00087 FreeMemory(Buffer); 00088 return ESUCCESS; 00089 }

ARC_STATUS FmtQueryFatPartitionList OUT PCHAR **  FatPartitionList,
OUT PULONG  ListLength
 

Definition at line 724 of file fmtexp.c.

References AllocateMemory, ARC_STATUS, ArcClose, ArcOpen, ArcOpenReadOnly, CHAR, CONFIGURATION_TYPE, DiskPeripheral, EIO, ENOMEM, ESUCCESS, FmtIsFat(), FreeMemory, LowFreePathList(), LowQueryPathList(), NULL, sprintf(), and strlen().

00730 : 00731 00732 This routine browses the component tree for all disk peripherals 00733 and the attempts to open partitions on all of them. It add all 00734 FAT partitions to the list and returns it. 00735 00736 Arguments: 00737 00738 FatPartitionList - Returns a list of FAT partitions. 00739 ListLength - Returns the length of the list. 00740 00741 Return Value: 00742 00743 LowQueryPathList, ArcOpen, ArcClose, FmtIsFat, EIO, ENOMEM, ESUCCESS 00744 00745 --*/ 00746 { 00747 CONFIGURATION_TYPE config_type; 00748 ARC_STATUS r; 00749 PCHAR* peripheral_list; 00750 ULONG peripheral_list_length; 00751 ULONG i, j; 00752 ULONG num_partitions; 00753 CHAR partition_buf[21]; 00754 ULONG partition_id; 00755 PCHAR* fat_partition_list; 00756 ULONG fat_partition_list_length; 00757 BOOLEAN is_fat; 00758 PCHAR partition_name; 00759 00760 00761 // First get a list of the all of the disk peripheral paths. 00762 00763 config_type = DiskPeripheral; 00764 r = LowQueryPathList(NULL, &config_type, &peripheral_list, 00765 &peripheral_list_length); 00766 00767 if (r != ESUCCESS) { 00768 return r; 00769 } 00770 00771 // Now we have a list of disk peripheral paths. 00772 00773 00774 00775 // Next, count how many partitions there are. 00776 00777 num_partitions = 0; 00778 for (i = 0; i < peripheral_list_length; i++) { 00779 00780 partition_name = AllocateMemory(strlen(peripheral_list[i]) + 21); 00781 00782 if (!partition_name) { 00783 LowFreePathList(peripheral_list, peripheral_list_length); 00784 return ENOMEM; 00785 } 00786 00787 for (j = 1; ; j++) { 00788 00789 strcpy(partition_name, peripheral_list[i]); 00790 sprintf(partition_buf, "partition(%d)", j); 00791 strcat(partition_name, partition_buf); 00792 00793 r = ArcOpen(partition_name, ArcOpenReadOnly, &partition_id); 00794 00795 if (r != ESUCCESS) { 00796 break; 00797 } 00798 00799 num_partitions++; 00800 00801 r = ArcClose(partition_id); 00802 00803 if (r != ESUCCESS) { 00804 LowFreePathList(peripheral_list, peripheral_list_length); 00805 FreeMemory(partition_name); 00806 return r; 00807 } 00808 } 00809 00810 FreeMemory(partition_name); 00811 } 00812 00813 // 'num_partitions' indicates the number of partitions on the disk. 00814 00815 00816 // Allocate a buffer for the FAT partitions list. There can be 00817 // no more FAT partitions then there are partitions. 00818 00819 fat_partition_list = (PCHAR*) AllocateMemory(num_partitions*sizeof(PCHAR)); 00820 00821 if (!fat_partition_list) { 00822 LowFreePathList(peripheral_list, peripheral_list_length); 00823 return ENOMEM; 00824 } 00825 00826 for (i = 0; i < num_partitions; i++) { 00827 fat_partition_list[i] = NULL; 00828 } 00829 00830 fat_partition_list_length = 0; 00831 00832 // 'fat_partition_list_length' indicates the number of FAT partitions. 00833 00834 00835 00836 // Now go through all of the peripherals trying all possible 00837 // partitions on each. Test these to see if they are FAT and 00838 // put the FAT ones in 'fat_partitions_list'. 00839 00840 for (i = 0; i < peripheral_list_length; i++) { 00841 00842 partition_name = AllocateMemory(strlen(peripheral_list[i]) + 21); 00843 00844 if (!partition_name) { 00845 LowFreePathList(peripheral_list, peripheral_list_length); 00846 LowFreePathList(fat_partition_list, fat_partition_list_length); 00847 return ENOMEM; 00848 } 00849 00850 for (j = 1; ; j++) { 00851 00852 strcpy(partition_name, peripheral_list[i]); 00853 sprintf(partition_buf, "partition(%d)", j); 00854 strcat(partition_name, partition_buf); 00855 00856 r = ArcOpen(partition_name, ArcOpenReadOnly, &partition_id); 00857 00858 if (r != ESUCCESS) { 00859 break; 00860 } 00861 00862 r = ArcClose(partition_id); 00863 00864 if (r != ESUCCESS) { 00865 LowFreePathList(peripheral_list, peripheral_list_length); 00866 LowFreePathList(fat_partition_list, fat_partition_list_length); 00867 FreeMemory(partition_name); 00868 return r; 00869 } 00870 00871 r = FmtIsFat(partition_name, &is_fat); 00872 00873 if (r != ESUCCESS) { 00874 LowFreePathList(peripheral_list, peripheral_list_length); 00875 LowFreePathList(fat_partition_list, fat_partition_list_length); 00876 FreeMemory(partition_name); 00877 return r; 00878 } 00879 00880 if (is_fat) { 00881 00882 if (fat_partition_list_length == num_partitions) { 00883 // This can't happen. 00884 LowFreePathList(peripheral_list, peripheral_list_length); 00885 LowFreePathList(fat_partition_list, fat_partition_list_length); 00886 FreeMemory(partition_name); 00887 return EIO; 00888 } 00889 00890 fat_partition_list[fat_partition_list_length] = 00891 AllocateMemory(strlen(partition_name) + 1); 00892 00893 if (!fat_partition_list[fat_partition_list_length]) { 00894 LowFreePathList(peripheral_list, peripheral_list_length); 00895 LowFreePathList(fat_partition_list, fat_partition_list_length); 00896 FreeMemory(partition_name); 00897 return ENOMEM; 00898 } 00899 00900 strcpy(fat_partition_list[fat_partition_list_length], partition_name); 00901 00902 fat_partition_list_length++; 00903 } 00904 } 00905 00906 FreeMemory(partition_name); 00907 } 00908 00909 LowFreePathList(peripheral_list, peripheral_list_length); 00910 00911 *FatPartitionList = fat_partition_list; 00912 *ListLength = fat_partition_list_length; 00913 00914 return ESUCCESS; 00915 }

VOID FreeRegionArray IN PREGION_DESCRIPTOR  Region,
IN ULONG  RegionCount
 

Definition at line 1013 of file fdengine.c.

References FreeMemory.

Referenced by DoesAnyLogicalExist(), DoesAnyPrimaryExist(), DoesExtendedExist(), DoMakePartitionSystemPartition(), DoPartitionCreate(), DoPartitionDelete(), IsCreationOfExtendedAllowed(), IsCreationOfLogicalAllowed(), and IsCreationOfPrimaryAllowed().

01020 : 01021 01022 This routine frees a region array returned by GetDiskRegions(). 01023 01024 Arguments: 01025 01026 Region - pointer to the array of regions to be freed 01027 01028 RegionCount - number of items in the Region array 01029 01030 Return Value: 01031 01032 None. 01033 01034 --*/ 01035 01036 { 01037 ULONG i; 01038 01039 for(i=0; i<RegionCount; i++) { 01040 01041 if(Region[i].Reserved) { 01042 FreeMemory(Region[i].Reserved); 01043 } 01044 } 01045 FreeMemory(Region); 01046 }

ULONG GetDiskCount VOID   ) 
 

Definition at line 2587 of file fdengine.c.

References CountOfDisks.

Referenced by ChooseDisk(), and ConfigureSystemPartitions().

02593 : 02594 02595 This routine returns the number of attached partitionable disk 02596 devices. The returned value is one greater than the maximum index 02597 allowed for Disk parameters to partitioning engine routines. 02598 02599 Arguments: 02600 02601 None. 02602 02603 Return Value: 02604 02605 Count of disks. 02606 02607 --*/ 02608 02609 { 02610 return(CountOfDisks); 02611 }

PCHAR GetDiskName ULONG  Disk  ) 
 

Definition at line 2615 of file fdengine.c.

References DiskNames.

Referenced by CheckIfDiskIsOffLine(), ChooseDisk(), DoMakePartitionSystemPartition(), DoPartitionCreate(), DoPartitionDelete(), DoSystemPartitionCreate(), IsBootSelectionPartition(), and ZapSector().

02621 : 02622 02623 This routine returns the system name for the disk device whose 02624 index is given. 02625 02626 Arguments: 02627 02628 Disk - index of disk whose name is desired. 02629 02630 Return Value: 02631 02632 System name for the disk device. The caller must not attempt to 02633 free this buffer or modify it. 02634 02635 --*/ 02636 02637 { 02638 return(DiskNames[Disk]); 02639 }

ARC_STATUS GetDiskRegions IN ULONG  Disk,
IN BOOLEAN  WantUsedRegions,
IN BOOLEAN  WantFreeRegions,
IN BOOLEAN  WantPrimaryRegions,
IN BOOLEAN  WantLogicalRegions,
OUT PREGION_DESCRIPTOR Region,
OUT ULONG *  RegionCount
 

Definition at line 780 of file fdengine.c.

References AllocateMemory, FALSE, GetRegions(), LogicalVolumes, OK_STATUS, PrimaryPartitions, REGION_LOGICAL, and REGION_PRIMARY.

00792 : 00793 00794 This routine returns an array of region descriptors to the caller. 00795 A region desscriptor describes a space on the disk, either used 00796 or free. The caller can control which type of regions are returned. 00797 00798 The caller must free the returned array via FreeRegionArray(). 00799 00800 Arguments: 00801 00802 Disk - index of disk whose regions are to be returned 00803 00804 WantUsedRegions - whether to return used disk regions 00805 00806 WantFreeRegions - whether to return free disk regions 00807 00808 WantPrimaryRegions - whether to return regions not in the 00809 extended partition 00810 00811 WantLogicalRegions - whether to return regions within the 00812 extended partition 00813 00814 Region - where to put a pointer to the array of regions 00815 00816 RegionCount - where to put the number of items in the returned 00817 Region array 00818 00819 Return Value: 00820 00821 OK_STATUS or error code. 00822 00823 --*/ 00824 00825 { 00826 *Region = AllocateMemory(0); 00827 *RegionCount = 0; 00828 00829 if(WantPrimaryRegions) { 00830 return(GetRegions(Disk, 00831 PrimaryPartitions[Disk], 00832 WantUsedRegions, 00833 WantFreeRegions, 00834 WantLogicalRegions, 00835 Region, 00836 RegionCount, 00837 REGION_PRIMARY 00838 ) 00839 ); 00840 } else if(WantLogicalRegions) { 00841 return(GetRegions(Disk, 00842 LogicalVolumes[Disk], 00843 WantUsedRegions, 00844 WantFreeRegions, 00845 FALSE, 00846 Region, 00847 RegionCount, 00848 REGION_LOGICAL 00849 ) 00850 ); 00851 } 00852 return(OK_STATUS); 00853 }

ULONG GetHiddenSectorCount ULONG  Disk,
ULONG  Partition
 

PCHAR GetSysIDName UCHAR  SysID  ) 
 

Definition at line 2719 of file fdengine.c.

References SysIDStrings.

Referenced by DoMakePartitionSystemPartition(), and DoPartitionDelete().

02725 : 02726 02727 This routine returns the name for a given system ID. 02728 02729 Arguments: 02730 02731 SysID - system id in question 02732 02733 Return Value: 02734 02735 Name of system id. The caller must not attempt to free or 02736 modify this buffer. 02737 02738 --*/ 02739 02740 { 02741 return(SysIDStrings[SysID]); 02742 }

BOOLEAN HavePartitionsBeenChanged IN ULONG  Disk  ) 
 

Definition at line 3121 of file fdengine.c.

References ASRT, ChangesMade, and OffLine.

Referenced by CommitPartitionChanges().

03127 : 03128 03129 This routine returns TRUE if the given disk's partition structures 03130 have been modified by adding or deleting partitions, since the 03131 on-disk structures were last written by a call to CommitPartitionChanges 03132 (or first read). 03133 03134 Arguments: 03135 03136 Disk - index of disk to check 03137 03138 Return Value: 03139 03140 true if Disk's partition structure has changed. 03141 03142 --*/ 03143 03144 { 03145 if(OffLine[Disk]) { 03146 ASRT(!ChangesMade[Disk]); 03147 } 03148 return(ChangesMade[Disk]); 03149 }

ARC_STATUS IsAnyCreationAllowed IN ULONG  Disk,
IN BOOLEAN  AllowMultiplePrimaries,
OUT PBOOLEAN  AnyAllowed,
OUT PBOOLEAN  PrimaryAllowed,
OUT PBOOLEAN  ExtendedAllowed,
OUT PBOOLEAN  LogicalAllowed
 

Definition at line 2141 of file fdengine.c.

References ARC_STATUS, IsCreationOfExtendedAllowed(), IsCreationOfLogicalAllowed(), IsCreationOfPrimaryAllowed(), and OK_STATUS.

Referenced by DoPartitionCreate().

02152 : 02153 02154 This routine determines whether any partition may be created on a 02155 given disk, based on three sub-queries -- whether creation is allowed 02156 of a primary partition, an extended partition, or a logical volume. 02157 02158 Arguments: 02159 02160 Disk - index of disk to check 02161 02162 AllowMultiplePrimaries - whether to allow multiple primary partitions 02163 02164 AnyAllowed - returns whether any creation is allowed 02165 02166 PrimaryAllowed - returns whether creation of a primary partition 02167 is allowed 02168 02169 ExtendedAllowed - returns whether creation of an extended partition 02170 is allowed 02171 02172 Logical Allowed - returns whether creation of a logical volume is allowed. 02173 02174 Return Value: 02175 02176 OK_STATUS or error code 02177 02178 --*/ 02179 02180 { 02181 ARC_STATUS status; 02182 02183 if((status = IsCreationOfPrimaryAllowed(Disk,AllowMultiplePrimaries,PrimaryAllowed)) != OK_STATUS) { 02184 return(status); 02185 } 02186 if((status = IsCreationOfExtendedAllowed(Disk,ExtendedAllowed)) != OK_STATUS) { 02187 return(status); 02188 } 02189 if((status = IsCreationOfLogicalAllowed(Disk,LogicalAllowed)) != OK_STATUS) { 02190 return(status); 02191 } 02192 *AnyAllowed = (BOOLEAN)(*PrimaryAllowed || *ExtendedAllowed || *LogicalAllowed); 02193 return(OK_STATUS); 02194 }

ARC_STATUS IsCreationOfExtendedAllowed IN ULONG  Disk,
OUT PBOOLEAN  Allowed
 

ARC_STATUS IsCreationOfLogicalAllowed IN ULONG  Disk,
OUT PBOOLEAN  Allowed
 

ARC_STATUS IsCreationOfPrimaryAllowed IN ULONG  Disk,
IN BOOLEAN  AllowMultiplePrimaries,
OUT PBOOLEAN  Allowed
 

BOOLEAN IsDiskOffLine IN ULONG  Disk  ) 
 

Definition at line 3389 of file fdengine.c.

References OffLine.

03392 { 03393 return(OffLine[Disk]); 03394 }

BOOLEAN IsExtended IN UCHAR  SysID  ) 
 

Definition at line 2114 of file fdengine.c.

References SYSID_EXTENDED.

Referenced by DeletePartition(), DoesAnyPrimaryExist(), DoesExtendedExist(), DoMakePartitionSystemPartition(), DoPartitionDelete(), FindPartitionElement(), GetRegions(), InitializeLogicalVolumeList(), InitializePrimaryPartitionList(), IsCreationOfExtendedAllowed(), IsCreationOfPrimaryAllowed(), RenumberPartitions(), and WriteDriveLayout().

02120 : 02121 02122 This routine determines whether a given system id is for an 02123 extended type (ie, link) entry. 02124 02125 Arguments: 02126 02127 SysID - system id to be tested. 02128 02129 Return Value: 02130 02131 true/false based on whether SysID is for an extended type. 02132 02133 --*/ 02134 02135 { 02136 return((BOOLEAN)(SysID == SYSID_EXTENDED)); 02137 }

VOID JzDeleteVariableSegment PCHAR  VariableName,
ULONG  Selection
 

Definition at line 5 of file jzcrap.c.

References ArcGetEnvironmentVariable, ArcSetEnvironmentVariable, CHAR, Count, FALSE, Index, MAXIMUM_ENVIRONMENT_VALUE, NULL, and TRUE.

Referenced by DoPartitionDelete().

00009 { 00010 PCHAR Variable; 00011 CHAR VariableValue[MAXIMUM_ENVIRONMENT_VALUE]; 00012 ULONG Index; 00013 ULONG Count; 00014 BOOLEAN FirstSegment; 00015 00016 if ((Variable = ArcGetEnvironmentVariable(VariableName)) == NULL) { 00017 return; 00018 } 00019 00020 FirstSegment = TRUE; 00021 Index = 0; 00022 *VariableValue = 0; 00023 while (strchr(Variable,';') != NULL) { 00024 Count = strchr(Variable,';') - Variable; 00025 if (Index != Selection) { 00026 if (!FirstSegment) { 00027 strcat(VariableValue,";"); 00028 } 00029 strncat(VariableValue, Variable, Count); 00030 FirstSegment = FALSE; 00031 } 00032 Variable += Count + 1; 00033 Index++; 00034 } 00035 00036 if (Index != Selection) { 00037 if (!FirstSegment) { 00038 strcat(VariableValue,";"); 00039 } 00040 strcat(VariableValue,Variable); 00041 } 00042 00043 ArcSetEnvironmentVariable(VariableName, VariableValue); 00044 return; 00045 }

ARC_STATUS LowCloseDisk IN ULONG  DiskId  ) 
 

Definition at line 36 of file low.c.

References ArcClose.

Referenced by CheckIfDiskIsOffLine(), LowGetDiskLayout(), LowSetDiskLayout(), and ZapSector().

00041 : 00042 00043 This routine closes the supplied device. 00044 00045 Arguments: 00046 00047 DiskId - Supplies the disk id. 00048 00049 Return Value: 00050 00051 ArcClose 00052 00053 --*/ 00054 { 00055 return ArcClose(DiskId); 00056 }

ARC_STATUS LowFreeFdiskPathList IN OUT PCHAR *  PathList,
IN ULONG  ListLength
 

Definition at line 786 of file low.c.

References LowFreePathList().

Referenced by FdiskCleanUp().

00792 : 00793 00794 This routine frees up the space taken by the path lists. 00795 00796 Arguments: 00797 00798 PathList - Supplies the paths. 00799 ListLength - Supplies the number of paths. 00800 00801 Return Value: 00802 00803 ESUCCESS 00804 00805 --*/ 00806 { 00807 return LowFreePathList(PathList, ListLength); 00808 }

ARC_STATUS LowFreePathList IN PCHAR *  PathList,
IN ULONG  ListLength
 

Definition at line 721 of file low.c.

References ESUCCESS, and FreeMemory.

Referenced by FmtFreeFatPartitionList(), FmtQueryFatPartitionList(), LowFreeFdiskPathList(), and LowQueryPathList().

00727 : 00728 00729 This routine frees up the space taken by the path lists. 00730 00731 Arguments: 00732 00733 PathList - Supplies the paths. 00734 ListLength - Supplies the number of paths. 00735 00736 Return Value: 00737 00738 ESUCCESS 00739 00740 --*/ 00741 { 00742 ULONG i; 00743 00744 for (i = 0; i < ListLength; i++) { 00745 if (PathList[i]) { 00746 FreeMemory(PathList[i]); 00747 } 00748 } 00749 FreeMemory(PathList); 00750 00751 return ESUCCESS; 00752 }

ARC_STATUS LowGetDiskLayout IN PCHAR  Path,
OUT PDRIVE_LAYOUT_INFORMATION *  DriveLayout
 

Definition at line 812 of file low.c.

References _PARTITION_DESCRIPTOR::ActiveFlag, AlAllocateHeap(), AlDeallocateHeap(), AlReallocateHeap(), ARC_STATUS, BOOT_RECORD_SIGNATURE, BOOT_SIGNATURE_OFFSET, dummy(), ENOMEM, ESUCCESS, FALSE, Handle, LowCloseDisk(), LowGetDriveGeometry(), LowOpenDisk(), LowReadSectors(), NULL, NUM_PARTITION_TABLE_ENTRIES, PARTITION_TABLE_OFFSET, _PARTITION_DESCRIPTOR::PartitionType, PLENGTH, PSTART, PUSHORT, SYSID_EXTENDED, SYSID_UNUSED, and TRUE.

Referenced by InitializePartitionLists().

00816 { 00817 ARC_STATUS status; 00818 ULONG Handle; 00819 ULONG i,ExtendedStart,BootSector,Entry; 00820 ULONG dummy,bps; 00821 BOOLEAN Link,mbr; 00822 PDRIVE_LAYOUT_INFORMATION DriveInfo; 00823 PPARTITION_INFORMATION p; 00824 PCHAR SectorBuffer; 00825 PPARTITION_DESCRIPTOR ptable; 00826 00827 00828 #define PSTART(p) ( \ 00829 (ULONG) ((p)->StartingSectorLsb0) + \ 00830 (ULONG) ((p)->StartingSectorLsb1 << 8) + \ 00831 (ULONG) ((p)->StartingSectorMsb0 << 16) + \ 00832 (ULONG) ((p)->StartingSectorMsb1 << 24) ) 00833 00834 #define PLENGTH(p) ( \ 00835 (ULONG) ((p)->PartitionLengthLsb0) + \ 00836 (ULONG) ((p)->PartitionLengthLsb1 << 8) + \ 00837 (ULONG) ((p)->PartitionLengthMsb0 << 16) + \ 00838 (ULONG) ((p)->PartitionLengthMsb1 << 24) ) 00839 00840 00841 00842 if((DriveInfo = AlAllocateHeap(sizeof(DRIVE_LAYOUT_INFORMATION) + (500*sizeof(PARTITION_INFORMATION)))) == NULL) { 00843 return(ENOMEM); 00844 } 00845 p = &DriveInfo->PartitionEntry[0]; 00846 00847 if((status = LowGetDriveGeometry(Path,&dummy,&bps,&dummy,&dummy)) != ESUCCESS) { 00848 AlDeallocateHeap(DriveInfo); 00849 return(status); 00850 } 00851 00852 if((SectorBuffer = AlAllocateHeap(bps)) == NULL) { 00853 AlDeallocateHeap(DriveInfo); 00854 return(ENOMEM); 00855 } 00856 00857 ptable = (PPARTITION_DESCRIPTOR)(SectorBuffer + (2*PARTITION_TABLE_OFFSET)); 00858 00859 if((status = LowOpenDisk(Path,&Handle)) != ESUCCESS) { 00860 AlDeallocateHeap(SectorBuffer); 00861 AlDeallocateHeap(DriveInfo); 00862 return(status); 00863 } 00864 00865 mbr = TRUE; 00866 Entry = 0; 00867 BootSector = 0; 00868 ExtendedStart = 0; 00869 status = ESUCCESS; 00870 00871 do { 00872 00873 if((status = LowReadSectors(Handle,bps,BootSector,1,SectorBuffer)) != ESUCCESS) { 00874 break; 00875 } 00876 00877 // This is to catch the case where there is no MBR yet. 00878 00879 if(((PUSHORT)SectorBuffer)[BOOT_SIGNATURE_OFFSET] != BOOT_RECORD_SIGNATURE) { 00880 break; 00881 } 00882 00883 Link = FALSE; 00884 00885 for(i=0; i<NUM_PARTITION_TABLE_ENTRIES; i++) { 00886 00887 if(ptable[i].PartitionType == SYSID_UNUSED) { 00888 00889 // set as unused. 00890 00891 p[Entry].PartitionType = SYSID_UNUSED; 00892 p[Entry].BootIndicator = FALSE; 00893 p[Entry].RewritePartition = FALSE; 00894 p[Entry].PartitionLength.QuadPart = 0; 00895 p[Entry].HiddenSectors = 0; 00896 p[Entry].StartingOffset.QuadPart = 0; 00897 p[Entry].RecognizedPartition = FALSE; 00898 00899 } else { 00900 00901 LARGE_INTEGER Result1, Result2; 00902 00903 p[Entry].PartitionType = ptable[i].PartitionType; 00904 p[Entry].BootIndicator = ptable[i].ActiveFlag; 00905 p[Entry].RewritePartition = FALSE; 00906 p[Entry].PartitionLength.QuadPart = UInt32x32To64(PLENGTH(ptable + i),bps); 00907 00908 // BUGBUG (tedm) the following are not correct for link 00909 // entries in the extended partition. 00910 // But fdisk does not use these values in 00911 // this case so blow it off. As of 00912 // 11/13/91, IoReadPartitionTable has the 00913 // same bug. 00914 00915 p[Entry].HiddenSectors = PSTART(ptable + i); 00916 Result1.QuadPart = UInt32x32To64(PSTART(ptable + i),bps); 00917 Result2.QuadPart = UInt32x32To64(BootSector,bps); 00918 p[Entry].StartingOffset.QuadPart = Result1.QuadPart + Result2.QuadPart; 00919 00920 p[Entry].RecognizedPartition = TRUE; // BUGBUG this is broken 00921 00922 if(p[Entry].PartitionType == SYSID_EXTENDED) { 00923 00924 Link = TRUE; 00925 00926 if(mbr) { 00927 mbr = FALSE; 00928 BootSector = PSTART(ptable + i); 00929 ExtendedStart = BootSector; 00930 } else { 00931 BootSector = ExtendedStart + PSTART(ptable + i); 00932 } 00933 } 00934 } 00935 Entry++; 00936 } 00937 } while(Link); 00938 00939 LowCloseDisk(Handle); 00940 00941 AlDeallocateHeap(SectorBuffer); 00942 00943 if(status != ESUCCESS) { 00944 00945 AlDeallocateHeap(DriveInfo); 00946 return(status); 00947 } 00948 00949 // reallocate DriveInfo, set PartitionCount field. 00950 // DriveInfo is shrinking. 00951 00952 DriveInfo = AlReallocateHeap(DriveInfo, 00953 sizeof(DRIVE_LAYOUT_INFORMATION) 00954 + ((Entry - 1) * sizeof(PARTITION_INFORMATION)) 00955 ); 00956 00957 DriveInfo->PartitionCount = Entry; 00958 00959 *DriveLayout = DriveInfo; 00960 00961 return(ESUCCESS); 00962 }

ARC_STATUS LowGetDriveGeometry IN PCHAR  DevicePath,
OUT PULONG  TotalSectorCount,
OUT PULONG  SectorSize,
OUT PULONG  SectorsPerTrack,
OUT PULONG  Heads
 

Definition at line 59 of file low.c.

References Buffer, LowGetPartitionGeometry(), SectorSize, and sprintf().

Referenced by GetGeometry(), LowGetDiskLayout(), and LowSetDiskLayout().

00066 { 00067 char Buffer[256]; 00068 00069 sprintf(Buffer,"%spartition(0)",DevicePath); 00070 return(LowGetPartitionGeometry(Buffer,TotalSectorCount,SectorSize,SectorsPerTrack,Heads)); 00071 }

ARC_STATUS LowGetPartitionGeometry IN PCHAR  PartitionPath,
OUT PULONG  TotalSectorCount,
OUT PULONG  SectorSize,
OUT PULONG  SectorsPerTrack,
OUT PULONG  Heads
 

Definition at line 76 of file low.c.

References ARC_STATUS, ArcClose, ArcGetComponent, ArcGetConfigurationData, ArcGetFileInformation, ArcOpen, ArcOpenReadOnly, CHAR, _CONFIGURATION_COMPONENT::ConfigurationDataLength, E2BIG, EINVAL, _FILE_INFORMATION::EndingAddress, ESUCCESS, FILE_INFORMATION, NULL, SectorSize, and _FILE_INFORMATION::StartingAddress.

Referenced by FmtFatFormat(), FmtIsFat(), and LowGetDriveGeometry().

00085 : 00086 00087 This routine computes the drive geometry for the given partition or 00088 physical disk. 00089 00090 Arguments: 00091 00092 PartitionPath - Supplies a path to the partition or physical disk. 00093 NumberOfSectors - Returns the number of sectors. 00094 SectorSize - Returns the sector size. 00095 SectorsPerTrack - Returns the number of sectors per track. 00096 Heads - Returns the number of heads. 00097 00098 Return Value: 00099 00100 ArcOpen, ArcGetFileInformation, ArcClose, E2BIG, ESUCCESS 00101 00102 --*/ 00103 { 00104 FILE_INFORMATION file_info; 00105 ARC_STATUS r; 00106 ULONG fileid; 00107 LARGE_INTEGER l; 00108 CM_DISK_GEOMETRY_DEVICE_DATA *DiskGeometry; 00109 CONFIGURATION_COMPONENT *DiskComponent; 00110 CM_PARTIAL_RESOURCE_LIST *DiskConfiguration; 00111 CHAR DataBuffer[sizeof(CM_PARTIAL_RESOURCE_LIST) + 00112 sizeof(CM_DISK_GEOMETRY_DEVICE_DATA)]; 00113 CM_PARTIAL_RESOURCE_DESCRIPTOR *DiskData; 00114 00115 // Always assume 512 bytes per sector. 00116 00117 *SectorSize = 512; 00118 00119 // Assume the SCSI default values for number of heads and sectors per track 00120 00121 *SectorsPerTrack = 32; 00122 *Heads = 64; 00123 00124 // See if there is device specific data describing the geometry of 00125 // the drive. If there is none, then just use the default SCSI 00126 // values. 00127 00128 DiskComponent = ArcGetComponent(PartitionPath); 00129 00130 if (DiskComponent == NULL) { 00131 return EINVAL; 00132 } 00133 00134 // 00135 // See if the ConfigurationDataLength is correct 00136 // It should contain one DeviceSpecific resource descriptor 00137 // 00138 00139 if (DiskComponent->ConfigurationDataLength == sizeof(CM_PARTIAL_RESOURCE_LIST) + 00140 sizeof(CM_DISK_GEOMETRY_DEVICE_DATA) ) { 00141 00142 DiskConfiguration = (CM_PARTIAL_RESOURCE_LIST *)DataBuffer; 00143 00144 r = ArcGetConfigurationData(DiskConfiguration,DiskComponent); 00145 00146 if (r == ESUCCESS) { 00147 00148 // 00149 // See if the Configuration Data has ARC version 1.3 or greater 00150 // 00151 00152 if ( (DiskConfiguration->Version == 1 && DiskConfiguration->Revision >=3 ) || 00153 (DiskConfiguration->Version > 1) ) { 00154 00155 DiskData = &(DiskConfiguration->PartialDescriptors[DiskConfiguration->Count-1]); 00156 00157 if (DiskData->Type == CmResourceTypeDeviceSpecific) { 00158 00159 if (DiskData->u.DeviceSpecificData.DataSize == sizeof(CM_DISK_GEOMETRY_DEVICE_DATA)) { 00160 DiskGeometry = (CM_DISK_GEOMETRY_DEVICE_DATA *) 00161 &(DiskConfiguration->PartialDescriptors[DiskConfiguration->Count]); 00162 *SectorsPerTrack = DiskGeometry->SectorsPerTrack; 00163 *Heads = DiskGeometry->NumberOfHeads; 00164 *SectorSize = DiskGeometry->BytesPerSector; 00165 } 00166 } 00167 } 00168 } 00169 } 00170 00171 // PrintError("SectorSize = %08x",*SectorSize); 00172 // PrintError("SectorsPerTrack = %08x",*SectorsPerTrack); 00173 // PrintError("Heads = %08x",*Heads); 00174 00175 r = ArcOpen(PartitionPath, ArcOpenReadOnly, &fileid); 00176 00177 if (r != ESUCCESS) { 00178 return r; 00179 } 00180 00181 r = ArcGetFileInformation(fileid, &file_info); 00182 00183 if (r != ESUCCESS) { 00184 return r; 00185 } 00186 00187 r = ArcClose(fileid); 00188 00189 if (r != ESUCCESS) { 00190 return r; 00191 } 00192 00193 l.QuadPart = file_info.EndingAddress.QuadPart - 00194 file_info.StartingAddress.QuadPart; 00195 00196 l.QuadPart = ((ULONGLONG)l.QuadPart) / ((ULONGLONG)(*SectorSize)); 00197 00198 if (l.HighPart) { 00199 return E2BIG; 00200 } 00201 00202 *TotalSectorCount = l.LowPart; 00203 00204 return ESUCCESS; 00205 }

ARC_STATUS LowOpenDisk IN PCHAR  DevicePath,
OUT PULONG  DiskId
 

Definition at line 6 of file low.c.

References ArcOpen, ArcOpenReadWrite, and sprintf().

Referenced by CheckIfDiskIsOffLine(), LowGetDiskLayout(), LowSetDiskLayout(), and ZapSector().

00012 : 00013 00014 This routine opens the supplied device for DASD access. 00015 00016 Arguments: 00017 00018 DevicePath - Supplies the device path to be opened. 00019 DiskId - Returns the disk id. 00020 00021 Return Value: 00022 00023 ArcOpen 00024 00025 --*/ 00026 { 00027 char buffer[256]; 00028 00029 sprintf(buffer,"%spartition(0)",DevicePath); 00030 00031 return ArcOpen(buffer, ArcOpenReadWrite, DiskId); 00032 }

ARC_STATUS LowQueryComponentList IN CONFIGURATION_CLASS *ConfigClass  OPTIONAL,
IN CONFIGURATION_TYPE *ConfigType  OPTIONAL,
OUT PCONFIGURATION_COMPONENT **  ComponentList,
OUT PULONG  ListLength
 

Definition at line 595 of file low.c.

References AllocateMemory, ARC_STATUS, ENOMEM, ESUCCESS, LowTraverseChildren(), and NULL.

Referenced by LowQueryPathList().

00603 : 00604 00605 This routine returns an array of components whose class and 00606 type match the ones given. (Since each parameter is optional, 00607 you can do type-only and class-only searches.) 00608 00609 The array is allocated on the heap and contains pointers to 00610 the actual components (NOT copies). 00611 00612 Arguments: 00613 00614 ConfigClass - Supplies the configuation class to search for. 00615 ConfigType - Supplies the configuration type to search for. 00616 ComponentList - Returns a list of pointers to components whose 00617 class and type match 'ConfigClass' and 00618 'ConfigType'. 00619 ListLength - Returns the number of components in the list. 00620 00621 Return Value: 00622 00623 LowTraverseChildren, ENOMEM 00624 00625 --*/ 00626 { 00627 ARC_STATUS r; 00628 00629 *ListLength = 0; 00630 00631 r = LowTraverseChildren(NULL, ConfigClass, ConfigType, NULL, ListLength); 00632 00633 if (r != ESUCCESS) { 00634 return r; 00635 } 00636 00637 if (!(*ComponentList = (PCONFIGURATION_COMPONENT*) AllocateMemory( 00638 (*ListLength)*sizeof(PCONFIGURATION_COMPONENT)))) { 00639 00640 return ENOMEM; 00641 } 00642 00643 *ListLength = 0; 00644 00645 return LowTraverseChildren(NULL, ConfigClass, ConfigType, 00646 *ComponentList, ListLength); 00647 }

ARC_STATUS LowQueryFdiskPathList OUT PCHAR **  PathList,
OUT PULONG  ListLength
 

Definition at line 756 of file low.c.

References CONFIGURATION_TYPE, DiskPeripheral, LowQueryPathList(), and NULL.

Referenced by FdiskInitialize().

00762 : 00763 00764 This routine returns a list of paths to all the devices of interest 00765 to FDISK. 00766 00767 Arguments: 00768 00769 PathList - Returns a list of paths. 00770 ListLength - Returns the length of the list. 00771 00772 Return Value: 00773 00774 LowQueryComponentList, LowQueryPathFromComponent, ESUCCESS 00775 00776 --*/ 00777 { 00778 CONFIGURATION_TYPE config_type; 00779 00780 config_type = DiskPeripheral; 00781 return LowQueryPathList(NULL, &config_type, PathList, ListLength); 00782 }

ARC_STATUS LowQueryPathFromComponent IN PCONFIGURATION_COMPONENT  Component,
OUT PCHAR *  Path
 

Definition at line 486 of file low.c.

References AlGetPathnameFromComponent(), AllocateMemory, ENOMEM, ESUCCESS, path, and strlen().

Referenced by LowQueryPathList().

00492 : 00493 00494 This routine computes a path from a component. The resulting 00495 path is allocated on the heap. 00496 00497 Arguments: 00498 00499 Component - Supplies a component. 00500 Path - Returns the path corresponding to that component. 00501 00502 Return Value: 00503 00504 ENOMEM, ESUCCESS 00505 00506 --*/ 00507 { 00508 PCHAR p; 00509 PCHAR path; 00510 00511 p = AlGetPathnameFromComponent(Component); 00512 00513 path = AllocateMemory(strlen(p) + 1); 00514 00515 if (!path) { 00516 return ENOMEM; 00517 } 00518 00519 strcpy(path, p); 00520 00521 *Path = path; 00522 00523 return ESUCCESS; 00524 }

ARC_STATUS LowQueryPathList IN CONFIGURATION_CLASS *ConfigClass  OPTIONAL,
IN CONFIGURATION_TYPE *ConfigType  OPTIONAL,
OUT PCHAR **  PathList,
OUT PULONG  ListLength
 

Definition at line 651 of file low.c.

References AllocateMemory, ARC_STATUS, ENOMEM, ESUCCESS, FreeMemory, LowFreePathList(), LowQueryComponentList(), LowQueryPathFromComponent(), and NULL.

Referenced by FmtQueryFatPartitionList(), and LowQueryFdiskPathList().

00659 : 00660 00661 This routine returns a list of paths to the components that are 00662 of class ConfigClass and of type ConfigType. 00663 00664 Arguments: 00665 00666 ConfigClass - Supplies the configuation class to search for. 00667 ConfigType - Supplies the configuration type to search for. 00668 PathList - Returns a list of paths to the components. 00669 ListLength - Returns the number of components in the list. 00670 00671 Return Value: 00672 00673 LowQueryComponentList, LowQueryPathFromComponent 00674 00675 --*/ 00676 { 00677 PCONFIGURATION_COMPONENT* component_list; 00678 ULONG list_length; 00679 ARC_STATUS r; 00680 ULONG i; 00681 PCHAR* path_list; 00682 00683 r = LowQueryComponentList(ConfigClass, ConfigType, 00684 &component_list, &list_length); 00685 00686 if (r != ESUCCESS) { 00687 return r; 00688 } 00689 00690 if (!(path_list = (PCHAR*) AllocateMemory(list_length*sizeof(PCHAR)))) { 00691 FreeMemory(component_list); 00692 return ENOMEM; 00693 } 00694 00695 00696 for (i = 0; i < list_length; i++) { 00697 path_list[i] = NULL; 00698 } 00699 00700 for (i = 0; i < list_length; i++) { 00701 00702 r = LowQueryPathFromComponent(component_list[i], &path_list[i]); 00703 00704 if (r != ESUCCESS) { 00705 FreeMemory(component_list); 00706 LowFreePathList(path_list, list_length); 00707 return r; 00708 } 00709 } 00710 00711 FreeMemory(component_list); 00712 00713 *PathList = path_list; 00714 *ListLength = list_length; 00715 00716 return ESUCCESS; 00717 }

ARC_STATUS LowReadSectors IN ULONG  VolumeId,
IN ULONG  SectorSize,
IN ULONG  StartingSector,
IN ULONG  NumberOfSectors,
OUT PVOID  Buffer
 

Definition at line 212 of file low.c.

References ARC_STATUS, ArcRead, ArcSeek, Buffer, c, EIO, ESUCCESS, MAX_TRANSFER, min, SectorSize, and SeekAbsolute.

Referenced by FmtIsFatPartition(), FmtVerifySectors(), and LowGetDiskLayout().

00221 : 00222 00223 This routine reads 'NumberOfSectors' sectors starting at sector 00224 'StartingSector' on the volume with ID 'VolumeId'. 00225 00226 Arguments: 00227 00228 VolumeId - Supplies the ID for the volume. 00229 SectorSize - Supplies the number of bytes per sector. 00230 StartingSector - Supplies the starting sector for the read. 00231 NumberOfSectors - Supplies the number of sectors to read. 00232 Buffer - Returns the read in sectors. 00233 00234 Return Value: 00235 00236 ArcSeek, ArcRead, EIO, ESUCCESS 00237 00238 --*/ 00239 { 00240 ARC_STATUS r; 00241 ULONG c; 00242 LARGE_INTEGER l; 00243 ULONG i; 00244 ULONG transfer; 00245 PCHAR buf; 00246 ULONG total; 00247 00248 00249 l.QuadPart = UInt32x32To64(StartingSector,SectorSize); 00250 00251 buf = (PCHAR) Buffer; 00252 00253 r = ArcSeek(VolumeId, &l, SeekAbsolute); 00254 00255 if (r != ESUCCESS) { 00256 return r; 00257 } 00258 00259 total = SectorSize*NumberOfSectors; 00260 00261 for (i = 0; i < total; i += MAX_TRANSFER) { 00262 00263 transfer = min(MAX_TRANSFER, total - i); 00264 00265 r = ArcRead(VolumeId, &buf[i], transfer, &c); 00266 00267 if (r != ESUCCESS) { 00268 return r; 00269 } 00270 00271 if (c != transfer) { 00272 return EIO; 00273 } 00274 } 00275 00276 return ESUCCESS; 00277 }

ARC_STATUS LowSetDiskLayout IN PCHAR  Path,
IN PDRIVE_LAYOUT_INFORMATION  DriveLayout
 

Definition at line 1076 of file low.c.

References AlAllocateHeap(), AlDeallocateHeap(), ARC_STATUS, ASRT, BOOT_RECORD_SIGNATURE, BOOT_SIGNATURE_OFFSET, CalculateCHSVals(), dummy(), ENOMEM, ENTRIES_PER_BOOTSECTOR, ESUCCESS, FALSE, Handle, LowCloseDisk(), LowGetDriveGeometry(), LowOpenDisk(), LowWriteSectors(), min, NULL, PARTITION_TABLE_OFFSET, _PARTITION_DESCRIPTOR::PartitionType, PUSHORT, SECCNT, SetPartitionTableEntry(), SYSID_EXTENDED, SYSID_UNUSED, TRUE, ZeroPartitionTable(), and ZeroPartitionTableEntry.

Referenced by WriteDriveLayout().

01080 { 01081 ARC_STATUS status; 01082 ULONG dummy,bps,spt,h; 01083 PCHAR SectorBuffer; 01084 ULONG Handle; 01085 PPARTITION_DESCRIPTOR PartitionTable; 01086 PPARTITION_INFORMATION p; 01087 BOOLEAN mbr = TRUE,Update; 01088 ULONG BootSector = 0,ExtendedPartitionStart = 0, 01089 NextBootSector; 01090 ULONG i,j,UsedCount; 01091 CHS chs; 01092 01093 01094 #define SECCNT(l) ((ULONG)(((ULONGLONG)l.QuadPart)/((ULONGLONG)bps))) 01095 01096 01097 ASRT(DriveLayout->PartitionCount); 01098 01099 if((status = LowGetDriveGeometry(Path,&dummy,&bps,&spt,&h)) != ESUCCESS) { 01100 return(status); 01101 } 01102 01103 // allocate a buffer for sector I/O 01104 01105 if((SectorBuffer = AlAllocateHeap(bps)) == NULL) { 01106 return(ENOMEM); 01107 } 01108 01109 // 01110 // Use x86 bootcode as a template so the disk will boot an x86 01111 // if it is moved to disk0 on an x86 machine. 01112 // 01113 RtlMoveMemory(SectorBuffer,x86BootCode,min(X86BOOTCODE_SIZE,bps)); 01114 01115 ((PUSHORT)SectorBuffer)[BOOT_SIGNATURE_OFFSET] = BOOT_RECORD_SIGNATURE; 01116 PartitionTable = (PPARTITION_DESCRIPTOR)(&(((PUSHORT)SectorBuffer)[PARTITION_TABLE_OFFSET])); 01117 01118 if((status = LowOpenDisk(Path,&Handle)) != ESUCCESS) { 01119 AlDeallocateHeap(SectorBuffer); 01120 return(status); 01121 } 01122 01123 ASRT(!(DriveLayout->PartitionCount % ENTRIES_PER_BOOTSECTOR)); 01124 for(i=0; i<DriveLayout->PartitionCount; i+=ENTRIES_PER_BOOTSECTOR) { 01125 01126 Update = FALSE; 01127 UsedCount = 0; 01128 01129 ZeroPartitionTable(PartitionTable); 01130 01131 for(j=0; j<ENTRIES_PER_BOOTSECTOR; j++) { 01132 01133 p = &DriveLayout->PartitionEntry[i+j]; 01134 01135 switch(p->PartitionType) { 01136 case SYSID_UNUSED: 01137 ZeroPartitionTableEntry(PartitionTable+j); 01138 break; 01139 01140 case SYSID_EXTENDED: 01141 NextBootSector = SECCNT(p->StartingOffset); 01142 CalculateCHSVals(NextBootSector,SECCNT(p->PartitionLength),spt,h,&chs); 01143 SetPartitionTableEntry(PartitionTable+j, 01144 p->BootIndicator, 01145 SYSID_EXTENDED, 01146 SECCNT(p->StartingOffset) - ExtendedPartitionStart, 01147 SECCNT(p->PartitionLength), 01148 &chs 01149 ); 01150 if(mbr) { 01151 mbr = FALSE; 01152 ExtendedPartitionStart = NextBootSector; 01153 } 01154 break; 01155 01156 default: 01157 CalculateCHSVals(SECCNT(p->StartingOffset),SECCNT(p->PartitionLength),spt,h,&chs); 01158 SetPartitionTableEntry(PartitionTable+j, 01159 p->BootIndicator, 01160 p->PartitionType, 01161 SECCNT(p->StartingOffset) - BootSector, 01162 SECCNT(p->PartitionLength), 01163 &chs 01164 ); 01165 break; 01166 } 01167 Update = Update || p->RewritePartition; 01168 01169 if(p->PartitionType != SYSID_UNUSED) { 01170 UsedCount++; 01171 } 01172 } 01173 if(Update || !UsedCount) { 01174 if((status = LowWriteSectors(Handle,bps,BootSector,1,SectorBuffer)) != ESUCCESS) { 01175 LowCloseDisk(Handle); 01176 AlDeallocateHeap(SectorBuffer); 01177 return(status); 01178 } 01179 } 01180 BootSector = NextBootSector; 01181 } 01182 01183 LowCloseDisk(Handle); 01184 AlDeallocateHeap(SectorBuffer); 01185 return(ESUCCESS); 01186 }

ARC_STATUS LowWriteSectors IN ULONG  VolumeId,
IN ULONG  SectorSize,
IN ULONG  StartingSector,
IN ULONG  NumberOfSectors,
IN PVOID  Buffer
 

Definition at line 281 of file low.c.

References ARC_STATUS, ArcSeek, ArcWrite, Buffer, c, EIO, ESUCCESS, MAX_TRANSFER, min, SectorSize, and SeekAbsolute.

Referenced by FmtFatFormat(), LowSetDiskLayout(), and ZapSector().

00290 : 00291 00292 This routine write 'NumberOfSectors' sectors starting at sector 00293 'StartingSector' on the volume with ID 'VolumeId'. 00294 00295 Arguments: 00296 00297 VolumeId - Supplies the ID for the volume. 00298 SectorSize - Supplies the number of bytes per sector. 00299 StartingSector - Supplies the starting sector for the write. 00300 NumberOfSectors - Supplies the number of sectors to write. 00301 Buffer - Supplies the sectors to write. 00302 00303 Return Value: 00304 00305 ArcSeek, ArcWrite, EIO, ESUCCESS 00306 00307 --*/ 00308 { 00309 ARC_STATUS r; 00310 ULONG c; 00311 LARGE_INTEGER l; 00312 ULONG i; 00313 ULONG transfer; 00314 PCHAR buf; 00315 ULONG total; 00316 00317 l.QuadPart = UInt32x32To64(StartingSector,SectorSize); 00318 00319 buf = (PCHAR) Buffer; 00320 00321 r = ArcSeek(VolumeId, &l, SeekAbsolute); 00322 00323 if (r != ESUCCESS) { 00324 return r; 00325 } 00326 00327 total = SectorSize*NumberOfSectors; 00328 00329 for (i = 0; i < total; i += MAX_TRANSFER) { 00330 00331 transfer = min(MAX_TRANSFER, total - i); 00332 00333 r = ArcWrite(VolumeId, &buf[i], transfer, &c); 00334 00335 if (r != ESUCCESS) { 00336 return r; 00337 } 00338 00339 if (c != transfer) { 00340 return EIO; 00341 } 00342 } 00343 00344 return ESUCCESS; 00345 }

VOID SetPartitionActiveFlag IN PREGION_DESCRIPTOR  Region,
IN UCHAR  value
 

VOID SetSysID IN ULONG  Disk,
IN ULONG  Partition,
IN UCHAR  SysID
 

Definition at line 1366 of file fdengine.c.

References ASRT, CHANGED_DONT_ZAP, ChangesMade, _tagPARTITION::Disk, FindPartitionElement(), _tagPARTITION::SysID, TRUE, and _tagPARTITION::Update.

Referenced by DoMakePartitionSystemPartition(), and DoSystemPartitionCreate().

01374 : 01375 01376 This routine sets the system id of the given partition 01377 on the given disk. 01378 01379 Arguments: 01380 01381 Disk - index of relevent disk 01382 01383 Partition - partition number of relevent partition 01384 01385 SysID - new system ID for Partition on Disk 01386 01387 Return Value: 01388 01389 None. 01390 01391 --*/ 01392 01393 { 01394 PPARTITION p = FindPartitionElement(Disk,Partition); 01395 01396 ASRT(p); 01397 01398 if(p) { 01399 p->SysID = SysID; 01400 if(!p->Update) { 01401 p->Update = CHANGED_DONT_ZAP; 01402 } 01403 ChangesMade[p->Disk] = TRUE; 01404 } 01405 }

VOID SetSysID2 IN PREGION_DESCRIPTOR  Region,
IN UCHAR  SysID
 

Definition at line 1409 of file fdengine.c.

References CHANGED_DONT_ZAP, ChangesMade, _tagPARTITION::Disk, _tagPARTITION::SysID, TRUE, and _tagPARTITION::Update.

01413 { 01414 PPARTITION p = ((PREGION_DATA)(Region->Reserved))->Partition; 01415 01416 p->SysID = SysID; 01417 if(!p->Update) { 01418 p->Update = CHANGED_DONT_ZAP; 01419 } 01420 ChangesMade[p->Disk] = TRUE; 01421 }

ULONG SIZEMB IN LARGE_INTEGER  ByteCount  ) 
 

Definition at line 1972 of file fdengine.c.

References ONE_MEG.

Referenced by DiskSizeMB(), FdGetMaximumSizeMB(), FdGetMinimumSizeMB(), and GetRegions().

01978 : 01979 01980 Calculate the size in megabytes of a given byte count. The value is 01981 properly rounded (ie, not merely truncated). 01982 01983 This function replaces a macro of the same name that was truncating 01984 instead of rounding. 01985 01986 Arguments: 01987 01988 ByteCount - supplies number of bytes 01989 01990 Return Value: 01991 01992 Size in MB equivalent to ByteCount. 01993 01994 --*/ 01995 01996 { 01997 ULONG Remainder; 01998 ULONG SizeMB; 01999 02000 SizeMB = (ULONG)((ULONGLONG)ByteCount.QuadPart / (ULONGLONG)ONE_MEG); 02001 Remainder = (ULONG)((ULONGLONG)ByteCount.QuadPart % (ULONGLONG)ONE_MEG); 02002 02003 if(Remainder >= ONE_MEG/2) { 02004 SizeMB++; 02005 } 02006 02007 return(SizeMB); 02008 }

VOID vAlStatusMsg IN ULONG  Row,
IN BOOLEAN  Error,
IN PCHAR  FormatString,
IN va_list  ArgumentList
 

Definition at line 947 of file almisc.c.

References AlPrint(), AlSetPosition, AlSetScreenAttributes, AlSetScreenColor, ARC_CONSOLE_OUTPUT, ArcWrite, Count, Error, MSGMARGIN, and text.

Referenced by AlStatusMsg(), AlStatusMsgNoWait(), PrintError(), PrintErrorMsg(), and PrintMsg().

00953 { 00954 char text[256]; 00955 ULONG Length,Count; 00956 00957 AlSetPosition(Row,0); 00958 AlPrint(MSGMARGIN); 00959 Length = vsprintf(text,FormatString,ArgumentList); 00960 if(Error) { 00961 AlSetScreenColor(1,4); // red on blue 00962 } else { 00963 AlSetScreenColor(3,4); // yellow on blue 00964 } 00965 AlSetScreenAttributes(1,0,0); // hi intensity 00966 ArcWrite(ARC_CONSOLE_OUTPUT,text,Length,&Count); 00967 AlPrint("\r\n"); 00968 AlSetScreenColor(7,4); // white on blue 00969 AlSetScreenAttributes(1,0,0); // hi intensity 00970 }


Variable Documentation

PCHAR BootString[]
 

Definition at line 819 of file arcinst.h.

Referenced by DoPartitionDelete().

char MSGMARGIN[]
 

Definition at line 297 of file arcinst.h.

Referenced by AlWaitKey(), Confirm(), DoPartitionCreate(), FmtVerifySectors(), and vAlStatusMsg().


Generated on Sat May 15 19:42:55 2004 for test by doxygen 1.3.7