From c233fb3b2df310dd1a6e408c90aca4020e9aa0ae Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Fri, 4 Mar 2016 19:11:31 +0100 Subject: [PATCH] Allow setting flags when creating a partition. --- src/modules/partition/core/KPMHelpers.cpp | 29 ++++++++++++++--------- src/modules/partition/core/KPMHelpers.h | 13 +++++++--- 2 files changed, 28 insertions(+), 14 deletions(-) diff --git a/src/modules/partition/core/KPMHelpers.cpp b/src/modules/partition/core/KPMHelpers.cpp index 880e43569..ac7f588b1 100644 --- a/src/modules/partition/core/KPMHelpers.cpp +++ b/src/modules/partition/core/KPMHelpers.cpp @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * Copyright 2014, Aurélien Gâteau + * Copyright 2015-2016, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -105,7 +105,13 @@ findPartitions( const QList< Device* >& devices, Partition* -createNewPartition( PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem::Type fsType, qint64 firstSector, qint64 lastSector ) +createNewPartition( PartitionNode* parent, + const Device& device, + const PartitionRole& role, + FileSystem::Type fsType, + qint64 firstSector, + qint64 lastSector, + PartitionTable::Flags flags ) { FileSystem* fs = FileSystemFactory::create( fsType, firstSector, lastSector ); return new Partition( @@ -117,7 +123,7 @@ createNewPartition( PartitionNode* parent, const Device& device, const Partition PartitionTable::FlagNone /* availableFlags */, QString() /* mountPoint */, false /* mounted */, - PartitionTable::FlagNone /* activeFlags */, + flags /* activeFlags */, Partition::StateNew ); } @@ -131,13 +137,14 @@ clonePartition( Device* device, Partition* partition ) partition->firstSector(), partition->lastSector() ); - return new Partition( - partition->parent(), - *device, - partition->roles(), - fs, fs->firstSector(), fs->lastSector(), - partition->partitionPath() - ); + return new Partition( partition->parent(), + *device, + partition->roles(), + fs, + fs->firstSector(), + fs->lastSector(), + partition->partitionPath(), + partition->activeFlags() ); } diff --git a/src/modules/partition/core/KPMHelpers.h b/src/modules/partition/core/KPMHelpers.h index 2b9d6a8b9..f89cd2f8e 100644 --- a/src/modules/partition/core/KPMHelpers.h +++ b/src/modules/partition/core/KPMHelpers.h @@ -1,7 +1,7 @@ /* === This file is part of Calamares - === * - * Copyright 2014, Aurélien Gâteau - * Copyright 2015, Teo Mrnjavac + * Copyright 2014, Aurélien Gâteau + * Copyright 2015-2016, Teo Mrnjavac * * Calamares is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ #define KPMHELPERS_H // KPMcore +#include #include // Qt @@ -82,7 +83,13 @@ QList< Partition* > findPartitions( const QList< Device* >& devices, * Helper function to create a new Partition object (does not create anything * on the disk) associated with a FileSystem. */ -Partition* createNewPartition( PartitionNode* parent, const Device& device, const PartitionRole& role, FileSystem::Type fsType, qint64 firstSector, qint64 lastSector ); +Partition* createNewPartition( PartitionNode* parent, + const Device& device, + const PartitionRole& role, + FileSystem::Type fsType, + qint64 firstSector, + qint64 lastSector, + PartitionTable::Flags flags = PartitionTable::FlagNone ); Partition* clonePartition( Device* device, Partition* partition );