AuroraRuntime/Include/Aurora/IO/FS/Devices.hpp
Jamie Reece Wilson b35b290afd [+] File System devices API
[+] AuFS::EFSDeviceType
[+] AuFS::EFSBusType
[+] AuFS::LogicalUsedResponse
[+] AuFS::LogicalOffsetResponse
[+] AuFS::FSLogicalPartition
[+] AuFS::FSDevice
[+] AuFS::GetRootFromPath
[+] AuFS::GetDeviceFromPath
[+] AuFS::GetDeviceFromRoot
[+] AuFS::GetLogicalMountFromPath
[+] AuFS::TrySimplifyDevicePath
[+] AuFS::GetPerformanceBufferSizeFromPath
[+] AuFS::GetPhysicalSectorSizeFromPath
[+] AuFS::GetLogicalSectorSizeFromPath
[+] AuFS::GetLogicalUsedFromPath
[+] AuFS::GetLogicalUsedFromLogicalDevice
[+] AuFS::GetDeviceSizeInBytes
[+] AuFS::GetDeviceModel
[+] AuFS::GetFSDeviceByFilePath
[+] AuFS::GetFSDeviceByDevice
[+] AuFS::GetFSDevices
[+] AuFS::GetFSDevicesCachedUnsafe
[+] AuFS::ResetDeviceCache
[+] FSPlatformDevices.cpp
[+] FSPlatformDevices.NT.cpp
(holding back Linux)
2023-12-05 18:44:38 +00:00

99 lines
3.0 KiB
C++

/***
Copyright (C) 2023 Jamie Reece Wilson (a/k/a "Reece"). All rights reserved.
File: Devices.hpp
Date: 2023-08-11
Date: 2023-12-05
Author: Reece
***/
#pragma once
namespace Aurora::IO::FS
{
AUE_DEFINE(EFSDeviceType, (
eDeviceDisk,
eDeviceSCSI,
eDeviceCD,
eDeviceUSBMass,
eDeviceFloppy,
eDeviceNetworkMount,
eDeviceRamDisk,
eDeviceROMWindow,
eDeviceUnknown
))
AUE_DEFINE(EFSBusType, (
eBusGeneric,
eBusSCSI,
eBusSATA,
eBusUSB,
eBusNetwork
))
struct LogicalUsedResponse
{
AuUInt64 uLogicalSize {};
AuUInt64 uLogicalUsed {};
};
struct LogicalOffsetResponse
{
AuUInt64 uLogicalSize {};
AuUInt64 uLogicalOffset {};
};
struct FSLogicalPartition
{
AuString devicePath;
AuString logicalMount;
AuList<AuString> filesystemMountPoints;
AuOptional<AuString> name;
LogicalUsedResponse space;
LogicalOffsetResponse offset;
bool bIsReadOnly {};
uuids::uuid uuid;
// ... ?
};
struct FSDevice
{
EFSDeviceType type;
EFSBusType bus;
AuString devicePath;
AuString productModel;
AuOptional<AuString> altLabel;
AuOptional<AuString> altProductDescription;
AuList<FSLogicalPartition> partitions;
AuUInt64 uFSDeviceSizeInBytes {};
AuUInt64 uFSDevicePageSizeInBytes {};
uuids::uuid uuid;
};
AUKN_SYM AuString GetRootFromPath(const AuString &fileOrDirPath);
AUKN_SYM AuResult<AuString> GetDeviceFromPath(const AuString &fileOrDirPath);
AUKN_SYM AuResult<AuString> GetDeviceFromRoot(const AuString &root);
AUKN_SYM AuResult<AuString> GetLogicalMountFromPath(const AuString &fileOrDirPath);
AUKN_SYM AuString TrySimplifyDevicePath(const AuString &deviceOrLogicalMountPath);
// max: unbuffered pipe io
AUKN_SYM AuUInt32 GetPerformanceBufferSizeFromPath(const AuString &fileOrDirPath);
// min: unbuffered pipe io
AUKN_SYM AuUInt32 GetPhysicalSectorSizeFromPath(const AuString &fileOrDirPath);
// min viable sector size with abstractions on top of the disk
AUKN_SYM AuUInt32 GetLogicalSectorSizeFromPath(const AuString &fileOrDirPath);
AUKN_SYM LogicalUsedResponse GetLogicalUsedFromPath(const AuString &fileOrDirPath);
AUKN_SYM LogicalUsedResponse GetLogicalUsedFromLogicalDevice(const AuString &logicalMountPath);
AUKN_SYM AuUInt64 GetDeviceSizeInBytes(const AuString& physicalDevicePath);
AUKN_SYM AuResult<AuString> GetDeviceModel(const AuString& physicalDevicePath);
AUKN_SYM AuResult<FSDevice> GetFSDeviceByFilePath(const AuString &fileOrDirPath);
AUKN_SYM AuResult<FSDevice> GetFSDeviceByDevice(const AuString &physicalDevicePath);
AUKN_SYM AuList<FSDevice> GetFSDevices();
AUKN_SYM const AuList<FSDevice> &GetFSDevicesCachedUnsafe();
AUKN_SYM void ResetDeviceCache();
}