Commit Graph

370 Commits

Author SHA1 Message Date
Andrius Štikonas df449ac3d4 Mark old enum values as deprecated. 2018-04-09 13:42:36 +01:00
Andrius Štikonas ee2688d4d9 Merge branch 'master' into kauth 2018-04-09 12:44:14 +01:00
Andrius Štikonas f389306964 Make sure deprecated Partition::State enums have the same values as the new ones. 2018-04-09 12:32:46 +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 87f0d9d0a7 micro-optimization: QStringLiteral->QLatin1Char 2018-04-09 03:18:12 +01:00
Andrius Štikonas 844f7b3d59 LvmDevice: switch away from manual pointers. 2018-04-09 03:14:30 +01:00
Andrius Štikonas 3ccd04e675 Switch Device::Type enum to enum class. 2018-04-09 02:57:45 +01:00
Andrius Štikonas 1021e375b4 Create a new d-pointer when copying Device class.
Fixes a crash in Calamares
2018-04-09 02:45:24 +01:00
Andrius Štikonas 7e8bab3b4e d-pointerize LvmDevice class. 2018-04-09 02:40:24 +01:00
Andrius Štikonas df364bdc7c Reuse the d-pointer of the base class Device for the child class DiskDevice. 2018-04-09 00:35:06 +01:00
Andrius Štikonas 210dea15de Use smart pointer for SmartStatus.
Fixes a memory leak.
2018-04-08 14:58:02 +01:00
Andrius Štikonas a71be700ba d-pointerize Device class. 2018-04-08 14:45:59 +01:00
Andrius Štikonas 17c8772240 Explicitely specify the scope of enum. 2018-04-07 19:54:30 +01:00
Andrius Štikonas 876c037ebf Use strongly typed enum for SmartAttributeUnit. 2018-04-05 23:06:52 +01:00
Andrius Štikonas 63cea60ff1 Replace std::array with std::vector
Less efficient but helps with keeping ABI stable
2018-04-05 21:52:17 +01:00
Andrius Štikonas 54be18e8ad Deprecate cyllinder and head count. 2018-04-02 14:12:35 +01:00
Andrius Štikonas cfa853a931 d-pointerize DiskDevice class. 2018-04-02 13:46:53 +01:00
Andrius Štikonas 0b6d91bbdb Do not install some private smart include files. 2018-04-02 13:13:16 +01:00
Andrius Štikonas 398e9c3df5 d-pointerize FstabEntry class 2018-04-01 18:46:26 +01:00
Andrius Štikonas 2527b3ecc3 Merge branch 'master' into kauth 2018-03-31 20:30:05 +01:00
Andrius Štikonas c1f4b36305 Fix mutex logic for cancelling operations. 2018-03-31 20:17:43 +01:00
Andrius Štikonas 1500eeb625 Use std::unique_ptr for CoreBackendDevices 2018-03-31 14:44:40 +01:00
Andrius Štikonas e3aae714a2 Remove unnecessary whitespace. 2018-03-24 18:27:00 +00:00
Caio Carvalho f8f25dc82a - Changing SmartQuirkDatabase to store QString instead of char*.
- Changing quirkDatabase function to return QVector<SmartQuirkDatabase> instead of SmartQuirkDatabase*.
2018-03-24 15:17:30 -03:00
Andrius Štikonas ac6dc0eb87 Remove backend readData/writeData functions. 2018-02-06 16:48:02 +00:00
Andrius Štikonas 2641730c0c Merge branch 'master' into kauth 2018-02-04 15:56:38 +00:00
Andrius Štikonas 469855f7f7 Add missing variables to Partition class copy constructor. 2018-02-04 15:21:58 +00:00
Andrius Štikonas f2b7f2bd9b Use const char* instead of QString in Fstab::findBlkIdDevice
Thansk to: Adriaan de Groot
2018-01-31 17:02:59 +00:00
Andrius Štikonas f98dbcc208 Only use libblkid on Linux. 2018-01-31 16:58:00 +00:00
Andrius Štikonas 838150d439 Do not use blkid cache. 2018-01-31 16:53:34 +00:00
Andrius Štikonas c50006ed22 Fix #include issues in smart code.
CC: caiojcarvalho@gmail.com
2018-01-31 16:12:11 +00:00
Andrius Štikonas 9ea7cab92a Merge branch 'master' into kauth 2018-01-31 15:15:25 +00:00
Andrius Štikonas dd709fc8a9 Remove unnecessary extra LIBKPMCORE_EXPORT macros. 2018-01-27 13:15:19 +00:00
Huzaifa Faruqui e42a5c9289 Implement copyblocks function in KAuth helper.
Switch BackupFileSystemJob to thenew copyblocks function.

Reviewed and cleaned up by: Andrius Štikonas
2018-01-24 15:22:42 +00:00
Caio Carvalho a3d43e159f Removing LIBKPMCORE_EXPORT from SmartParser and adding SMART support dependencies to testsmart in cmake 2018-01-21 01:41:59 -03:00
Caio Carvalho 49c0c39f4b - Including SMART support test
- Adding export macro to SmartParser
2018-01-20 21:56:10 -03:00
Andrius Štikonas 1c024c6b29 Fix a typo in the comment. 2018-01-11 21:59:18 +01:00
Caio Carvalho 0190d32cf6 Including doxygen comments to the new SMART support classes 2018-01-11 17:38:53 -03:00
Andrius Štikonas a135c86ba1 Use QStringLiteral instead of QString::fromLocal8Bit 2018-01-11 14:17:55 +01:00
Andrius Štikonas ed7c5b1c77 Use long command line option for smartctl. 2018-01-11 12:00:52 +01:00
Andrius Štikonas 790553aa0b Merge branch 'smart' into kauth 2018-01-11 11:31:18 +01:00
Caio Carvalho 44fae61d4f - Removing libatasmart dependency from CMakeLists.txt
- Changing getQuirk regular expression evaluation to use QRegularExpression instead of QRegExp
2018-01-09 19:34:20 -03:00
Caio Carvalho d71731141c - Changed m_Quirk variable in SmartAttributeParsedData to SmartQuirk value instead of reference
- Changed smartctl call to use ExternalCommand class instead of QProcess
- Changed Q_FOREACH to C++11 ranged based for
- Changed quint64 json parsing
2018-01-09 01:35:59 -03:00
Caio Carvalho 8177fb9738 Adding smart JSON output support 2018-01-08 17:59:48 -03:00
Andrius Štikonas f20bea9bf8 Merge branch 'sfdisk' into kauth 2017-12-24 23:40:06 +00:00
Andrius Štikonas 3e7e9d8955 Sort partitions by first sector. 2017-12-21 23:16:12 +00:00
Andrius Štikonas 3a691edb4a Do not install copy source/target device headers. 2017-12-15 19:33:11 +00:00
Andrius Štikonas 8264c87ab8 Cleanup unnecessary includes. 2017-12-10 18:44:54 +00:00
Andrius Štikonas 27462bcddb Remove workaround to access user dbus session as root. 2017-12-10 18:09:03 +00:00
Andrius Štikonas 906a89c16d Use ExternalCommand to copy fstab file to its final location. 2017-12-10 17:36:39 +00:00
Andrius Štikonas d2f13ff4cc QFile->QTemporaryFile. 2017-12-10 17:36:39 +00:00
Andrius Štikonas 41473119b1 backend: provide more information about backend device.
Pass Device object, not just deviceNode string when opening Core Backend Device
2017-12-06 21:33:31 +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 0d88e26c8c Add an experimental sfdisk backend. 2017-11-07 22:51:29 +00:00
Andrius Štikonas 9ea983654c Do not export symbols of CopySource(Target)Device
Calamares resize jobs was ported to ResizeOperation, so this is no longer
necessary.
2017-11-01 20:11:38 +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
Andrius Štikonas e4c125c519 Do not over encapsulate Partition methods.
This caused more trouble than helped. There is no reason not to allow
e.g. settings new flags on partition or changing it's path.
2017-10-09 21:13:58 +01:00
Andrius Štikonas d741fe4a00 Fix a typo in a comment. 2017-10-09 17:37:16 +01:00
Andrius Štikonas 2760f02fbf Move LVM device scanning code.
Now it's the backend's responsibility to find LVM devices.
All LVM scanning code was moved into LvmDevice::scanSystemLVM helper,
so that it is very easy to plug LVM into backend.

LVM devices are now intentionally not detected in Dummy Backend.
2017-10-06 03:17:51 +01:00
Andrius Štikonas 15eabf9859 Add some comments about LVM in DeviceScanner. 2017-10-03 21:02:40 +01:00
Adriaan de Groot c4ae5d680c Docs: document Device (a description) and CoreBackendDevice (an operational class) 2017-10-03 05:56:16 -04:00
Andrius Štikonas 098fdee506 fstab fixes:
* Do not output # for empty inline comments.
  * More checks to validate fstab entry.
2017-09-20 21:22:53 +01:00
Andrius Štikonas a3732c1459 Fix a typo. Remove extra trimmed(). 2017-09-17 13:52:48 +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 4a64465738 Remove MountEntry class. 2017-09-16 20:56:32 +01:00
Andrius Štikonas 8dd1e70b21 Fix inline comment handling.
CCBUG: 305469
2017-09-16 20:50:57 +01:00
Andrius Štikonas baec157314 Add a function to write fstab file.
CCBUG: 305469
2017-09-16 20:40:46 +01:00
Andrius Štikonas 8719fb0bf3 Add fstab mutators. 2017-09-16 20:16:17 +01:00
Andrius Štikonas 4257021857 Use QStringList to store fstab options. 2017-09-16 19:09:03 +01:00
Andrius Štikonas ec89795326 Allow accessing untranslated partition roles. 2017-09-15 13:09:01 +01:00
Andrius Štikonas dff6086e64 Copy paste typo. 2017-09-15 12:59:10 +01:00
Andrius Štikonas 0d16e945c1 Add a partition role name for LVM logical volume. 2017-09-15 12:50:05 +01:00
Andrius Štikonas f1888f0d1c Change a way untranslated file system name is accessed. 2017-09-15 12:47:01 +01:00
Andrius Štikonas f29534e7c7 Use untranslated file system name when exporting partition table.
CCBUG: 364648
2017-09-14 14:47:00 +01:00
Andrius Štikonas 50ba46a693 Fix a typo where declarared variable was not used. 2017-09-14 01:27:38 +01:00
Andrius Štikonas 268a68a318 Split fstab lines with both spaces and tabs. 2017-09-13 23:05:32 +01:00
Andrius Štikonas 8f7e0beb0f Sort files in CMakeLists.txt alphabetically. 2017-09-13 18:52:43 +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 17e6c32633 Fix more implicit type conversion warnings. 2017-09-11 13:41:03 +01:00
Andrius Štikonas a041090168 Port LvmDevice away from KDiskFreeSpaceInfo. 2017-09-11 12:15:37 +01:00
Andrius Štikonas 8a477e689e Minor clang warnings++ 2017-09-11 12:01:39 +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 1889b9e8fa Port unmount code away from KMountPoints (KIO). 2017-09-08 17:58:27 +01:00
Andrius Štikonas 3866bf6fef Only include <linux/fs.h> on GNU/Linux 2017-09-07 21:34:45 +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 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 756c5b5beb Use QHash instead of QMap for storing LVM LV sizes. 2017-08-31 10:16:16 +01:00
Andrius Štikonas 13c063a150 Fix a possible null pointer dereference.
On some systems getlogin() function might fail to obtain user name.
For now just check whether pointer is nullptr. In that case suspending
plasma device automounter would not work but at least we will not crash.

In future it might make sense to try to use other methods of obtaining login
name, such as running "who am i".

BUG: 381987
2017-07-04 21:07:54 +01:00
Andrius Štikonas 6b31dd0e85 Remove accidentally commited debug code. 2017-06-14 15:26:02 +02:00
Andrius Štikonas b98dcc90d8 Bump version to 3.1.1. 2017-06-14 00:20:13 +02:00
Andrius Štikonas 9252bc6156 seteuid has to be used instead of setuid.
According to setuid manual, seteuid has to be used to be able to
regain root privileges later.
2017-06-12 22:00:36 +02:00
Andrius Štikonas 63ddb4e472 QList<QString> -> QStringList. 2017-06-12 12:47:17 +02:00
Andrius Štikonas 63b5c8c34c Suspend Plasma removable device automounting.
Before doing operations, we connect to DBus session of the original user
and stop kded module for device automounting.

BUG: 368175
2017-06-07 19:21:59 +02:00
Andrius Štikonas 3228fa081a Use qAsConst in ranged based for loops. 2017-06-04 22:26:24 +01:00
Andrius Štikonas d2ce014589 Use range based for instead of Q_FOREACH.
Bump Qt version requirements to 5.7.0
2017-06-01 11:16:09 +01:00
Andrius Štikonas 5f0d1cd72b Port qSort. 2017-05-03 19:24:20 +01: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
Teo Mrnjavac a749d1c84d Handle parent change in Partition copy constructor. 2016-12-01 19:00:39 +01:00
Andrius Štikonas 2e960d5c00 Make initLUKS function non-static. 2016-11-30 17:18:51 +00:00
Andrius Štikonas e0afdeb6cb Move sorting comparison function to lambda. 2016-11-19 01:39:10 +00:00
Andrius Štikonas 6926046edb Sort LVM LV volumes alphabetically. 2016-11-19 01:36:15 +00:00
Andrius Štikonas 3c58349561 Make sure KDiskFreeSpaceInfo is never used for swap. 2016-11-15 17:00:59 +00:00
Andrius Štikonas a78e6f986e Disable pasting into LVM VG. It does not yet work. 2016-11-10 14:52:02 +00:00
Andrius Štikonas 0c8035f667 Improve wording in comments a bit. 2016-11-10 14:37:48 +00:00
Andrius Štikonas ee49c05d60 Remove ResizeVolumeGroup operation from operation stack if it has no jobs. 2016-11-07 18:56:26 +00:00
Andrius Štikonas ca0def38f7 Add a comment. 2016-11-07 17:49:30 +00:00
Andrius Štikonas 4ed3ce6267 Check if fileSystem pointer is nullptr before trying to read used space
Hopefully it fixes the following crashes as well:
BUG: 364863
BUG: 365872
2016-11-07 17:45:22 +00:00
Andrius Štikonas f948569fef Pass --force to vgremove in order to allow removing deactivated volume groups. 2016-11-05 21:48:30 +00:00
Andrius Štikonas e3214a1b48 Do not call KDiskFreeSpaceInfo::freeSpaceInfo without a non-empty mount point. 2016-11-05 20:29:31 +00:00
Andrius Štikonas d6c375f959 Update copyrights. 2016-11-04 14:20:11 +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 724574e436 Fix creation of LVM VGs when LVM PV is encrypted. 2016-10-30 03:24:01 +00:00
Andrius Štikonas 98d0ea309b Fix include header: QDebug->QTextStream. 2016-10-30 02:37:48 +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 28fa6ac5a4 Add support for GTP partition labels. 2016-09-24 22:15:15 +01:00
Andrius Štikonas 9c7db501bf Use cached values for resizing volume groups. 2016-09-24 21:09:11 +01:00
Andrius Štikonas 23bf7585ed Small typo in a comment. 2016-09-20 22:56:48 +01:00
Andrius Štikonas 5e4b16b7fe Add a context to UI string. 2016-09-18 11:55:35 +01:00
Andrius Štikonas 28478ee0ad More conversion from QStringList to QList<const Partition*>. 2016-09-18 01:53:42 +01:00
Andrius Štikonas c41b008dc1 Remove obsolete note. 2016-09-17 01:23:04 +01:00
Chantara Tith 874900fe72 Move initLUKS from helpers to FS::luks. 2016-09-12 23:49:20 +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
Teo Mrnjavac 05e6ea82a3 Make copy constructor public. 2016-09-08 18:13:05 +02:00
Andrius Štikonas 70a9a0dd9a More optimizations for LVM. 2016-09-08 01:42:04 +01:00
Teo Mrnjavac 882886c1d4 Copy constructor for PartitionTable. 2016-09-07 17:36:53 +02:00
Teo Mrnjavac 25b8cc0a42 core/smartattribute.h must be included in smartstatus.h for deep copy. 2016-09-07 17:36:20 +02:00
Teo Mrnjavac ea9e079ee8 Add copy constructor to Device. 2016-09-07 17:35:35 +02:00
Andrius Štikonas c480d80273 Make LvmDevice::LVPathList public. 2016-09-05 17:28:54 +01:00
Andrius Štikonas 5e5178b3af Initial work on storing LVM variables during initial scan. 2016-09-05 14:48:36 +01:00
Andrius Štikonas b3e82d7c75 Cache LUKS specific variables during initial scan. 2016-09-04 23:32:00 +01:00
Andrius Štikonas 68539ad97a Remove some comments about data loss.
lvresize --force should not cause data loss when reducing because we reduce file system first.
vgextend --yes is about overwriting number of metadata copies, so it shouldn't cause data loss either.
2016-09-01 22:22:46 +01:00
Andrius Štikonas cd4a6314e7 Simplify QStringList->QString conversion. 2016-09-01 22:05:35 +01:00
Andrius Štikonas 4889a0ef34 Remove some TODO comments. 2016-08-31 20:37:32 +01:00
Andrius Štikonas 56533022cb Simplify if-return code a bit. 2016-08-31 20:14:21 +01:00
Andrius Štikonas a1ebb5205b Round used sectors up in lvm device scanner. 2016-08-29 13:03:26 +01:00
Andrius Štikonas 5ab60c6dfa Enable used space reporting for swap.
BUG: 367473
2016-08-29 12:12:57 +01:00
Anthony Fieroni ac16bd6185 [smart] SSD attribute names
REVIEW: 128710

Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
2016-08-21 07:44:31 +03:00
Chantara Tith 28dd42839d More documentations. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 3eda1d79c6 Make sure to activate all LVM LVs on start. 2016-08-15 17:20:50 +01:00
Chantara Tith eb3910679c Add all LVM devices to the bottom of the devices list. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 8a3c11774c Make variable names slightly more consistent thruoght kmpcore.
Add more doxygen comments.
2016-08-15 17:20:50 +01:00
Chantara Tith 426a9385cd Remove unused includes. 2016-08-15 17:20:50 +01:00
Chantara Tith 69536b1129 Remove unused parameters from LvmDevice. 2016-08-15 17:20:50 +01:00
Chantara Tith 6fd0c7a0db API changes, Refactor and Raname to a consistant interface. 2016-08-15 17:20:50 +01:00
Andrius Štikonas 40ff0861a8 Convert most of the remaining foreach cases. 2016-08-15 17:20:50 +01:00