Commit Graph

3828 Commits

Author SHA1 Message Date
Luca Bacci 07fc4aefc3 Use Gtk::Box for Dialog_Progress (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_Progress.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:05 +01:00
Luca Bacci d780ca644e Use Gtk::Box for Dialog_Rescue_Data (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_Rescue_Data.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:05 +01:00
Luca Bacci cc6a085e60 Use Gtk::Box for DialogPasswordEntry (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for DialogPasswordEntry.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:05 +01:00
Luca Bacci c1f22e28a4 Use Gtk::Box for Dialog_Partition_Name (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_Partition_Name.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:05 +01:00
Luca Bacci 784a4977b1 Use Gtk::Box for Dialog_FileSystem_Label (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_FileSystem_Label.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci ca4c4160cc Use Gtk::Box for DialogFeatures (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for DialogFeatures.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci 85ab57fee6 Use Gtk::Box for Dialog_DiskLabel (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_DiskLabel.cc.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci 363868bf5c Use Gtk::Box for Dialog_Partition_Info (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_Partition_Info.{h,cc}.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci bfeb123462 Use Gtk::Box for Dialog_Base_Partition (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for Dialog_Base_Partition.{h,cc}.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci b0f455c702 Use Gtk::Box for HBoxOperations (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2.  Replace with
plain Gtk::Box.

This commit makes the change for HBoxOperations.{h,cc}.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci c02c3ee4b5 Use Gtk::Box for Win_GParted (!25)
Gtk::HBox and Gtk::VBox were deprecated in Gtkmm 3.2 [1].  Replace with
plain Gtk::Box.

This commit makes the change for Win_GParted.{h,cc}.

[1] Gtkmm 3.2.0 NEWS file (actually first included in gtkmm 3.1.6
    unstable)
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.2.0/NEWS#L91
        Gtk:
        * All H* or V* specialized classes have been deprecated, to
          match the deprecations in the GTK+ C API.  You should now
          set the orientation instead.
          This includes HBox, VBox, HButtonBox, VButtonBox, HPaned,
          VPaned, HScale, VScale, HSeparator, VSeparator, HScrollbar and
          VScrollbar.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Luca Bacci 74bb981ed2 Use Gdk::RGBA (!25)
The Gdk::RGBA data type was introduced to replace Gdk::Color in
Gtkmm 3.0 [1], with Gdk::Color being deprecated in Gtkmm 3.10 [2].

With this commit we make the change to Gdk::RGBA data type which is the
modern replacement to Gdk::Color.  Gdk::RGBA can be used almost as a
drop in replacement because it keeps most of the Gdk::Color interface.

Also, this commit removes the C Gtk call introduced during the
port-to-gtk3 patchset by commit:
    5379352766
    repare-for-gtk3: Prepare for removal of Gtk::Widget::modify_fg() (#7)

[1] Gtkmm 3.0.1 NEWS file
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.0.1/NEWS#L48
        * RGBA replaces Color, though Color still exists because it is
          used by TextView.  We hope to deprecated Color completely in
          gtkmm 3.2.

[2] Gtkmm 3.10.0 NEWS file
    https://gitlab.gnome.org/GNOME/gtkmm/blob/3.10.0/NEWS#L127
        Gdk:
        * Deprecate Color.

Closes !25 - Modern Gtk3 - part 1
2019-04-27 12:03:04 +01:00
Mike Fleetwood 2c19a620b1 Update includes in DialogFeatures.h and .cc
Mostly add, but also remove, #includes so both DialogFeatures.h and .cc
include exactly the header files each needs to get the definitions they
use.

Header file #include guards are there to specifically enable this.
2019-04-22 21:51:30 +01:00
Mike Fleetwood 57e8ac50f4 Rename method to DialogFeatures::load_one_filesystem()
To better reflect that it is loading the supported actions for one file
system into the treeview, just like it's parent load_filesystems() is
initiating the loading for all the file systems.
2019-04-22 21:51:30 +01:00
Mike Fleetwood 4939b941dd Fix available Partition menu options not being updated on rescan (!38)
Select a partition and look at the available actions in the Partition
menu.  Then add or remove some commands which that particular file
system uses and rescan to detect those changes.  Open the Partition menu
again.  It doesn't reflect the changes of supported actions seen in the
File System Support dialog.  Select a different partition and then
select the original partition again.  Now the available actions in the
Partition menu reflect the changes of supported actions.

Have been testing by adding and removing /sbin/e2label to add and
remove EXT2/3/4 file system labelling support just because that feature
has existed for a very long time and EXT2/3/4 are displayed near the top
of the File System Support dialog.  Tested this minor issue existed as
far back as GParted 0.3.7.

Fix by simply also refreshing the valid operations to update the
Partition menu after updating the found file system specific commands.

Closes !38 - Fixes for minor issues with File System Support rescanning
2019-04-22 21:51:30 +01:00
Mike Fleetwood 7ea91bca61 Fix File System Support dialog not showing changes after rescan (!38)
Open the File System Support dialog, either add or remove some file
system specific commands used by GParted and press the
[Rescan For Supported Actions] button.  The supported actions don't
change.  However after just closing and reopening the dialog, the
supported actions do reflect the added or removed file system specific
commands.

Bisected to this commit:
    4d6d464664
    Display "other" in the File System Support dialog (!13)

The problem is that commit made a subset copy of the
GParted_Core::FILESYSTEMS vector, obtained from get_filesystems(), so
when the rescan ran and the FILESYSTEMS vector was updated with new
supported actions, the dialog still displayed the original subset copy,
so didn't reflect the changed supported actions.

Fix by passing a reference to the GParted_Core::FILESYSTEMS vector,
obtained from get_filesystems(), and perform the necessary filtering
inside the dialog, like before the above faulty commit.  Additionally
finding and adding "other" file system to the end of the list.

Closes !38 - Fixes for minor issues with File System Support rescanning
2019-04-22 21:51:28 +01:00
Mike Fleetwood 1b17264603 Stop checking for 'ntfslabel --new-serial' support
The oldest supported distributions have these versions of ntfs-3g /
ntfsprogs.

  Distro             EOL        ntfs-3g / ntfsprogs
- Debian 8           2020-Jun   2014.2.16AR.2
- RHEL / CentOS 7    2024-Jun   2017.3.23
- Ubuntu 14.04 LTS   2019-Apr   2013.1.13AR.1

The oldest version of ntfs-3g / ntfsprogs on Ubuntu 14.04 LTS includes
support for the --new-serial option.

    $ ntfslabel -V

    ntfslabel v2013.1.13AR.1 (libntfs-3g) - Display, or set, the label for an NTFS Volume.

    $ ntfslabel --help | grep -- --new-serial
            --new-serial   Set a new serial number

Therefore it is no longer necessary to check for this option as it is
always available.  The worst case scenario is that some how an old
version of ntfslabel is used which doesn't support this option.  In such
a case GParted goes from not supporting changing the UUID to claiming
support, but presumably it would fail with an error reporting unknown
option when applied.  Arguably better from an end user support point of
view.
2019-04-17 16:40:19 +00:00
Mike Fleetwood d795cccb1b Consolidate common if have ntfsresize command conditions 2019-04-17 16:40:19 +00:00
Mike Fleetwood ef4d4cb100 Switch to faster ntfsinfo to read NTFS usage (#47)
A user reported GParted was slow to refresh and timing ntfsresize to
query his file systems found that it was taking 4.7 seconds and 9.2
seconds for sizes 31.7 GiB and 49 GiB NTFS file systems respectively.
Almost 14 seconds just to read the usage.

Created a 4 GiB NTFS and filled it with as many 4 KiB files as possible,
just over 800,000 files.

    # df -k /mnt/2
    Filesystem     1K-blocks    Used Available Use% Mounted on
    /dev/sdb2        4194300 4193860       440 100% /mnt/2
    # df -i /mnt/2
    Filesystem     Inodes  IUsed IFree IUse% Mounted on
    /dev/sdb2      819640 808591 11049   99% /mnt/2

Testing perform of ntfsresize:

    # time ntfsresize --info --force --no-progress-bar /dev/sdb2 | \
    > egrep 'Current volume size|resize at|Cluster size'
    Cluster size       : 4096 bytes
    Current volume size: 4294963712 bytes (4295 MB)
    You might resize at 4294516736 bytes (freeing 450560 bytes).

    real    0m5.231s
    user    0m2.072s
    sys     0m3.014s

Computation of figures:
    Clusters per volume = 4294963712 / 4096 = 1048575.125
    Free clusters = (4294963712 - 4294516736) / 4096 = 109.125

Testing performance of ntfscluster, as used before this commit [1] from
GParted 0.3 in 2006:

    # time ntfscluster --force /dev/sdb2 | \
    > egrep 'bytes per cluster|bytes per volume|clusters per volume|clusters of free space'
    ...
    bytes per cluster       : 4096
    bytes per volume        : 4294963200
    clusters per volume     : 131071
    clusters of free space  : 110

    real    0m4.243s
    user    0m1.629s
    sys     0m2.587s

Note that the clusters per volume figure reported by ntfscluster is
wrong.  4294963200 / 4096 = 1048575, not 131071.

Testing performance using ntfsinfo:

    # time ntfsinfo --mft /dev/sdb2 | \
    egrep 'Cluster Size|Volume Size in Clusters|Free Clusters'
            Cluster Size: 4096
            Volume Size in Clusters: 1048575
            Free Clusters: 110 (0.0%)

    real    0m0.022s
    user    0m0.012s
    sys     0m0.018s

Repeating the above tests while also using 'btrace /dev/sdb2' and Ctrl-C
around each test via a separate terminal, reports these numbers of I/Os
being performed:
  Command      Read requests   Read bytes
- ntfsresize           2,695     1116 MiB
- ntfscluster          2,685     1116 MiB
- ntfsinfo                13     2208 KiB
No wonder that ntfsresize and ntfscluster take a long time, they read
just over 1 GiB of data from the 4 GiB file system, where as ntfsinfo
only reads just over 2 MiB.

Switch to using ntfsinfo to report file system usage.

[1] 9d956594d6
    replaced ntfscluster with ntfsresize (see #350789)

Closes #47 - GParted is slow refreshing NTFS file systems
2019-04-17 16:40:19 +00:00
Daniel Mustieles 8a7d7fbcf7 Updated Spanish translation 2019-04-17 12:29:26 +02:00
Daniel Mustieles e2d8272fa3 Update Spanish translation 2019-04-17 10:27:46 +00:00
Mike Fleetwood 8ea0b7ef13 Prefer enum to string comparison in set_partition_type() 2019-04-15 18:28:13 +00:00
Mike Fleetwood ab1381b1f4 Stop trying unneeded alternative libparted linux-swap names
With that same commit in parted 1.9 [1], libparted only recognised these
linux-swap names via deprecated aliases:
    linux-swap(old)
    linux-swap(new)
but does accept this name as a current alias:
    linux-swap
for:
    linux-swap(v1)

Demonstration:
    # parted -v
    parted (GNU parted) 2.1
    ...

    # parted /dev/sdc mkfs yes 1 "linux-swap(new)" unit s print
    ...
    [0] filesys.c:148 (ped_file_system_type_get(): File system alias linux-swap(new) is deprecated
    ...
    Number  Start  End       Size      Type     File system     Flags
     1      2048s  2099199s  2097152s  primary  linux-swap(v1)

    # parted /dev/sdc mkfs yes 1 "linux-swap" unit s print
    ...
    Number  Start  End       Size      Type     File system     Flags
     1      2048s  2099199s  2097152s  primary  linux-swap(v1)

Again as GParted now requires libparted 2.2 or later:
1) Stop using alternative "linux-swap(new)" name as that is deprecated
   by libparted.
2) Also stop using alternative "linux-swap(v1)" name as that code is
   never used because libparted recognised the GParted "linux-swap"
   name as a current alias.

[1] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=cfafa4394998a11f871a0f8d172b13314f9062c2
    Rationalise linux-swap fs names, and add a "linux-swap" alias
2019-04-15 18:28:13 +00:00
Mike Fleetwood 40ec0deba8 Stop recognising retired libparted linux-swap names
With this commit in parted 1.8.3 [1], libparted changed from reporting
the name of Linux swap as:
    linux-swap
to reporting either:
    linux-swap(old)
    linux-swap(new)
Later with this commit in parted 1.9 [2], libparted stopped reporting
those names and reported these instead:
    linux-swap(v0)
    linux-swap(v1)

Demonstration:
    # mkswap /dev/sdc1
    Setting up swapspace version 1, size = 1048572 KiB
    no label, UUID=a2010834-003d-4bf2-9e94-58383fe20a26
    # blkid /dev/sdc1
    /dev/sdc1: UUID="a2010834-003d-4bf2-9e94-58383fe20a26" TYPE="swap"
    # parted -v
    parted (GNU parted) 2.1
    ...
    # parted /dev/sdc unit s print
    ...
    Number  Start  End       Size      Type     File system     Flags
     1      2048s  2099199s  2097152s  primary  linux-swap(v1)

As GParted now requires libparted 2.2 or later [3], remove recognition
for those no longer libparted reported linux-swap names.  Note that the
"swap" name is reported by blkid.

[1] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=98a53fd115ca012edf226525b8d4be628454f99e
    Enable support for swsusp partitions, and the ability to
    differentiate between old and new versions of linux-swap partitions.
    Changed the swap_init signature and removed extra ped_geometry_read
    from _swap*_open.

[2] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=cfafa4394998a11f871a0f8d172b13314f9062c2
    Rationalise linux-swap fs names, and add a "linux-swap" alias

[3] 8df975c7d1
    Increase minimum required libparted to 2.2 (!22)
2019-04-15 18:28:13 +00:00
Mike Fleetwood 4d9dc14b0e Set partition type when formatting to cleared (!36)
Formatting a partition to cleared over the top of LVM2 PV leaves the
"lvm" flag set on the partition; where as formatting with an actual file
system over the top of an LVM2 PV clears the "lvm" flag.  This is true
for both MSDOS and GPT partitioned drives.

Fix by setting the partition type when formatting to cleared too.

Closes !36 - Set partition type when clearing partition contents
2019-04-15 18:28:13 +00:00
Stas Solovey 5d2dc72144 Update Russian translation 2019-04-15 17:59:16 +00:00
Piotr Drąg 7796a87ed2 Update Polish translation 2019-04-14 14:12:10 +02:00
Mike Fleetwood 6ad107bc3b Remove unnecessary #include from GParted_Core.cc 2019-04-11 10:06:36 -06:00
Mike Fleetwood ea7bd0d419 Rename Dialog_Progress member variable to m_curr_op
Having a member variable named 't' which is used to share state in a
Dialog_Progress object between on_signal_show() and on_cancel() methods
is horrible.  Rename to something more meaningful.

Also initialise m_curr_op in the constructor's initialisation list,
rather than later when first used in on_signal_show().  Not strictly
required, but avoids this POD (Plain Old Data) member variable being
undefined in the Dialog_Progress object between construction and when
on_signal_show() previously assigned to it for the first time and
started using it.

* C++ FAQ / Should my constructors use "initialization lists" or
  "assignment"?
  https://isocpp.org/wiki/faq/ctors#init-lists
2019-04-11 10:06:36 -06:00
Mike Fleetwood 22ce8a4c64 Rename for loop counter variables to normative 'i' in Dialog_Progress
Several for loops created counter variable t, hiding member variable of
the same name.  Rename those loop counter variables to the normative
name 'i'.

* Why do most of us use 'i' as a loop counter variable?
  https://softwareengineering.stackexchange.com/questions/86904/why-do-most-of-us-use-i-as-a-loop-counter-variable
2019-04-11 10:06:36 -06:00
Mike Fleetwood 63f578a94b Use CSS to turn off table borders once in saved details HTML 2019-04-11 10:06:36 -06:00
Mike Fleetwood 4ccee8063c Rename method to Dialog_Progress::write_operation_details()
And update comment about replacing '\n' to reflect what the code
actually does.
2019-04-11 10:06:36 -06:00
Mike Fleetwood f779002972 Additionally write partition information to saved details (#639176)
Bug 639176 - Save partition layout to gparted_details.htm
2019-04-11 10:06:36 -06:00
Mike Fleetwood edb3afac7b Write starting device overview information to saved details (#639176)
Writes the starting device overview information of all known devices to
the top of the saved details HTML.  This is so that hopefully we don't
need to additionally ask users for their disk layouts via 'fdisk -l',
'parted print' and 'lsblk' when the saved details file is provided.

Also moves the equals separators "==================" from below to
above each operation so the each section is separated.

Bug 639176 - Save partition layout to gparted_details.htm
2019-04-11 10:06:36 -06:00
Luca Bacci f252e677d4 Ensure icon sizes (#39)
Some icon themes only provide large icons for stock items.  This can
cause problems like overly large icons appearing in the GParted UI.
Found on Kubuntu 16.04 LTS with default breeze icon theme.

Be compatible with these icon themes by forcing scaling of stock icons
to the requested size.

Icons are used either by Gtk::Image widgets, or Gtk::CellRendererPixbuf
objects for comboboxes/treeviews.  For Gtk::Image widgets we add
Utils::mk_image() that constructs Gtk::Image widgets and then sets the
pixel-size property.  For Gtk::CellRendererPixbuf we add
Utils::mk_pixbuf() that first loads a Gdk::Pixbuf and then scales if
needed.

Closes #39 - After GTK3 port icons are too big on KDE
2019-04-06 11:42:28 +01:00
Mike Fleetwood 23f956bb83 Update distro specific package installation instructions
- Back in Fedora 22 the distribution switched from using yum to dnf for
  package installation, while CentOS / RHEL continues to use yum.
  Separate out package instructions.

- Update package dependencies for what is required on current versions
  of the documented distributions.
2019-04-03 20:45:31 +00:00
Mike Fleetwood 56596d680a Also write "Root privileges are required ..." message to stderr (!34)
To further help in diagnosing root authorisation issues by reporting the
error message to the terminal too.  Also set a failure exit status when
terminating with this error.

Example:
    $ ./gpartedbin
    GParted 0.33.0-git
    configuration --enable-online-resize
    libparted 3.2
    Root privileges are required for running GParted
    $ echo $?
    1

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood 68cdfe99d9 Print new info before "Root privileges are required ..." dialog (!34)
So that the new version and configuration information is displayed even
if the gpartedbin executable is run as a non-root user.  To help with
diagnosing root authorisation issues with the gparted shell wrapper
script.

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood 707aaea56f Remove now unused Dialog_Progress::signal_get_libparted_version (!34)
... and related GParted_Core::get_libparted_version() method.

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood c1c20854b4 Report the same information into saved operation details (!34)
For consistency save the 3 same lines of information into the saved
operation details.  None of the new 3 lines are subject to translation.
As this information is really for our benefit when supporting users
leaving them as English is OK.  Also "GParted" and "Libparted", as
previously used, are proper nouns so they were never changed as part of
any language translation.  See with:
    egrep -r '"(GParted|Libparted)"' po/

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood c626b4cea6 Display more version and configuration info to stdout when starting (!34)
So that we might get more information from users when helping them.
Starting GParted from the command line now looks like this:
    # ./gpartedbin
    GParted 0.33.0-git
    configuration --enable-online-resize
    libparted 3.2

Closes !34 - Display more version and configuration information
2019-04-03 20:45:31 +00:00
Mike Fleetwood a476b8cc2c Rename local variable to meaningful benchmark_copysize 2019-04-01 09:12:10 -06:00
Mike Fleetwood fc5cc1d3b4 Stop trying to access device '/dev/mapper/No RAID disks' (#786031)
Running GParted on AltLinux with dmraid installed but with no configured
RAID arrays produces this error:
    # gparted
    ...
    Could not stat device /dev/mapper/No RAID disks - No such file or directory.

Most distributions use dmraid 1.0.0.rc16 which reports no raid disks
like this:
    # dmraid -sa -c
    no raid disks
    # echo $?
    1

However AltLinux had the slightly older version, dmraid 1.0.0.rc14,
which reported no raid disks like this:
    # dmraid -sa -c
    No RAID disks
    # echo $?
    0

So because dmraid 1.0.0.rc14 reported success, exit status 0, and the
"No RAID disks" message was not in lower case, that text was considered
a disk device in a DMRaid array.  Fix by checking for "no raid disks" in
any case.

Bug 786031 - Could not stat device /dev/mapper/No RAID disks - No such
             file or directory
2019-04-01 09:12:10 -06:00
Mike Fleetwood 97ce96da03 Pass constant parameter by reference to load_operations() (#788814)
It is common C++ practice to pass a constant object by reference to
avoid constructing a duplicate object for pass by value [1].

[1] How to pass objects to functions in C++?
    https://stackoverflow.com/questions/2139224/how-to-pass-objects-to-functions-in-c/2139254#2139254

Bug 788814 - gparted-0.30.0/include/HBoxOperations.h:37]: performance
             problem
2019-03-31 09:29:05 -06:00
Luca Bacci 56d8533add Always show menu images (!32)
There is a GtkSetting [1] that controls whether images in menus are
shown or not.  On some distributions / desktops it is enabled by default
and on others it is disabled by default.  To force show images in menus
set the 'always-show-image' property to true in Gtk::ImageMenuItems [2].

References:

[1] Gtk3 Reference Documentation - Settings/gtk-menu-images
    https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-menu-images

[2] Gtk3 Reference Documentation - GtkImageMenuItem
    https://developer.gnome.org/gtk3/stable/GtkImageMenuItem.html#gtk-image-menu-item-set-always-show-image

Closes !32 - Always show menu images
2019-03-28 12:01:41 +00:00
Mike Fleetwood d1441ce6a9 Drop compose subdir (#46)
It's no longer used so drop it.

Closes #46 - Drop compose subdir
2019-03-27 16:45:22 +00:00
Mike Fleetwood e55b3c8544 Replace String::ucompose() with Glibmm equivalent (#46)
Glibmm has implemented a ustring::compose() set of methods [1] since
Glibmm 2.16, circa 2008.  So replace String::ucompose().  Note that
GParted already requires glibmm >= 2.32 as set in configure.ac.

This commit just replaces all the method calls.  Edit created by:
    sed -i 's|String::ucompose *|Glib::ustring::compose|' src/*.cc

[1] Glibmm Reference Manual, Glib::ustring Class, compose() method
    https://developer.gnome.org/glibmm/2.32/classGlib_1_1ustring.html#a64ff7ac3d9e9899c2910f1d831f8d500

Closes #46 - Drop compose subdir
2019-03-27 16:45:22 +00:00
Mike Fleetwood 415f502036 Recognise contribution by Antoine Viallon 2019-03-26 08:08:10 +00:00
Mike Fleetwood c9f47403b8 Raise the maximum F2FS label size to 127 characters (!29)
Fix to make mkfs.f2fs properly handle labels longer than 16 characters
was included in f2fs-tools 1.2.0 [1].  The oldest supported
distributions now include this release:
  Distro             EOL        f2fs-tools
- Debian 8           2020-Jun   1.4.0
- RHEL / CentOS 7    2024-Jun   1.4.1
- SLES 12            2027-Oct   Unknown
- Ubuntu 14.04 LTS   2019-Apr   1.2.0

Note that on Ubuntu 14.04 LTS blkid from util-linux 2.20.1 is too old to
recognise F2FS file systems, as 2.23 is required for F2FS support [2].

mkfs.f2fs claims the maximum label length is less than 512 characters,
but actually accepts 512 characters.

    # label=`head -c 1024 < /dev/zero | tr '\0' 'A'`
    # mkfs.f2fs -l `echo -n "$label" | cut -c1-513` /dev/sdb10

            F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-09-18)

    Error: Volume Label should be less than      512 characters

    Usage: mkfs.f2fs [options] device [sectors]
    [options]:
      -a heap-based allocation [default:1]
      -d debug level [default:0]
      -e [extension list] e.g. "mp3,gif,mov"
      -l label
      -o overprovision ratio [default:5]
      -s # of segments per section [default:1]
      -z # of sections per zone [default:1]
      -t 0: nodiscard, 1: discard [default:1]
    sectors: number of sectors. [default: determined by device size]
    # echo $?
    1

    # mkfs.f2fs -l `echo -n "$label" | cut -c1-512` /dev/sdb10

            F2FS-tools: mkfs.f2fs Ver: 1.4.0 (2014-09-18)

    Info: Label = AAAAAAAAAAAA...[trimmed from 512 "A"s]...AAAAAAAAAAAA
    Info: sector size = 512
    Info: total sectors = 1048576 (in 512bytes)
    Info: zone aligned segment0 blkaddr: 256
    Info: Discarding device
    Info: This device doesn't support TRIM
    Info: format successful
    # echo $?
    0

    # blkid -V
    blkid from util-linux 2.25.2  (libblkid 2.25.0, 24-Oct-2014)
    # blkid /dev/sdb
    /dev/sdb10: LABEL="AAAAAAAAAAAA...[only 127 "A"s]...AAAAAAAAAAAA"
    UUID="f47f3fdc-dd91-4616-bb6d-0d643a884265" TYPE="f2fs"
    PARTUUID="3bb4bef8-9494-4e82-8dda-5d8edd9c60d9"

As blkid only reports the first 127 characters and is the only command
used for reading the label of an F2FS file system, use this as the new
increased limit.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=9799d6364dc93e1fd259d812d4a50ed984a6456b
    mkfs: handle labels longer than 16 characters

[2] https://mirrors.edge.kernel.org/pub/linux/utils/util-linux/v2.23/v2.23-ReleaseNotes
    "add Flash-Friendly File System (f2fs) support  [Alejandro Martinez
    Ruiz]"

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00
Mike Fleetwood afbf56c1c2 Drop fsck.f2fs -y option not available before f2fs-tools 1.10.0 (!29)
On CentOS 7 with f2fs-tools 1.4.1, checking an F2FS file system fails
like this:
    # fsck.f2fs -f -y -a /dev/sdb3
    Info: Force to fix corruption
    fsck.f2fs: invalid option -- 'y'
            Error: Unknown option ?

    Usage: fsck.f2fs [options] device
    [options]:
      -a check/fix potential corruption, reported by f2fs
      -d debug level default:0]
      -f check/fix entire partition
      -t show directory tree [-d -1]
    # echo $?
    1

Turns out that the '-y' option was not available until f2fs-tools 1.10.0
and is identical to the existing '-f' option anyway [1], which GParted
already uses.  Just remove the '-y' option passed to fsck.f2fs.

[1] https://git.kernel.org/pub/scm/linux/kernel/git/jaegeuk/f2fs-tools.git/commit/?id=55ee9e7202f84168f868d863da8ed1c4995a0e6d
    fsck.f2fs: add -y for generic fsck

Closes !29 - Enhance F2FS support
2019-03-26 08:08:10 +00:00