[*] After just shy of 1y, introduce FS devices into the default include tree. Linux will be brought up soon enough
This commit is contained in:
parent
3143f3d2eb
commit
4ab5b4cba7
@ -11,6 +11,7 @@
|
|||||||
namespace Aurora::IO::FS
|
namespace Aurora::IO::FS
|
||||||
{
|
{
|
||||||
AUE_DEFINE(EFSDeviceType, (
|
AUE_DEFINE(EFSDeviceType, (
|
||||||
|
eDeviceUnknown,
|
||||||
eDeviceDisk,
|
eDeviceDisk,
|
||||||
eDeviceSCSI,
|
eDeviceSCSI,
|
||||||
eDeviceCD,
|
eDeviceCD,
|
||||||
@ -18,8 +19,10 @@ namespace Aurora::IO::FS
|
|||||||
eDeviceFloppy,
|
eDeviceFloppy,
|
||||||
eDeviceNetworkMount,
|
eDeviceNetworkMount,
|
||||||
eDeviceRamDisk,
|
eDeviceRamDisk,
|
||||||
|
eDeviceTempRamDisk,
|
||||||
eDeviceROMWindow,
|
eDeviceROMWindow,
|
||||||
eDeviceUnknown
|
eDeviceVirtualFileSystem,
|
||||||
|
eDeviceKernelConfig
|
||||||
))
|
))
|
||||||
|
|
||||||
AUE_DEFINE(EFSBusType, (
|
AUE_DEFINE(EFSBusType, (
|
||||||
@ -27,73 +30,143 @@ namespace Aurora::IO::FS
|
|||||||
eBusSCSI,
|
eBusSCSI,
|
||||||
eBusSATA,
|
eBusSATA,
|
||||||
eBusUSB,
|
eBusUSB,
|
||||||
eBusNetwork
|
eBusNetwork,
|
||||||
|
eBusNVMePCIe
|
||||||
))
|
))
|
||||||
|
|
||||||
struct LogicalUsedResponse
|
struct LogicalUsedResponse
|
||||||
{
|
{
|
||||||
AuUInt64 uLogicalSize {};
|
AuUInt64 uLogicalSize {};
|
||||||
AuUInt64 uLogicalUsed {};
|
AuUInt64 uLogicalUsed {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct LogicalOffsetResponse
|
struct LogicalOffsetResponse
|
||||||
{
|
{
|
||||||
AuUInt64 uLogicalSize {};
|
AuUInt64 uLogicalSize {};
|
||||||
AuUInt64 uLogicalOffset {};
|
AuUInt64 uLogicalOffset {};
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FSLogicalPartition
|
struct FSLogicalPartition
|
||||||
{
|
{
|
||||||
AuString devicePath;
|
/**
|
||||||
AuString logicalMount;
|
* The logical volume as a filesystem path. Under Windows, this will be a global path to the device object.
|
||||||
AuList<AuString> filesystemMountPoints;
|
* Under Linux, this will be your /dev/<whatever>.
|
||||||
AuOptional<AuString> name;
|
*/
|
||||||
LogicalUsedResponse space;
|
AuString devicePath;
|
||||||
|
/**
|
||||||
|
* The logical volume as a filesystem path. Under Windows, this will be a global path to the volume object.
|
||||||
|
* Under Linux, this will be your /dev/<whatever><n>.
|
||||||
|
*/
|
||||||
|
AuString logicalMount;
|
||||||
|
/**
|
||||||
|
* Drive letter, NTFS volume mount path, Linux filesystem mount directory, etc
|
||||||
|
*/
|
||||||
|
AuList<AuString> filesystemMountPoints;
|
||||||
|
/**
|
||||||
|
* GPT or other filesystem label
|
||||||
|
*/
|
||||||
|
AuOptional<AuString> name;
|
||||||
|
/*
|
||||||
|
* Do I really need to document this?
|
||||||
|
*/
|
||||||
|
bool bIsReadOnly {};
|
||||||
|
/*
|
||||||
|
* GPT or other UUID-like ID
|
||||||
|
*/
|
||||||
|
uuids::uuid uuid;
|
||||||
|
/*
|
||||||
|
* Often globally unique drive or volume ID
|
||||||
|
*/
|
||||||
|
AuOptional<AuString> altID;
|
||||||
|
/*
|
||||||
|
* Do I really need to document this?
|
||||||
|
*/
|
||||||
|
LogicalUsedResponse space;
|
||||||
|
/*
|
||||||
|
* The physical offset of the logical filesystem/volume/partition relative to the parent FSDevice's block device object.
|
||||||
|
*/
|
||||||
LogicalOffsetResponse offset;
|
LogicalOffsetResponse offset;
|
||||||
bool bIsReadOnly {};
|
|
||||||
uuids::uuid uuid;
|
|
||||||
// ... ?
|
// ... ?
|
||||||
};
|
};
|
||||||
|
|
||||||
struct FSDevice
|
struct FSDevice
|
||||||
{
|
{
|
||||||
EFSDeviceType type;
|
EFSDeviceType type;
|
||||||
EFSBusType bus;
|
EFSBusType bus;
|
||||||
AuString devicePath;
|
AuString devicePath;
|
||||||
AuString productModel;
|
uuids::uuid uuid;
|
||||||
AuOptional<AuString> altLabel;
|
AuString productModel;
|
||||||
AuOptional<AuString> altProductDescription;
|
AuOptional<AuString> altLabel;
|
||||||
|
AuOptional<AuString> altProductDescription;
|
||||||
AuList<FSLogicalPartition> partitions;
|
AuList<FSLogicalPartition> partitions;
|
||||||
AuUInt64 uFSDeviceSizeInBytes {};
|
AuUInt64 uFSDeviceSizeInBytes {};
|
||||||
AuUInt64 uFSDevicePageSizeInBytes {};
|
AuUInt64 uFSDevicePageSizeInBytes {};
|
||||||
uuids::uuid uuid;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AUKN_SYM AuString GetRootFromPath(const AuString &fileOrDirPath);
|
/**
|
||||||
|
* Provides the best-fit FSLogicalPartition::filesystemMountPoints of a string.
|
||||||
|
* Sometimes the platform shell can help, some platforms need to pull the fs devices cache.
|
||||||
|
*/
|
||||||
|
AUKN_SYM AuString GetRootFromPath(const AuString &fileOrDirPath);
|
||||||
|
|
||||||
AUKN_SYM AuResult<AuString> GetDeviceFromPath(const AuString &fileOrDirPath);
|
/**
|
||||||
AUKN_SYM AuResult<AuString> GetDeviceFromRoot(const AuString &root);
|
* Provides a FSDevice::devicePath of a file or directory.
|
||||||
AUKN_SYM AuResult<AuString> GetLogicalMountFromPath(const AuString &fileOrDirPath);
|
*/
|
||||||
|
AUKN_SYM AuResult<AuString> GetDeviceFromPath(const AuString &fileOrDirPath);
|
||||||
|
|
||||||
AUKN_SYM AuString TrySimplifyDevicePath(const AuString &deviceOrLogicalMountPath);
|
/**
|
||||||
|
* Provides a FSDevice::devicePath of a root mountpoint.
|
||||||
|
*/
|
||||||
|
AUKN_SYM AuResult<AuString> GetDeviceFromRoot(const AuString &root);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides the FSLogicalPartition::logicalMount of a file or directory.
|
||||||
|
*/
|
||||||
|
AUKN_SYM AuResult<AuString> GetLogicalMountFromPath(const AuString &fileOrDirPath);
|
||||||
|
|
||||||
|
AUKN_SYM AuString TrySimplifyDevicePath(const AuString &deviceOrLogicalMountPath);
|
||||||
|
|
||||||
// max: unbuffered pipe io
|
// max: unbuffered pipe io
|
||||||
AUKN_SYM AuUInt32 GetPerformanceBufferSizeFromPath(const AuString &fileOrDirPath);
|
AUKN_SYM AuUInt32 GetPerformanceBufferSizeFromPath(const AuString &fileOrDirPath);
|
||||||
// min: unbuffered pipe io
|
// min: unbuffered pipe io
|
||||||
AUKN_SYM AuUInt32 GetPhysicalSectorSizeFromPath(const AuString &fileOrDirPath);
|
AUKN_SYM AuUInt32 GetPhysicalSectorSizeFromPath(const AuString &fileOrDirPath);
|
||||||
// min viable sector size with abstractions on top of the disk
|
// min viable sector size with abstractions on top of the disk
|
||||||
AUKN_SYM AuUInt32 GetLogicalSectorSizeFromPath(const AuString &fileOrDirPath);
|
AUKN_SYM AuUInt32 GetLogicalSectorSizeFromPath(const AuString &fileOrDirPath);
|
||||||
|
|
||||||
AUKN_SYM LogicalUsedResponse GetLogicalUsedFromPath(const AuString &fileOrDirPath);
|
/**
|
||||||
AUKN_SYM LogicalUsedResponse GetLogicalUsedFromLogicalDevice(const AuString &logicalMountPath);
|
* Provides a FSLogicalPartition::space of a file or directory.
|
||||||
|
*/
|
||||||
|
AUKN_SYM LogicalUsedResponse GetLogicalUsedFromPath(const AuString &fileOrDirPath);
|
||||||
|
|
||||||
AUKN_SYM AuUInt64 GetDeviceSizeInBytes(const AuString& physicalDevicePath);
|
/**
|
||||||
|
* Provides a FSLogicalPartition::space of a logical volume path / FSLogicalPartition::logicalMount string.
|
||||||
|
*/
|
||||||
|
AUKN_SYM LogicalUsedResponse GetLogicalUsedFromLogicalDevice(const AuString &logicalMountPath);
|
||||||
|
|
||||||
|
// Convenience function
|
||||||
|
AUKN_SYM AuUInt64 GetDeviceSizeInBytes(const AuString& physicalDevicePath);
|
||||||
|
|
||||||
|
// Convenience function
|
||||||
AUKN_SYM AuResult<AuString> GetDeviceModel(const AuString& physicalDevicePath);
|
AUKN_SYM AuResult<AuString> GetDeviceModel(const AuString& physicalDevicePath);
|
||||||
|
|
||||||
|
// Convenience function
|
||||||
AUKN_SYM AuResult<FSDevice> GetFSDeviceByFilePath(const AuString &fileOrDirPath);
|
AUKN_SYM AuResult<FSDevice> GetFSDeviceByFilePath(const AuString &fileOrDirPath);
|
||||||
|
|
||||||
|
// Convenience function
|
||||||
AUKN_SYM AuResult<FSDevice> GetFSDeviceByDevice(const AuString &physicalDevicePath);
|
AUKN_SYM AuResult<FSDevice> GetFSDeviceByDevice(const AuString &physicalDevicePath);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Provides a copy of the internal FSDevice cache under lock
|
||||||
|
*/
|
||||||
AUKN_SYM AuList<FSDevice> GetFSDevices();
|
AUKN_SYM AuList<FSDevice> GetFSDevices();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Provides a reference/pointer to the internal cache without a consumer interface for read/write locking
|
||||||
|
*/
|
||||||
AUKN_SYM const AuList<FSDevice> &GetFSDevicesCachedUnsafe();
|
AUKN_SYM const AuList<FSDevice> &GetFSDevicesCachedUnsafe();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Erases the FDDevice cache
|
||||||
|
*/
|
||||||
AUKN_SYM void ResetDeviceCache();
|
AUKN_SYM void ResetDeviceCache();
|
||||||
}
|
}
|
@ -321,4 +321,5 @@ namespace Aurora::IO::FS
|
|||||||
#include "Watcher.hpp"
|
#include "Watcher.hpp"
|
||||||
#include "IReadDir.hpp"
|
#include "IReadDir.hpp"
|
||||||
#include "Overlapped.hpp"
|
#include "Overlapped.hpp"
|
||||||
#include "MemoryMappedFile.hpp"
|
#include "MemoryMappedFile.hpp"
|
||||||
|
#include "Devices.hpp"
|
Loading…
Reference in New Issue
Block a user