[gparted] Display btrfs members in the Partition Information dialog (#723842)



commit 20f52e28664e29d93b1a9f13fc43d01638157522
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Fri May 16 20:32:37 2014 +0100

    Display btrfs members in the Partition Information dialog (#723842)
    
    Bug #723842 - GParted resizes the wrong filesystem (does not pass the
                  devid to btrfs filesystem resize)

 include/btrfs.h              |    1 +
 src/Dialog_Partition_Info.cc |   22 +++++++++++++++++++---
 src/btrfs.cc                 |    6 ++++++
 3 files changed, 26 insertions(+), 3 deletions(-)
---
diff --git a/include/btrfs.h b/include/btrfs.h
index f732096..ce76936 100644
--- a/include/btrfs.h
+++ b/include/btrfs.h
@@ -45,6 +45,7 @@ public:
 
        static void clear_cache() ;
        static Glib::ustring get_mount_device( const Glib::ustring & path ) ;
+       static std::vector<Glib::ustring> get_members( const Glib::ustring & path ) ;
 
 private:
        static const BTRFS_Device & get_cache_entry( const Glib::ustring & path ) ;
diff --git a/src/Dialog_Partition_Info.cc b/src/Dialog_Partition_Info.cc
index 0dac5dc..9b33a95 100644
--- a/src/Dialog_Partition_Info.cc
+++ b/src/Dialog_Partition_Info.cc
@@ -17,6 +17,7 @@
  
 #include "../include/Dialog_Partition_Info.h"
 #include "../include/LVM2_PV_Info.h"
+#include "../include/btrfs.h"
 
 #include <gtk/gtk.h>
 #include <gtkmm/alignment.h>
@@ -371,7 +372,7 @@ void Dialog_Partition_Info::Display_Info()
                table ->attach( * Utils::mk_label( str_temp, true, false, true ), 2, 3, top++, bottom++, 
Gtk::FILL ) ;
        }
 
-       //Optional Logical Volume Manager Physical Volume details
+       //Optional, LVM2 Volume Group name
        if ( partition .filesystem == FS_LVM2_PV )
        {
                //Volume Group
@@ -379,14 +380,29 @@ void Dialog_Partition_Info::Display_Info()
                                1, 2, top, bottom, Gtk::FILL ) ;
                table ->attach( * Utils::mk_label( vgname, true, false, true ),
                                2, 3, top++, bottom++, Gtk::FILL ) ;
+       }
 
+       //Optional, members of multi-device file systems
+       if (    partition .filesystem == FS_LVM2_PV
+            || partition .filesystem == FS_BTRFS   )
+       {
                //Members
                table ->attach( * Utils::mk_label( "<b>" + Glib::ustring( _("Members:") ) + "</b>", true, 
false, false, 0.0 /* ALIGN_TOP */ ),
                                1, 2, top, bottom, Gtk::FILL ) ;
 
                std::vector<Glib::ustring> members ;
-               if ( ! vgname .empty() )
-                       members = lvm2_pv_info .get_vg_members( vgname ) ;
+               switch ( partition .filesystem )
+               {
+                       case FS_BTRFS:
+                               members = btrfs::get_members( partition .get_path() ) ;
+                               break ;
+                       case FS_LVM2_PV:
+                               if ( ! vgname .empty() )
+                                       members = lvm2_pv_info .get_vg_members( vgname ) ;
+                               break ;
+                       default:
+                               break ;
+               }
 
                Glib::ustring members_str = "" ;
                if ( ! members .empty() )
diff --git a/src/btrfs.cc b/src/btrfs.cc
index 7d0e493..c88ac2b 100644
--- a/src/btrfs.cc
+++ b/src/btrfs.cc
@@ -459,6 +459,12 @@ Glib::ustring btrfs::get_mount_device( const Glib::ustring & path )
        return "" ;
 }
 
+std::vector<Glib::ustring> btrfs::get_members( const Glib::ustring & path )
+{
+       BTRFS_Device btrfs_dev = get_cache_entry( path ) ;
+       return btrfs_dev .members ;
+}
+
 //Private methods
 
 //Return btrfs device cache entry, incrementally loading cache as required


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]