[gparted] Always use blkid file system detection before libparted (#757781)
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Always use blkid file system detection before libparted (#757781)
- Date: Tue, 10 Nov 2015 16:52:17 +0000 (UTC)
commit 6e97a63f49016ea6b0b48f37aedb10fe6ec808bb
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Sun Nov 8 10:56:12 2015 +0000
Always use blkid file system detection before libparted (#757781)
Blkid recognises many more file system types and RAID member signatures
than libparted. GParted already uses blkid detection instead of or
before libparted for whole disk devices [1] and for ext4 detection [2]
(only required with libparted < 1.9.0). Also GParted could only use
blkid detection on non-512 byte sector devices [3] before libparted was
fixed in version 3.2 [4]. Blkid was documented as a mandatory
requirement from GParted 0.24.0 [5].
Util-linux package, of which blkid command is a part, is a core piece of
Linux software which is very actively maintained and used by lots of
other packages. Parted package is much less active and has added
detection of fewer file systems and doesn't recognise any RAID members.
In cases of multiple signatures within a partition blkid and libparted
can report different results leading to confusion and issues for
GParted. This was the primary reason for bug 688882 "Improve clearing
of file system signatures" and a number of other changes to GParted.
Also as the mount command links with libblkid it uses it's detection
when telling the kernel the type of a file system to be mounted.
There aren't any current issues with GParted's file system detection but
given the above argument, switch to using blkid before libparted for
file system detection. Only falling back to libparted when blkid
doesn't report a result, notably for extended partitions. Order of
information sources for detection is now:
1) mdadm (for SWRaid members)
2) blkid
3) libparted
4) GParted internal code
References:
[1] f8faee637787329c07771e495c9b26abc9ac1603
Avoid whole disk FAT being detected as MSDOS partition table (#743181)
[2] 533eb1bc039455b734b9c1509e8fb588bdabc37e
Added support for ext4 file systems
[3] 9e5e9f5627e0fb1b547f07cdaaac773c7b6035b9
Enhance file system detection to use FS_Info method - blkid
[4] http://git.savannah.gnu.org/cgit/parted.git/commit/?id=80678bdd957cf49a9ccfc8b88ba3fb8b4c63fc12
Fix filesystem detection on non 512 byte sectors
[5] 749a2495716a82a7287fad943109b6cfb927245c
Document blkid command as a mandatory requirement (#753436)
Bug 757781 - Always use blkid file system detection before libparted
src/GParted_Core.cc | 40 ++++++++++++++--------------------------
1 files changed, 14 insertions(+), 26 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 7191384..485a764 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1526,11 +1526,11 @@ FILESYSTEM GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition
static Glib::ustring luks_unsupported = _("Linux Unified Key Setup encryption is not yet supported.");
if ( lp_partition )
- // Will query partition using methods: (Q1) SWRaid, (Q2) libparted,
- // (Q3) blkid, (Q4) internal
+ // Will query partition using methods: (Q1) SWRaid, (Q2) blkid,
+ // (Q3) libparted, (Q4) internal
path = get_partition_path( lp_partition );
else
- // Will query whole disk device using methods: (Q1) SWRaid, (Q3) blkid,
+ // Will query whole disk device using methods: (Q1) SWRaid, (Q2) blkid,
// (Q4) internal
path = lp_device->path;
@@ -1538,29 +1538,17 @@ FILESYSTEM GParted_Core::detect_filesystem( PedDevice * lp_device, PedPartition
if ( SWRaid_Info::is_member( path ) )
return FS_LINUX_SWRAID;
- if ( lp_partition )
- {
- // (Q2) Standard libparted file system detection
- if ( lp_partition->fs_type )
- {
- fsname = lp_partition->fs_type->name;
-
- // TODO: Temporary code to detect ext4. Replace when
- // libparted >= 1.9.0 is chosen as minimum required version.
- Glib::ustring temp = fs_info.get_fs_type( path );
- if ( temp == "ext4" || temp == "ext4dev" )
- fsname = temp;
- }
- }
-
- // (Q3) FS_Info (blkid) file system detection
- // Originally just because libparted v2.2 didn't appear to detect file system for
- // sector sizes other than 512 bytes. Now to also detect what libparted doesn't.
- if ( fsname.empty() )
- {
- //TODO: blkid does not return anything for an "extended" partition. Need to handle this
somehow
- fsname = fs_info.get_fs_type( path );
- }
+ // (Q2) FS_Info (blkid) file system detection
+ // Blkid detects more signatures and generally has less limitations so use before
+ // libparted detection, but it doesn't report anything for extended partitions.
+ fsname = fs_info.get_fs_type( path );
+
+ // (Q3) Libparted file system detection
+ // Only used when blkid didn't report anything and only on partitions, not whole
+ // disk devices. (Doesn't detect anything on non-512 byte sector devices before
+ // libparted 3.2).
+ if ( fsname.empty() && lp_partition && lp_partition->fs_type )
+ fsname = lp_partition->fs_type->name;
if ( ! fsname.empty() )
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]