[fedora-virt-maint] rpms/qemu/devel qemu-prefer-sysfs-for-usb-host-devices.patch, NONE, 1.1 qemu.spec, 1.105, 1.106

Mark McLoughlin markmc at fedoraproject.org
Fri Jul 3 08:32:58 UTC 2009


Author: markmc

Update of /cvs/pkgs/rpms/qemu/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv30905

Modified Files:
	qemu.spec 
Added Files:
	qemu-prefer-sysfs-for-usb-host-devices.patch 
Log Message:
* Fri Jul  3 2009 Mark McLoughlin <markmc at redhat.com> - 2:0.10.50-8.kvm87
- Prefer sysfs over usbfs for usb passthrough (#508326)


qemu-prefer-sysfs-for-usb-host-devices.patch:

--- NEW FILE qemu-prefer-sysfs-for-usb-host-devices.patch ---
>From 9cf0574418cc7657618a738dd31337739c635875 Mon Sep 17 00:00:00 2001
From: Mark McLoughlin <markmc at redhat.com>
Date: Fri, 3 Jul 2009 09:17:20 +0100
Subject: [PATCH] Prefer sysfs for USB host devices

Scanning for devices via /sys/bus/usb/devices/ and using them via the
/dev/bus/usb/<bus>/<device> character devices is the prefered method
on modern kernels, so try that first.

When using SELinux and libvirt, qemu will have access to /sys/bus/usb
but not /proc/bus/usb, so although the current code will work just
fine, it will generate SELinux AVC warnings.

See also:

  https://bugzilla.redhat.com/508326

Reported-by: Daniel Berrange <berrange at redhat.com>
Signed-off-by: Mark McLoughlin <markmc at redhat.com>
---
 usb-linux.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/usb-linux.c b/usb-linux.c
index 67e4acd..3c724ba 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1265,6 +1265,15 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
 
     /* only check the host once */
     if (!usb_fs_type) {
+        dir = opendir(USBSYSBUS_PATH "/devices");
+        if (dir) {
+            /* devices found in /dev/bus/usb/ (yes - not a mistake!) */
+            strcpy(devpath, USBDEVBUS_PATH);
+            usb_fs_type = USB_FS_SYS;
+            closedir(dir);
+            dprintf(USBDBG_DEVOPENED, USBSYSBUS_PATH);
+            goto found_devices;
+        }
         f = fopen(USBPROCBUS_PATH "/devices", "r");
         if (f) {
             /* devices found in /proc/bus/usb/ */
@@ -1284,15 +1293,6 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
             dprintf(USBDBG_DEVOPENED, USBDEVBUS_PATH);
             goto found_devices;
         }
-        dir = opendir(USBSYSBUS_PATH "/devices");
-        if (dir) {
-            /* devices found in /dev/bus/usb/ (yes - not a mistake!) */
-            strcpy(devpath, USBDEVBUS_PATH);
-            usb_fs_type = USB_FS_SYS;
-            closedir(dir);
-            dprintf(USBDBG_DEVOPENED, USBSYSBUS_PATH);
-            goto found_devices;
-        }
     found_devices:
         if (!usb_fs_type) {
             monitor_printf(mon, "husb: unable to access USB devices\n");
-- 
1.6.2.5



Index: qemu.spec
===================================================================
RCS file: /cvs/pkgs/rpms/qemu/devel/qemu.spec,v
retrieving revision 1.105
retrieving revision 1.106
diff -u -p -r1.105 -r1.106
--- qemu.spec	29 Jun 2009 17:27:20 -0000	1.105
+++ qemu.spec	3 Jul 2009 08:32:58 -0000	1.106
@@ -5,7 +5,7 @@
 Summary: QEMU is a FAST! processor emulator
 Name: qemu
 Version: 0.10.50
-Release: 7.%{kvmvertag}%{?dist}
+Release: 8.%{kvmvertag}%{?dist}
 # Epoch because we pushed a qemu-1.0 package
 Epoch: 2
 License: GPLv2+ and LGPLv2+ and BSD
@@ -28,6 +28,9 @@ Patch03: qemu-fix-linux-user-build-on-pp
 # Fix for hw/pcspk.c errors with --disable-kvm
 Patch04: qemu-fix-pcspk-build-with-kvm-disabled.patch
 
+# Prefer sysfs over usbfs for usb passthrough (#508326)
+Patch05: qemu-prefer-sysfs-for-usb-host-devices.patch
+
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires: SDL-devel zlib-devel which texi2html gnutls-devel cyrus-sasl-devel
 BuildRequires: rsync dev86 iasl
@@ -212,6 +215,7 @@ such as kvmtrace and kvm_stat.
 %patch02 -p1
 %patch03 -p1
 %patch04 -p1
+%patch05 -p1
 
 %build
 # systems like rhel build system does not have a recent enough linker so
@@ -456,6 +460,9 @@ fi
 %{_mandir}/man1/qemu-img.1*
 
 %changelog
+* Fri Jul  3 2009 Mark McLoughlin <markmc at redhat.com> - 2:0.10.50-8.kvm87
+- Prefer sysfs over usbfs for usb passthrough (#508326)
+
 * Sat Jun 27 2009 Mark McLoughlin <markmc at redhat.com> - 2:0.10.50-7.kvm87
 - Update to kvm-87
 - Drop upstreamed patches




More information about the Fedora-virt-maint mailing list