From patchwork Sun Oct 31 11:40:08 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gleb Natapov X-Patchwork-Id: 69708 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 777B4B6F0D for ; Sun, 31 Oct 2010 22:47:25 +1100 (EST) Received: from localhost ([127.0.0.1]:45190 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCWNe-0003DH-OD for incoming@patchwork.ozlabs.org; Sun, 31 Oct 2010 07:47:22 -0400 Received: from [140.186.70.92] (port=55434 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PCWGp-0007mW-TB for qemu-devel@nongnu.org; Sun, 31 Oct 2010 07:40:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PCWGn-0008Em-PT for qemu-devel@nongnu.org; Sun, 31 Oct 2010 07:40:19 -0400 Received: from mx1.redhat.com ([209.132.183.28]:13473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PCWGn-0008EJ-Ha for qemu-devel@nongnu.org; Sun, 31 Oct 2010 07:40:17 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o9VBeEc2020090 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sun, 31 Oct 2010 07:40:14 -0400 Received: from dhcp-1-237.tlv.redhat.com (dhcp-1-237.tlv.redhat.com [10.35.1.237]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o9VBeDIn011830; Sun, 31 Oct 2010 07:40:13 -0400 Received: by dhcp-1-237.tlv.redhat.com (Postfix, from userid 13519) id 13ACF18D476; Sun, 31 Oct 2010 13:40:10 +0200 (IST) From: Gleb Natapov To: qemu-devel@nongnu.org Date: Sun, 31 Oct 2010 13:40:08 +0200 Message-Id: <1288525209-3303-8-git-send-email-gleb@redhat.com> In-Reply-To: <1288525209-3303-1-git-send-email-gleb@redhat.com> References: <1288525209-3303-1-git-send-email-gleb@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. Cc: blauwirbel@gmail.com, alex.williamson@redhat.com, armbru@redhat.com, kvm@vger.kernel.org Subject: [Qemu-devel] [PATCHv2 7/8] Change pci bus get_dev_path callback to print only slot and func X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Domain should be determined form parent bus and bus number is configured by guest and should not be used in qemu internally. Signed-off-by: Gleb Natapov --- hw/pci.c | 11 ++++++----- 1 files changed, 6 insertions(+), 5 deletions(-) diff --git a/hw/pci.c b/hw/pci.c index 92aaa85..1c5706f 100644 --- a/hw/pci.c +++ b/hw/pci.c @@ -2138,12 +2138,13 @@ static void pcibus_dev_print(Monitor *mon, DeviceState *dev, int indent) static char *pcibus_get_dev_path(DeviceState *dev) { PCIDevice *d = (PCIDevice *)dev; - char path[16]; - - snprintf(path, sizeof(path), "%04x:%02x:%02x.%x", - pci_find_domain(d->bus), d->config[PCI_SECONDARY_BUS], - PCI_SLOT(d->devfn), PCI_FUNC(d->devfn)); + char path[50]; + int off; + off = snprintf(path, sizeof(path), "%s@%x", qdev_driver_name(dev), + PCI_SLOT(d->devfn)); + if (PCI_FUNC(d->devfn)) + snprintf(path + off, sizeof(path) + off, ",%x", PCI_FUNC(d->devfn)); return strdup(path); }