Commit Graph

323 Commits

Author SHA1 Message Date
Mike Fleetwood 4b72ecd44e Display device serial numbers (#751251)
Run "hdparm -I /dev/DISK" to get the hard drive serial number of
every device which has one and display it in the Device Information.
The displayed value can either be the actual serial number, "none" or
blank.  "none" means the device doesn't have a hard drive serial number,
such as for Linux software RAID arrays, BIOS fake RAID arrays or USB
flash drives.  Blank means something went wrong getting the serial
number.  Either it couldn't be found in the hdparm output or the hdparm
command wasn't installed.

Example real hard drive:
    # hdparm -I /dev/sda
    ...
    ATA device, with non-removable media
            Model Number:       SAMSUNG HM500JI
            Serial Number:      S1WFJDSZ123732
    ...

Example Linux software RAID array:
    # hdparm -I /dev/md127

    /dev/md127:
     HDIO_DRIVE_CMD(identify) failed: Inappropriate ioctl for device

On my desktop with 4 internal hard drives 2 Linux software RAID arrays
on those hard drives, 2 USB flash drives and 1 USB hard drive attached,
running hdparm 9 times added 0.07 seconds to the device refresh time.

Bug 751251 - Show serial number in device information
2015-07-01 10:22:47 -06:00
Mike Fleetwood 2c5e7b0d90 Stop needing any LVM2_PV_Info objects (#750582)
The LVM2_PV_Info cache had a pretend multi-object interface, yet all the
data is static.  An LVM2_PV_Info object doesn't contain any member
variables, yet was needed just to call the member functions.

Make all the member functions static removing the need to use any
LVM2_PV_Info objects.

Bug 750582 - Refactor the LVM2_PV_Info module object interface and
             internal cache representation
2015-06-13 10:56:12 -06:00
Mike Fleetwood 7a4a375ed6 Remove Set_Data() from the copy, resize/move and new dialog class APIs
The copy, resize/move and new dialog classes (Dialog_Partition_Copy,
Dialog_Partition_Resize_Move and Dialog_Partition_New respectively) had
to be used like this:

    construct dialog object passing some parameters
    call Set_Data() to pass more parameters
    run() dialog
    call Get_New_Partition()

There is nothing in the classes which forces Set_Data() to be called,
but it must be called for the dialogs to work and prevent GParted from
crashing.

Make these class APIs safer by making it impossible to program
incorrectly in this regard.  Move all the additional parameters from
each Set_Data() method to each constructor.  The constructors just call
the now private set_data() methods.
2015-06-10 10:44:33 -06:00
Mike Fleetwood 7f05037dbc Stop copying displayed partition objects in activate_resize() (#750168)
The first actions of Win_GParted::activate_resize() were to create a
copy of the vector of partitions for the currently displayed device and
visually apply any pending operations.  Exactly this has already been
done in Win_GParted::Refresh_Visual() with the result now available in
the member variable display_partitions.  Stop this unnecessary partition
object copying and processing by just using display_partitions member
variable instead.

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:40 -06:00
Mike Fleetwood 1143917d34 Document how the GUI works and the lifetimes of important data (#750168)
Document how GParted displays partitions in the GUI and manages the
lifetime and ownership of that data.

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:40 -06:00
Mike Fleetwood 6ae327c8f9 Assert selected_partition_ptr is valid before use (#750168)
Further ensure that a bug doesn't get introduced with the use of
selected_partition_ptr, by asserting that it points to a current
partition object in the vector of display partitions.

After deliberately breaking the code so that selected_partition_ptr
points to some other partition object, trying to display the Information
dialog causes this crash:

======================
libparted : 2.4
======================
**
ERROR:Win_GParted.cc:989:void GParted::Win_GParted::set_valid_operations(): assertion failed: (valid_display_partition_ptr( selected_partition_ptr ))
Aborted (core dumped)

At this point in the code:

    973  void Win_GParted::set_valid_operations()
    974  {
    ...
    986          // No partition selected ...
    987          if ( ! selected_partition_ptr )
    988                  return ;
>>  989          g_assert( valid_display_partition_ptr( selected_partition_ptr ) );  // Bug: Not pointing at a valid display partition object

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:40 -06:00
Mike Fleetwood 5e027d6989 Assert selected_partition_ptr is not NULL (#750168)
Add Glib g_assert() to ensure that a bug doesn't get introduced which
allows a partition callback to be called without a partition being
selected first.

After deliberately breaking the code so that selected_partition_ptr is
not set, trying to display the Information dialog causes this crash:

    # ./gpartedbin
    ======================
    libparted : 2.4
    ======================
    ERROR:Win_GParted.cc:1978:void GParted::Win_GParted::activate_info(): assertion failed: (selected_partition_ptr != NULL)
    Aborted (core dumped)

At this point in the code:

   1976  void Win_GParted::activate_info()
   1977  {
>> 1978          g_assert( selected_partition_ptr != NULL );  // Bug: Partition callback without a selected partition
   1979

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:17 -06:00
Mike Fleetwood da39e3cad3 Change selected partition into a pointer (#750168)
Now that TreeView_Details and DrawingAreaVisualDisk classes store and
pass pointers to partition objects in the Gtk signal callbacks, change
the selected partition into a pointer too.

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:14 -06:00
Mike Fleetwood c430acf52a Pass by pointer in the signal_partition_selected callbacks (#750168)
Change from passing a reference to the selected partition, to passing a
pointer to the selected partition in the signal_partition_selected
callbacks between the disk graphic, partition list and core GUI modules.

This is an enabler for the following patches.

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:43:14 -06:00
Mike Fleetwood 545b75d957 Move vector of partition objects to a Win_GParted class member (#750168)
Win_GParted::Refresh_Visual() used a local variable containing a copy of
the vector of partitions in the current device to be displayed.  After
visually applying pending operations it loaded copies of each partition
object into the GUI widgets to display the disk graphic and partition
list, DrawingAreaVisualDisk and TreeView_Details classes respectively.
When a partition is selected in the UI, again a partition object is
copied.  Also several of the partition dialogs, including the
information dialog, take a copy of the partition object.  All these are
copies of the same set of partition objects, those currently being
displayed in the UI.

Move the vector of displayed partitions from a local variable in
Refresh_Visual() to a Win_GParted member variable.  This will allow for
the above cases to be changed to used pointers and references to the
same set of partition objects.

The valid lifetime of pointers to elements in this partition object
vector is from one refresh to the next, when the vector is cleared and
repopulated with a new set of partition objects.  This is exactly what
is needed as the GUI widgets are reloaded on each refresh, the selected
partition is reset and none of the partition dialog objects exist.
Dialog objects being created and destroyed on each use.

On the other hand some copies of partition objects currently being
displayed, still need to be made because they have lifetimes which need
to last longer than the next call to Refresh_Visual().  Specifically the
source of the copy partition and the partition objects copied into the
in the list of pending operations.

Bug 750168 - Reduce the amount of copying of partition objects
2015-06-10 10:42:36 -06:00
Mike Fleetwood 8bbb77f1f8 Remove cylinder size adjustments in the copy dialog (#749867)
BUF in the copy dialog class, Dialog_Partition_Copy, is use to adjust
limits in 2 cases:

1) Minimum size when copying an XFS file system

Minimum size was set to the used space + 2 * cylinder size (typically
plus ~16 MiB).  This commit from 2004-12-20 added it:
    a54b52ea33
    xfs copy now uses xfsdump and xfsrestore. icw some hacks in the other 2

Issues:
* This is increasing the minimum XFS file system size when copying it,
  which doesn't happen in the resize case for other file systems.
* It allows an XFS file system to be created which is smaller than the
  minimum size allowed by GParted.  Copying an empty XFS file system can
  create a new file system as small as 26 MiB.  This is smaller than the
  minimum GParted allows of 32 MiB because that is the minimum
  xfs_repair can handle.

Remove this addition when copying an XFS file system and enforce minimum
file system size.

2) Maximum size when copying a file system into empty space larger than
   it's maximum size

Maximum size was set to maximum file system size - cylinder size
(typically minus ~8 MiB).  Only applied to FAT16 which has a maximum
file system size set in and can be grown.  Added by this commit from
2004-12-15:
    10e8f3338d
    :get_fs now returns a const reference. in copy and resizedialog
    ...
    * in copy and resizedialog filesystems with MAX set now have a max size of MAX - one cylinder .

Issue:
* This is applying a lower maximum resize when copying the file system
  compared to that when creating the file system.
  NOTE:
  GParted currently allows all file systems to be resize to any size,
  regardless of the maximum file system size.  This is probably an
  oversight, but it does allow libparted to convert FAT16 to FAT32 file
  system when resizing.

Remove this lower maximum file system size when copying and resizing,
compared to creating.

Bug 749867 - Some limits are adjusted by arcane cylinder size amount
             when copying and resizing in a single operation
2015-05-28 12:53:41 -06:00
Mike Fleetwood b9262922a7 Remove last trace of cylinder size adjustments in the resize dialog (#749867)
This commit from 2010-05-20 removed use of cylinder size increase in the
minimum, and cylinder size decrease in the maximum file system sizes
from the resize/move dialog.
    e62a23b5b5
    Add partition alignment option to align to MiB (#617409)

This cylinder size limit adjustments were being performed using the
Dialog_Base_Partition::BUF member variable.  Now in the
Dialog_Partition_Resize_Move class it is never accessed, and only
unnecessarily set.  Move BUF from the common base class into the
Dialog_Partition_Copy class where it is still used.

Bug 749867 - Some limits are adjusted by arcane cylinder size amount
             when copying and resizing in a single operation
2015-05-28 12:44:51 -06:00
Mike Fleetwood 9ced6b051e Small simplification of Win_GParted code which calls get_custom_text()
Avoid long lines, long statements and repeated calls to
gparted_core.get_filesystem_object( selected_partition.filesystem ) by
storing the returned pointer in a local variable.

Needs the previous commit so that the the local variable can be a
pointer to a const FileSystem object instead of a pointer to a
(modifiable) FileSystem object.
2015-05-19 10:34:59 -06:00
Mike Fleetwood 6a9a06af0e Pass Device object when setting up Dialog_Partition_New (#746214)
Adding a partition name entry to the Create New Partition dialog will
need access to these two Device methods: partition_naming_supported()
and get_max_partition_length().  The Set_Data() function already takes
two parameters, only_unformatted and disktype, taken from Device member
variables.

Rather than add two more parameters to the Set_Data() function pass the
Device object instead, replacing the current only_unformatted and
disktype parameters.

Bug 746214 - Partition name enhancements
2015-03-25 10:02:43 -06:00
Mike Fleetwood eae2dbaa82 Preserve partition name in preview of format operation (#746214)
Preview of the format operation cleared the partition name, yet when
applied, the partition name reappeared.  Fix the preview to reflect
reality.

Bug 746214 - Partition naming enhancements
2015-03-25 10:02:42 -06:00
Mike Fleetwood 9b2c95bcd1 Make support of naming for other partition table types possible (#746214)
Previously partition naming had only been implemented for gpt.  Make the
code ready to support naming of the other partition table types for
which libparted supports naming.  Specifically: amiga, dvh, mac and
pc98 in addition to gpt.  Document issues found with some of these
partition table types, which can relatively easily been worked around.

Leave support of naming for partition table types other than gpt
disabled, mostly just to reduce ongoing testing effort, at least until
there is any user demand for it.

Bug 746214 - Partition naming enhancements
2015-03-25 10:02:42 -06:00
Mike Fleetwood f804bc3244 Allow partition naming on busy partitions (#746214)
Allow partition names to be changed whether or not the partition is
busy, rather than only when not busy, because it doesn't effect the busy
file system or change the partition boundaries in any way.

Bug 746214 - Partition naming enhancements
2015-03-25 10:02:42 -06:00
Mike Fleetwood e7ed209020 Erase file system signatures before creating a partition table (#743181)
When writing "loop" partition table over the top of some whole disk
device file system types GParted continued to show those whole disk
device file systems rather than the virtual unknown partition from the
"loop" partition table.

This affected btrfs, jfs, reiser4 and reiserfs.  It occurred because of
several factors:
1) Libparted only zeroed the first and last 9.5 KiB (assuming 512 byte
   sectors) of the device before writing a new partition table.  See
   ped_disk_clobber().
2) These file systems have their super blocks and therefore signatures
   after the first 9.5 KiB.
3) Whole disk device file system detection is performed using blkid
   before checking for a libparted "loop" partition table.  See
   GParted_Core::set_devices_thread().

Ref:
libparted 3.2: disk.c:ped_disk_clobber()
http://git.savannah.gnu.org/cgit/parted.git/tree/libparted/disk.c?id=v3.2#n302

Fix by always erasing any possible file system signatures on the device
before creating a new "loop" partition table.

NOTE:
This is typically taking up to 0.5 seconds in my testing on a 5400 RPM
hard drive, during which time the GParted UI is hung and the create
partition table dialog shows the apply button pressed but no other
progress indication.

Bug 743181 - Add unpartitioned drive read-write support
2015-03-09 11:04:13 -06:00
Mike Fleetwood 63f701033e Correct whole disk device file system format to cleared preview (#743181)
The preview of clearing a whole disk device file system was previewing
the same as formatting to all other file system types; as a cleared file
system spanning the whole disk device.  However when implemented this
removes all signatures on the disk so it actually becomes an unallocated
and unpartitioned device.  Make the preview match what happens in when
implemented.

GParted previously used mydevice.max_prims = -1 to represent an
unpartitioned device.  It is now represented as:

    mydevice.max_prims = 1
    mydevice.disktype  = _("unrecognized")
    mydevice.partitions[0].type         = TYPE_UNALLOCATED
    mydevice.partitions[0].whole_device = true
    mydevice.partitions[0].filesystem   = FS_UNALLOCATED

and the check for an unpartitioned device in Win_GParted.cc becomes:

    partitions[0].type == TYPE_UNALLOCATED && partitions[0].whole_device

Bug 743181 - Add unpartitioned drive read-write support
2015-03-09 11:04:13 -06:00
Mike Fleetwood 6c333f845c Enable operations on whole disk device virtual partitions (#743181)
Enable operations on whole disk devices containing any recognised file
system.

The new partition operation on an empty whole disk device continues to
display the "No partition table found on device /dev/DEVICE" information
dialog.

Specifically unsupported operations:

 *  Delete -

    Deletion of a partition only involves removal of the entry in the
    partition table leaving the file system intact on the disk.  However
    this doesn't work for a whole disk device file system.  Instead the
    file system signatures would have to be erased which is much more
    destructive and virtually impossible to undo.  Therefore don't
    implement whole disk device file system deletion.  Alternatives are
    to format the file system to cleared or create a partition table on
    the device.  Both of these imply overwriting the existing data and
    set the expectation that undo is not possible.

 *  Manage flags -

    There's no partition table, so there's no partition, so there's no
    flags.

Resize/Move operation is being supported so that a whole disk device
file system can be resized to handle devices which can be resize, such
as those from SANs or Linux Software RAID arrays.  The start of the file
system must remain fixed so move won't be allowed.

So far only simple operations work if they don't need libparted support
at all [1], or only need libparted support for the calibrate step AND
the file system on the whole disk device is recognised by libparted [2].
(Needs libparted to provide a "loop" partition, hence the recognition
requirement, so that the calibrate step can successfully read the
virtual "loop" partition table.  Doesn't matter whether it's an old
version of libparted and it gets the name of the device wrong as GParted
is already using the whole disk device name anyway).

[1] Operations not needing any libparted support:
    Mount on, Unmount, Swapon, Swapoff, Activate and Deactivate

[2] Operations only needing libparted support for the calibrate step:
    Check, Label, New UUID

Bug 743181 - Add unpartitioned drive read-write support
2015-03-09 11:04:13 -06:00
Mike Fleetwood 5098744f9a Add whole_device flag to the partition object (#743181)
Need to be able to take different actions in the GParted_Core partition
manipulation methods and in Win_GParted UI methods to deal with
libparted supported partitions or whole disk devices without a partition
table.  Add boolean whole_device to the partition object and set
appropriately to allow for this.

Bug 743181 - Add unpartitioned drive read-write support
2015-03-09 11:04:13 -06:00
Mike Fleetwood e33bb8d688 Display failing activate/deactivate commands in error dialogs
As was done with a failed mount operation, include the failed activate/
deactivate command in the error dialog.  Two example error dialogs now
look like this:

    (-) Could not deactivate swap

        # swapoff -v /dev/sdb7
        swapoff: /dev/sdb7: swapoff failed: Invalid argument

                                                    [  OK  ]

    (-) Could not unmount /dev/sdb6

        # umount -v "/mnt/6"
        umount: /mnt/6: not mounted

                           [  OK  ]
2015-03-09 10:50:40 -06:00
Mike Fleetwood 8d9c6f197d Second, try mounting file systems specifying the type (#742741)
On RHEL/CentOS 6, GParted fails to mount nilfs2 file system like this:

    # mkfs.nilfs2 /dev/sdb1
    # mount /dev/sdb1 /mnt/1
    mount: you must specify the filesystem type

This fails because mount internally uses libblkid to determine the file
system type when it is not specified on the command line.  However on
RHEL/CentOS 6 libblkid is too old to recognise nilfs2.

GParted used libparted recognition first and blkid second.  Mount only
uses libblkid.  When there are multiple signatures on a partition
GParted may report a different result to blkid alone.  Therefore fix by
first trying to mount the file system without specifying the type, as is
already done, and if that fails, trying specifying the file system type.
This allows GParted to mount nilfs2 file systems.

    # mount -t nilfs2 /dev/sdb1 /mnt/1
    # mount | fgrep sdb1
    /dev/sdb1 on /mnt/1 type nilfs2 (rw,gcpid=30946)

And for unsupported file systems the error dialog from the failed mount
command shows both commands like this:

    (-) Could not mount /dev/sdb3 on /mnt/3

        # mount -v /dev/sdb3 "/mnt/3"
        mount: unknown filesystem type 'reiser4'

        # mount -v -t reiser4 /dev/sdb3 "/mnt/3"
        mount: unknown filesystem type 'reiser4'

                                         [  OK  ]

Bug 742741 - Nilfs2 file system is unusable on RHEL/CentOS 6
2015-03-09 10:50:40 -06:00
Mike Fleetwood 0bdc1fef14 Add lookup for Linux kernel names of mountable file systems (#742741)
Function Utils::get_filesystem_kernel_name() returns the name of the
file system as needed for use in the mount command:
    mount -t TYPE DEVICE DIR

Needed because the kernel / mount name is 'hfsplus' where as libparted /
GParted, as reported by Utils::get_filesystem_string(), calls it 'hfs+'.
So far just added debugging when mounting a file system to test the
function works.

    # ./gartedbin
    ======================
    libparted : 2.1
    ======================
    DEBUG: (hfsplus) # mount -v /dev/sdb5 "/mnt/5"
    DEBUG: (nilfs2) # mount -v /dev/sdb1 "/mnt/1"

Bug 742741 - Nilfs2 file system is unusable on RHEL/CentOS 6
2015-03-09 10:50:40 -06:00
Mike Fleetwood 30086b2e80 Include failing mount command in the error dialog (#742741)
On RHEL/CentOS 6 GParted fails to mount nilfs2 file system.  Include the
failing file system mount command in the error dialog so the user knows
what command failed.  The error dialog now looks like:

    (-) Could not mount /dev/sdc1 on /mnt/1

        # mount -v /dev/sdc1 "/mnt/1"
        mount: you must specify the filesystem type

                                           [  OK  ]

Also stop telling the dialog that the secondary text contains pango
markup as the command line and error message certainly isn't pango
markup text.

Bug 742741 - Nilfs2 file system is unusable on RHEL/CentOS 6
2015-03-09 10:50:40 -06:00
Mike Fleetwood 474c5b10b3 Set activate/deactivate partition menu item name earlier (#741430)
So that, even though the menu item is greyed out, it is correctly named
Activate or Deactivate for an LVM2 Physical Volume on a whole disk
device, rather than the default Mount or Unmount.

Bug 741430 - GParted cannot recognise LVM signature on unpartitioned
             drive
2015-03-09 10:17:22 -06:00
Mike Fleetwood dd049e8b4b Disable manipulation operations on "none" partition tables (#741430)
At this time we are providing read-only support for file systems on
whole disk devices.  Also all manipulation operations fail at the
calibrate step with libparted error "unrecognised disk label", and
manage flags is for real partitions only.

Bug 741430 - GParted cannot recognise LVM signature on unpartitioned
             drive
2015-03-09 10:17:22 -06:00
Curtis Gedak ed9d537227 Add Mike Fleetwood to menu_help_about 2015-02-01 13:14:05 -07:00
Curtis Gedak 44eaabc57c Provide credit for patch by Michael Zimmermann
Provide credit for patch to add support for GPT partition names.
Also indicate significant effort by Sinlu Bes while we tried different
ideas for how GPT partition name support should work.
2015-02-01 11:01:41 -07:00
Michael Zimmermann 1f5841b4ad Add support for GPT partition names (#741424)
Embedded devices (Android) use GPT partition names to identify
partitions, instead of file system labels.  Add support for viewing and
changing them.

As partition names are used to provide unique identification they are
never copied when copying the contents of one partition to another.

Note that GNU/Linux uses file system labels, UUIDs or device names for
identification during the boot process and afterwards so while partition
names can be used, they are optional and purely for user information.

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Mike Fleetwood e1dc89cd11 Rename class to Dialog_FileSystem_Label (#741424)
class Dialog_Partition_Label   -> Dialog_FileSystem_Label
file Dialog_Partition_Label.h  -> Dialog_FileSystem_Label.h
file Dialog_Partition_Label.cc -> Dialog_FileSystem_Label.cc

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Mike Fleetwood 04450c577c Rename class to OperationLabelFileSystem (#741424)
class OperationLabelPartition   -> OperationLabelFileSystem
file OperationLabelPartition.h  -> OperationLabelFileSystem.h
file OperationLabelPartition.cc -> OperationLabelFileSystem.cc

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Mike Fleetwood 3630b9c83b Rename methods in GParted_Core and Win_GParted classes (#741424)
class GParted_Core:
    label_partition() -> label_filesystem()

class Win_GParted:
    allow_label_partition()    -> allow_label_filesystem()
    activate_label_partition() -> activate_label_filesystem()

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Mike Fleetwood 63aeb150ac Rename member variables and methods in Partition class (#741424)
class Partition:
    have_label    -> have_filesystem_label
    label         -> filesystem_label
    label_known() -> filesystem_label_known()
    get_label()   -> get_filesystem_label()
    set_label()   -> set_filesystem_label()

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Mike Fleetwood d480800600 Rename enum to OPERATION_LABEL_FILESYSTEM (#741424)
This and the following few commits rename variables, methods, classes,
etc from *label_partition* to *label_filesystem* so that the code also
reflects that it is the label of the file system that is being modified
and to separate it from the name partition operation about to be added.

enum OPERATION_LABEL_PARTITION -> OPERATION_LABEL_FILESYSTEM

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Mike Fleetwood 332a2e7a79 Rename Partition Label to File System Label in the GUI (#741424)
Rename the Partition Label concept to File System Label throughout the
GUI.  This is to better reflect that it is the label of the file system
that is being modified and to separate it from the Partition Name
concept about to be added.

Bug 741424 - Add support for GPT partition names
2015-02-01 10:08:23 -07:00
Curtis Gedak 570680826d Update copyright year 2015-01-26 09:48:36 -07:00
Mike Fleetwood 88f67058e8 Use supported_filesystem() predicate (#738471)
Use GParted_Core::supported_filesystem() to remove the need to
explicitly list the growing number of recognised, but otherwise
unsupported, file system signatures in multiple places.

Bug #738471 - ReFS file system is not recognised
2014-10-30 09:55:01 -06:00
Mike Fleetwood 0fb8cce699 Reduce flashing redraw from automatic partition selection (#696149)
Automatic selection of the largest unallocated partition caused flashing
redraw of the partition graphic and partition list.  Both the partition
graphic and partition list were being drawn blank then redrawn fully
populated.  This only happened on some distributions including:
CentOS 5.10, 6.5, 7.0, Debian 6, Fedora 14, 20, Xubuntu 14.04 LTS.  Did
not happen on: Kubuntu 12.04 LTS.

This is a workaround, not a complete fix.  It moves automatic selection
of the largest unallocated partition to after processing of the GTK
Event loop in Refresh_Visual() which redraws the partition graphic and
partition list.  These visuals are now drawn only once, fully populated,
however this draws them without the selected partition.  The partition
selection is then drawn afterwards which causes the selection to flash
instead.  This is significant improvement to the whole partition graphic
and partition list flashing when redrawn.

Bug #696149 - Double refresh of display introduced with default
              unallocated space
2014-10-07 10:38:27 -06:00
Mike Fleetwood 52ee26f971 Prevent flashing redraw of the devices combobox (#696149)
The device combobox was getting drawn blank, then getting drawn again
with the selected device.  This was happening because at the start of
Win_GParted::refresh_combo_devices() the GTK model behind the combobox,
liststore_devices, was cleared, changing the active item, causing the
combobox to get redrawn empty.  After the GTK model had been repopulated
the active item was reset causing the comboxbox to get redrawn again,
now showing the selected device.  Call flow:

    Win_GParted::refresh_combo_devices()
        liststore_devices->clear()
            //Gtk::Combobox emits signal_change.  Registered callbacks
            //called.
                Win_GParted::combo_devices_changed()
                    Win_GParted::Refresh_Visual()
                        ...
        ...
        combo_devices.set_active(current_device);
            //Gtk::Combobox emits signal_change.  Registered callbacks
            //called.
                Win_GParted::combo_devices_changed()
                    Win_GParted::Refresh_Visual()
                        ...

This has always been the case, since the device combobox was first added
to GParted before version 0.1 by commit:

    3a4b43e0ad
    replaced deprecated OptionMenu with ComboBox ...

Fix by temporarily blocking the devices comboxbox from emitting
signal_changed while the GTK model behind the combobox is recreated.

However, since automatic selection of the largest free space was added
[1] in GParted 0.15.0, a more noticeable flashing redraw issue was
caused in which the partition graphic and partition list were both drawn
blank then redrawn fully populated.  Some distributions were not
affected by this at all, some only experienced a single flash and others
suffered from two or more flashing redraws.  Some affected
distributions: CentOS 5.10, 6.5, 7.0, Debian 6, Fedora 14, 19, 20,
Ubuntu 13.10, Xubuntu 14.04 LTS.  Did not occur on Kubuntu 12.04 LTS.

[1] 5b53c12f6e
    Select largest unallocated partition by default (#667365)

Bug #696149 - Double refresh of display introduced with default
              unallocated space
2014-10-07 10:38:27 -06:00
Mike Fleetwood 20158f0440 Tidyup Autoconf check for --disable-doc (#734076)
Use AC_ARG_ENABLE() and AS_HELP_STRING() macros to improve handling of
the --disable-doc option.

Change the names, and sence, of the Autoconf and Automake definitions
used to control building of the help documentation.  Reasons are:
(1) Switch from negative to positive statements which are more natural
    to comprehend.
(2) Insert HELP in the names from *_DOC to *_HELP_DOC as they control
    building of the documentation in the help subdirectory, not the
    manual page in the doc directory.

Autoconf: HAVE_DISABLE_DOC -> ENABLE_HELP_DOC
Automake: DISABLE_DOC      -> BUILD_HELP_DOC

Bug #734076 - Autodetect parted online partition resizing capability
2014-08-31 11:04:36 -06:00
Mike Fleetwood a0c0533e3e Add is_dev_mounted() to expose core partition is mounted test (#723842)
Add static member function GParted_Core::is_dev_mounted() so that other
modules can determine if a particular partition contains a mounted file
system or not.

Make it a static member function so that it can be called without
needing the gparted_core object.  Extend to make the group of
manipulated variables (mount_info, fstab_info) and manipulating
functions (init_maps(), read_mountpoints_from_file(),
read_mountpoints_from_file_swaps(), get_all_mountpoints()) static too.

Bug #723842 - GParted resizes the wrong filesystem (does not pass the
              devid to btrfs filesystem resize)
2014-07-28 10:03:16 -06:00
Mike Fleetwood 960ce2df56 Make LVM members selectable together in delete non-empty PV dialog
Place the LVM2 member names in a single string, separated by new lines,
so that they can be selected all together by the user.  This was not
previously possible when each member name was placed in a separate
widget.
2014-04-28 08:42:40 +01:00
Curtis Gedak 203a345cfb Update copyright year 2014-02-08 12:23:55 +00:00
Mike Fleetwood 9728479771 Recognise BitLocker encrypted partitions (#723232)
Only recognises partitions containing BitLocker Disk Encryption content.
No other actions are supported.

Bug #723232 - BitLocker Disk Encryption not recognised
2014-01-31 09:55:05 -07:00
Daniel Mustieles 3861b9257b Replace obsolete FSF postal address in copyright notices (#721565)
This is part of parent bug:
    Bug #721455 - Obsolete info in license text on multiple modules

and GNOME Goal:
    https://wiki.gnome.org/Initiatives/GnomeGoals/Proposals

    * verify all source files to make sure they have a license and a
      copyright, and that both are up-to-date

Bug #721565 -  License text contains obsolete FSF postal address
2014-01-26 10:53:23 +00:00
Mike Fleetwood 7b43d52720 Display partition table types in order (#711098)
In the Create Partition Table dialog display the entries in the combobox
in order.

Previously the default of MSDOS or GPT was moved to the first item in
the combobox.  Now the partition table types remain in order with just
either MSDOS or GPT being selected as as the default as required.

The partition table types are displayed in the order supplied by
libparted, which is alphabetic except with "loop" last.

Bug #711098 - Default partition table can not handle > 2 TiB disks
2014-01-06 10:45:00 +00:00
Phillip Susi 07bd72ba80 Default to GPT on disks >= 2 TiB (#711098)
MSDOS partition table is limited to addressing 2^32 sectors, limiting
disks using 512 byte sectors to 2 TiB in size.  Fdisk reports the
following warning on disks 2 TiB and larger.

    # truncate -s 2T /var/tmp/loop-2T
    # losetup /dev/loop0 /var/tmp/loop-2T
    # fdisk /dev/loop0

    WARNING: The size of this disk is 2.2 TB (2199023255552 bytes).
    DOS partition table format can not be used on drives for volumes
    larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
    partition table format (GPT).

(Fdisk arguably reports this warning one sector too early.  Anyway for
safety and consistency GParted will use this limit too).  Continue to
use MSDOS as the default partition table type for disks smaller than 2
TiB and use GPT as the default for disks 2 TiB and larger.  This
maximises compatibility.

Also remove the advanced expander and always show the partition table
list box.

Bug #711098 - Default partition table can not handle > 2 TiB disks
2014-01-06 10:44:59 +00:00
Phillip Susi de2844d02d Add online resize support (#694622)
Many file systems are capable of growing while mounted, and a few can
even shrink.  This support must be explicitly enabled at configure time
with the --enable-online-resize flag and depends on a patched libparted.
Also requires kernel >= 3.6 for partition resizing, even if the
partition is in use (BLKPG_RESIZE_PARTITION).

Thanks to Mike Fleetwood for double check mark idea instead of a second
column to show the online grow/shrink.

Bug #694622 - Add support for online resize
2013-11-24 10:10:37 +00:00
Mike Fleetwood d2e1130ad2 Detect busy status of Linux Software RAID members (#709640)
Read the contents of /proc/mdstat file to determine if a device is a
member of of an active RAID array.

    $ cat /proc/mdstat
    Personalities : [raid1]
    md1 : active raid1 sda1[2] sdb1[3]
          524224 blocks super 1.0 [2/2] [UU]

    md2 : active raid1 sdb2[2] sda2[3](F)
          5238720 blocks super 1.1 [2/1] [U_]

    md3 : active raid1 sdb3[1]
          10477440 blocks super 1.1 [2/1] [_U]
          bitmap: 1/1 pages [4KB], 65536KB chunk

    md4 : inactive sda4[0](S)
          1048564 blocks super 1.2

    unused devices: <none>

There are 5 example Linux Software RAID arrays, md1 to md5.  All are
RAID1 mirrors with 2 members, in various states.

    Array  Members     Status
    md1    sda1, sdb2  Fully operational.
    md2    sda2, sdb2  Member sda2 marked as faulty.  (Device sda2 is
                       still in use).
    md3    sda3, sdb3  Member sda3 has been removed.  (Device sda3 is
                       not in use).
    md4    sda4, sdb4  Incremental start of member sda4 only.  (Neither
                       member devices is in use).
    md5    sda5, sdb5  Array stopped.  (Neither member device is in
                       use).

Also disable "Unmount" in the partition menu for active RAID array
members.

Bug #709640 - Linux Swap Suspend and Software RAID partitions not
              recognised
2013-10-19 10:21:03 -06:00