Commit Graph

2947 Commits

Author SHA1 Message Date
Mike Fleetwood 85b6858702 Remove remaining vestiges of coloured text from the partition list
This commit stopped setting the text colours in the Partition, File
System and Mount Point columns to avoid hard coding text colours making
them impossible to read when using GNOME's High Contrast Inverse theme:
    ff2a6c00dd
    Changes post gparted-0.3.6 - code recreation from Source Forge

    * src/TreeView_Detail.cc: Removed text_color hard coding
      - Removed hard coding of Partition and Filesystem text_color
        which was based on if partition was TYPE_UNALLOCATED.
      - Removed hard coding of Mount text_color which was based
        on if partition was busy.  Lock symbol provides this indicator.
      - Closes GParted bug #413810 - Don't hardcode text colour in
        partition list

Now remove the remaining vestiges left behind.  Remove the unused color
text and mount_text_color columns from the tree model.  Also remove
setting of the column attributes which set the colour of the text in the
tree view from those unused columns in the tree model.

Unnecessary history.  Added by:
    b179990dc9
    show greyed-out mountpoint of unmounted partitions in the treeview
    as an improved way to identify partitions
    Bug #333027 -  Displaying unmounted partitions' default mount points
    in grey

and by commit only in CVS history:
    Bart Hakvoort <...> 2004-08-22 15:06:45
    Made text in Partition column darkgrey for unallocated. this offers
    more visual difference between partitions and unallocated space
2016-10-05 10:53:21 -06:00
Mike Fleetwood c6d29aa7e8 Include extended partitions in the count of active partitions
Trying to create a new partition table on a device with active
partitions reports the number of active partitions in the error dialog.
However when there is a busy logical partition the number of reported
busy partitions will be one less than the number of partitions in the
main UI showing the busy symbol.

GParted considers extended partitions as busy when any of the logical
partitions it contains as busy.  Display in the main UI reflects this.

Fix Win_GParted::active_partitions_on_device_count() to not exclude
extended partitions from the count.
2016-10-05 09:59:15 -06:00
Mike Fleetwood 253c4d6416 Fix BlockSpecial comparison (#771670)
Found that in some cases usage of active encrypted swap was not working,
but only for the first encrypted swap partition.  This only failed on
the first Device Mapper device, dm-0:

    # ls -l /dev/mapper/ /dev/dm-*
    brw-rw---- 1 root disk 254, 0 Oct  4 20:58 /dev/dm-0
    brw-rw---- 1 root disk 254, 1 Oct  4 20:58 /dev/dm-1

    /dev/mapper/:
    total 0
    crw------- 1 root root 10,236 Oct  4 19:48 control
    lrwxrwxrwx 1 root root      7 Oct  4 20:58 sdb1_crypt -> ../dm-0
    lrwxrwxrwx 1 root root      7 Oct  4 20:58 sdb2_crypt -> ../dm-1

    # cat /proc/swaps
    Filename                        Type        Size    Used    Priority
    /dev/sda1                       partition   1524732 92356   -1
    /dev/dm-0                       partition   1046524 0       -2
    /dev/dm-1                       partition   1046524 0       -3

Was failing because the minor number of dm-0 was 0, causing BlockSpecial
operator==() to fall back to name comparison rather than major, minor
number, and GParted name /dev/mapper/sdb1_crypt doesn't match /dev/dm-0.

Found on openSUSE and Ubuntu which don't use LVM by default and don't
already have dm-0 used as an LVM Logical Volume which GParted doesn't
support.

The LINUX ALLOCATED DEVICES document [1] says block special device 0, 0
(major, minor) is not used "reserved as null device number".   (Not to
be confused with 1, 3 /dev/null the Null device).  All other
non-negative pairs are valid block special device numbers.  Therefore
update BlockSpecial operator==() accordingly; compare by major, minor
number when either is greater than 0 falling back to string compare
otherwise.  This still fits in with the BlockSpecial() constructor using
major, minor numbers 0, 0 to represent plain files.

[1] LINUX ALLOCATED DEVICES
    https://www.kernel.org/doc/Documentation/devices.txt

Bug 771670 - Usage of active encrypted swap is not shown
2016-10-05 09:59:15 -06:00
Mike Fleetwood 3966cc3e6f Implement usage reporting of active encrypted swap partitions (#771670)
GParted does not show the usage of active encrypted swap partitions,
instead showing partition warning "Unable to read the contents of this
file system! ...".  OS setup:

    # ls -l /dev/mapper/sdb4_crypt /dev/dm-3
    brw-rw----. 1 root disk 253, 3 Sep 14 07:26 /dev/dm-3
    lrwxrwxrwx. 1 root root      7 Sep 14 07:26 /dev/mapper/sdb4_crypt -> ../dm-3
    # mkswap -L encrypted_swap /dev/mapper/sdb4_crypt
    # swapon /dev/mapper/sdb4_crypt
    # cat /proc/swaps
    Filename                        Type        Size    Used    Priority
    /dev/sda2                       partition   2097148 237632  -1
    /dev/dm-3                       partition   1046524 0       -2

This is because the code was performing a string compare between the
canonical /dev/mapper/sdb4_crypt name GParted is using and the /dev/dm-3
name reported by the kernel via /proc/swaps.  Fix by creating
BlockSpecial objects from the names and compare those so that comparison
is done correctly using major, minor numbers.

Bug 771670 - Usage of active encrypted swap is not shown
2016-10-05 09:59:15 -06:00
gogo 3d7804576f Updated Croatian translation 2016-10-04 17:30:58 +00:00
gogo 1824997ab3 Updated Croatian translation 2016-10-03 17:58:49 +00:00
Daniel Șerbănescu 08e3f4b21f Updated Romanian translation 2016-09-30 16:17:34 +00:00
gogo 115090a0af Added Croatian translation 2016-09-22 22:28:30 +00:00
Anders Jonsson 8570f0c7a1 Updated Swedish translation 2016-09-20 20:59:26 +00:00
David King 7e116fa42e Update British English translation 2016-09-20 16:27:23 +02:00
GNOME Translation Robot ae21d6d4c2 Updated British English translation 2016-09-20 12:45:43 +00:00
Mike Fleetwood d64283fd1a Remove left behind typedef GParted_Core::MountMapping
Left behind by:
    63ec73dfda
    Split mount_info and fstab_info maps into separate Mount_Info module
2016-09-14 09:48:33 -06:00
Mike Fleetwood ab4040c547 Remove out of date comment from the end of set_devices_thread()
The comment became completely unnecessary with the transfer of
mount_info and fstab_info into separate Mount_Info module by commit:
    63ec73dfda
    Split mount_info and fstab_info maps into separate Mount_Info module

It was never necessary to clear one of the mappings at the end of the
device refresh because it was reloaded at the start of the next device
refresh anyway and it is only a small amount of memory.
2016-09-14 09:48:33 -06:00
Mike Fleetwood 8c870cf72f Stop showing duplicate mount points for unmounted encrypted file systems (#771323)
Have an unmounted file system within an open encrypted mapping and an
entry in /etc/fstab for the file system like this:

    # lsblk
    NAME           MAJ:MIN RM   SIZE RO TYPE   MOUNTPOINT
    ...
    sdb              8:16   0     8G  0 disk
    +-sdb1           8:17   0     1G  0 part
      +-sdb1_crypt 253:0    0  1022M  0 crypt
    # blkid | grep sdb1
    /dev/sdb1: TYPE="crypto_LUKS" ...
    /dev/mapper/sdb1_crypt: TYPE="ext4" ...
    # ls -l /dev/mapper/sdb1_crypt /dev/dm-0
    brw-rw----. 1 root disk 253, 0 Sep 12 19:09 /dev/dm-0
    lrwxrwxrwx. 1 root root      7 Sep 12 19:09 /dev/mapper/sdb1_crypt -> ../dm-0
    # grep sdb1 /etc/fstab
    /dev/mapper/sdb1_crypt   /mnt/1   ext4   defaults    0 0

The mount point will be shown twice for the partition:
    /mnt/1, /mnt/1

This is because add_node_and_mountpoint() adds two entries for both the
symbolic and real block special names:
    map["/dev/mapper/sdb1_crypt"] = ["/mnt/1"]
    map["/dev/dm-0"]              = ["/mnt/1"]
This was needed for the old code which used string compare to match
block devices so that the mount point could be looked up by either name.
However since bug 767842 introduced major, minor number comparison it
became unnecessary.  As both names refer to the same device the mount
point gets added twice to the same entry.  Hence display of the double
mount.
    map[BlockSpecial{"/dev/mapper/sdb1_crypt", 253, 0}] =
                                                    ["/mnt/1", "/mnt/1"]

It is always going to be the case that the symbolic link and real block
special names have the same major, minor numbers.  That was the
requirement of the BlockSpecial class and the reason for using stat() to
lookup the numbers.  Therefore adding entries for both names will always
add duplicate entries.  Fix by stop using realpath() to lookup the real
name and adding the duplicate entry.

Introduced by:
    a800ca8b68
    Add BlockSpecial into mount_info and fstab_info (#767842)

Bug 771323 - GParted is showing duplicate mount points for unmounted
             encrypted file systems
2016-09-14 09:48:33 -06:00
Daniel Mustieles 7a2e95c4b5 Updated Spanish translation 2016-09-13 20:20:23 +02:00
Piotr Drąg 6a9c57632f Updated Polish translation 2016-09-09 03:43:24 +02:00
Jiri Grönroos e4987fb58e Updated Finnish translation 2016-09-04 15:31:46 +00:00
Baurzhan Muftakhidinov 54c996eae6 Updated Kazakh translation 2016-09-04 08:37:12 +00:00
Piotr Drąg c93814720f Updated Polish translation 2016-08-21 11:04:15 +02:00
Мирослав Николић f3df5d14a1 Updated Serbian translation 2016-08-20 22:47:35 +02:00
Aurimas Černius 4632ef4286 Updated Lithuanian translation 2016-08-15 13:20:32 +03:00
Mike Fleetwood e6f4b1c305 Remove no longer needed includes from GParted_Core.cc
No longer needed since commit:
    504eb04ddc
    Roll back (remove) code to recognize /dev/mapper/* devices, because ...
2016-08-06 09:47:58 -06:00
Mike Fleetwood 63ec73dfda Split mount_info and fstab_info maps into separate Mount_Info module
The GParted_Core::mount_info and GParted_Core::fstab_info maps and the
methods that manipulate them are self-contained.  Therefore move them to
a separate Mount_Info module and reduce the size of the monster
GParted_Core slightly.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 0785c5d7ef Remove unimplemented prototype DMRaid::partition_is_mounted_by_path() 2016-08-06 09:47:58 -06:00
Mike Fleetwood a94be2da05 Switch to static class interface for FS_Info
The FS_Info module has a pseudo multi-object interface and used the
constructor to load the cache.  However all the data in the class is
static.  An FS_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
FS_Info objects and provide an explicit load_cache() method.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 5055c0b638 Simplify whole device matching in load_proc_partitions_Info_cache()
Following earlier commit "Pre-populate BlockSpecial cache while reading
/proc/partitions (#767842)" load_proc_partitions_info_cache() has
extracted just the name field from each line of /proc/partitions.
Therefore simplify the regular expressions matching each type of whole
disk device to just matching in the name field rather than matching in
the whole line.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 912766c2e1 Switch to a static interface for Proc_Partitions_Info
The Proc_Partitions_Info has a pseudo multi-object interface and uses
the constructor to load the cache.  However all the data in the class is
static.  A Proc_Partitions_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
Proc_Partitions_Info objects and provide and explicit load_cache()
method.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 91e5a0960e Remove remaining use of retired vol_id
Vol_id has been retired and removed from all supported distributions.
See earlier commit "Remove use of retired vol_id from FS_Info module
(#767842)" for more details.  Therefore remove it's use from GParted
entirely.
2016-08-06 09:47:58 -06:00
Mike Fleetwood 571304d2c6 Pre-populate BlockSpecial cache while reading /proc/partitions (#767842)
GParted is already reading /proc/partitions to get whole disk device
names.  The file also contains the major, minor device number of every
partition.  Use this information to pre-populate the cache in the
BlockSpecial class.

    # cat /proc/partitions
    major minor  #blocks  name

       8        0   20971520 sda
       8        1     512000 sda1
       8        2   20458496 sda2
    ...
       9        3    1047552 md3
     259        2     262144 md3p1
     259        3     262144 md3p2
    ...
     253        0   18317312 dm-0
     253        1    2097152 dm-1
     253        2    8383872 dm-2
     253        3    1048576 dm-3

Note that for Device-Mapper names (dm-*) the kernel is not using the
canonical user space names (mapper/*).  There is no harm in
pre-populating the cache with these names and will help if tools report
them too.  It is just that for DMRaid, LVM and LUKS, GParted uses the
canonical /dev/mapper/* names so will still have to call stat() once for
each such name.

For plain disks (sd*) and Linux Software RAID arrays (md*) the kernel
name is the common user space name too, therefore matches what GParted
uses and pre-populating does avoid calling stat() at all for these
names.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 003d6eff94 Cache looked up major, minor numbers in BlockSpecial class (#767842)
Creation of every BlockSpecial object used to result in a stat() OS
call.  On one of my test VMs debugging with 4 disks and a few partitions
on each, GParted refresh generated 541 calls to stat() in the
BlockSpecial(name) constructor.  However there were only 45 unique
names.  So on average each name was stat()ed approximately 12 times.

Cache the major, minor number associated with each name after starting
with a cleared cache for each GParted refresh.  This reduces these
direct calls to stat() to just the 45 unique names.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood ce8fb1dd91 Use BlockSpecial in FS_Info module cache (#767842)
The FS_Info cache is loaded from "blkid" output and compares block
special names.  Therefore switch to using BlockSpecial objects so that
comparisons are performed by the major, minor device number instead.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 23da3ab9a8 Parse FS_Info cache into fields while loading (#767842)
FS_Info module caches the output from blkid as a single string and uses
regular expressions to find the line matching the requested block
special file name.  This is not compatible with using BlockSpecial
objects to represent block special files, and perform matching by major,
minor device number.  Therefore parse the blkid output into a vector of
structures containing the needed fields, ready for switching to
BlockSpecial objects in the following patch.

Interface to the module remains unchanged.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 8aa34f7baa Remove use of retired vol_id from FS_Info module (#767842)
Vol_id was removed from udev 142, released 2009-05-13, and udev switched
to using blkid instead [1].  All currently supported distributions use
later versions of udev (or systemd after the udev merge), except for
RedHat / CentOS 5 with udev 095.  However RedHat / CentOS 5 does provide
blkid and vol_id is found in udev specific /lib/udev directory not on
the PATH.  Therefore effectively vol_id is not available on any
supported distribution and blkid is always available.  Therefore remove
use of vol_id from the FS_Info module.  Less code to refactor and test
in following changes.

[1] delete vol_id and require util-linux-ng's blkid
    http://git.kernel.org/cgit/linux/hotplug/udev.git/commit/?id=f07996885dab45102492d7f16e7e2997e264c725

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 2b013e494c Use BlockSpecial in SWRaid_Info module cache (#767842)
The SWRaid_Info cache is loaded from "mdadm" command output and
/proc/mdstat file.  It contains the member name which is used to access
the cache, therefore switch to using BlockSpecial objects so that
comparison is performed using the major, minor device number.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 7cd574cac5 Use BlockSpecial in LUKS_Info module cache (#767842)
The LUKS_Info module cache is loaded from "dmsetup" command and compares
block special files, therefore switch to using BlockSpecial objects so
that comparisons are performed by major, minor device number.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood e4a8530b14 Overload is_dev_mounted() function (#767842)
Small optimisation which avoids constructing an extra BlockSpecial
object when determining if a btrfs member is mounted.  Rather than
extracting the name from the BlockSpecial object in
btrfs::get_mount_device() and re-constructing another BlockSpecial
object from that name in GParted_Core::is_dev_mounted(), pass the
BlockSpecial object directly.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood abee66484f Use BlockSpecial objects in btrfs member cache (#767842)
There are no known errors which affect the remaining caches in GParted.
However those caches which compare block special devices will be changed
to use BlockSpecial objects so comparison is by major, minor device
number rather than by name.

Change btrfs member cache loaded from "btrfs filesystem show" output to
use BlockSpecial objects.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood a800ca8b68 Add BlockSpecial into mount_info and fstab_info (#767842)
On some distributions having btrfs on top of LUKS encrypted partitions,
adding a second device and removing the first device used to mount the
file system causes GParted to no longer be able to report the file
system as busy or the mount points themselves.

For example, on CentOS 7, create a single btrfs file system and mount
it.  The provided /dev/mapper/sdb1_crypt name is reported, via
/proc/mounts, as the mounting device:
    # cryptsetup luksFormat --force-password /dev/sdb1
    # cryptsetup luksOpen /dev/sdb1 sdb1_crypt
    # mkfs.btrfs -L encrypted-btrfs /dev/mapper/sdb1_crypt
    # mount /dev/mapper/sdb1_crypt /mnt/1

    # ls -l /dev/mapper
    total 0
    lrwxrwxrwx. 1 root root       7 Jul  2 14:15 centos-root -> ../dm-1
    lrwxrwxrwx. 1 root root       7 Jul  2 14:15 centos-swap -> ../dm-0
    crw-------. 1 root root 10, 236 Jul  2 14:15 control
    lrwxrwxrwx. 1 root root       7 Jul  2 15:14 sdb1_crypt -> ../dm-2
    # fgrep btrfs /proc/mounts
    /dev/mapper/sdb1_crypt /mnt/1 btrfs rw,seclabel,relatime,space_cache 0 0

Add a second device to the btrfs file system:
    # cryptsetup luksFormat --force-password /dev/sdb2
    # cryptsetup luksOpen /dev/sdb2 sdb2_crypt
    # btrfs device add /dev/mapper/sdb2_crypt /mnt/1

    # ls -l /dev/mapper
    ...
    lrwxrwxrwx. 1 root root       7 Jul  2 15:12 sdb2_crypt -> ../dm-3
    # btrfs filesystem show /dev/mapper/sdb1_crypt
    Label: 'encrypted-btrfs'  uuid: 45d7b1ef-820c-4ef8-8abd-c70d928afb49
            Total devices 2 FS bytes used 32.00KiB
            devid    1 size 1022.00MiB used 12.00MiB path /dev/mapper/sdb1_crypt
            devid    2 size 1022.00MiB used 0.00B path /dev/mapper/sdb2_crypt

Remove the first mounting device from the btrfs file system.  Now the
non-canonical name /dev/dm-3 is reported, via /proc/mounts, as the
mounting device:
    # btrfs device delete /dev/mapper/sdb1_crypt /mnt/1

    # btrfs filesystem show /dev/mapper/sdb2_crypt
    Label: 'encrypted-btrfs'  uuid: 45d7b1ef-820c-4ef8-8abd-c70d928afb49
            Total devices 1 FS bytes used 96.00KiB
            devid    2 size 1022.00MiB used 144.00MiB path /dev/mapper/sdb2_crypt
    # fgrep btrfs /proc/mounts
    /dev/dm-3 /mnt/1 btrfs rw,seclabel,relatime,space_cache 0 0
    # ls -l /dev/dm-3
    brw-rw----. 1 root disk 253, 3 Jul  2 15:12 /dev/dm-3

GParted loads the mount_info mapping from /proc/mounts and with it the
/dev/dm-3 name.  When GParted is determining if the encrypted btrfs file
system is mounted or getting the mount points it is using the
/dev/mapper/sdb2_crypt name.  Therefore no information is found and the
file system is incorrectly reported as unmounted.

Fix by changing mount_info and fstab_info to use BlockSpecial objects
instead of strings so that matching is performed by major, minor device
numbers rather than by string compare.  Note that as BlockSpecial
objects are used as the key of std::map [1] mappings operator<() [2]
needs to be provided to order the key values.

[1] std::map
    http://www.cplusplus.com/reference/map/map/
[2] std::map::key_comp
    http://www.cplusplus.com/reference/map/map/key_comp/

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood ab2d4f5ee6 Create BlockSpecial class and use in LVM2_PV_Info (#767842)
In some cases creating an LVM2 Physical Volume on top of a DMRaid array
reports no usage information and this partition warning:
    Unable to read the contents of this file system!
    Because of this some operations may be unavailable.
    The cause might be a missing software package.
    The following list of software packages is required for lvm2
    pv file system support: lvm2.

For example on Ubuntu 14.04 LTS (with GParted built with
--enable-libparted-dmraid) create an LVM2 PV in a DMRaid array
partition.  GParted uses this command:
    # lvm pvcreate -M 2 /dev/mapper/isw_bacdehijbd_MyArray0p2

But LVM reports the PV having a different name:
    # lvm pvs
      PV                                                VG   Fmt  Attr PSize PFree
      /dev/disk/by-id/dm-name-isw_bacdehijbd_MyArray0p2      lvm2 a--  1.00g 1.00g

This alternate name is loaded into the LVM2_PV_Info module cache.  Hence
when GParted queries partition /dev/mapper/isw_bacdehijbd_MyArray0p2 it
has no PV information against that name and reports unknown usage.

However they are actually the same block special device; major 252,
minor 2:
    # ls -l /dev/mapper/isw_bacdehijbd_MyArray0p2
    brw-rw---- 1 root disk 252, 2 Jul  2 11:09 /dev/mapper/isw_bacdehijbd_MyArray0p2

    # ls -l /dev/disk/by-id/dm-name-isw_bacdehijbd_MyArray0p2
    lrwxrwxrwx 1 root root 10 Jul  2 11:09 /dev/disk/by-id/dm-name-isw_bacdehijbd_MyArray0p2 -> ../../dm-2
    # ls -l /dev/dm-2
    brw-rw---- 1 root disk 252, 2 Jul  2 11:09 /dev/dm-2

To determine if two names refer to the same block special device their
major, minor numbers need to be compared, instead of string comparing
their names.

Implement class BlockSpecial which encapsulates the name and major,
minor numbers for a block special device.  Also performs comparison as
needed.  See bug 767842 comments 4 and 5 for further investigation and
decision for choosing to implement a class.

Replace name strings in the LVM2_PV_Info module with BlockSpecial
objects performing correct block special device comparison.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 0f4df8dfd1 Remove now unused Proc_Partitions_Info::get_alternate_paths() (#767842)
Now Device and Partition objects only have a single path,
get_alternate_paths() is never called.  Remove the method and population
of the private alternate_paths_cache member that went with it.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 40f39bdbe2 Rename Partition::add_path() to set_path() (#767842)
To reflect that there is now only a single path in the Partition object
now.  Also get rid of the now unneeded optional clear_paths parameter
which was only relevant when there was a vector of paths.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 54652b0d4e Update calibrate_partition() for single partition path (#767842)
Now that Partition objects only have a single path, rather than a list
of paths, stop performing unnecessary actions in calibrate_partitions()
which added alternate paths reported from libparted.  Just left with
setting the partition path name correctly, when the path name doesn't
exist.  Happens when the path is set to "Copy of /dev/SRC" when the
partition was newly created by a copy-paste into unallocated space
earlier in the sequence of operations now being applied.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 214255eda3 Simplify Partition object to a single path (#767842)
Change from a vector of paths to a single path member in the Partition
object.  Remove add_paths() and get_paths() methods.  Keep add_path()
and get_path().

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 1dc8a0c628 Rename Device::add_path() to set_path() (#767842)
To reflect that there is only a single path in the Device object now.
Also get rid of the now unneeded optional parameter which was only
relevant when there was a vector of paths.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Mike Fleetwood 902afaa010 Simplify Device object to a single path (#767842)
Background

GParted stored a list of paths for Device and Partition objects.  It
sorted this list [1][2] and treated the first specially as that is what
get_path() returned and was used almost everywhere; with the file system
specific tools, looked up in various *_Info caches, etc.

[1] Device::add_path(), ::add_paths()
[2] Partition::add_path(), ::add_paths()

Mount point display [3] was the only bit of GParted which really worked
with the path list.  Busy file system detection [4] just used the path
provided by libparted, or for LUKS /dev/mapper/* names.  It checked that
single path against the mounted file systems found from /proc/mounts,
expanded with additional block device names when symlinks were
encountered.

[3] GParted_Core::set_mountpoints() -> set_mountpoints_helper()
[4] GParted_Core::set_device_partitions() -> is_busy()
    GParted_Core::set_device_one_partition() -> is_busy()
    GParted_Core::set_luks_partition() -> is_busy()

Having the first path, by sort order, treated specially by being used
everywhere and virtually ignoring the others was wrong, complicated to
remember and difficult code with.  As all the additional paths were
virtually unused and made no difference, remove them.  The "improved
detection of mountpoins, free space, etc.." benefit from commit [5]
doesn't seem to exist.  Therefore simplify to a single path for Device
and Partition objects.

[5] commit 6d8b169e73
    changed the way devices and partitions store their device paths.
    Instead of holding a 'realpath' and a symbolic path we store paths
    in a list.  This allows for improved detection of mountpoins, free
    space, etc..

This patch

Simplify the Device object from a vector of paths to a single path.
Remove add_paths() and get_paths() methods.  Keep add_path() and
get_path() for now.

Bug 767842 - File system usage missing when tools report alternate block
             device names
2016-08-06 09:47:58 -06:00
Balázs Úr 7745abd767 Updated Hungarian translation 2016-08-04 21:59:54 +00:00
Piotr Drąg 0778e4fdd1 Add Language headers to po files
Future versions of gettext will fail if this header is missing.
2016-07-21 22:35:03 +02:00
Andika Triwidada b8de6d0006 Updated Indonesian translation 2016-07-08 12:56:16 +00:00
Tiago Santos b2a4956d77 Updated Portuguese translation 2016-07-04 14:01:27 +00:00
Natanael Copa 25209904a9 Fix sscanf modifier for long long (#768239)
POSIX says that %lld is the modifier for long long.
http://pubs.opengroup.org/onlinepubs/9699919799/functions/fscanf.html

This fixes wrong sizes with musl libc.

Bug 768239 - sizes are wrong with musl libc due to use of non-standard
             sscanf "%Ld" modifier
2016-07-01 15:37:01 +01:00