From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Michael S. Tsirkin" Subject: Re: [PATCHv2 7/8] Change pci bus get_dev_path callback to print only slot and func Date: Mon, 8 Nov 2010 19:17:37 +0200 Message-ID: <20101108171737.GA8498@redhat.com> References: <1288525209-3303-1-git-send-email-gleb@redhat.com> <1288525209-3303-8-git-send-email-gleb@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: qemu-devel@nongnu.org, kvm@vger.kernel.org, blauwirbel@gmail.com, armbru@redhat.com, alex.williamson@redhat.com To: Gleb Natapov Return-path: Received: from mx1.redhat.com ([209.132.183.28]:20930 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754937Ab0KHRRp (ORCPT ); Mon, 8 Nov 2010 12:17:45 -0500 Content-Disposition: inline In-Reply-To: <1288525209-3303-8-git-send-email-gleb@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sun, Oct 31, 2010 at 01:40:08PM +0200, Gleb Natapov wrote: > 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); > } Can we change separators to be : and . instead of @ and , please? This will make it compatible with existing code and generally what users expect. -- MST From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46574 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PFVLq-0006g5-70 for qemu-devel@nongnu.org; Mon, 08 Nov 2010 12:17:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PFVLl-0002co-5e for qemu-devel@nongnu.org; Mon, 08 Nov 2010 12:17:47 -0500 Received: from mx1.redhat.com ([209.132.183.28]:45798) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PFVLk-0002cd-Uz for qemu-devel@nongnu.org; Mon, 08 Nov 2010 12:17:45 -0500 Date: Mon, 8 Nov 2010 19:17:37 +0200 From: "Michael S. Tsirkin" Message-ID: <20101108171737.GA8498@redhat.com> References: <1288525209-3303-1-git-send-email-gleb@redhat.com> <1288525209-3303-8-git-send-email-gleb@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1288525209-3303-8-git-send-email-gleb@redhat.com> Subject: [Qemu-devel] Re: [PATCHv2 7/8] Change pci bus get_dev_path callback to print only slot and func List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Gleb Natapov Cc: blauwirbel@gmail.com, alex.williamson@redhat.com, qemu-devel@nongnu.org, kvm@vger.kernel.org, armbru@redhat.com On Sun, Oct 31, 2010 at 01:40:08PM +0200, Gleb Natapov wrote: > 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); > } Can we change separators to be : and . instead of @ and , please? This will make it compatible with existing code and generally what users expect. -- MST