File indexing completed on 2024-04-28 05:45:44
0001 /* 0002 SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de> 0003 SPDX-FileCopyrightText: 2012-2018 Andrius Štikonas <andrius@stikonas.eu> 0004 SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com> 0005 0006 SPDX-License-Identifier: GPL-3.0-or-later 0007 */ 0008 0009 #ifndef KPMCORE_DISKDEVICE_H 0010 #define KPMCORE_DISKDEVICE_H 0011 0012 #include "util/libpartitionmanagerexport.h" 0013 #include "core/device.h" 0014 0015 #include <memory> 0016 0017 #include <QString> 0018 #include <QObject> 0019 #include <QtGlobal> 0020 0021 class PartitionTable; 0022 class CreatePartitionTableOperation; 0023 class CoreBackend; 0024 class SmartStatus; 0025 class DiskDevicePrivate; 0026 0027 /** A disk device. 0028 0029 Represents a device like /dev/sda. 0030 0031 Devices are the outermost entity; they contain a PartitionTable that itself contains Partitions. 0032 0033 @see PartitionTable, Partition 0034 @author Volker Lanz <vl@fidra.de> 0035 */ 0036 0037 class LIBKPMCORE_EXPORT DiskDevice : public Device 0038 { 0039 Q_DISABLE_COPY(DiskDevice) 0040 0041 friend class CreatePartitionTableOperation; 0042 friend class CoreBackend; 0043 0044 public: 0045 DiskDevice(const QString& name, const QString& deviceNode, qint32 heads, qint32 numSectors, qint32 cylinders, qint64 sectorSize, const QString& iconName = QString()); 0046 0047 public: 0048 /** 0049 * @return the number of heads on the Device in CHS notation 0050 */ 0051 [[deprecated]] 0052 qint32 heads() const; 0053 0054 /** 0055 * @return the number of cylinders on the Device in CHS notation 0056 */ 0057 [[deprecated]] 0058 qint32 cylinders() const; 0059 0060 /** 0061 * @return the number of sectors on the Device in CHS notation 0062 */ 0063 qint32 sectorsPerTrack() const; 0064 0065 /** 0066 * @return the physical sector size the Device uses or -1 if unknown 0067 */ 0068 qint64 physicalSectorSize() const; 0069 0070 /** 0071 * @return the logical sector size the Device uses 0072 */ 0073 qint64 logicalSectorSize() const; 0074 0075 /** 0076 * @return the total number of sectors on the device 0077 */ 0078 qint64 totalSectors() const; 0079 0080 /** 0081 * @return the size of a cylinder on this Device in sectors 0082 */ 0083 qint64 cylinderSize() const; 0084 }; 0085 0086 #endif