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
This commit is contained in:
Mike Fleetwood 2022-01-04 22:40:40 +00:00 committed by Curtis Gedak
parent 6617e6f3a3
commit e5041954cf
3 changed files with 15 additions and 10 deletions

View File

@ -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

View File

@ -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" )

View File

@ -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";