mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 05:51:44 +00:00
[SETUPLIB][USETUP] Some cleanup for partition code.
- Make the Create*Partition helpers take a size in bytes, not in sectors. This allows them to be easier to use by the caller, alleviating the need for making the size conversion into sectors. Instead it is done internally by the helpers. - Introduce helper macros to easily retrieve the size of a partition entry or a disk in bytes, from their internal representation in number of sectors. - The 'AutoCreate' variable being USETUP-specific, remove it from the PARTENTRY structure and use instead a flag set into the 'New' member. - Rename IsDiskSizeValid to IsPartitionLargeEnough, to better describe what the function is for.
This commit is contained in:
parent
b2ec78673d
commit
b7ad4a2298
5 changed files with 143 additions and 131 deletions
|
@ -70,9 +70,6 @@ typedef struct _PARTENTRY
|
|||
/* Partition is new, table does not exist on disk yet */
|
||||
BOOLEAN New;
|
||||
|
||||
/* Partition was created automatically */
|
||||
BOOLEAN AutoCreate;
|
||||
|
||||
/* Partition must be checked */
|
||||
BOOLEAN NeedsCheck;
|
||||
|
||||
|
@ -227,6 +224,16 @@ RoundingDivide(
|
|||
IN ULONGLONG Divisor);
|
||||
|
||||
|
||||
#define GetPartEntryOffsetInBytes(PartEntry) \
|
||||
((PartEntry)->StartSector.QuadPart * (PartEntry)->DiskEntry->BytesPerSector)
|
||||
|
||||
#define GetPartEntrySizeInBytes(PartEntry) \
|
||||
((PartEntry)->SectorCount.QuadPart * (PartEntry)->DiskEntry->BytesPerSector)
|
||||
|
||||
#define GetDiskSizeInBytes(DiskEntry) \
|
||||
((DiskEntry)->SectorCount.QuadPart * (DiskEntry)->BytesPerSector)
|
||||
|
||||
|
||||
BOOLEAN
|
||||
IsSuperFloppy(
|
||||
IN PDISKENTRY DiskEntry);
|
||||
|
@ -306,14 +313,13 @@ BOOLEAN
|
|||
CreatePartition(
|
||||
_In_ PPARTLIST List,
|
||||
_Inout_ PPARTENTRY PartEntry,
|
||||
_In_ ULONGLONG SectorCount,
|
||||
_In_ BOOLEAN AutoCreate);
|
||||
_In_opt_ ULONGLONG SizeBytes);
|
||||
|
||||
BOOLEAN
|
||||
CreateExtendedPartition(
|
||||
_In_ PPARTLIST List,
|
||||
_Inout_ PPARTENTRY PartEntry,
|
||||
_In_ ULONGLONG SectorCount);
|
||||
_In_opt_ ULONGLONG SizeBytes);
|
||||
|
||||
NTSTATUS
|
||||
DismountVolume(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue