feat: added Files app USB medium detection

This commit is contained in:
2026-05-18 20:00:42 +02:00
parent 54c60e7a81
commit 7cb1866998
14 changed files with 50 additions and 2 deletions
+12
View File
@@ -142,6 +142,18 @@ namespace Fs::FsProbe {
return -1;
}
int GetBlockDeviceForDrive(int driveNum) {
if (driveNum < 0) return -1;
int partCount = Drivers::Storage::Gpt::GetPartitionCount();
for (int i = 0; i < partCount && i < Drivers::Storage::Gpt::MaxPartitions; i++) {
if (g_mounted[i] && g_driveForPart[i] == driveNum) {
auto* part = Drivers::Storage::Gpt::GetPartition(i);
if (part) return part->BlockDevIndex;
}
}
return -1;
}
int UnmountPartitionsForBlockDevice(int blockDevIndex) {
int partCount = Drivers::Storage::Gpt::GetPartitionCount();
int unmounted = 0;
+4
View File
@@ -34,4 +34,8 @@ namespace Fs::FsProbe {
// mount bookkeeping to match Gpt::RemovePartitionsForBlockDevice().
int UnmountPartitionsForBlockDevice(int blockDevIndex);
// Return the block-device index backing a mounted VFS drive, or -1 if the
// drive isn't backed by a partition (e.g. ramdisk).
int GetBlockDeviceForDrive(int driveNum);
};