[gparted] Merge FS_Info load cache calls (#131)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Merge FS_Info load cache calls (#131)
- Date: Wed, 10 Feb 2021 16:49:37 +0000 (UTC)
commit 45f88c3274096e973712d7d1a442bc4c69e7dd75
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Tue Jan 19 20:22:25 2021 +0000
Merge FS_Info load cache calls (#131)
Now FS_Info::load_cache() and ::load_cache_for_paths() are nearly next
to each other, merge them together to simplify the code a little. This
makes the special case to ensure that file system images named on the
command line were queried by blkid and loaded into the FS_Info cache [1]
become the normal cache loading method. Already passing all discovered
or named devices to load_cache_for_paths() is also a step on the way to
doing it for all devices and partitions of interest.
Just need to ensure that load_cache_for_paths() always loads the cache
as load_cache() did, rather than only when it hadn't already been
loaded. Otherwise GParted will only ever run blkid and load the cache
once at startup and not on each refresh.
[1] e8f0504b13d98e23e70021f70638184daab228ec
Make sure that FS_Info cache is loaded for all named paths (#787181)
Closes #131 - GParted hangs when non-named device is hung
include/FS_Info.h | 1 -
src/FS_Info.cc | 7 ++-----
src/GParted_Core.cc | 7 +------
3 files changed, 3 insertions(+), 12 deletions(-)
---
diff --git a/include/FS_Info.h b/include/FS_Info.h
index f9fa32f3..000f5af1 100644
--- a/include/FS_Info.h
+++ b/include/FS_Info.h
@@ -38,7 +38,6 @@ struct FS_Entry
class FS_Info
{
public:
- static void load_cache();
static void load_cache_for_paths( const std::vector<Glib::ustring> &device_paths );
static Glib::ustring get_fs_type( const Glib::ustring & path );
static Glib::ustring get_label( const Glib::ustring & path, bool & found );
diff --git a/src/FS_Info.cc b/src/FS_Info.cc
index fadbbd58..8d5a5511 100644
--- a/src/FS_Info.cc
+++ b/src/FS_Info.cc
@@ -49,16 +49,13 @@ bool FS_Info::need_blkid_vfat_cache_update_workaround = true;
// ]
std::vector<FS_Entry> FS_Info::fs_info_cache;
-void FS_Info::load_cache()
+
+void FS_Info::load_cache_for_paths( const std::vector<Glib::ustring> &device_paths )
{
set_commands_found();
load_fs_info_cache();
fs_info_cache_initialized = true;
-}
-void FS_Info::load_cache_for_paths( const std::vector<Glib::ustring> &device_paths )
-{
- initialize_if_required();
const BlockSpecial empty_bs = BlockSpecial();
for ( unsigned int i = 0 ; i < device_paths.size() ; i ++ )
{
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index f2758ead..6a237c25 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -248,18 +248,13 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
}
// Initialise and load caches needed for content discovery.
- FS_Info::load_cache(); // Cache of file system details from blkid.
+ FS_Info::load_cache_for_paths(device_paths);
Mount_Info::load_cache();
LVM2_PV_Info::clear_cache();
btrfs::clear_cache();
SWRaid_Info::load_cache();
LUKS_Info::clear_cache();
- // Ensure all named paths have FS_Info blkid cache entries specifically so that
- // command line named file system image files, which blkid can't otherwise know
- // about, can be identified.
- FS_Info::load_cache_for_paths( device_paths );
-
for ( unsigned int t = 0 ; t < device_paths .size() ; t++ )
{
/*TO TRANSLATORS: looks like Searching /dev/sda partitions */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]