mirror of
https://gitlab.gnome.org/GNOME/gparted
synced 2024-08-27 11:40:03 +00:00
Add busy detection of LUKS mapping (#760080)
Provide a minimal implementation of a luks file system class which only does busy detection. NOTE: For now, read-only LUKS support, a LUKS partition will be busy when a dm-crypt mapping exists. Later when read-write LUKS support is added GParted will need to look at the busy status of the encrypted file system within the open LUKS partition and map LUKS partition busy status to encryption being open or closed. Bug 760080 - Implement read-only LUKS support
This commit is contained in:
parent
b77a6be76b
commit
070d734e57
|
@ -55,6 +55,7 @@ EXTRA_DIST = \
|
|||
jfs.h \
|
||||
linux_swap.h \
|
||||
lvm2_pv.h \
|
||||
luks.h \
|
||||
nilfs2.h \
|
||||
ntfs.h \
|
||||
reiser4.h \
|
||||
|
|
|
@ -79,17 +79,17 @@ enum FILESYSTEM
|
|||
FS_HFSPLUS = 14,
|
||||
FS_JFS = 15,
|
||||
FS_LINUX_SWAP = 16,
|
||||
FS_LVM2_PV = 17,
|
||||
FS_NILFS2 = 18,
|
||||
FS_NTFS = 19,
|
||||
FS_REISER4 = 20,
|
||||
FS_REISERFS = 21,
|
||||
FS_UFS = 22,
|
||||
FS_XFS = 23,
|
||||
FS_LUKS = 17,
|
||||
FS_LVM2_PV = 18,
|
||||
FS_NILFS2 = 19,
|
||||
FS_NTFS = 20,
|
||||
FS_REISER4 = 21,
|
||||
FS_REISERFS = 22,
|
||||
FS_UFS = 23,
|
||||
FS_XFS = 24,
|
||||
|
||||
// Recognised signatures but otherwise unsupported file system types
|
||||
FS_BITLOCKER = 24,
|
||||
FS_LUKS = 25,
|
||||
FS_BITLOCKER = 25,
|
||||
FS_LINUX_SWRAID = 26,
|
||||
FS_LINUX_SWSUSPEND = 27,
|
||||
FS_REFS = 28,
|
||||
|
|
35
include/luks.h
Normal file
35
include/luks.h
Normal file
|
@ -0,0 +1,35 @@
|
|||
/* 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_LUKS_H
|
||||
#define GPARTED_LUKS_H
|
||||
|
||||
#include "../include/FileSystem.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
class luks : public FileSystem
|
||||
{
|
||||
public:
|
||||
FS get_filesystem_support();
|
||||
bool is_busy( const Glib::ustring & path );
|
||||
};
|
||||
|
||||
} //GParted
|
||||
|
||||
#endif /* GPARTED_LUKS_H */
|
|
@ -47,6 +47,7 @@ src/hfsplus.cc
|
|||
src/jfs.cc
|
||||
src/linux_swap.cc
|
||||
src/lvm2_pv.cc
|
||||
src/luks.cc
|
||||
src/main.cc
|
||||
src/ntfs.cc
|
||||
src/nilfs2.cc
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include "../include/fat16.h"
|
||||
#include "../include/linux_swap.h"
|
||||
#include "../include/lvm2_pv.h"
|
||||
#include "../include/luks.h"
|
||||
#include "../include/reiserfs.h"
|
||||
#include "../include/nilfs2.h"
|
||||
#include "../include/ntfs.h"
|
||||
|
@ -3948,6 +3949,7 @@ void GParted_Core::init_filesystems()
|
|||
FILESYSTEM_MAP[FS_JFS] = new jfs();
|
||||
FILESYSTEM_MAP[FS_LINUX_SWAP] = new linux_swap();
|
||||
FILESYSTEM_MAP[FS_LVM2_PV] = new lvm2_pv();
|
||||
FILESYSTEM_MAP[FS_LUKS] = new luks();
|
||||
FILESYSTEM_MAP[FS_NILFS2] = new nilfs2();
|
||||
FILESYSTEM_MAP[FS_NTFS] = new ntfs();
|
||||
FILESYSTEM_MAP[FS_REISER4] = new reiser4();
|
||||
|
@ -3955,7 +3957,6 @@ void GParted_Core::init_filesystems()
|
|||
FILESYSTEM_MAP[FS_UFS] = new ufs();
|
||||
FILESYSTEM_MAP[FS_XFS] = new xfs();
|
||||
FILESYSTEM_MAP[FS_BITLOCKER] = NULL;
|
||||
FILESYSTEM_MAP[FS_LUKS] = NULL;
|
||||
FILESYSTEM_MAP[FS_LINUX_SWRAID] = NULL;
|
||||
FILESYSTEM_MAP[FS_LINUX_SWSUSPEND] = NULL;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@ gpartedbin_SOURCES = \
|
|||
jfs.cc \
|
||||
linux_swap.cc \
|
||||
lvm2_pv.cc \
|
||||
luks.cc \
|
||||
main.cc \
|
||||
nilfs2.cc \
|
||||
ntfs.cc \
|
||||
|
|
|
@ -337,6 +337,7 @@ Glib::ustring Utils::get_filesystem_software( FILESYSTEM filesystem )
|
|||
case FS_JFS : return "jfsutils" ;
|
||||
case FS_LINUX_SWAP : return "util-linux" ;
|
||||
case FS_LVM2_PV : return "lvm2" ;
|
||||
case FS_LUKS : return "dmsetup";
|
||||
case FS_NILFS2 : return "nilfs-utils" ;
|
||||
case FS_NTFS : return "ntfs-3g / ntfsprogs" ;
|
||||
case FS_REISER4 : return "reiser4progs" ;
|
||||
|
|
40
src/luks.cc
Normal file
40
src/luks.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/LUKS_Info.h"
|
||||
#include "../include/luks.h"
|
||||
|
||||
namespace GParted
|
||||
{
|
||||
|
||||
FS luks::get_filesystem_support()
|
||||
{
|
||||
FS fs;
|
||||
fs.filesystem = FS_LUKS;
|
||||
|
||||
fs.busy = FS::EXTERNAL;
|
||||
|
||||
return fs;
|
||||
}
|
||||
|
||||
bool luks::is_busy( const Glib::ustring & path )
|
||||
{
|
||||
Glib::ustring name = LUKS_Info::get_mapping_name( path );
|
||||
return ! name.empty();
|
||||
}
|
||||
|
||||
} //GParted
|
Loading…
Reference in a new issue