/*** 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 filesystemMountPoints; AuOptional name; LogicalUsedResponse space; LogicalOffsetResponse offset; bool bIsReadOnly {}; uuids::uuid uuid; // ... ? }; struct FSDevice { EFSDeviceType type; EFSBusType bus; AuString devicePath; AuString productModel; AuOptional altLabel; AuOptional altProductDescription; AuList partitions; AuUInt64 uFSDeviceSizeInBytes {}; AuUInt64 uFSDevicePageSizeInBytes {}; uuids::uuid uuid; }; AUKN_SYM AuString GetRootFromPath(const AuString &fileOrDirPath); AUKN_SYM AuResult GetDeviceFromPath(const AuString &fileOrDirPath); AUKN_SYM AuResult GetDeviceFromRoot(const AuString &root); AUKN_SYM AuResult 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 GetDeviceModel(const AuString& physicalDevicePath); AUKN_SYM AuResult GetFSDeviceByFilePath(const AuString &fileOrDirPath); AUKN_SYM AuResult GetFSDeviceByDevice(const AuString &physicalDevicePath); AUKN_SYM AuList GetFSDevices(); AUKN_SYM const AuList &GetFSDevicesCachedUnsafe(); AUKN_SYM void ResetDeviceCache(); }