File indexing completed on 2024-05-12 04:01:52

0001 /*
0002     SPDX-FileCopyrightText: 2006 Kevin Ottens <ervin@kde.org>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef SOLID_IFACES_STORAGEVOLUME_H
0008 #define SOLID_IFACES_STORAGEVOLUME_H
0009 
0010 #include <solid/devices/ifaces/block.h>
0011 #include <solid/storagevolume.h>
0012 
0013 namespace Solid
0014 {
0015 namespace Ifaces
0016 {
0017 /**
0018  * This device interface is available on volume devices.
0019  *
0020  * A volume is anything that can contain data (partition, optical disc,
0021  * memory card). It's a particular kind of block device.
0022  */
0023 class StorageVolume : virtual public Block
0024 {
0025 public:
0026     /**
0027      * Destroys a StorageVolume object.
0028      */
0029     ~StorageVolume() override;
0030 
0031     /**
0032      * Indicates if this volume should be ignored by applications.
0033      *
0034      * If it should be ignored, it generally means that it should be
0035      * invisible to the user. It's useful for firmware partitions or
0036      * OS reinstall partitions on some systems.
0037      *
0038      * @return true if the volume should be ignored
0039      */
0040     virtual bool isIgnored() const = 0;
0041 
0042     /**
0043      * Retrieves the type of use for this volume (for example filesystem).
0044      *
0045      * @return the usage type
0046      * @see Solid::StorageVolume::UsageType
0047      */
0048     virtual Solid::StorageVolume::UsageType usage() const = 0;
0049 
0050     /**
0051      * Retrieves the filesystem type of this volume.
0052      *
0053      * @return the filesystem type if applicable, QString() otherwise
0054      */
0055     virtual QString fsType() const = 0;
0056 
0057     /**
0058      * Retrieves this volume label.
0059      *
0060      * @return the volume level if available, QString() otherwise
0061      */
0062     virtual QString label() const = 0;
0063 
0064     /**
0065      * Retrieves this volume Universal Unique IDentifier (UUID).
0066      *
0067      * You can generally assume that this identifier is unique with reasonable
0068      * confidence. Except if the volume UUID has been forged to intentionally
0069      * provoke a collision, the probability to have two volumes having the same
0070      * UUID is low.
0071      *
0072      * @return the Universal Unique IDentifier if available, QString() otherwise
0073      */
0074     virtual QString uuid() const = 0;
0075 
0076     /**
0077      * Retrieves this volume size in bytes.
0078      *
0079      * @return the size of this volume
0080      */
0081     virtual qulonglong size() const = 0;
0082 
0083     /**
0084      * Retrieves the crypto container UDI of this volume.
0085      *
0086      * @return the encrypted volume UDI containing the current volume if applicable,
0087      * an empty string otherwise
0088      */
0089     virtual QString encryptedContainerUdi() const = 0;
0090 };
0091 }
0092 }
0093 
0094 Q_DECLARE_INTERFACE(Solid::Ifaces::StorageVolume, "org.kde.Solid.Ifaces.StorageVolume/0.1")
0095 
0096 #endif // SOLID_IFACES_STORAGEVOLUME_H