#pragma region CPL License /* Nuclex Native Framework Copyright (C) 2002-2023 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #pragma endregion // CPL License #ifndef NUCLEX_PLATFORM_HARDWARE_STOREINFO_H #define NUCLEX_PLATFORM_HARDWARE_STOREINFO_H #include "Nuclex/Platform/Config.h" #include // for std::size_t #include // for std::string #include // for std::vector #include // for std::optional namespace Nuclex { namespace Platform { namespace Hardware { // ------------------------------------------------------------------------------------------- // enum class StoreType; // declared further down in this file // ------------------------------------------------------------------------------------------- // class PartitionInfo; // declared further down in this file // ------------------------------------------------------------------------------------------- // /// Informations about a storage volume accessible on the system /// /// /// All the storage-related terms are a bit overused already, with different meanings, /// too, and no agreed-upon denominators, it seems. For this library's purpose, /// a "store" is something that provides individual partitions or shares. /// /// /// So a physical disk drive or SSD is a store on which partitions can exist. /// On Linux, a block device is a store and it also can have partitions. A server /// reachable via network providing different "shares" or "folders" /// is also a store (with the "shares" or "folders" being seen as /// partitions). And a connected CD/DVD drive would be a store that has partitions /// only when a disc is inserted. /// /// /// The purpose of this is a) knowing which paths share the same drive or server /// so you can sequentialize access to this resource, b) knowing which paths to /// present to the user as their drives or mount points and c) being able to /// figure out the basic storage resources for logging and debugging. /// /// class NUCLEX_PLATFORM_TYPE StoreInfo { /* /// Operating-system specific identifier of the drive public: std::string Identifier; /// Human-readable name of the drive's manufacturer public: std::string ManufacturerName; /// Model name of the drive public: std::string ModelName; /// Total capacity of this drive in megabytes (1024-based) public: std::size_t CapacityInMegabytes; */ /// How the store is connected or reachable by the local machine public: StoreType Type; /// Whether this is a solid state drive public: std::optional IsSolidState; /// Detailed information about the mounted partitions from the drive public: std::vector Partitions; }; // ------------------------------------------------------------------------------------------- // /// Type of the data store, indi enum class NUCLEX_PLATFORM_TYPE StoreType { /// Unknown drive type Unknown, /// A hard drive or SSD installed inside the machine /// /// Would also cover eSATA drives, but from a software perspective, they're identical /// to internal SATA drives. /// LocalInternalDrive, /// An external drive connected via USB or Thunderbolt LocalExternalDrive, /// A CD/DVD disc drive, either internal or external /// /// Even if we could figure out of this kind of drive is connected via SATA or USB, /// it doesn't really make a difference. No software is shipped on CD/DVD anymore, /// this type is only useful to filter out such drives from inspection (because it /// might spin up the drive) and help the user distinguish it in any possible UI. /// LocalDiscDrive, /// Another computer or storage device on the network NetworkServer }; // ------------------------------------------------------------------------------------------- // /// Informations about a partition mounted for access by the system class NUCLEX_PLATFORM_TYPE PartitionInfo { /// Total (theoretical) capacity of the partition in megabytes public: std::optional CapacityInMegabytes; /// Label that has been assigned to the partition via the file system public: std::string Label; /// Serial number of the partition public: std::string Serial; /// Name describing the type of file system used public: std::string FileSystem; /// Root path to which this partition has been mounted public: std::vector MountPaths; }; // ------------------------------------------------------------------------------------------- // // QueryFreeSpace() as separate method // ------------------------------------------------------------------------------------------- // }}} // namespace Nuclex::Platform::Hardware #endif // NUCLEX_PLATFORM_HARDWARE_STOREINFO_H