dtkio
dtk library for dtkio.
载入中...
搜索中...
未找到
dblockpartition.h
浏览该文件的文档.
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DBLOCKPARTITION_H
6#define DBLOCKPARTITION_H
7
8#include <DBlockDevice>
9
10DMOUNT_BEGIN_NAMESPACE
11
12class DBlockPartition;
13namespace DDeviceManager {
14DExpected<DBlockPartition *> createBlockPartition(const QString &path, QObject *parent);
15DExpected<DBlockPartition *> createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent);
16} // namespace DDeviceManager
17
18class DBlockPartitionPrivate;
20{
21 Q_OBJECT
22 Q_DECLARE_PRIVATE(DBlockPartition)
23
24 Q_PROPERTY(quint64 flags READ flags NOTIFY flagsChanged)
25 Q_PROPERTY(bool isContained READ isContained NOTIFY isContainedChanged)
26 Q_PROPERTY(bool isContainer READ isContainer NOTIFY isContainerChanged)
27 Q_PROPERTY(QString name READ name NOTIFY nameChanged)
28 Q_PROPERTY(uint number READ number NOTIFY numberChanged)
29 Q_PROPERTY(quint64 offset READ offset NOTIFY offsetChanged)
30 Q_PROPERTY(quint64 size READ size NOTIFY sizeChanged)
31 Q_PROPERTY(QString table READ table CONSTANT)
32 Q_PROPERTY(QString type READ type NOTIFY typeChanged)
33 Q_PROPERTY(MbrPartitionType mbrType READ mbrType NOTIFY mbrPartitionTypeChanged)
34 Q_PROPERTY(GptPartitionType gptType READ gptType NOTIFY gptPartitionTypeChanged)
35 Q_PROPERTY(QString UUID READ UUID NOTIFY UUIDChanged)
36
37public:
40 UnknownMbrType = -1,
41
42 EmptyMbrType = 0x00,
43 FAT12Type = 0x01,
44 XENIX_root = 0x02,
45 XENIX_usr = 0x03,
46 FAT16_Less_32M = 0x04,
47 Extended = 0x05,
48 FAT16Type = 0x06,
49 HPFS_NTFS = 0x07,
50 AIX = 0x08,
51 AIX_bootable = 0x09,
52 OS2_Boot_Manager = 0x0a,
53 Win95_FAT32 = 0x0b,
54 Win95_FAT32_LBA = 0x0c,
55 Win95_FAT16_LBA = 0x0e,
56 Win95_Extended_LBA = 0x0f,
57 OPUS = 0x10,
58 Hidden_FAT12 = 0x11,
59 Compaq_diagnostics = 0x12,
60 Hidden_FAT16_Less_32M = 0x14,
61 Hidden_FAT16 = 0x16,
62 Hidden_HPFS_or_NTFS = 0x17,
63 AST_SmartSleep = 0x18,
64 Hidden_Win95_FAT32 = 0x1b,
65 Hidden_Win95_FAT32_LBA = 0x1c,
66 Hidden_Win95_FAT16_LBA = 0x1e,
67 NEC_DOS = 0x24,
68 Plan9 = 0x39,
69 PartitionMagic_recovery = 0x3c,
70 Venix_80286 = 0x40,
71 PPC_PReP_Boot = 0x41,
72 SFS = 0x42,
73 QNX4_dot_x = 0x4d,
74 QNX4_dot_x_2nd_part = 0x4e,
75 QNX4_dot_x_3rd_part = 0x4f,
76 OnTrack_DM = 0x50,
77 OnTrack_DM6_Aux1 = 0x51,
78 CP_M = 0x52,
79 OnTrack_DM6_Aux3 = 0x53,
80 OnTrackDM6 = 0x54,
81 EZ_Drive = 0x55,
82 Golden_Bow = 0x56,
83 Priam_Edisk = 0x5c,
84 SpeedStor = 0x61,
85 GNU_HURD_or_SysV = 0x63,
86 Novell_Netware_286 = 0x64,
87 Novell_Netware_386 = 0x65,
88 DiskSecure_Multi_Boot = 0x70,
89 PC_IX = 0x75,
90 Old_Minix = 0x80,
91 Minix_old_Linux = 0x81,
92 Linux_swap = 0x82,
93 Linux = 0x83,
94 OS2_hidden_C_drive = 0x84,
95 Linux_extended = 0x85,
96 NTFS_volume_set_1 = 0x86,
97 NTFS_volume_set_2 = 0x87,
98 Linux_LVM = 0x8e,
99 Amoeba = 0x93,
100 Amoeba_BBT = 0x94,
101 BSD_OS = 0x9f,
102 IBM_Thinkpad_hibernation = 0xa0,
103 FreeBSD = 0xa5,
104 OpenBSD = 0xa6,
105 NeXTSTEP = 0xa7,
106 NetBSD = 0xa8,
107 BSDI_fs = 0xa9,
108 BSDI_swap = 0xb7,
109 Boot_Wizard_hidden = 0xb8,
110 DRDOS_sec_FAT12 = 0xbb,
111 DRDOS_sec_FAT16_Less_32M = 0xc1,
112 DRDOS_sec_FAT16 = 0xc4,
113 DRDOS_sec_extend = 0xc5,
114 Syrinx = 0xc6,
115 Non_FS_data = 0xc7,
116 Multiuser_DOS_extend = 0xd5,
117 CP_M_CTOS_dot_dot_dot = 0xda,
118 Dell_Utility = 0xdb,
119 BootIt = 0xde,
120 DOS_access = 0xdf,
121 DOS_R_O = 0xe1,
122 SpeedStor_1 = 0xe3,
123 BeOS_fs = 0xe4,
124 EFI_GPT = 0xeb,
125 EFI_FAT12_16_32 = 0xee,
126 Linux_PA_RISC_boot = 0xef,
127 SpeedStor_2 = 0xf0,
128 SeppdStor_3 = 0xf4,
129 DOS_secondary = 0xf2,
130 Linux_raid_autodetect = 0xfd,
131 LANstep = 0xfe,
132 BBT = 0xff,
133
134 };
135 Q_ENUM(MbrPartitionType)
136
137
139 UnknownGptType = -1,
140 EmptyGptType = 0,
141
142 UnusedEntryNA = 1,
143 MBRPartitionSchemeNA,
144 EFISystemPartitionNA,
145 BIOSBootPartitionNA,
146 IntelFastFlashPartitionNA,
147 SonyBootPartitionNA,
148 LenovoBootPartitionNA,
149
150 MicrosoftReservedPartitionWin = 20,
151 BasicDataPartitionWin,
152 LogicalDiskManagerMetaDataPartitionWin,
153 LogicalDiskManagerDataPartitionWin,
154 WindowsRecoveryEnvironmentWin,
155 IBMGeneralParallelFileSystemPartitionWin,
156 StorageSpacesPartitionWin,
157 StorageReplicaPartitionWin,
158
159 DataPartitionHPUX = 40,
160 ServicePartitionHPUX,
161
162 LinuxFilesystemDataLinux = 50,
163 RAIDPartitionLinux,
164 RootPartitionX86Linux,
165 RootPartitionX8664Linux,
166 RootPartitionArm32Linux,
167 RootPartitionArm64Linux,
168 BootPartitionLinux,
169 SwapPartitionLinux,
170 LogicalVolumeManagerPartitionLinux,
171 HomePartitionLinux,
172 ServerDataPartitionLinux,
173 PlainDMCryptPartitionLinux,
174 LUKSPartitionLinux,
175 ReservedLinux,
176
177 BootPartitionFreeBSD = 100,
178 BSDDisklabelPartitionFreeBSD,
179 SwapPartitionFreeBSD,
180 UnixFileSystemPartitionFreeBSD,
181 VinumVolumeManagerPartitionFreeBSD,
182 ZFSPartitionFreeBSD,
183 NandfsPartitionFreeBSD,
184
185 HierarchialFileSystemPlusPartitionMacOS = 120,
186 AppleAPFSContainerMacOS,
187 AppleUFSContainerMacOS,
188 ZFSMacOS,
189 AppleRAIDPartitionMacOS,
190 AppleRAIDPartitionOfflineMacOS,
191 AppleBootPartitionMacOS,
192 AppleLabelMacOS,
193 AppleTVRecoveryPartitionMacOS,
194 AppleCoreStorageContainerMacOS,
195 AppleAPFSPrebootPartitionMacOS,
196 AppleAPFSRecoveryPartitionMacOS,
197
198 BootPartitionSolaris = 150,
199 RootPartitionSolaris,
200 SwapPartitionSolaris,
201 BackupPartitionSolaris,
202 UsrPartitionSolaris,
203 VarPartitionSolaris,
204 HomePartitionSolaris,
205 AlternateSectorSolaris,
206 ReservedPartitionSolaris,
207
208 SwapPartitionNetBSD = 170,
209 FFSPartitionNetBSD,
210 LFSPartitionNetBSD,
211 RAIDPartitionNetBSD,
212 ConcatenatedPartitionNetBSD,
213 EncryptedPartitionNetBSD,
214
215 KernelChromeOS = 190,
216 RootfsChromeOS,
217 FirmwareChromeOS,
218 FutureUseChromeOS,
219 MiniOSChromeOS,
220 HibernateChromeOS,
221
222 UsrPartitionCoreOS = 220,
223 ResizableRootfsCoreOS,
224 OEMCustomizationsCoreOS,
225 RootFilesystemOnRAIDCoreOS,
226
227 HaikuBFSHaiku = 230,
228
229 BootPartitionMidnightBSD = 240,
230 DataPartitionMidnightBSD,
231 SwapPartitionMidnightBSD,
232 UnixFileSystemPartitionMidnightBSD,
233 VinumVolumemanagerPartitionMidnightBSD,
234 ZFSPartitionMidnightBSD,
235
236 JournalCeph = 260,
237 DmCryptJournalCeph,
238 OSDCeph,
239 DmCryptOSDCeph,
240 DiskinCreationCeph,
241 DmCryptDiskinCreationCeph,
242 BlockCeph,
243 BlockDBCeph,
244 BlockWriteAheadlogCeph,
245 LockboxForDmCryptKeysCeph,
246 MultipathOSDCeph,
247 MultipathJournalCeph,
248 MultipathBlockCeph,
249 MultipathBlockDBCeph,
250 MultipathblockwriteAheadogCeph,
251 DmCryptBlockCeph,
252 DmCryptBlockDBCeph,
253 DmCryptBlockWriteAheadlogCeph,
254 DmCryptLUKSjournalCeph,
255 DmCryptLUKSBlockCeph,
256 DmCryptLUKSBlockDBCeph,
257 DmCryptLUKSBlockwriteAheadlogCeph,
258 DmCryptLUKSOSDCeph,
259
260 DataPartitionOpenBSD = 300,
261
262 PowerSafeFilesystemQNX = 360,
263
264 Plan9PartitionPlan9 = 370,
265
266 VmkCoreVMwareESX = 380,
267 VMFSFilesystemPartitionVMwareESX,
268 VMWareReservedVMwareESX,
269
270 BootloaderAndroidIA = 400,
271 Bootloader2AndroidIA,
272 BootAndroidIA,
273 RecoveryAndroidIA,
274 MiscAndroidIA,
275 MetadataAndroidIA,
276 SystemAndroidIA,
277 CacheAndroidIA,
278 DataAndroidIA,
279 PersistentAndroidIA,
280 VendorAndroidIA,
281 ConfigAndroidIA,
282 FactoryAndroidIA,
283 FactoryAltAndroidIA,
284 FastbootOrTertiaryAndroidIA,
285 OEMAndroidIA,
286
287 AndroidMetaAndroid6Arm = 450,
288 AndroidEXTAndroid6Arm,
289
290 BootONIE = 460,
291 ConfigONIE,
292
293 PRePBootPowerPC = 470,
294
295 SharedBootloaderConfigurationFreedesktop = 480,
296
297 BasicDataPartitionAtariTOS = 490,
298
299 EncryptedDataPartitionVeraCrypt = 500,
300
301 ArcaOSType1OS2 = 510,
302
303 SPDKBlockDeviceSPDK = 520,
304
305 BareBoxStateBareboxBootloader = 530,
306
307 UBootEnvironmentUBootBootloader = 540,
308
309 StatusSoftRAID = 550,
310 ScratchSoftRAID,
311 VolumeSoftRAID,
312 CacheSoftRAID,
313
314 BootloaderFuchsiaStandard = 570,
315 DurablemutableencryptedsystemdataFuchsiaStandard,
316 DurablemutablebootloaderdataFuchsiaStandard,
317 FactoryProvisionedreadOnlysystemdataFuchsiaStandard,
318 FactoryProvisionedreadOnlybootloaderdataFuchsiaStandard,
319 FuchsiaVolumeManagerFuchsiaStandard,
320 VerifiedbootmetadataFuchsiaStandard,
321 ZirconbootimageFuchsiaStandard,
322
323 FuchsiaEspFuchsiaLegacy = 590,
324 FuchsiaSystemFuchsiaLegacy,
325 FuchsiaDataFuchsiaLegacy,
326 FuchsiaInstallFuchsiaLegacy,
327 FuchsiaBlobFuchsiaLegacy,
328 FuchsiaFvmFuchsiaLegacy,
329 ZirconbootimageSlotAFuchsiaLegacy,
330 ZirconbootimageSlotBFuchsiaLegacy,
331 ZirconbootimageSlotRFuchsiaLegacy,
332 SysConfigFuchsiaLegacy,
333 FactoryConfigFuchsiaLegacy,
334 BootloaderFuchsiaLegacy,
335 GuidTestFuchsiaLegacy,
336 VerifiedbootmetadataSlotAFuchsiaLegacy,
337 VerifiedbootmetadataSlotBFuchsiaLegacy,
338 VerifiedbootmetadataSlotRFuchsiaLegacy,
339 MiscFuchsiaLegacy,
340 EmmcBoot1FuchsiaLegacy,
341 EmmcBoot2FuchsiaLegacy,
342
343 };
344 Q_ENUM(GptPartitionType)
345
346 quint64 flags() const;
347 bool isContained() const;
348 bool isContainer() const;
349 QString name() const;
350 uint number() const;
351 quint64 offset() const;
352 quint64 size() const;
353 QString table() const;
354 QString type() const;
355 MbrPartitionType mbrType() const;
356 GptPartitionType gptType() const;
357 QString UUID() const;
358
359 static QString mbrTypeDescription(MbrPartitionType type);
360 static QString gptTypeDescription(GptPartitionType type);
361
362public Q_SLOTS:
363 void deletePartition(const QVariantMap &options);
364 void resize(quint64 size, const QVariantMap &options);
365 void setFlags(quint64 flags, const QVariantMap &options);
366 void setName(const QString &name, const QVariantMap &options);
367 void setType(const QString &type, const QVariantMap &options);
368 void setType(Dtk::Mount::DBlockPartition::MbrPartitionType type, const QVariantMap &options);
369
370Q_SIGNALS:
371 void flagsChanged(quint64 flags);
372 void isContainedChanged(bool isContained);
373 void isContainerChanged(bool isContainer);
374 void nameChanged(const QString &name);
375 void numberChanged(uint number);
376 void offsetChanged(quint64 offset);
377 void sizeChanged(quint64 size);
378 void typeChanged(const QString &type);
379 void mbrPartitionTypeChanged(Dtk::Mount::DBlockPartition::MbrPartitionType type);
380 void gptPartitionTypeChanged(Dtk::Mount::DBlockPartition::GptPartitionType type);
381 void UUIDChanged(const QString &UUID);
382
383private:
384 explicit DBlockPartition(const QString &path, QObject *parent = nullptr);
385
386 friend DExpected<DBlockPartition *> DDeviceManager::createBlockPartition(const QString &path, QObject *parent);
387 friend DExpected<DBlockPartition *> DDeviceManager::createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent);
388};
389
390DMOUNT_END_NAMESPACE
391
392#endif // DBLOCKPARTITION_H
用于管理系统中块设备的类,对设备进行挂载、卸载等操作,以及获取其基本属性
Definition dblockdevice.h:31
用于管理块设备上的分区
Definition dblockpartition.h:20
GptPartitionType
Gpt 分区所涵盖的分区类型
Definition dblockpartition.h:138
MbrPartitionType
Mbr 分区所涵盖的分区类型
Definition dblockpartition.h:39
DExpected< DBlockPartition * > createBlockPartition(const QString &path, QObject *parent)
用于创建设备分区对象
DExpected< DBlockPartition * > createBlockPartitionByMountPoint(const QByteArray &path, QObject *parent)
通过挂载点创建分区对象