File indexing completed on 2024-05-12 04:01:50
0001 /* 0002 SPDX-FileCopyrightText: 2006-2007 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_BLOCK_H 0008 #define SOLID_BLOCK_H 0009 0010 #include <solid/solid_export.h> 0011 0012 #include <solid/deviceinterface.h> 0013 0014 namespace Solid 0015 { 0016 class BlockPrivate; 0017 class Device; 0018 0019 /** 0020 * @class Solid::Block block.h <Solid/Block> 0021 * 0022 * This device interface is available on block devices. 0023 * 0024 * A block device is an addressable device such as drive or partition. 0025 * It is possible to interact with such a device using a special file 0026 * in the system. 0027 */ 0028 class SOLID_EXPORT Block : public DeviceInterface 0029 { 0030 Q_OBJECT 0031 Q_PROPERTY(int major READ deviceMajor) 0032 Q_PROPERTY(int minor READ deviceMinor) 0033 Q_PROPERTY(QString device READ device) 0034 Q_DECLARE_PRIVATE(Block) 0035 friend class Device; 0036 0037 private: 0038 /** 0039 * Creates a new Block object. 0040 * You generally won't need this. It's created when necessary using 0041 * Device::as(). 0042 * 0043 * @param backendObject the device interface object provided by the backend 0044 * @see Solid::Device::as() 0045 */ 0046 SOLID_NO_EXPORT explicit Block(QObject *backendObject); 0047 0048 public: 0049 /** 0050 * Destroys a Block object. 0051 */ 0052 ~Block() override; 0053 0054 /** 0055 * Get the Solid::DeviceInterface::Type of the Block device interface. 0056 * 0057 * @return the Block device interface type 0058 * @see Solid::Ifaces::Enums::DeviceInterface::Type 0059 */ 0060 static Type deviceInterfaceType() 0061 { 0062 return DeviceInterface::Block; 0063 } 0064 0065 /** 0066 * Retrieves the major number of the node file to interact with 0067 * the device. 0068 * 0069 * @return the device major number 0070 */ 0071 int deviceMajor() const; 0072 0073 /** 0074 * Retrieves the minor number of the node file to interact with 0075 * the device. 0076 * 0077 * @return the device minor number 0078 */ 0079 int deviceMinor() const; 0080 0081 /** 0082 * Retrieves the absolute path of the special file to interact 0083 * with the device. 0084 * 0085 * @return the absolute path of the special file to interact with 0086 * the device 0087 */ 0088 QString device() const; 0089 }; 0090 } 0091 0092 #endif