mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-08-27 11:40:03 +00:00
Add PartitionLUKS class and create objects (#760080)
Absolute minimum implementation of a PartitionLUKS class which can be constructed, polymorphically copied and destroyed. Contains an "encrypted" member of type Partition to represent the encrypted file system within the LUKS format. Create PartitionLUKS objects instead of base Partition objects when a LUKS formatted partition is found. Only the base Partition object member values have been populated, and the "encrypted" member remains blank at this point. Bug 760080 - Implement read-only LUKS support
This commit is contained in:
parent
9fee0c57ea
commit
99ff0c7628
|
@ -37,6 +37,7 @@ EXTRA_DIST = \
|
|||
OperationNamePartition.h \
|
||||
OperationResizeMove.h \
|
||||
Partition.h \
|
||||
PartitionLUKS.h \
|
||||
PartitionVector.h \
|
||||
PipeCapture.h \
|
||||
Proc_Partitions_Info.h \
|
||||
|
|
40
include/PartitionLUKS.h
Normal file
40
include/PartitionLUKS.h
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* Copyright (C) 2015 Mike Fleetwood
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef GPARTED_PARTITIONLUKS_H
|
||||
#define GPARTED_PARTITIONLUKS_H
|
||||
|
||||
#include "../include/Partition.h"
|
||||
#include "../include/Utils.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
class PartitionLUKS : public Partition
|
||||
{
|
||||
public:
|
||||
PartitionLUKS();
|
||||
virtual ~PartitionLUKS();
|
||||
virtual PartitionLUKS * clone() const;
|
||||
|
||||
private:
|
||||
Partition encrypted;
|
||||
};
|
||||
|
||||
}//GParted
|
||||
|
||||
#endif /* GPARTED_PARTITIONLUKS_H */
|
|
@ -32,6 +32,7 @@ src/OperationLabelFileSystem.cc
|
|||
src/OperationNamePartition.cc
|
||||
src/OperationResizeMove.cc
|
||||
src/Partition.cc
|
||||
src/PartitionLUKS.cc
|
||||
src/PartitionVector.cc
|
||||
src/SWRaid_Info.cc
|
||||
src/TreeView_Detail.cc
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "../include/Operation.h"
|
||||
#include "../include/OperationCopy.h"
|
||||
#include "../include/Partition.h"
|
||||
#include "../include/PartitionLUKS.h"
|
||||
#include "../include/PartitionVector.h"
|
||||
#include "../include/Proc_Partitions_Info.h"
|
||||
#include "../include/SWRaid_Info.h"
|
||||
|
@ -1281,7 +1282,10 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
|||
partition_is_busy = is_busy( filesystem, partition_path ) ;
|
||||
}
|
||||
|
||||
partition_temp = new Partition();
|
||||
if ( filesystem == FS_LUKS )
|
||||
partition_temp = new PartitionLUKS();
|
||||
else
|
||||
partition_temp = new Partition();
|
||||
partition_temp->Set( device .get_path(),
|
||||
partition_path,
|
||||
lp_partition->num,
|
||||
|
@ -1393,7 +1397,11 @@ void GParted_Core::set_device_one_partition( Device & device, PedDevice * lp_dev
|
|||
Glib::ustring path = lp_device->path;
|
||||
bool partition_is_busy = is_busy( fstype, path );
|
||||
|
||||
Partition * partition_temp = new Partition();
|
||||
Partition * partition_temp = NULL;
|
||||
if ( fstype == FS_LUKS )
|
||||
partition_temp = new PartitionLUKS();
|
||||
else
|
||||
partition_temp = new Partition();
|
||||
partition_temp->Set( device.get_path(),
|
||||
path,
|
||||
1,
|
||||
|
|
|
@ -48,6 +48,7 @@ gpartedbin_SOURCES = \
|
|||
OperationNamePartition.cc \
|
||||
OperationResizeMove.cc \
|
||||
Partition.cc \
|
||||
PartitionLUKS.cc \
|
||||
PartitionVector.cc \
|
||||
PipeCapture.cc \
|
||||
Proc_Partitions_Info.cc \
|
||||
|
|
40
src/PartitionLUKS.cc
Normal file
40
src/PartitionLUKS.cc
Normal file
|
@ -0,0 +1,40 @@
|
|||
/* Copyright (C) 2015 Mike Fleetwood
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "../include/PartitionLUKS.h"
|
||||
#include "../include/Utils.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
PartitionLUKS::PartitionLUKS()
|
||||
{
|
||||
// Nothing further to do here as the base class Partition default constructor,
|
||||
// which calls Partition::Reset(), is called for this object and also to
|
||||
// initialise the encrypted member variable of type Partition.
|
||||
}
|
||||
|
||||
PartitionLUKS::~PartitionLUKS()
|
||||
{
|
||||
}
|
||||
|
||||
PartitionLUKS * PartitionLUKS::clone() const
|
||||
{
|
||||
// Virtual copy constructor method
|
||||
return new PartitionLUKS( *this );
|
||||
}
|
||||
|
||||
} //GParted
|
Loading…
Reference in a new issue