[gparted] Add detection of bcache (#183)
- From: Mike Fleetwood <mfleetwo src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Add detection of bcache (#183)
- Date: Tue, 1 Mar 2022 21:41:13 +0000 (UTC)
commit e5041954cf4bcaf1f711acf85ebc47a3551e8adb
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Tue Jan 4 22:40:40 2022 +0000
Add detection of bcache (#183)
Use blkid to detect bcache formatted devices. Requires blkid from
util-linux >= 2.24 for detection of bcache devices [1].
Use util-linux's FS images when testing GParted detection.
# wget
http://git.kernel.org/cgit/utils/util-linux/util-linux.git/plain/tests/ts/blkid/images-fs/bcache-B.img.xz
# xzcat bcache-B.img.xz > /dev/sdb1
# wget
http://git.kernel.org/cgit/utils/util-linux/util-linux.git/plain/tests/ts/blkid/images-fs/bcache-C.img.xz
# xzcat bcache-C.img.xz > /dev/sdc1
# blkid /dev/sdb1 /dev/sdc1
/dev/sdb1: UUID="8fb7f716-4c19-4517-bfbb-6f4a2becad60" TYPE="bcache" PARTUUID="f8f1485e-01"
/dev/sdc1: UUID="7a343627-ac87-4bf0-b76f-46067cbc9b8c" TYPE="bcache" PARTUUID="f46e8c86-01"
To tidy-up after testing GParted detection, stop the bcache device in
case it was automatically started and wipe the signatures. This is to
prevent udev rules from automatically starting the bcache device on
every subsequent reboot.
# echo 1 > /sys/block/sdb/sdb1/bcache/stop
# wipefs -a /dev/sdb1 /dev/sdc1
Closes #183 - Basic support for bcache
include/Utils.h | 21 +++++++++++----------
src/GParted_Core.cc | 2 ++
src/Utils.cc | 2 ++
3 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/include/Utils.h b/include/Utils.h
index 0e0e6865..9eed1e52 100644
--- a/include/Utils.h
+++ b/include/Utils.h
@@ -96,18 +96,19 @@ enum FSType
// Other recognised file system types
FS_APFS = 28,
FS_ATARAID = 29,
- FS_BITLOCKER = 30,
- FS_GRUB2_CORE_IMG = 31,
- FS_ISO9660 = 32,
- FS_LINUX_SWRAID = 33,
- FS_LINUX_SWSUSPEND = 34,
- FS_REFS = 35,
- FS_UFS = 36,
- FS_ZFS = 37,
+ FS_BCACHE = 30,
+ FS_BITLOCKER = 31,
+ FS_GRUB2_CORE_IMG = 32,
+ FS_ISO9660 = 33,
+ FS_LINUX_SWRAID = 34,
+ FS_LINUX_SWSUSPEND = 35,
+ FS_REFS = 36,
+ FS_UFS = 37,
+ FS_ZFS = 38,
// Partition space usage colours
- FS_USED = 38,
- FS_UNUSED = 39
+ FS_USED = 39,
+ FS_UNUSED = 40
} ;
enum SIZE_UNIT
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 4ad347de..343e7709 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -1323,6 +1323,8 @@ FSType GParted_Core::detect_filesystem(const PedDevice *lp_device, const PedPart
return FS_UFS;
else if ( fsname == "apfs" )
return FS_APFS;
+ else if (fsname == "bcache")
+ return FS_BCACHE;
else if ( fsname == "BitLocker" )
return FS_BITLOCKER;
else if ( fsname == "iso9660" )
diff --git a/src/Utils.cc b/src/Utils.cc
index b59c22a0..6a1c181b 100644
--- a/src/Utils.cc
+++ b/src/Utils.cc
@@ -179,6 +179,7 @@ Glib::ustring Utils::get_color(FSType fstype)
case FS_XFS: return "#EED680"; // Accent Yellow
case FS_APFS: return "#874986"; // Magenta Dark [*]
case FS_ATARAID: return "#5A4733"; // Brown Dark [+]
+ case FS_BCACHE: return "#E0C39E"; // Face Skin Medium
case FS_BITLOCKER: return "#494066"; // Purple Shadow
case FS_GRUB2_CORE_IMG: return "#666666"; // Dark Gray [*]
case FS_ISO9660: return "#D3D3D3"; // Light Gray [*]
@@ -371,6 +372,7 @@ const Glib::ustring Utils::get_filesystem_string(FSType fstype)
case FS_XFS: return "xfs";
case FS_APFS: return "apfs";
case FS_ATARAID: return "ataraid";
+ case FS_BCACHE: return "bcache";
case FS_BITLOCKER: return "bitlocker";
case FS_GRUB2_CORE_IMG: return "grub2 core.img";
case FS_ISO9660: return "iso9660";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]