xref: /reactos/base/setup/lib/fsutil.h (revision 8a978a17)
1 /*
2  * PROJECT:     ReactOS Setup Library
3  * LICENSE:     GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
4  * PURPOSE:     Filesystem support functions
5  * COPYRIGHT:   Copyright 2003-2019 Casper S. Hornstrup (chorns@users.sourceforge.net)
6  *              Copyright 2017-2020 Hermes Belusca-Maito
7  */
8 
9 #pragma once
10 
11 #include <fmifs/fmifs.h>
12 
13 /** QueryAvailableFileSystemFormat() **/
14 BOOLEAN
15 GetRegisteredFileSystems(
16     IN ULONG Index,
17     OUT PCWSTR* FileSystemName);
18 
19 
20 /** ChkdskEx() **/
21 NTSTATUS
22 ChkdskFileSystem_UStr(
23     IN PUNICODE_STRING DriveRoot,
24     IN PCWSTR FileSystemName,
25     IN BOOLEAN FixErrors,
26     IN BOOLEAN Verbose,
27     IN BOOLEAN CheckOnlyIfDirty,
28     IN BOOLEAN ScanDrive,
29     IN PFMIFSCALLBACK Callback);
30 
31 NTSTATUS
32 ChkdskFileSystem(
33     IN PCWSTR DriveRoot,
34     IN PCWSTR FileSystemName,
35     IN BOOLEAN FixErrors,
36     IN BOOLEAN Verbose,
37     IN BOOLEAN CheckOnlyIfDirty,
38     IN BOOLEAN ScanDrive,
39     IN PFMIFSCALLBACK Callback);
40 
41 
42 /** FormatEx() **/
43 NTSTATUS
44 FormatFileSystem_UStr(
45     IN PUNICODE_STRING DriveRoot,
46     IN PCWSTR FileSystemName,
47     IN FMIFS_MEDIA_FLAG MediaFlag,
48     IN PUNICODE_STRING Label,
49     IN BOOLEAN QuickFormat,
50     IN ULONG ClusterSize,
51     IN PFMIFSCALLBACK Callback);
52 
53 NTSTATUS
54 FormatFileSystem(
55     IN PCWSTR DriveRoot,
56     IN PCWSTR FileSystemName,
57     IN FMIFS_MEDIA_FLAG MediaFlag,
58     IN PCWSTR Label,
59     IN BOOLEAN QuickFormat,
60     IN ULONG ClusterSize,
61     IN PFMIFSCALLBACK Callback);
62 
63 
64 //
65 // Bootsector routines
66 //
67 
68 #define FAT_BOOTSECTOR_SIZE     (1 * SECTORSIZE)
69 #define FAT32_BOOTSECTOR_SIZE   (1 * SECTORSIZE) // Counts only the primary sector.
70 #define BTRFS_BOOTSECTOR_SIZE   (3 * SECTORSIZE)
71 
72 typedef NTSTATUS
73 (/*NTAPI*/ *PFS_INSTALL_BOOTCODE)(
74     IN PCWSTR SrcPath,          // Bootsector source file (on the installation medium)
75     IN HANDLE DstPath,          // Where to save the bootsector built from the source + partition information
76     IN HANDLE RootPartition);   // Partition holding the (old) bootsector data information
77 
78 NTSTATUS
79 InstallFatBootCode(
80     IN PCWSTR SrcPath,
81     IN HANDLE DstPath,
82     IN HANDLE RootPartition);
83 
84 #define InstallFat12BootCode    InstallFatBootCode
85 #define InstallFat16BootCode    InstallFatBootCode
86 
87 NTSTATUS
88 InstallFat32BootCode(
89     IN PCWSTR SrcPath,
90     IN HANDLE DstPath,
91     IN HANDLE RootPartition);
92 
93 NTSTATUS
94 InstallBtrfsBootCode(
95     IN PCWSTR SrcPath,
96     IN HANDLE DstPath,
97     IN HANDLE RootPartition);
98 
99 
100 //
101 // Formatting routines
102 //
103 
104 struct _PARTENTRY; // Defined in partlist.h
105 
106 BOOLEAN
107 PreparePartitionForFormatting(
108     IN struct _PARTENTRY* PartEntry,
109     IN PCWSTR FileSystemName);
110 
111 /* EOF */
112