summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS2
-rw-r--r--pci.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/NEWS b/NEWS
index 2a69f01..4fc7aea 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,5 @@
+- do not fake Xen blk & net controllers on dom0 (mga#9546)
+
Version 0.12.6 - 31 March 2013, Thierry Vignaud
- add support for detecting Xen blk & net controllers (mga#9546)
diff --git a/pci.c b/pci.c
index 57f67ab..c841bbe 100644
--- a/pci.c
+++ b/pci.c
@@ -54,6 +54,16 @@ static void detect_xen(struct pciusb_entries *r) {
struct stat sb;
if (stat("/sys/bus/xen", &sb) != 0)
return;
+ FILE *f;
+ if (!(f = fopen("/sys/hypervisor/uuid", "r")))
+ return;
+ char buf[38];
+ fgets(buf, sizeof(buf) - 1, f);
+ fclose(f);
+ if (!strncmp(buf, "00000000-0000-0000-0000-000000000000", sizeof(buf)))
+ return;
+
+ // We're now sure to be in a Xen guest:
struct pciusb_entry *e = &r->entries[r->nb++];
pciusb_initialize(e);