mirror of
https://github.com/systemd/systemd.git
synced 2025-01-12 13:18:14 +03:00
kmod-setup: bypass heavy virtio-rng check if we are not running in a VM anyway
detect_vm() is cheap, because cached, let's hence do that early before we get out the big guns and sweep through sysfs.
This commit is contained in:
parent
fa505db314
commit
0a5d3c0b5b
@ -67,6 +67,10 @@ static int has_virtio_rng_recurse_dir_cb(
|
||||
static bool has_virtio_rng(void) {
|
||||
int r;
|
||||
|
||||
/* Directory traversal might be slow, hence let's do a cheap check first if it's even worth it */
|
||||
if (detect_vm() == VIRTUALIZATION_NONE)
|
||||
return false;
|
||||
|
||||
r = recurse_dir_at(
|
||||
AT_FDCWD,
|
||||
"/sys/devices/pci0000:00",
|
||||
|
Loading…
Reference in New Issue
Block a user