Commit Graph

283 Commits

Author SHA1 Message Date
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
Mike Fleetwood fac3f5b865 Recognise Linux Swap Suspend and Software RAID partitions (#709640)
Recognise in kernel, Linux Swap Suspend partitions.  (When hibernated
the kernel write the RAM out to swap space and changes the magic string
from swap space to suspend).  Recognition required either
libparted >= 1.8.8.1 or blkid from util-linux >= 2.15 or before that
blkid from e2fsprogs >= 1.39.

Recognise Linux Software RAID partitions.  Recognition requires blkid
from util-linux >= 2.15.

Example:

    # blkid /dev/sda10 /dev/sda11
    /dev/sda10: ... TYPE="swsuspend"
    /dev/sda11: ... TYPE="linux_raid_member"

    # parted /dev/sda print
    Model: ATA SAMSUNG HM500JI (scsi)
    Disk /dev/sda: 500GB
    Sector size (logical/physical): 512B/512B
    Partition Table: msdos

    Number  Start   End     Size    Type      File system     Flags
    ...
    10      361GB   362GB   1074MB  logical   swsusp
    11      362GB   363GB   1074MB  logical                   raid

Bug #709640 - Linux Swap Suspend and Software RAID partitions not
              recognised
2013-10-19 10:05:54 -06:00
Mike Fleetwood be2689ad25 Stop using deprecated widget alignment enumerators (#652044)
Step 3 of 3:

Now that all label widgets are created with ALIGN_LEFT and ALIGN_CENTER
alignment remove the x_align and y_align parameters from mk_label() and
always use this alignment.  Also specify this alignment via floats
rather than enumerators, one of which was deprecated.

Bug #652044 - uses deprecated APIs
2013-10-18 10:17:22 -06:00
Mike Fleetwood 18e2eb8618 Replace widget alignment ALIGN_RIGHT with ALIGN_LEFT (#652044)
Step 2 of 3:

ALIGN_RIGHT was only used for the size figures in the GParted > Devices
device selector with radio buttons.  Change to ALIGN_LEFT and adjust the
widget packing to maintain appearance.

Bug #652044 - uses deprecated APIs
2013-10-18 10:17:22 -06:00
Mike Fleetwood 8b57278f67 Replace widget alignment ALIGN_TOP with ALIGN_CENTER (#652044)
Gtkmm release 2.24 in February 2011 deprecated the use of these
alignment enumerators superseding them with:

    Deprecated enumerator    Use instead
    Gtk::ALIGN_LEFT          Gtk::ALIGN_START
    Gtk::ALIGN_RIGHT         Gtk::ALIGN_END
    Gtk::ALIGN_TOP           Gtk::ALIGN_START
    Gtk::ALIGN_BOTTOM        Gtk::ALIGN_END

    gtkmm: gtkmm Enums and Flags [2.24]
    https://developer.gnome.org/gtkmm/2.24/group__gtkmmEnums.html

The deprecated alignment enumerators were only used in the creation of
Gtk::Label widgets by method Utils::mk_label().  In all but three cases
the alignment was left, center.  So make all labels with alignment left,
center and then stop using the deprecated enumerators.

Step 1 of 3:

ALIGN_TOP was only used for these 2 labels:

    "Path:" text in View > Device Information;
    "Path:" text in Partition > Information.

Use of ALIGN_TOP makes no difference to these labels so just change to
ALIGN_CENTER.

Bug #652044 - uses deprecated APIs
2013-10-18 10:17:22 -06:00
Mike Fleetwood 4cc426c6cf Only allow Undo and Apply after merging operations (#699452)
It was possible to make GParted crash by adding a label, check or new
UUID operation and then applying the operation before the view of
pending operations had finished fully opening.  The operation would be
successfully applied but GParted would crash afterwards.

The fault was that Add_Operation() still enabled the Undo and Apply
buttons and processed the GTK event loop before merging the list of
pending operations.  Faulty code flow went like this:

    activate_*()
        Add_Operation()
            Add operation to the operations[] vector
            Enable Undo and Apply buttons
            Refresh_Visual()
                Process GTK event loop
                    Process Apply button callback applying operations,
                    refreshing display and clearing operations[] vector
        Merge operations in the operations[] vector
        << Core dump here >>
            Merge_Operations()
                Refresh_Visual()

This faulty code flow came about when merging of operations was added
and it didn't appreciate that the operations[] vector could have been
processed and cleared by Add_Operations() before the merge step.
Relevant commit:

    b10349ae37
    Merge overlapping operations (#438573)

Fragment of code in the label operation case:

  2454  void Win_GParted::activate_label_partition()
  2455  {
  ...
  2472          Add_Operation( operation ) ;
  2473
  2474          // Verify if the two operations can be merged
  2475          for ( unsigned int t = 0 ; t < operations .size() - 1 ; t++ )
  2476          {
  2477              if ( operations[ t ] ->type == OPERATION_LABEL_PARTITION )
  2478              {
  2479                  if ( Merge_Operations( t, operations .size() - 1 ) )
  2480                      break;
  2481              }
  2482          }

Commentary in the crashing label operation case:

  2472  The pending operation was already applied when Add_Operation()
        returned resulting in the operations[] vector being cleared
        setting its size to 0.
  2475  The return type of operations.size() is an unsigned integral, so
        the upper limit of the for loop is t < 0UL - 1.  Assuming a
        32-bit machine that's t < 4294967295.
  2477  operations[] vector is access from out of bounds offset 0
        upwards until unallocated memory is accessed resulting in a core
        dump.

Fix this by not enabling the Undo and Apply buttons and processing the
GTK event loop until after merging of operations has been performed.
Fixed code flow goes like this:

    activate_*()
        Add_Operation()
            Add operation to the operations[] vector
        Merge operations in the operations[] vector
            Merge_Operations()
        show_operationslist()
            Enable Undo and Apply buttons
            Refresh_Visual()
                Process GTK event loop
                    Process Apply button callback applying operations,
                    refreshing display and clearing operations[] vector

Not allowing the operations list to be process until after the merge
step is the be correct ordering.  This also prevents the new operation
from flashing up in the operations list and then immediately
disappearing if merged.  In the case of adding the first operation,
delaying enabling the Undo and Apply buttons is enough as the buttons
were previously disabled preventing the operation being applied before
the merge.  In the case of adding further operations, processing of the
GTK event loop must also be delayed until after the merge to prevent the
operations being applied before the merge.  Although that window of
opportunity would only be microseconds.

Bug #699452 - Crash when applying operations before pending operations
              fully displayed
2013-05-19 13:18:25 -06:00
Mike Fleetwood b09d6035cd Add fallback method for specifying GParted icon (#695279)
On RHEL / CentOS 5.9 GParted couldn't set an icon as the
set_default_icon_name() method is not available.  See commit [1] for
details.

Re-add the old set_icon_from_file() method as a fallback and re-install
a GParted pixmap as was used before commit [2].

Commit [1]:
    a042107883
    Only use Gtk::Window::set_default_icon_name method when available

Commit [2]:
    f5a80bc904
    Enabled GParted to use themed app icon (Tango theme)

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-04-28 13:51:06 -06:00
Mike Fleetwood d4f68eb730 Add new "cleared" file system format (#688882)
Add "cleared" to the bottom of list of file system formats available in
the Create new Partition dialog and in the Format to --> (file system
list) menu.  This clears existing file system signatures in the newly
created partitions and existing partitions respectively.

Bug #688882 - Improve clearing of file system signatures
2013-03-25 10:06:39 -06:00
Mike Fleetwood bc5b57ab35 Refactor Win_GParted::create_format_menu() (#688882)
Move some code into new create_format_menu_add_item() sub-function which
adds one file system entry to the Partition --> Format to -->
(file system list) menu.

Bug #688882 - Improve clearing of file system signatures
2013-03-25 10:06:39 -06:00
Mike Fleetwood a042107883 Only use Gtk::Window::set_default_icon_name method when available (#695279)
GParted fails to compile on RHEL/CentOS 5.9 because it doesn't provide
the Gtk::Window::set_default_icon_name() method.  The "gtkmm GTK::Window
Class Reference" document says that set_default_icon_name() is available
in gtkmm >= 2.6, however it is not available in RHEL/CentOS 5.9 with
gtkmm 2.10.

Add an autoconf compile and link check for the set_default_icon_name()
method and make GParted only use the method when available.

Bug #695279 - GParted doesn't compile on RHEL / CentOS 5.9
2013-03-20 11:46:20 -06:00
Mike Fleetwood 5b53c12f6e Select largest unallocated partition by default (#667365)
After a refresh, instead of having no partition selected, default to the
largest unallocated partition.  This allows immediate creation of a new
partition in the unallocated space.

Bug 667365 - Free space should be selected by default
2013-03-17 11:06:10 -06:00
Mike Fleetwood 92f4947618 Revert "Select unallocated partition by default (#667365)"
This reverts commit 3dd769d955.

It didn't consider unallocated partitions within extended partitions
when looking for the largest one to select.
2013-03-17 11:06:10 -06:00
Phillip Susi 2a2d21c231 Bind ctrl-enter to apply-operations
Bind the keyboard accelerator key ctrl-enter to apply operations.
2013-03-11 18:40:31 -06:00
Phillip Susi 3dd769d955 Select unallocated partition by default (#667365)
After a refresh, instead of having no partition selected, default to the
largest unallocated partition.  This allows immediate creation of a new
partition in the unallocated space.

Closes Bug 667365 - Free space should be selected by default
2013-03-11 18:40:31 -06:00
Phillip Susi 9ad53d94a0 Bind Insert key to new partition
Add an accelerator key for Insert to trigger the new partition menu item.
2013-03-11 18:40:31 -06:00
Phillip Susi 52a2a9b00a Reduce threading (#685740)
Win_Gparted and Dialog_Progress were creating threads to perform most
functions in the background.  Most of the time, the only reason the
threads blocked was to execute an external command.  The external command
execution has been changed to spawn the command asynchronously and wait
for completion with a nested main loop.  While waiting for completion,
the pipe output is captured via events.  In the future, this will allow
for it to be parsed in real time to obtain progress information.

Those tasks in GParted_Core that still block now spawn a background thread
and wait for it to complete with a nested main loop to avoid hanging the
gui.

Part of Bug #685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Phillip Susi 124342e979 Use a full fledged nested main loop while waiting and pulsing progress bars (#685740)
Win_Gparted and Dialog_Progress were looping on Gtk::Main::events_pending()
and iteration() with usleeps in between.  Use a full mainloop instead and
a proper timeout to trigger pulsebar updates instead of usleeps.

Part of Bug 685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Phillip Susi f5a5c9cdb9 Remove gdk_threads_enter/exit (#685740)
Use of these functions is depreciated and making gtk calls in a background
thread still sometimes causes deadlocks or crashes.  Change ped exception
handler to instead use an idle function to force the main thread to display
the dialog box.

Part of Bug 685740 - Refactor to use asynchronous command execution
2013-03-11 18:40:31 -06:00
Curtis Gedak a0e0f1c5d9 Update copyright year 2013-02-21 10:43:14 -07:00
Curtis Gedak 81682eaf29 Provide credit in About dialog for contributions
Recognize contributions by Sinlu Bes.
2013-01-02 11:53:50 -07:00
Curtis Gedak c17959e200 Provide credit in About dialog for contributions
Recognize contributions by Matthias Gehre.
2012-11-30 13:32:31 -07:00
Mike Fleetwood 686ec8f713 Make GParted recognise reading blank file system labels (#685656)
GParted doesn't notice when a file system label is changed to blank.
GParted first calls the file system specific read_label() method.  When
the label is blank read_label() correctly sets partition.label to the
zero length string.  Second GParted_Core::set_device_partitions() treats
the zero length string to mean that the label is unset and calls
FS_Info::get_label() to retrieve it from the cache of blkid output.
Blkid also doesn't notice when the file system label has been changed to
blank so reports the previous label.  Hence GParted displays the
previous file system label.

Fix by making label a private member variable of the class Partition and
providing access methods set_label(), get_label() and label_known()
which track whether the label has been set or not.  This only fixes the
fault for file systems which use file system specific commands to read
the label and when these tools are installed.  Otherwise GParted uses,
or has to fall back on using, the buggy blkid command to read the file
system label.

NOTE:
Many of the file system specific read_label() methods use a tool which
outputs more than just the label and use Utils::regexp_label() to match
leading text and the label itself.  If the surrounding text changes or
disappears altogether to indicated a blank label, regexp_label() doesn't
match anything and returns the zero length string.  This  is exactly
what is required and is passed to set_label() to set the label to blank.

Bug 685656 - GParted doesn't notice when file system label is changed to
             blank
2012-11-04 12:26:09 +00:00
Mike Fleetwood fbc4e9e941 Remove full stops from the end of primary text in dialogs
The GNOME HIG, 3.4.1 "Alert Text" states:

    ...  The primary text is punctuated in 'newspaper headline' style,
    that is, it has no terminating period, but it may have a terminating
    question mark.

http://developer.gnome.org/hig-book/3.0/windows-alert.html.en#alert-text
2012-08-30 13:47:46 -06:00
Mike Fleetwood 85e9ce3428 Remove outdated FIXME comment from active_partitions_on_device_count()
Active LVM2 PVs have the partition class busy member set in
GParted_Core::set_device_partitions() just as mounted file systems do.
This is a basic requirement for GParted so that it only manipulates
partitions and contained file systems when they are not in use.
2012-08-30 13:47:46 -06:00
Mike Fleetwood ca3d40d9c7 Rename *toggle_swap_mount* -> *toggle_busy*
Rename functions and a variable to use a generic term for the menu item
which changes the busy state of partitions now that it also activates
and deactivates LVM2 Physical Volumes as well as mounting and unmounting
file systems and enables and disables swap partitions.
2012-08-30 13:47:45 -06:00
Mike Fleetwood 590f1377f9 Add fallback implementation to new delete LVM2 PV warning dialog (#670171)
The new delete non-empty LVM2 Physical Volume warning dialog uses
Gtk::MessageDialog::get_message_area() in the display of Volume Group
members.  This function was new in gtkmm 2.22, released September 2010,
which is not available in a number of current distributions including:
Unbuntu 10.04 LTS, RHEL 6.3, SLES 11-SP2, Debian 6.0.

Implement fallback method to display the VG name and member PVs in the
warning dialog for when get_message_area() is not available.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 69c8acce75 Add warning dialog when deleting non-empty LVM2 PVs (#670171)
When attempting to delete a non-empty LVM2 Physical Volume (one which is
still a member of a Volume Group) display a warning dialog which
includes the VG name and a list of the PV members to allow the user to
make an informed choice whether to go ahead and perform the deletion or
cancel to the operation.  This dialog is displayed when a partition
containing a PV is being deleted or being overwritten by being
reformatted or pasted into.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood 619bda5d8b Enable LVM2 VG activation / deactivation (#670171)
In the Partition menu enable activation / deactivation of the LVM2
Volume Group of which the Physical Volume is a member.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Mike Fleetwood c3ab62591b Add creation of LVM2 PVs (#670171)
Add creation of Physical Volumes specifying LVM2 metatdata format:
    lvm pvcreate -M 2 /dev/DEVICE

Also set the partition type to identify its contents as LVM.  Note that
libparted treats every partition type as a file system except LVM which
it treats as a flag, hence GParted displaying "lvm" in the Manage Flags
dialog.  Never the less libparted set the partition types correctly.
For MBR partitioning the type is 8e "Linux LVM" and for GPT partitioning
the type is E6D6D379-F507-44C2-A23C-238F2A3DF928.  Setting the partition
type as LVM is not strictly required as LVM2 scans the contents of all
partitions looking for PVs, but it is best practice.

Bug #670171 - Add LVM PV read-write support
2012-08-30 13:47:45 -06:00
Curtis Gedak 9591b2de08 Provide credit in About dialog for significant contributions (#678486)
Closes Bug #678486 - Provide Credit in About Dialog for Significant
                     Contributions
2012-06-30 11:27:25 -06:00
Curtis Gedak d631c93607 Update credits in about dialog for artwork
Provide credit for the Tango themed icons designed by Sebastian Kraft.
2012-06-21 14:52:04 -06:00
Mike Fleetwood 7ebedc4bb3 Don't show intrinsic unallocated space (#499202)
Most file systems report intrinsic unallocated space using the statvfs()
system call when mounted, but not using their own tools.  They are:
ext2/3/4, fat16/32, hfs, nilfs2, reiserfs and xfs.  Showing either a
little or no unallocated space, depending on whether a file system is
mounted or not, could be confusing to the user.

When all file systems are created filling their partitions the unused
figure reported by statvfs() and their own tools are the same or very
close.  Also the used plus unallocated figure from statvfs() agrees with
the used figure from their own tools.

For all file systems don't display intrinsic unallocated space (that
below the threshold of 2 to 5%), instead include it as used space.  As
soon as the amount of unallocated space becomes significant display it
everywhere and also trigger the warning.

For display purposes always use the new Partition methods:
get_sectors_used(), get_sectors_unused(), and get_sectors_unallocated().
When calculating new usage figures during Paste and Resize/Move
operations directly access sectors_used, sectors_unused and
sectors_unallocated members.

Bug #499202 - gparted does not see the difference if partition size
              differs from filesystem size
2012-06-18 12:41:59 -06:00
Mike Fleetwood 04f5250644 Set unallocated space when performing simple operations (#499202)
When pasting a copied partition into an existing partition set its space
utilisation so that any unallocated space is displayed correctly before
the operation is applied.  If the destination partition is larger the
file system will be grown to fill the partition.

NOTE:
GParted will attempt to grow the the file system in this situation
regardless of whether the file system supports it or not.  These file
systems: exfat, hfs, hfs+, reiser4 and ufs can't be grown and will fail
with "growing is not available for this file system".  The preview will
also be wrong in this case for the same reason.  Everything will be
depicted correctly after the refresh.

When formatting an existing partition default its space utilisation to
unknown for display before the operation is applied.

Bug 499202 - gparted does not see the difference if partition size
             differs from filesystem size
2012-06-18 10:24:28 -06:00
Rogier Goossens a5242a28f4 Fix for FS flags becoming unknown after change label
AFAICS, there is no reason to manually copy all partition fields,
or to manually initialize the copy of the new partition object.
So now the partition object is simply copied using assignment.
2012-04-02 10:21:12 -06:00
Rogier Goossens ea26fcb4fa Fix for FS size & flags becoming unknown after change UUID
AFAICS, there is no reason to manually copy all partition fields,
or to manually initialize the copy of the new partition object.
So now the partition object is simply copied using assignment.
2012-04-02 10:21:12 -06:00
Mike Fleetwood ea4b77eb01 Fix uninitialised read when pasting into an existing partition
GParted_Core::set_device_partitions() creates and initialises the
partition objects based on the partitions on the disk using
partition.Reset() and partition.Set().  These methods never set the
alignment attribute.

Copy and pasting into an existing partition calls GParted_Core::
snap_to_alignment() to adjust the start and end of the newly created
in memory partition object.  When pasting into unallocated space the
user has selected the required alignment and this is exactly what is
needed.  However when pasting into an existing partition the in memory
partition object should always match the actual partition boundaries on
disk.  Unfortunately the partition boundaries are adjusted based on
reading the uninitialised alignment attribute.

Initialise the alignment attribute of newly created partition objects to
ALIGN_STRICT.  Also, when pasting into an existing partition set the
alignment of that partition object to ALIGN_STRICT so that no boundary
adjustment is performed.

valgrind:
==6845== Conditional jump or move depends on uninitialised value(s)
==6845==    at 0x80C779A: GParted::GParted_Core::snap_to_alignment(...) (GParted_Core.cc:566)
==6845==    by 0x810C115: GParted::Win_GParted::Add_Operation(...) (Win_GParted.cc:692)
==6845==    by 0x8110499: GParted::Win_GParted::activate_paste() (Win_GParted.cc:1649)
...
==6845== Conditional jump or move depends on uninitialised value(s)
==6845==    at 0x80C77A8: GParted::GParted_Core::snap_to_alignment(...) (GParted_Core.cc:568)
==6845==    by 0x810C115: GParted::Win_GParted::Add_Operation(...) (Win_GParted.cc:692)
==6845==    by 0x8110499: GParted::Win_GParted::activate_paste() (Win_GParted.cc:1649)

GParted_Core.cc:
   562  bool GParted_Core::snap_to_alignment( const Device & device, Partition & partition, Glib::ustring & error )
   563  {
   564          bool rc = true ;
   565
>> 566          if ( partition .alignment == ALIGN_CYLINDER )
   567                  rc = snap_to_cylinder( device, partition, error ) ;
>> 568          else if ( partition .alignment == ALIGN_MEBIBYTE )
   569                  rc = snap_to_mebibyte( device, partition, error ) ;
   570

Closes Bug #672654 - Pasting into an existing partition may shrink
                     GParted's representation of it
2012-03-24 10:53:00 -06:00
Curtis Gedak 57762cb610 Make all move warning strings translatable 2012-03-19 10:58:39 -06:00
Rogier Goossens 4108daf15f Implement changing UUID for NTFS (#667278)
Part 4 of 4 to provide new UUID support for NTFS.

Closes Bug #667278 - Add support for setting UUID
2012-02-10 10:33:13 -07:00
Rogier Goossens 170a79b3a0 Use custom text functions for mount/unmount and swapon/swapoff texts
Part 3 of 4 to provide new UUID support for NTFS.

See Bug #667278 - Add support for setting UUID
2012-02-10 10:33:12 -07:00
Mike Fleetwood aa085a3caa Display busy status of LVM2 PVs (#160787)
A Volume Group is active when any of its Logical Volume mappings are
loaded (and enabled) in the Kernel's device-mapper driver.  Therefore
all the Physical Volumes in the VG (must be considered) active too.
This is exactly equivalent to a mounted file system, as the kernel is
actively using the partition.  Mark active LVM2 PVs as busy in GParted.

Don't use statvfs() for determining sector usage of busy LVM2 PVs as it
will fail with "statvfs(VGNAME): No such file or directory".  Instead
always use the LVM2 PV specific method.

Display the status of the LVM2 PV in the Information dialog using one of
the following relevant messages:
    Not active (Not part of any volume group)
    VGNAME not active
    VGNAME active
(The code uses the VGNAME stored in the partition's first mount point,
as displayed in the "Mount Point" column, rather than going back to the
primary source of the information in the LVM2_PV_Info class).

Temporarily prevent GParted from offering to unmount LVM2 PVs until
activating and deactivating Volume Groups is implemented later.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00
Mike Fleetwood 8083f11d84 Display LVM2 VGNAME as the PV's mount point (#160787)
As the Mount Point column is being borrowed to display the PV's VGNAME,
also suppress generation of the "Mount on" submenu for LVM2 PVs.

Bug #160787 - lvm support
2012-02-02 10:24:31 -07:00