Commit Graph

329 Commits

Author SHA1 Message Date
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 0f2ab468eb Disable some characters in FAT label input. 2017-09-10 19:19:08 +01:00
Andrius Štikonas f1654486dc Remove unnecessary semicolon. 2017-09-10 17:26:12 +01:00
Andrius Štikonas 5a83e741cb Add support for detecting ISO9660 file systems.
BUG: 364476
2017-09-08 11:42:12 +01:00
Andrius Štikonas 2cfcefd9c9 nilfs2: pass -f to mkfs.nilfs2 to overwrite existing file system 2017-09-08 00:20:35 +01:00
Andrius Štikonas 2b52ec492b Only create QRegularExpressionValidator when needed and destroy it afterwards. 2017-09-05 16:20:50 +01:00
Pali Rohár 9cc6596cb4 Implement udf::labelValidator() for validating UDF label
This would rapidly simplify UDF code if all checks are done by caller.

Also checks for MIN_UDF_BLOCKS/MAX_UDF_BLOCKS are removed as they should be
covered by udf::minCapacity() and udf::maxCapacity().
2017-09-05 15:53:24 +01:00
Andrius Štikonas 58f3d09d71 Port away from QRegExp. 2017-09-05 12:57:45 +01:00
Andrius Štikonas 447ae7fc90 Use QValidator to validate label input. 2017-09-05 12:52:34 +01:00
Andrius Štikonas 0badfebcb1 lvm: disable error channel for vgs/pvs commands.
Having an error channel can result in unwanted devices, e.g.:
"/dev//dev/mapper/test: read failed after 0 of 4096 at 0: Input/output error"
2017-09-04 19:55:08 +01:00
Andrius Štikonas 4a39e453dc Add a function for validating labels. 2017-09-04 17:39:29 +01:00
Andrius Štikonas 6ad873223e udf: set MBR partition id to 0x07. 2017-09-03 21:24:15 +01:00
Andrius Štikonas 703270b64c udf: do not hardcode min/max sector size. 2017-09-03 18:40:19 +01:00
Andrius Štikonas c4628ad715 Use block size provided by the backend in UDF file system. 2017-09-03 18:27:57 +01:00
Andrius Štikonas 7dba4b8245 Record sector size in FileSystem class. 2017-09-03 15:37:14 +01:00
Pali Rohár db13a4bab9 Process UDF label correctly when creating new UDF file system
Mkudffs from udftools prior to version 1.1 damages the label if it contains
non-ASCII characters.

The Volume Identifier (--vid) can only contain 30 bytes, either 30
ISO-8859-1 (Latin 1) characters or 15 UCS-2BE characters. Store the most
characters possible in the Volume Identifier.
2017-08-31 10:13:32 +01:00
Andrius Štikonas fd68f9334c Add createWithLabel support for F2FS. 2017-08-31 10:13:07 +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 684a1ce073 Add colour for UDF file system. 2017-08-31 10:12:54 +01:00
Pali Rohár feec00f4e7 Add basic support for UDF filesystem
For reading UDF label and UUID is needed blkid >= 2.30. For creating new
UDF filesystem is needed mkudffs binary from the udftools package.

When creating new UDF fileystem, revision 2.01 for hard disk media is used.
Therefore it is not possible to use it for optical (or other) medias.

Problems:
* Check for min and max capacity is incorrect as it depends on logical
  (sector) size of the disk.
* Check for max label length is incorrect too as it depends on characters
  itself in label.
* Specifying label is not working yet as FileSystem::create() does not get
  label parameter.
* UDF filesystem should be used on unpartitioned disk, without MBR or GPT
  and spanning whole disk, but KDE Partition Manager does not support it.
* When MBR is used, MBR partition id should be 0x07, but currently it is
  incorrect 0x83. See: https://serverfault.com/a/829172 (same for GPT)
2017-08-31 10:12:44 +01:00
Andrius Štikonas 037380228d QRegularExpression->QJson
lsblk LUKS mapping point parsing now uses json.
2017-07-04 14:42:39 +01:00
Andrius Štikonas 3228fa081a Use qAsConst in ranged based for loops. 2017-06-04 22:26:24 +01:00
Christian Morlok b10577e1c7 Fix creation of encrypted volumes
We can't rely on the order of lsblk. Check for the type=crypt instead.

BUG: 379205
2017-04-25 19:08:14 +01:00
Andrius Štikonas ff714f2f0e Fix online label support.
Some filesystems require mountpoint while some deviceNode to change file system
label only. So split writeLabel action into online and offline actions.
2017-04-09 17:49:55 +01:00
Andrius Štikonas 7c901593b2 Use slightly more descriptive variable names. 2017-02-05 15:50:56 +00:00
Andrius Štikonas b5b3af4b22 Use qCeil to set used sectors for luks file systems.
When using LUKS encrypted LVM logical volumes sector size is large and
we cannot assume that result of division is integer. Without this, number of
used extents can be underestimated by one.
2017-01-26 17:40:41 +00:00
Andrius Štikonas 901d01185f Do not set LUKS logical sector size to 512.
This breaks used space reporting for LUKS encrypted LVM LV.
2017-01-25 18:21:25 +01:00
Andrius Štikonas f8ba25fdfa Improve used space detection to use fs utils when not mounted. 2017-01-05 17:27:17 +00:00
Teo Mrnjavac 30ac4bb6ab [Coverity] Initialize all members.
CID 147251
2016-12-13 16:46:36 +01:00
Teo Mrnjavac dcf972b779 [Coverity] Initialize all members.
CID 154913
2016-12-13 16:40:47 +01:00
Andrius Štikonas cbe21e7ef9 Fix online resize of encrypted volumes. 2016-12-06 21:42:44 +00:00
Andrius Štikonas cc8a2558eb Fix one forgotten instance of fsck.msdos -> fsck.fat. 2016-12-06 01:45:22 +00:00
Andrius Štikonas 2e960d5c00 Make initLUKS function non-static. 2016-11-30 17:18:51 +00:00
Teo Mrnjavac 52b356e45f Make sure to always also read outerUuid. 2016-11-30 17:44:03 +01:00
Teo Mrnjavac 39ec355b70 Remove obsolete headers. 2016-11-30 16:42:03 +01:00
Teo Mrnjavac 5e40017238 Add FS::luks::outerUuid(). 2016-11-30 16:42:03 +01:00
Teo Mrnjavac eb3b90ec9e Handle cryptsetup luksUUID failure. 2016-11-16 15:20:54 +01:00
Andrius Štikonas bb8514e859 Fix handling of encrypted LVM physical volumes. 2016-11-03 14:21:18 +00:00
Andrius Štikonas e47dd74635 Convert Partition*->QPointer<Partition> in LvmPV class. 2016-11-03 13:39:16 +00:00
Andrius Štikonas 5d2bb2f8af Store list of physical volumes in a global variable. 2016-11-03 13:26:14 +00:00
Andrius Štikonas 36202cc1ad Replace complicated QPair type with custom LvmPV class. 2016-11-02 23:06:55 +00:00
Andrius Štikonas 0827eda687 Do not run the same check twice.
Spotted by Kevin_Kofler.
2016-10-30 02:54:10 +00:00
Andrius Štikonas e103c65b73 Always force LUKS password (in case crypsetup is compiled with libpwquality). 2016-10-30 02:41:24 +00:00
Andrius Štikonas 3272cd3f5f Do not allow deactivating LUKS containers containing active LVM physical volumes. 2016-10-30 02:31:46 +00:00
Andrius Štikonas 2414b69be1 mkfs.fat exists with code 1 when it is run without any arguments. 2016-10-30 01:15:08 +00:00
Andrius Štikonas e765316f9e Mark LVM PV as mounted if it is part of Volume Group.
* Add support for online LVM PV resize and check actions.
* Fix support for online actions inside LUKS container.
2016-10-30 01:47:29 +01:00
Andrius Štikonas 898c9a7333 mkfs.msdos->mkfs.fat 2016-10-28 22:07:52 +01:00
Andrius Štikonas 559fad9803 Show mount point for swap as "none".
This also silences QFileInfo warning from KMountPoint.
2016-10-03 00:14:46 +01:00
Andrius Štikonas ee6e4469ca Remove unused function. 2016-09-24 23:05:15 +01:00
Andrius Štikonas aa5daf0378 Use symlinks to hfsplus (diskdev_cmds) commands.
Some distributions rename those commands to mkfs.hfsplus and fsck.hfsplus.

BUG: 369288
2016-09-24 17:10:16 +01:00
Andrius Štikonas ef7680030c Remove some no longer necessary functions. 2016-09-18 02:40:30 +01:00
Andrius Štikonas 5592c05ef3 Mark luks sector size to be constexpr. 2016-09-12 19:43:58 +01:00
Chantara Tith 874900fe72 Move initLUKS from helpers to FS::luks. 2016-09-12 23:49:20 +07:00
Chantara Tith c70945b116 Change LUKS default logicalSectorSize to 512 2016-09-12 23:44:17 +07:00
Chantara Tith bcd6156628 Reduce code duplication in handling mountPoint/mount/diskSpace. 2016-09-12 17:23:19 +07:00
Andrius Štikonas 123369f78b Store the list of LVM Physical Volumes in operationStack.
This is necessary in order to make LVM LV formatted as LVM PV work.
2016-09-10 22:10:25 +01:00
Andrius Štikonas 70a9a0dd9a More optimizations for LVM. 2016-09-08 01:42:04 +01:00
Andrius Štikonas 7c0a32758e Do not check for cryptsetup executable so often. 2016-09-07 15:14:25 +01:00
Andrius Štikonas 8f77c6d679 Construct list of LVM PVs from our own device list instead of using pvs. 2016-09-07 14:36:25 +01:00
Andrius Štikonas d197b9b06e Optimize LUKS scanning. 2016-09-06 18:21:17 +01:00
Andrius Štikonas b95fe45d66 Fix a bug when creating a luks encrypted partition. 2016-09-06 00:25:59 +01:00
Andrius Štikonas 4b9f34b109 Do not allow mounting/umounting LVM PVs. 2016-09-06 00:14:44 +01:00
Andrius Štikonas 5e5178b3af Initial work on storing LVM variables during initial scan. 2016-09-05 14:48:36 +01:00
Andrius Štikonas d83ec394b1 Make Filesystem::create non-const. 2016-09-05 12:10:56 +01:00
Andrius Štikonas b3e82d7c75 Cache LUKS specific variables during initial scan. 2016-09-04 23:32:00 +01:00
Andrius Štikonas b5b5ac9cb4 getPESize does not have to be static. 2016-09-04 11:55:49 +01:00
Andrius Štikonas 5ab60c6dfa Enable used space reporting for swap.
BUG: 367473
2016-08-29 12:12:57 +01:00
Andrius Štikonas 742905ef7f Support setting labels online. 2016-08-26 21:16:14 +01:00
Andrius Štikonas c84ff5b957 Use swaplabel for swap labels. 2016-08-26 18:31:14 +01:00
Andrius Štikonas ef2c85e60f Silence clang warning + some other small changes.
Fix a typo in a comment
2016-08-24 23:01:36 +01:00
Chantara Tith 28dd42839d More documentations. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 4de925735e Convert some for loops into for ranged based loops. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 16a2d063e3 More work on C++11 for loops. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 799d213530 Make getFreePV const. 2016-08-15 17:20:50 +01:00
Andrius Štikonas a10c8d3aaa Convert to C++11 for loop where it is safe (avoid detaching Qt objects). 2016-08-15 17:20:50 +01:00
Andrius Štikonas da081d2f29 Add --force to lvm pvcreate in case there are some old file system signatures. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 81a35f0ffd Improve resizing of LVM PVs. 2016-08-15 17:20:50 +01:00
Chantara Tith 61d5e874d8 FIX LVM2 PV resize FIXME. 2016-08-15 17:20:50 +01:00
Chantara Tith 0d09853bd4 Remove hardcoded 4096 payloadOffset. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 8a3ba0a4a6 Remove unused header. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 432e59ac67 Add support for lvm pvmove before doing pvresize. 2016-08-15 17:20:50 +01:00
Andrius Štikonas fd8c81921e Get rid of unused LVM flag for LVM LV. 2016-08-15 17:20:50 +01:00
Chantara Tith 97c20ef236 Fix Luks over LVM resizing. Hardcode 512 as the sector instead of LVM PE size. 2016-08-15 17:20:50 +01:00
Chantara Tith 0952ffb11f Hardcode LUKS payload offset return value in byte size instead of sector number. 2016-08-15 17:20:50 +01:00
Chantara Tith 38b324036e Overload getPVSize for QStringList. 2016-08-15 17:20:50 +01:00
Chantara Tith c26e094ca1 Move lvm2_pv functions to static. 2016-08-15 17:20:50 +01:00
Chantara Tith e8bff59040 It makes more sense to have logic for getting list of used PVs in the LvmDevice. 2016-08-15 17:20:50 +01:00
Chantara Tith ad23d6cbce Fix createVG PV list white space problem. 2016-08-15 17:20:50 +01:00
Chantara Tith 036ed02b29 Add used and free PV scan for lvm2_pv. 2016-08-15 17:20:50 +01:00
Chantara Tith a91d65aa47 Move lvm2_pv from regex to field options. Add read used space to lvm pv 2016-08-15 17:20:50 +01:00
Chantara Tith f53cc1b55c Cache lvm2_pv and luks result in finding external tool 2016-08-15 17:20:50 +01:00
Chantara Tith 6360260fae Add support for reading LVM PV info 2016-08-15 17:20:50 +01:00
Chantara Tith 0af98556ac Implement lvm PV resizing 2016-08-15 17:20:50 +01:00
Chantara Tith 0a6de0c2f0 Set VG name as PV mount point 2016-08-15 17:20:50 +01:00
Andrius Štikonas b0dccc1c36 Also enable LUKS for F2FS and nilfs2 filesystems. 2016-08-08 02:03:45 +01:00
Andrius Štikonas 4d25524e91 Add support for resizing online. 2016-08-08 02:01:35 +01:00
Andrius Štikonas 0f33fe07c9 Fix coverity issues and some other minor simplifications. 2016-08-05 13:55:56 +01:00
Andrius Štikonas ea99bcc76f Correctly report used space of FAT partitions whose dirty bit is set.
BUG: 366313
2016-08-02 21:41:09 +01:00
Andrius Štikonas 918cf2ffa4 Use more compact syntax for passing and returning kauth helper arguments. 2016-07-29 14:19:12 +01:00
Andrius Štikonas 99886f32fc Add more warning tags. 2016-07-18 12:50:52 +01:00
Andrius Štikonas 39e419a36e Use <warning> KUIT tags. 2016-07-18 12:21:06 +01:00
Andrius Štikonas 3a2b78e143 Improve semantic markup of translations. 2016-07-17 23:41:00 +01:00
Andrius Štikonas e437da6091 Also check whether HFS+ shrink support is available. 2016-06-12 16:15:18 +01:00
Andrius Štikonas 2514f7d8f4 Use diskdev_cmds instead of obsolete hfsplusutils for HFS+ file systems. 2016-06-12 13:33:04 +01:00
Andrius Štikonas b6911285dc Adjust maximum capacity for fat32, jfs and reiserfs. 2016-06-09 22:07:23 +01:00
Andrius Štikonas 35c7f9749e Also reduce max capacity for ext2 and ext3 file systems. 2016-06-09 19:46:21 +01:00
Andrius Štikonas 3756ec45da Reduce maximum capacity of FAT16 file systems by 1 MiB. 2016-06-09 19:22:56 +01:00
Andrius Štikonas 09711cdf1d Whitespace fixes. 2016-06-01 21:00:31 +01:00
Andrius Štikonas 0c70c66aae Disable MountPointDialog for swap, lvm pv and unknown partitions. 2016-05-24 17:26:12 +01:00
Andrius Štikonas 9de7341985 Use lsblk --list instead of lsblk --raw. Makes unicode mapper names work. 2016-05-23 12:00:33 +01:00
Andrius Štikonas b4a13599aa Libpartedbackend can also use KDiskFreeSpaceInfo for mounted luks partitions. 2016-05-22 00:52:07 +01:00
Andrius Štikonas 35a4798672 Add some support to get used space info for mounted LUKS partitions using KDiskFreeSpaceInfo. 2016-05-22 00:48:55 +01:00
Andrius Štikonas 7e8ee77edf Make luks helper functions non-static. 2016-05-20 19:38:12 +01:00
Andrius Štikonas 12bc2329a2 Used space is larger for luks volumes due to payload. 2016-05-20 19:17:52 +01:00
Andrius Štikonas fdfc47cf8f Leave LUKS cmdSupport variables static for now. 2016-05-18 17:39:28 +01:00
Andrius Štikonas 7914e0aa98 Improve luks::supportCopy and luks::supportSetLabel. 2016-05-18 02:04:33 +01:00
Andrius Štikonas ecbbdb3b1d Do not allow moving open luks volumes. 2016-05-18 00:46:08 +01:00
Andrius Štikonas 47cb6752ba Use batch mode of cryptsetup to format luks volume. 2016-05-18 00:44:15 +01:00
Andrius Štikonas e5d72b7d11 Set miinimal capacity for btrfs filesystems back to 256 MiB.
mkfs.btrfs can make smaller filesystems but other tools, e.g.
btrfs filesystem resize do not work well on small partitions.
2016-05-17 22:02:21 +01:00
Andrius Štikonas a610e24686 Move luks init code to constructor. 2016-05-17 19:05:17 +01:00
Andrius Štikonas 142ff07938 Remove reduntant virtual keywords. 2016-05-17 18:01:31 +01:00
Andrius Štikonas 094042cc75 Fix luks operations. 2016-05-17 17:38:17 +01:00
Andrius Štikonas 5d28790152 Simplify Luks support tool (and do not init Luks filesystem). 2016-05-17 17:35:49 +01:00
Andrius Štikonas 927a6421fe Make FileSystem::init virtual instead of static. 2016-05-17 16:33:52 +01:00
Andrius Štikonas e64e536797 Revert "Remove Luks from FileSystemFactory."
This reverts commit 98d515e826.
2016-05-17 15:30:40 +01:00
Andrius Štikonas 98d515e826 Remove Luks from FileSystemFactory. 2016-05-17 15:04:50 +01:00
Andrius Štikonas 6d82fc0964 Document new function variables. 2016-05-13 23:18:24 +01:00
Andrius Štikonas c6c31dc5c0 Use long options for mount. 2016-05-13 23:13:22 +01:00
Andrius Štikonas 1dfe304fd2 Restore back functionality of unmounting all mount points. 2016-05-13 23:08:58 +01:00
Chantara Tith b653b5b6e3 move mount logic from Partition to FileSystem 2016-05-13 23:00:27 +01:00
Chantara Tith 2a12571d44 move unmount logic from Partition to FileSystem 2016-05-13 23:00:27 +01:00
Andrius Štikonas 3bfb0b4b5b Restore optimized luks::mapperName function.
It seems that crashes are not our fault but rather of frameworkintegration.
2016-05-13 00:58:00 +01:00
Andrius Štikonas 9b5c33696c Show error message if shrinking innerFS inside luks fails. 2016-05-12 16:48:32 +01:00
Andrius Štikonas 1ea4f4976d Revert "Revert "Port away from QRegExp to QRegularExpression.""
This reverts commit c291af2c83.
2016-05-12 16:45:13 +01:00
Andrius Štikonas 82243234e3 We no longer need to fill partition sizes. KPMCore now tracks max fs size (including inside luks). 2016-05-11 23:00:37 +01:00
Andrius Štikonas c291af2c83 Revert "Port away from QRegExp to QRegularExpression."
This reverts commit bb2de6cd56.

This was causing a crash when restoring partitions.
2016-05-11 22:31:33 +01:00
Andrius Štikonas 513bbdac4c Convert FS::luks static cmdSupport members to non-static. 2016-05-11 18:01:21 +01:00
Andrius Štikonas 7c137c36c6 Disable copying open luks volumes. 2016-05-11 15:19:51 +01:00
Andrius Štikonas 4aeea8b143 Remove accidentally committed debug code. 2016-05-11 14:58:06 +01:00
Andrius Štikonas a7c9acd518 Move luks label handlingfrom libpartedbackend to FS::luks. 2016-05-11 11:53:15 +01:00
Andrius Štikonas 19f5ce0b28 Remove curly braces when generating a new LUKS UUID. 2016-05-11 02:16:24 +01:00
Andrius Štikonas 0031f84315 Do not allow setting LUKS labels when crypt is closed. 2016-05-10 02:20:37 +01:00
Andrius Štikonas 64b0cf4c77 Unbreak non ASCII passphrases. 2016-05-09 11:07:31 +01:00
Andrius Štikonas 785aa7edf4 Avoid piping LUKS passphrase.
Also remove piping support from ExternalCommand.
It's unlikely that it will be useful enough. There were no more users of this
after luks open was migrated to QProcess::write.
2016-05-09 00:42:01 +01:00
Andrius Štikonas bb2de6cd56 Port away from QRegExp to QRegularExpression. 2016-05-08 00:22:22 +01:00
Andrius Štikonas 29c6578351 Fix nilfs reporting missing tools. 2016-05-08 00:21:22 +01:00
Andrius Štikonas 5c32921fcd Make log message more user friendly. 2016-05-07 01:11:59 +01:00
Andrius Štikonas 464b3060fb Remove remaining ../ from #includes. 2016-05-06 22:36:24 +01:00
Andrius Štikonas dc421db5c3 Move FS detection code back to backends. 2016-05-06 19:14:01 +01:00
Teo Mrnjavac d584c70696 Passphrase accessor. 2016-05-06 16:50:23 +02:00