Skip to content

Commit 1f2d67a

Browse files
authored
[FS_REC] Rename Ext2 recognizer to Ext recognizer (reactos#7497)
Rename the Ext2 recognizer to a more generic Ext to be more future-proof with a possible upcoming ext4 support. Also, it already makes no sense to use the name ext2 as it already recognizes all the FS of the "Ext family". In addition, add the Ext Recognizer for CDs.
1 parent 8f0337f commit 1f2d67a

File tree

5 files changed

+47
-35
lines changed

5 files changed

+47
-35
lines changed

drivers/filesystems/fs_rec/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ list(APPEND SOURCE
22
blockdev.c
33
btrfs.c
44
cdfs.c
5-
ext2.c
5+
ext.c
66
fat.c
77
fatx.c
88
ffs.c
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
/*
22
* COPYRIGHT: See COPYING in the top level directory
33
* PROJECT: ReactOS File System Recognizer
4-
* FILE: drivers/filesystems/fs_rec/ext2.c
5-
* PURPOSE: EXT2 Recognizer
4+
* FILE: drivers/filesystems/fs_rec/ext.c
5+
* PURPOSE: EXT Recognizer
66
* PROGRAMMER: Eric Kohl
77
* Pierre Schweitzer ([email protected])
88
*/
99

1010
/* INCLUDES *****************************************************************/
1111

1212
#include "fs_rec.h"
13-
#include "ext2.h"
13+
#include "ext.h"
1414

1515
#define NDEBUG
1616
#include <debug.h>
@@ -19,21 +19,21 @@
1919

2020
BOOLEAN
2121
NTAPI
22-
FsRecIsExt2Volume(IN PEXT2_SUPER_BLOCK SuperBlock)
22+
FsRecIsExtVolume(IN PEXT_SUPER_BLOCK SuperBlock)
2323
{
2424
/* Just check for magic */
25-
return (SuperBlock->Magic == EXT2_SUPER_MAGIC);
25+
return (SuperBlock->Magic == EXT_SUPER_MAGIC);
2626
}
2727

2828
NTSTATUS
2929
NTAPI
30-
FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject,
31-
IN PIRP Irp)
30+
FsRecExtFsControl(IN PDEVICE_OBJECT DeviceObject,
31+
IN PIRP Irp)
3232
{
3333
PIO_STACK_LOCATION Stack;
3434
NTSTATUS Status;
3535
PDEVICE_OBJECT MountDevice;
36-
PEXT2_SUPER_BLOCK Spb = NULL;
36+
PEXT_SUPER_BLOCK Spb = NULL;
3737
ULONG SectorSize;
3838
LARGE_INTEGER Offset;
3939
BOOLEAN DeviceError = FALSE;
@@ -53,16 +53,16 @@ FsRecExt2FsControl(IN PDEVICE_OBJECT DeviceObject,
5353
if (FsRecGetDeviceSectorSize(MountDevice, &SectorSize))
5454
{
5555
/* Try to read the superblock */
56-
Offset.QuadPart = EXT2_SB_OFFSET;
56+
Offset.QuadPart = EXT_SB_OFFSET;
5757
if (FsRecReadBlock(MountDevice,
5858
&Offset,
59-
EXT2_SB_SIZE,
59+
EXT_SB_SIZE,
6060
SectorSize,
6161
(PVOID)&Spb,
6262
&DeviceError))
6363
{
64-
/* Check if it's an actual EXT2 volume */
65-
if (FsRecIsExt2Volume(Spb))
64+
/* Check if it's an actual EXT volume */
65+
if (FsRecIsExtVolume(Spb))
6666
{
6767
/* It is! */
6868
Status = STATUS_FS_DRIVER_REQUIRED;
Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
/*
22
* COPYRIGHT: See COPYING in the top level directory
33
* PROJECT: ReactOS File System Recognizer
4-
* FILE: drivers/filesystems/fs_rec/ext2.h
5-
* PURPOSE: EXT2 Header File
4+
* FILE: drivers/filesystems/fs_rec/ext.h
5+
* PURPOSE: EXT Header File
66
* PROGRAMMER: Pierre Schweitzer ([email protected])
77
*/
88

99
#include <pshpack1.h>
10-
typedef struct _EXT2_SUPER_BLOCK {
10+
typedef struct _EXT_SUPER_BLOCK {
1111
ULONG InodesCount;
1212
ULONG BlocksCount;
1313
ULONG ReservedBlocksCount;
@@ -34,15 +34,15 @@ typedef struct _EXT2_SUPER_BLOCK {
3434
USHORT DefResUid;
3535
USHORT DefResGid;
3636
// Partial
37-
} EXT2_SUPER_BLOCK, *PEXT2_SUPER_BLOCK;
37+
} EXT_SUPER_BLOCK, *PEXT_SUPER_BLOCK;
3838
#include <poppack.h>
3939

40-
C_ASSERT(FIELD_OFFSET(EXT2_SUPER_BLOCK, FreeInodesCount) == 0x10);
41-
C_ASSERT(FIELD_OFFSET(EXT2_SUPER_BLOCK, BlocksPerGroup) == 0x20);
42-
C_ASSERT(FIELD_OFFSET(EXT2_SUPER_BLOCK, WriteTime) == 0x30);
43-
C_ASSERT(FIELD_OFFSET(EXT2_SUPER_BLOCK, LastCheck) == 0x40);
44-
C_ASSERT(FIELD_OFFSET(EXT2_SUPER_BLOCK, DefResUid) == 0x50);
40+
C_ASSERT(FIELD_OFFSET(EXT_SUPER_BLOCK, FreeInodesCount) == 0x10);
41+
C_ASSERT(FIELD_OFFSET(EXT_SUPER_BLOCK, BlocksPerGroup) == 0x20);
42+
C_ASSERT(FIELD_OFFSET(EXT_SUPER_BLOCK, WriteTime) == 0x30);
43+
C_ASSERT(FIELD_OFFSET(EXT_SUPER_BLOCK, LastCheck) == 0x40);
44+
C_ASSERT(FIELD_OFFSET(EXT_SUPER_BLOCK, DefResUid) == 0x50);
4545

46-
#define EXT2_SUPER_MAGIC 0xEF53
47-
#define EXT2_SB_OFFSET 0x400
48-
#define EXT2_SB_SIZE 0x400
46+
#define EXT_SUPER_MAGIC 0xEF53
47+
#define EXT_SB_OFFSET 0x400
48+
#define EXT_SB_SIZE 0x400

drivers/filesystems/fs_rec/fs_rec.c

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ FsRecFsControl(IN PDEVICE_OBJECT DeviceObject,
158158
Status = FsRecUdfsFsControl(DeviceObject, Irp);
159159
break;
160160

161-
case FS_TYPE_EXT2:
161+
case FS_TYPE_EXT:
162162

163-
/* Send EXT2 command */
164-
Status = FsRecExt2FsControl(DeviceObject, Irp);
163+
/* Send EXT command */
164+
Status = FsRecExtFsControl(DeviceObject, Irp);
165165
break;
166166

167167
case FS_TYPE_BTRFS:
@@ -329,6 +329,7 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
329329
PDEVICE_OBJECT CdfsObject;
330330
PDEVICE_OBJECT UdfsObject;
331331
PDEVICE_OBJECT FatObject;
332+
PDEVICE_OBJECT ExtObject;
332333

333334
PAGED_CODE();
334335

@@ -430,17 +431,28 @@ DriverEntry(IN PDRIVER_OBJECT DriverObject,
430431
0);
431432
if (NT_SUCCESS(Status)) DeviceCount++;
432433

433-
/* Register EXT2 */
434+
/* Register EXT */
434435
Status = FsRecRegisterFs(DriverObject,
435436
NULL,
436-
NULL,
437-
L"\\Ext2fs",
438-
L"\\FileSystem\\Ext2Recognizer",
439-
FS_TYPE_EXT2,
437+
&ExtObject,
438+
L"\\Extfs",
439+
L"\\FileSystem\\ExtRecognizer",
440+
FS_TYPE_EXT,
440441
FILE_DEVICE_DISK_FILE_SYSTEM,
441442
0);
442443
if (NT_SUCCESS(Status)) DeviceCount++;
443444

445+
/* Register EXT for CDs */
446+
Status = FsRecRegisterFs(DriverObject,
447+
ExtObject,
448+
NULL,
449+
L"\\ExtfsCdrom",
450+
L"\\FileSystem\\ExtCdRomRecognizer",
451+
FS_TYPE_EXT,
452+
FILE_DEVICE_CD_ROM_FILE_SYSTEM,
453+
0);
454+
if (NT_SUCCESS(Status)) DeviceCount++;
455+
444456
/* Register BTRFS */
445457
Status = FsRecRegisterFs(DriverObject,
446458
NULL,

drivers/filesystems/fs_rec/fs_rec.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ typedef enum _FILE_SYSTEM_TYPE
173173
FS_TYPE_NTFS,
174174
FS_TYPE_CDFS,
175175
FS_TYPE_UDFS,
176-
FS_TYPE_EXT2,
176+
FS_TYPE_EXT,
177177
FS_TYPE_BTRFS,
178178
FS_TYPE_REISERFS,
179179
FS_TYPE_FFS,
@@ -227,7 +227,7 @@ FsRecUdfsFsControl(
227227

228228
NTSTATUS
229229
NTAPI
230-
FsRecExt2FsControl(
230+
FsRecExtFsControl(
231231
IN PDEVICE_OBJECT DeviceObject,
232232
IN PIRP Irp
233233
);

0 commit comments

Comments
 (0)