Skip to content

Commit c546534

Browse files
committed
PhysicalDisk (Linux): don't detect disk type for virtual disks
Fix fastfetch-cli#1669
1 parent cdda65e commit c546534

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/detection/physicaldisk/physicaldisk_linux.c

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
7878
ffStrbufInitMove(&device->name, &name);
7979
ffStrbufInitF(&device->devPath, "/dev/%s", devName);
8080

81+
bool isVirtual = false;
8182
{
8283
ffStrbufInit(&device->interconnect);
8384
if (ffStrStartsWith(devName, "nvme"))
@@ -97,6 +98,8 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
9798
ffStrbufSetStatic(&device->interconnect, "SCSI");
9899
else if (strstr(pathSysDeviceReal, "/nvme") != NULL)
99100
ffStrbufSetStatic(&device->interconnect, "NVMe");
101+
else if (strstr(pathSysDeviceReal, "/virtio") != NULL)
102+
ffStrbufSetStatic(&device->interconnect, "Virtual");
100103
else
101104
{
102105
if (ffAppendFileBufferRelative(devfd, "transport", &device->interconnect))
@@ -106,6 +109,7 @@ static void parsePhysicalDisk(int dfd, const char* devName, FFPhysicalDiskOption
106109
}
107110
}
108111

112+
if (!isVirtual)
109113
{
110114
char isRotationalChar = '1';
111115
if (ffReadFileDataRelative(dfd, "queue/rotational", 1, &isRotationalChar) > 0)

0 commit comments

Comments
 (0)