1 /*
2     SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
3     SPDX-FileCopyrightText: 2012-2018 Andrius Štikonas <andrius@stikonas.eu>
4     SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
5 
6     SPDX-License-Identifier: GPL-3.0-or-later
7 */
8 
9 #ifndef KPMCORE_DISKDEVICE_H
10 #define KPMCORE_DISKDEVICE_H
11 
12 #include "util/libpartitionmanagerexport.h"
13 #include "core/device.h"
14 
15 #include <memory>
16 
17 #include <QString>
18 #include <QObject>
19 #include <QtGlobal>
20 
21 class PartitionTable;
22 class CreatePartitionTableOperation;
23 class CoreBackend;
24 class SmartStatus;
25 class DiskDevicePrivate;
26 
27 /** A disk device.
28 
29     Represents a device like /dev/sda.
30 
31     Devices are the outermost entity; they contain a PartitionTable that itself contains Partitions.
32 
33     @see PartitionTable, Partition
34     @author Volker Lanz <vl@fidra.de>
35 */
36 
37 class LIBKPMCORE_EXPORT DiskDevice : public Device
38 {
39     Q_DISABLE_COPY(DiskDevice)
40 
41     friend class CreatePartitionTableOperation;
42     friend class CoreBackend;
43 
44 public:
45     DiskDevice(const QString& name, const QString& deviceNode, qint32 heads, qint32 numSectors, qint32 cylinders, qint64 sectorSize, const QString& iconName = QString());
46 
47 public:
48     /**
49      * @return the number of heads on the Device in CHS notation
50      */
51     [[deprecated]]
52     qint32 heads() const;
53 
54     /**
55      * @return the number of cylinders on the Device in CHS notation
56      */
57     [[deprecated]]
58     qint32 cylinders() const;
59 
60     /**
61      * @return the number of sectors on the Device in CHS notation
62      */
63     qint32 sectorsPerTrack() const;
64 
65     /**
66      * @return the physical sector size the Device uses or -1 if unknown
67      */
68     qint64 physicalSectorSize() const;
69 
70     /**
71      * @return the logical sector size the Device uses
72      */
73     qint64 logicalSectorSize() const;
74 
75     /**
76      * @return the total number of sectors on the device
77      */
78     qint64 totalSectors() const;
79 
80     /**
81      * @return the size of a cylinder on this Device in sectors
82      */
83     qint64 cylinderSize() const;
84 };
85 
86 #endif
87