WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] qemu-xen: pass-through: Catch errors in do_pci_del()

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] qemu-xen: pass-through: Catch errors in do_pci_del()
From: Simon Horman <horms@xxxxxxxxxxxx>
Date: Mon, 1 Jun 2009 12:33:43 +1000
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
Delivery-date: Sun, 31 May 2009 19:34:07 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.18 (2008-05-17)
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>

--- 

The strdup() is needed because the aprsing of devname is destructive.
I have patches to fix this if there is interest.

Index: ioemu-remote/xen-vl-extra.c
===================================================================
--- ioemu-remote.orig/xen-vl-extra.c    2009-04-06 10:04:39.000000000 +1000
+++ ioemu-remote/xen-vl-extra.c 2009-04-06 10:06:41.000000000 +1000
@@ -119,9 +119,21 @@ static int tap_open(char *ifname, int if
 void do_pci_del(char *devname)
 {
     int pci_slot;
+    char *devname_cpy;
+
+    devname_cpy = strdup(devname);
+    if (!devname_cpy)
+        return;
+
     pci_slot = bdf_to_slot(devname);
 
-    acpi_php_del(pci_slot);
+    if (pci_slot < 0)
+        fprintf(logfile, "Device \"%s\" is not used by a hotplug device.\n",
+                devname_cpy);
+    else
+        acpi_php_del(pci_slot);
+
+    free(devname_cpy);
 }
 
 void do_pci_add(char *devname)


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] qemu-xen: pass-through: Catch errors in do_pci_del(), Simon Horman <=