1
0
mirror of https://github.com/bobranten/Ext4Fsd.git synced 2025-10-29 13:18:30 -05:00

Ext2Mgr list other common filesystems

This commit is contained in:
Bo Branten
2024-06-25 14:07:46 +02:00
parent 9d5e749bdc
commit cff159a1d1
2 changed files with 71 additions and 1 deletions

View File

@@ -2189,6 +2189,57 @@ Ext2QueryVolumeFS(
// Show swap partitions as unused.
volume->FssInfo.AvailableAllocationUnits = volume->FssInfo.TotalAllocationUnits;
volume->bRecognized = TRUE;
goto errorout;
}
if (*((PULONG)&buffer[XFS_MAGIC_OFFSET]) == XFS_SB_MAGIC_LE) {
volume->FsaInfo.FileSystemNameLength = 6;
volume->FsaInfo.FileSystemName[0] = (WCHAR)'X';
volume->FsaInfo.FileSystemName[1] = (WCHAR)'F';
volume->FsaInfo.FileSystemName[2] = (WCHAR)'S';
goto errorout;
}
// The LVM superblock is stored in one of the first 4 sectors as an option to pvcreate
if ((memcmp(&buffer[0*512], LVM_MAGIC, 8) == 0) ||
(memcmp(&buffer[1*512], LVM_MAGIC, 8) == 0) ||
(memcmp(&buffer[2*512], LVM_MAGIC, 8) == 0) ||
(memcmp(&buffer[3*512], LVM_MAGIC, 8) == 0)) {
volume->FsaInfo.FileSystemNameLength = 6;
volume->FsaInfo.FileSystemName[0] = (WCHAR)'L';
volume->FsaInfo.FileSystemName[1] = (WCHAR)'V';
volume->FsaInfo.FileSystemName[2] = (WCHAR)'M';
goto errorout;
}
if (*((PULONG)&buffer[512]) == BSD_DISKMAGIC) {
volume->FsaInfo.FileSystemNameLength = 6;
volume->FsaInfo.FileSystemName[0] = (WCHAR)'B';
volume->FsaInfo.FileSystemName[1] = (WCHAR)'S';
volume->FsaInfo.FileSystemName[2] = (WCHAR)'D';
goto errorout;
}
Ext2Read(Handle, FALSE, 512, (ULONGLONG)BTRFS_SUPER_BLOCK_OFFSET, 4096, buffer);
if (*((PULONGLONG)&buffer[BTRFS_MAGIC_OFFSET]) == BTRFS_MAGIC) {
volume->FsaInfo.FileSystemNameLength = 10;
volume->FsaInfo.FileSystemName[0] = (WCHAR)'B';
volume->FsaInfo.FileSystemName[1] = (WCHAR)'T';
volume->FsaInfo.FileSystemName[2] = (WCHAR)'R';
volume->FsaInfo.FileSystemName[3] = (WCHAR)'F';
volume->FsaInfo.FileSystemName[4] = (WCHAR)'S';
goto errorout;
}
Ext2Read(Handle, FALSE, 512, (ULONGLONG)RAID_SUPER_BLOCK_OFFSET, 4096, buffer);
if (*((PULONG)&buffer[RAID_MAGIC_OFFSET]) == RAID_MAGIC) {
volume->FsaInfo.FileSystemNameLength = 8;
volume->FsaInfo.FileSystemName[0] = (WCHAR)'R';
volume->FsaInfo.FileSystemName[1] = (WCHAR)'A';
volume->FsaInfo.FileSystemName[2] = (WCHAR)'I';
volume->FsaInfo.FileSystemName[3] = (WCHAR)'D';
}
errorout:

View File

@@ -1,7 +1,7 @@
#ifndef SUPER_H
#define SUPER_H
/* The following is a subset of ext4.h used by the application */
/* This is a subset of ext4.h used by the application */
typedef unsigned char __u8;
typedef unsigned short __u16, __le16;
@@ -232,4 +232,23 @@ struct ext4_super_block {
EXT4_FEATURE_INCOMPAT_FLEX_BG| \
EXT4_FEATURE_INCOMPAT_CSUM_SEED)
/* Definitions for other common filesystems so the application can list them. */
#define BTRFS_MAGIC 0x4D5F53665248425FULL /* '_BHRfS_M' */
#define BTRFS_MAGIC_OFFSET 64
#define BTRFS_SUPER_BLOCK_OFFSET 0x10000
#define XFS_SB_MAGIC_BE 0x58465342 /* 'XFSB' */
#define XFS_SB_MAGIC_LE 0x42534658 /* 'BSFX' */
#define XFS_MAGIC_OFFSET 0
#define XFS_SUPER_BLOCK_OFFSET 0
#define RAID_MAGIC 0xa92b4efc
#define RAID_MAGIC_OFFSET 0
#define RAID_SUPER_BLOCK_OFFSET 0x1000
#define LVM_MAGIC "LABELONE"
#define BSD_DISKMAGIC 0x82564557 /* The disk magic number */
#endif /* SUPER_H */