From 4b747f70a40ff906fd8d4e9bd880ab6436216688 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Fri, 23 Feb 2024 09:29:39 +0800 Subject: [PATCH] Disk (Linux): ensure only physical devices are detected Ref: https://github.com/fastfetch-cli/fastfetch/issues/731#issuecomment-1955814211 --- src/detection/disk/disk_linux.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/detection/disk/disk_linux.c b/src/detection/disk/disk_linux.c index c73af0b3c..b7150bb47 100644 --- a/src/detection/disk/disk_linux.c +++ b/src/detection/disk/disk_linux.c @@ -33,14 +33,18 @@ static bool isPhysicalDevice(const struct mntent* device) if(ffStrEquals(device->mnt_type, "9p")) return true; - //ZFS pool or bcachefs filesystem - if(ffStrEquals(device->mnt_type, "zfs") || ffStrEquals(device->mnt_type, "bcachefs")) + //ZFS pool + if(ffStrEquals(device->mnt_type, "zfs")) return true; //Pseudo filesystems don't have a device in /dev if(!ffStrStartsWith(device->mnt_fsname, "/dev/")) return false; + //#731 + if(ffStrEquals(device->mnt_type, "bcachefs")) + return true; + if( ffStrStartsWith(device->mnt_fsname + 5, "loop") || //Ignore loop devices ffStrStartsWith(device->mnt_fsname + 5, "ram") || //Ignore ram devices