feat: add 'vol' command

This commit is contained in:
daniel committed 2026-09-19 08:54:15 +02:00
1 parent 420a7c996c
commit 80b5beb17d
17 files changed
+284 -17

No files matched your search

+9 -5
View File
@@ -154,18 +154,22 @@ namespace Fs::FsProbe {
return -1;
}
int GetBlockDeviceForDrive(int driveNum) {
int GetPartitionForDrive(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;
}
if (g_mounted[i] && g_driveForPart[i] == driveNum) return i;
}
return -1;
}
int GetBlockDeviceForDrive(int driveNum) {
int partIndex = GetPartitionForDrive(driveNum);
if (partIndex < 0) return -1;
auto* part = Drivers::Storage::Gpt::GetPartition(partIndex);
return part ? part->BlockDevIndex : -1;
}
int UnmountPartitionsForBlockDevice(int blockDevIndex) {
int partCount = Drivers::Storage::Gpt::GetPartitionCount();
int unmounted = 0;