forked from reactos/reactos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WIP - [SETUPLIB][USETUP] Isolate and decouple the filesystem volume o…
…perations code from the UI. The idea is similar to the SetupCommitFileQueue() function: filesystem volume operations are "queued" (and are retrieved via the GetNextUnformatted/UncheckedPartition() helpers) and processed via a "commit queue", that employs a user-specified callback. That latter one can deal with displaying the appropriate UI screens, etc.
- Loading branch information
Showing
9 changed files
with
1,327 additions
and
726 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
/* | ||
* PROJECT: ReactOS Setup Library | ||
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+) | ||
* PURPOSE: Filesystem support functions | ||
* PURPOSE: Filesystem Format and ChkDsk support functions. | ||
* COPYRIGHT: Copyright 2003-2019 Casper S. Hornstrup ([email protected]) | ||
* Copyright 2017-2020 Hermes Belusca-Maito | ||
*/ | ||
|
@@ -101,11 +101,121 @@ InstallBtrfsBootCode( | |
// Formatting routines | ||
// | ||
|
||
struct _PARTENTRY; // Defined in partlist.h | ||
NTSTATUS // ERROR_NUMBER | ||
FormatPartition( | ||
IN PPARTENTRY PartEntry, | ||
IN PCWSTR FileSystemName, | ||
IN FMIFS_MEDIA_FLAG MediaFlag, | ||
IN PCWSTR Label, | ||
IN BOOLEAN QuickFormat, | ||
IN ULONG ClusterSize, | ||
IN PFMIFSCALLBACK Callback); | ||
|
||
NTSTATUS // ERROR_NUMBER | ||
// ChkdskPartition | ||
CheckPartition( | ||
IN PPARTENTRY PartEntry, | ||
IN BOOLEAN FixErrors, | ||
IN BOOLEAN Verbose, | ||
IN BOOLEAN CheckOnlyIfDirty, | ||
IN BOOLEAN ScanDrive, | ||
IN PFMIFSCALLBACK Callback); | ||
|
||
|
||
// | ||
// FileSystem Volume Operations Queue | ||
// | ||
|
||
// Like the SPFILENOTIFY_xxxx values | ||
typedef enum _FSVOLNOTIFY | ||
{ | ||
FSVOLNOTIFY_STARTQUEUE = 0, | ||
FSVOLNOTIFY_ENDQUEUE, | ||
FSVOLNOTIFY_STARTSUBQUEUE, | ||
FSVOLNOTIFY_ENDSUBQUEUE, | ||
FSVOLNOTIFY_PREPAREFORMAT, | ||
FSVOLNOTIFY_STARTFORMAT, | ||
FSVOLNOTIFY_ENDFORMAT, | ||
ChangeSystemPartition, // FIXME: Deprecate! | ||
SystemPartitionError, // FIXME: Deprecate! | ||
FSVOLNOTIFY_FORMATERROR, | ||
// FSVOLNOTIFY_PREPARECHECK, | ||
FSVOLNOTIFY_STARTCHECK, | ||
FSVOLNOTIFY_ENDCHECK, | ||
FSVOLNOTIFY_CHECKERROR | ||
} FSVOLNOTIFY; | ||
|
||
// Like the FILEOP_xxxx values | ||
typedef enum _FSVOL_OP | ||
{ | ||
/* Operations ****/ | ||
FSVOL_FORMAT = 0, | ||
FSVOL_CHECK, | ||
/* Response actions ****/ | ||
FSVOL_ABORT = 0, | ||
FSVOL_DOIT, | ||
FSVOL_RETRY = FSVOL_DOIT, | ||
FSVOL_SKIP, | ||
} FSVOL_OP; | ||
|
||
#define ERROR_SYSTEM_PARTITION_NOT_FOUND (ERROR_LAST_ERROR_CODE + 1) | ||
|
||
typedef struct _FORMAT_PARTITION_INFO | ||
{ | ||
PPARTENTRY PartEntry; | ||
// PCWSTR NtPathPartition; | ||
NTSTATUS ErrorStatus; | ||
|
||
/* Input information given by the 'FSVOLNOTIFY_PREPAREFORMAT' step ****/ | ||
PCWSTR FileSystemName; | ||
FMIFS_MEDIA_FLAG MediaFlag; | ||
PCWSTR Label; | ||
BOOLEAN QuickFormat; | ||
ULONG ClusterSize; | ||
PFMIFSCALLBACK Callback; | ||
|
||
} FORMAT_PARTITION_INFO, *PFORMAT_PARTITION_INFO; | ||
|
||
typedef struct _CHECK_PARTITION_INFO | ||
{ | ||
PPARTENTRY PartEntry; | ||
// PCWSTR NtPathPartition; | ||
NTSTATUS ErrorStatus; | ||
|
||
/* Input information given by the 'FSVOLNOTIFY_STARTCHECK' step ****/ | ||
// PCWSTR FileSystemName; // Obtained from PartEntry! | ||
BOOLEAN FixErrors; | ||
BOOLEAN Verbose; | ||
BOOLEAN CheckOnlyIfDirty; | ||
BOOLEAN ScanDrive; | ||
PFMIFSCALLBACK Callback; | ||
|
||
} CHECK_PARTITION_INFO, *PCHECK_PARTITION_INFO; | ||
|
||
typedef FSVOL_OP | ||
(CALLBACK *PFSVOL_CALLBACK)( | ||
IN PVOID Context OPTIONAL, | ||
IN FSVOLNOTIFY FormatStatus, | ||
IN ULONG_PTR Param1, | ||
IN ULONG_PTR Param2); | ||
|
||
BOOLEAN | ||
CommitFsVolOpsQueue( | ||
IN PPARTLIST PartitionList, | ||
IN PPARTENTRY InstallPartition, | ||
IN PPARTENTRY SystemPartition, | ||
IN PFSVOL_CALLBACK FsVolCallback OPTIONAL, | ||
IN PVOID Context OPTIONAL); | ||
|
||
/* | ||
* FIXME: TODO: Setup-specific stuff; find a better place to put it! | ||
*/ | ||
BOOLEAN | ||
PreparePartitionForFormatting( | ||
IN struct _PARTENTRY* PartEntry, | ||
IN PCWSTR FileSystemName); | ||
InitSystemPartition( | ||
IN PPARTLIST PartitionList, | ||
IN PPARTENTRY InstallPartition, | ||
OUT PPARTENTRY* pSystemPartition, | ||
IN PFSVOL_CALLBACK FsVolCallback OPTIONAL, | ||
IN PVOID Context OPTIONAL); | ||
|
||
/* EOF */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.