Commit Graph

328 Commits

Author SHA1 Message Date
Andrius Štikonas 7ed6657e30 Restore functionality of FileSystem::findExternal
This also fixes unused variable warnings
2018-03-31 23:49:37 +01:00
Andrius Štikonas 738842799a Make kpmcore link libraries private. 2018-03-31 16:30:53 +01:00
Andrius Štikonas 9ea7cab92a Merge branch 'master' into kauth 2018-01-31 15:15:25 +00:00
Andrius Štikonas ba4e443223 Move file system label and UUID read code to backends.
This allows to use different implementations on different platforms.
E.g. libblkid is not available on FreeBSD.

libparted backend still uses the same libblkid implementation
sfdisk backend reads label and UUID from udev database
2018-01-31 15:13:34 +00:00
Andrius Štikonas 2534608094 Use btrfs check --repair instead of btrfsck. 2018-01-29 13:30:14 +00:00
Andrius Štikonas 4069e5112e Post merge fixes.
In kauth branch ExternalCommand::write should be called before start.
2018-01-11 11:45:39 +01:00
Andrius Štikonas 790553aa0b Merge branch 'smart' into kauth 2018-01-11 11:31:18 +01:00
Pali Rohár 2f4aeaf851 Add support for reading capacity and changing label/uuid on UDF filesystem 2018-01-03 20:09:53 +02:00
Andrius Štikonas 8b9451c8d7 We don't need keyLocation for luks1 file system it is always dm-crypt. 2017-12-29 22:53:02 +00:00
Andrius Štikonas 1802b7ad05 Add luks2::create method. 2017-12-29 20:38:36 +00:00
Andrius Štikonas 4773f49edc Initial support for resizing LUKS2 volumes.
Does not yet work when LUKS2 is used with dm-integrity.
2017-12-29 20:01:06 +00:00
Andrius Štikonas f20bea9bf8 Merge branch 'sfdisk' into kauth 2017-12-24 23:40:06 +00:00
Andrius Štikonas 97ccd8d154 Merge branch 'master' into sfdisk 2017-12-24 23:38:39 +00:00
Andrius Štikonas 5123411f1f Add support for FAT12 file system. 2017-12-24 23:24:37 +00:00
Andrius Štikonas 8de54d390e Make default LUKS2 colour different from LUKS. 2017-12-24 20:38:46 +00:00
Andrius Štikonas 76934a0cba Add forgotten luks2 files. 2017-12-15 19:35:30 +00:00
Andrius Štikonas 7aa77f489d Add FileSystem::Luks2 child class. 2017-12-14 02:08:32 +00:00
Andrius Štikonas 3f562ab0f0 Allow reading LUKS label. 2017-12-13 00:07:55 +00:00
Andrius Štikonas 4cc07d2366 Adapt ntfs updateBootSector changes to kauth branch. 2017-12-10 17:37:10 +00:00
Andrius Štikonas 47429dd1bf Proof of concept attempt to implement KAuth. 2017-12-10 17:36:39 +00:00
Andrius Štikonas e7b0192630 Merge branch 'master' into sfdisk 2017-12-10 17:35:35 +00:00
Andrius Štikonas e49a266922 ntfs: update backup boot sector too
When moving NTFS partition to a new location we need to update its boot sector
as well as backup boot sector. Otherwise ntfslabel --new-serial won't work.
2017-12-10 17:34:07 +00:00
Andrius Štikonas 0bfb7094df Merge branch 'master' into sfdisk 2017-12-06 00:41:19 +00:00
Andrius Štikonas d27455b6f0 Avoid unnecessary QString encoding/decoding.
CCBUG: 384321
2017-12-04 21:19:11 +00:00
Andrius Štikonas 8afe33a4a4 Allow setting label for inner LUKS file system during the initial creation. 2017-12-03 16:28:16 +00:00
Andrius Štikonas 6996687123 Merge branch 'master' into sfdisk 2017-12-03 12:38:43 +00:00
Andrius Štikonas 4bf5bb467f Fix conversion to/from QString/QByteArray
BUG: 384321
2017-12-03 12:37:21 +00:00
Andrius Štikonas f1a695bdac Add support for growing f2fs file system. 2017-11-13 19:34:52 +00:00
Andrius Štikonas be7ba11f17 Remove unnecessary semicolons. 2017-11-12 14:55:55 +00:00
Andrius Štikonas fad8a3568e Fix the previous commit.
FileSystem::create is never called if createWithLabel is available.
2017-11-12 14:45:49 +00:00
Andrius Štikonas 58f2decdf8 Support newer f2fs-tools versions.
BUG: 386771
2017-11-12 13:07:48 +00:00
Andrius Štikonas fcfd78cdc4 Add support for fatresize program. 2017-11-09 23:14:52 +00:00
Andrius Štikonas 89a5308686 btrfs: implement updateUUID. 2017-11-05 20:42:40 +00: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
Adriaan de Groot e67b6b6a2b Docs: Add documentation about FileSystem::name() 2017-10-02 16:16:49 +02:00
Andrius Štikonas 8c3ab58d84 Add a comment about FAT volume ID hack. 2017-09-28 14:24:13 +01:00
Pali Rohár e957c220bd Disallow non-ASCII and ASCII control characters in FAT label
FAT label is interpreted according to current OEM DOS codepage which is
system dependent setting. But most DOS codepages have same characters in
printable ASCII range, so this is the only safe range of characters which
are interpreted in same way by most programs and operating systems. Also
all DOS codepages are only 8bit, so characters above U+FF cannot be stored
to FAT label.
2017-09-26 22:02:02 +01:00
Pali Rohár 5a30aff288 Set FAT label in upper case
FAT label should be stored in upper case. Also Windows systems doing it.
2017-09-26 22:01:56 +01:00
Andrius Štikonas d99b3f6eb3 Improve QFileInfo usage.
Cache QFileInfo result in a local variable.
Before repeated request often incorrectly resulted in QString()
2017-09-17 00:39:53 +01:00
Andrius Štikonas f1888f0d1c Change a way untranslated file system name is accessed. 2017-09-15 12:47:01 +01:00
Andrius Štikonas 95a74c63d1 Do not report wrong mountpoint for closed LUKS file systems.
When libparted scans luks partitions it calls detectFileSystem
regardless of whether luks is open or closed. This results in
mapperNode being empty, so we need to prevent detectFileSystem
from reporting anything in this case.
2017-09-14 17:50:21 +01:00
Andrius Štikonas 5d65d83990 Add functions to access untranslated name of file system.
CCBUG: 364648
2017-09-14 14:23:07 +01:00
Andrius Štikonas 50ba46a693 Fix a typo where declarared variable was not used. 2017-09-14 01:27:38 +01:00
Andrius Štikonas 6b4185cff1 Do not crash when partition has no mount points. 2017-09-13 23:28:37 +01:00
Andrius Štikonas 34712dd2ed Add fstab file parser.
Remove dependency on KMountPoint and hence KIO.
2017-09-13 18:46:33 +01:00
Andrius Štikonas 6b6ddbdcef Use int for maxLabelLength. 2017-09-11 16:52:20 +01:00
Andrius Štikonas 17e6c32633 Fix more implicit type conversion warnings. 2017-09-11 13:41:03 +01:00
Andrius Štikonas 6c433c264c Port FileSystem::luks away from KDiskFreeSpaceInfo. 2017-09-11 12:19:49 +01:00
Andrius Štikonas 5433294a5b Fix more minor clang issues. 2017-09-11 00:29:30 +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 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