Commit Graph

119 Commits

Author SHA1 Message Date
Tomaz Canabrava 6c14ddb043 Add new job to change permission of the newly created partition 2021-12-28 15:07:35 +00:00
Artem Grinev f4664671d6 Clear attributes on new partition creation 2021-08-27 02:37:19 +04:00
Andrius Štikonas 2382b9e1c5 Rename d pointer to d_ptr to disambiguate from Device d. 2020-11-12 01:04:47 +00:00
Gaël PORTAY 82566e63e7 d-pointerize NewOperation class. 2020-11-11 16:41:14 -05:00
Andrius Štikonas 19f78ef76a Port away from qAsConst. 2020-10-24 22:01:45 +01:00
Andrius Štikonas ec3479f302 Add overrides to destructors. 2020-10-24 01:33:52 +01:00
Andrius Štikonas 0910875137 Do not delete partitions when we have no partition table. 2020-10-03 14:15:10 +01:00
Andrius Štikonas de346177b5 Do not allow moving partitions without partition table. 2020-10-03 12:41:18 +01:00
Andrius Štikonas d68ffeadef REUSE: SPDX style license headers for src/util. 2020-10-01 00:33:19 +01:00
Andrius Štikonas 8b10771327 REUSE: SPDX style license headers for src/ops. 2020-09-30 23:28:47 +01:00
Andrius Štikonas fc826690b9 SPDX licenses for tests and CMakeLists.txt. 2020-09-17 02:15:16 +01:00
Andrius Štikonas c5c21849b9 Compile kpmcore with QT_NO_KEYWORDS. 2020-09-15 02:36:46 +01:00
Gaël PORTAY 0ffec31e2b Add new job to set the GPT partition attributes
The GPT partition layout supports partition attributes.

The CLI sfdisk sets the partition attributes using the option
--part-attrs. See the examples below:

	$ cat <<EOF | sfdisk disk.img
	label: gpt
	type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=64M
	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
	EOF
	(...)

	$ sfdisk --part-attrs disk.img 1 RequiredPartition,NoBlockIOProtocol,LegacyBIOSBootable,48
	(...)

	$ sfdisk --part-attrs disk.img 2 60,61,62,63
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=BBE806BB-8567-A843-9FF5-9B6B35D2908E, attrs="RequiredPartition NoBlockIOProtocol LegacyBIOSBootable GUID:48"
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=7DB39F08-C138-664B-B38E-ED2DEB549AA6, attrs="GUID:60,61,62,63"

This commit introduces the new job set-partition-attributes that is used
in the new-operation to set the attributes of the partition. The job
uses the newly introduced method setPartitionAttributes that is
implemented by the sfdisk and dummy backends.

Note: This is a copypaste of what was done for GPT partition label in
commit f585f6c (Add new job to set the GPT partition label) and GPT
partition UUID in commit 1dde035 (Add new job to set the GPT partition
UUID).

Note: RequiredPartition, NoBlockIOProtocol, LegacyBIOSBootable are
key words for 0, 1 and 2.
2020-06-15 17:51:42 -04:00
Gaël PORTAY 1dde035705 Add new job to set the GPT partition UUID
The GPT partition layout supports unique GUID partitions.

The CLI sfdisk sets the partition UUID using the option --part-uuid.
See the examples below:

	$ cat <<EOF | sfdisk disk.img
	label: gpt
	type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=64M
	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
	EOF
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=BBE806BB-8567-A843-9FF5-9B6B35D2908E
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=7DB39F08-C138-664B-B38E-ED2DEB549AA6

	$ sfdisk --part-uuid disk.img 1 00000000^C000-0000-0000-000000000000
	(...)

	$ sfdisk --part-uuid disk.img 2 11111111-1111-1111-1111-111111111111
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=00000000-0000-0000-0000-000000000000
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=11111111-1111-1111-1111-111111111111

This commit introduces the new job set-partition-uuid that is used in
the new-operation to set the UUID of the partition. The job uses the
newly introduced method setPartitionUUID that is implemented by the
sfdisk and dummy backends.

Note: This is a copypaste of what was done for GTP partition label in
commit f585f6c (Add new job to set the GPT partition label).
2020-05-15 12:13:17 -04:00
Andrius Štikonas d6b2584d1b Merge branch 'partition-name' into 'master'
Add support for setting the GPT partition name.

See merge request kde/kpmcore!4
2020-03-28 00:42:09 +00:00
Gaël PORTAY f585f6c3ad Add new job to set the GPT partition label
The GPT partition layout supports naming partitions.

The support for the partition label was added in the backend libparted
since commit 28fa6ac (Add support for GTP partition labels).

The libparted was removed later by commit 8fa1814 (Remove libparted
backend) and no backend sets the partition label.

The CLI sfdisk sets the partition label using the option --part-label.
See the examples below:

	$ cat <<EOF | sfdisk disk.img
	label: gpt
	type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, size=64M
	type=0FC63DAF-8483-4772-8E79-3D69D8477DE4
	EOF
	(...)

	$ sfdisk --part-label disk.img 1 efi
	(...)

	$ sfdisk --part-label disk.img 2 rootfs
	(...)

	$ sfdisk --dump disk.img
	(...)
	disk.img1 : start=        2048, size=      131072, type=C12A7328-F81F-11D2-BA4B-00A0C93EC93B, uuid=D08E5B2A-4649-9F4A-AEA3-6C3048888EAA, name="efi"
	disk.img2 : start=      133120, size=     1963999, type=0FC63DAF-8483-4772-8E79-3D69D8477DE4, uuid=0BEEFE82-19EA-DC4C-BB6A-27B6DA0C3BD2, name="rootfs"

This commit introduces the new job set-partition-label that is used in
the new-operation to set the label of the partition. The job uses the
newly introduced method setPartitionLabel that is implemented by the
sfdisk and dummy backends.
2020-03-25 11:20:01 -04:00
Yuri Chornoivan 62aaa90a29
Fix minor EBN issues 2020-03-21 11:22:15 +00:00
Andrius Štikonas 4b6a26f0f8 Fix setting partition path when restoring partitions.
BUG: 399791
2019-05-10 02:12:07 +01:00
Andrius Štikonas 28e1308ec5
Switch to scoped name PartitionTable::Flag::
Deprecated old style enum PartitionTable::FlagName.
This will allow to switch to scoped enum class in some future version.
2019-02-09 18:04:44 +00:00
Andrius Štikonas d17615532a Check if PartitionNode::insert returns success. 2018-10-19 20:18:39 +01:00
Andrius Štikonas b06af11357 Fix free space handling with LVM LVs.
The previous commit worked for resizing LVM.
However, it is better to do special handling of LVMs in
insert/removePreviewPartition.

BUG: 399772
2018-10-19 19:55:35 +01:00
Andrius Štikonas 3e31ec1431 Fix free space handling when resizing LVM LVs.
BUG: 399772
2018-10-14 00:02:06 +01:00
Caio Carvalho 4b723be585 Adding LvmDevice::s_OrphanPVs shared list to store PVs paths that are member of VGs that will be deleted soon. 2018-07-23 13:34:40 -03:00
Caio Carvalho 9138e02726 Operations should check LvmDevice::s_DirtyPVs instead of check pending CreateVolumeGroupOperations to search for newly LVM PVs. 2018-07-15 19:41:44 -03:00
Caio Carvalho f3fac7eac7 Add SoftwareRAID::Status enum.
Check for RAID before modelCommand in SfdiskBackend::scanDevice.
2018-07-15 13:11:50 -03:00
Caio Carvalho a0b9a93b6b Support inactive RAID devices. 2018-07-15 10:31:27 -03:00
Andrius Štikonas 9e3386a53b Static cast should be sufficient here
In the line above we already check if partition type is luks
2018-07-08 11:02:34 +01:00
Caio Carvalho 9e6cf4063a - Refactoring LVM::pvList to be a class with static QList<LvmPV> attribute instead of extern instance.
- Moving LVM VG verification in canShrink, canMove, canGrow to isLVMPVinNewlyVG method at ResizeOperation.
- Don't grow LVM PVs that are being targeted by CreateVolumeGroupOperations.
2018-05-09 04:09:17 -03:00
Caio Carvalho 6b0af70ccd Avoiding segfault in DeleteOperation and ResizeOperation. 2018-05-07 22:56:24 -03:00
Caio Carvalho 1e95d01923 - Including vgName in CreateVolumeGroupOperation description.
- Don't delete LVM PVs that are being targeted by CreateVolumeGroupOperations.
- Don't shrink or move LVM PVs that are being targeted by CreateVolumeGroupOperations.
2018-05-07 21:55:49 -03:00
Caio Carvalho 34cfc63da4 Including CreateVolumeGroupOperation::targets(const Partition&) implementation. 2018-05-03 20:48:11 -03:00
Andrius Štikonas 9e107c8136 Add forgotten files. 2018-04-11 15:14:17 +03:00
Andrius Štikonas db40442744 d-pointerize Operation class. 2018-04-11 03:52:46 +03:00
Andrius Štikonas 622def3b56 Convert more enums to scoped enums. 2018-04-09 15:14:34 +01:00
Andrius Štikonas ee2688d4d9 Merge branch 'master' into kauth 2018-04-09 12:44:14 +01:00
Andrius Štikonas b42b41bdea Add a shorter Partition::State enum names.
Will be converted to enum class later.
2018-04-09 03:46:05 +01:00
Andrius Štikonas 3ccd04e675 Switch Device::Type enum to enum class. 2018-04-09 02:57:45 +01:00
Andrius Štikonas 17c8772240 Explicitely specify the scope of enum. 2018-04-07 19:54:30 +01:00
Andrius Štikonas 7ed6657e30 Restore functionality of FileSystem::findExternal
This also fixes unused variable warnings
2018-03-31 23:49:37 +01:00
Andrius Štikonas 72dfbe480a Replace readSectors/writeSectors backend functions.
New alternatives use QByteArray to store data and use bytes, not sectors.
2017-10-28 18:07:44 +01:00
Andrius Štikonas 8a477e689e Minor clang warnings++ 2017-09-11 12:01:39 +01:00
Andrius Štikonas f7e5f7c7bf Rename KPMcore include guards.
clang in -Weverything mode does not like double underscore.
2017-09-10 20:12:52 +01:00
Andrius Štikonas f1accd1e0d Remove IconThemes dependency from kpmcore. 2017-09-08 15:05:55 +01:00
Andrius Štikonas 7dba4b8245 Record sector size in FileSystem class. 2017-09-03 15:37:14 +01:00
Andrius Štikonas d797a47229 QList->QVector. 2017-08-31 10:48:10 +01:00
Andrius Štikonas 6a78a74515 Add support for creating file systems with label.
Some file systems such as UDF or F2FS only support writing labels when creating
them.

At the moment this only works in new partition dialog and not in the partition
properties dialog.
2017-08-31 10:13:01 +01:00
Andrius Štikonas 3228fa081a Use qAsConst in ranged based for loops. 2017-06-04 22:26:24 +01:00
Teo Mrnjavac a20d81c345 [Coverity] Initialize all members.
CID 154914
2016-12-13 16:36:36 +01:00
Andrius Štikonas a78e6f986e Disable pasting into LVM VG. It does not yet work. 2016-11-10 14:52:02 +00:00
Andrius Štikonas f9d9d8912b Disable copying LVM LVs. It does not yet work. 2016-11-10 14:29:38 +00:00