From 98a7a39cf4b3890b80b5232895f64d0de66d16a8 Mon Sep 17 00:00:00 2001
From: Markus Armbruster <armbru@redhat.com>
Date: Wed, 18 Jan 2012 10:38:40 +0100
Subject: [PATCH 46/52] usb-linux: Disable legacy /proc/bus/usb and
 /dev/bus/usb scan

RH-Author: Markus Armbruster <armbru@redhat.com>
Message-id: <1326883126-22053-47-git-send-email-armbru@redhat.com>
Patchwork-id: 36617
O-Subject: [RHEL-6.3 PATCH qemu-kvm 46/52] usb-linux: Disable legacy /proc/bus/usb and /dev/bus/usb scan
Bugzilla: 758194
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
RH-Acked-by: Amit Shah <amit.shah@redhat.com>

It's unused (we have /sys/bus/usb), Coverity hates it, and the
upstream fixes for that (commit 0c402e5a and 0cd0fd08) don't apply
cleanly.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 usb-linux.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

Signed-off-by: Michal Novotny <minovotn@redhat.com>
---
 usb-linux.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/usb-linux.c b/usb-linux.c
index 12b6cf6..98e9303 100644
--- a/usb-linux.c
+++ b/usb-linux.c
@@ -1501,6 +1501,7 @@ int usb_host_device_close(const char *devname)
     return -1;
 }
 
+#if 0 /* Disabled for Red Hat Enterprise Linux */
 static int get_tag_value(char *buf, int buf_size,
                          const char *str, const char *tag,
                          const char *stopchars)
@@ -1616,6 +1617,7 @@ static int usb_host_scan_dev(void *opaque, USBScanFunc *func)
         fclose(f);
     return ret;
 }
+#endif
 
 /*
  * Read sys file-system device file
@@ -1753,6 +1755,7 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
             DPRINTF(USBDBG_DEVOPENED, USBSYSBUS_PATH);
             goto found_devices;
         }
+#if 0 /* Disabled for Red Hat Enterprise Linux */
         f = fopen(USBPROCBUS_PATH "/devices", "r");
         if (f) {
             /* devices found in /proc/bus/usb/ */
@@ -1772,6 +1775,9 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
             DPRINTF(USBDBG_DEVOPENED, USBDEVBUS_PATH);
             goto found_devices;
         }
+#else
+        (void)f;
+#endif
     found_devices:
         if (!usb_fs_type) {
             if (mon)
@@ -1788,10 +1794,12 @@ static int usb_host_scan(void *opaque, USBScanFunc *func)
     }
 
     switch (usb_fs_type) {
+#if 0 /* Disabled for Red Hat Enterprise Linux */
     case USB_FS_PROC:
     case USB_FS_DEV:
         ret = usb_host_scan_dev(opaque, func);
         break;
+#endif
     case USB_FS_SYS:
         ret = usb_host_scan_sys(opaque, func);
         break;
-- 
1.7.7.5

