From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:44769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHEDP-0007pw-PD for qemu-devel@nongnu.org; Fri, 21 Oct 2011 08:28:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RHEDO-0002lV-Tg for qemu-devel@nongnu.org; Fri, 21 Oct 2011 08:28:47 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45557) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RHEDO-0002lQ-I9 for qemu-devel@nongnu.org; Fri, 21 Oct 2011 08:28:46 -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.14.4/8.14.4) with ESMTP id p9LCSioj026792 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 21 Oct 2011 08:28:44 -0400 Message-ID: <4EA16636.7000807@redhat.com> Date: Fri, 21 Oct 2011 14:31:50 +0200 From: Kevin Wolf MIME-Version: 1.0 References: <1318503845-11473-1-git-send-email-pbonzini@redhat.com> <1318503845-11473-16-git-send-email-pbonzini@redhat.com> In-Reply-To: <1318503845-11473-16-git-send-email-pbonzini@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 15/35] scsi: remove devs array from SCSIBus List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org Am 13.10.2011 13:03, schrieb Paolo Bonzini: > Change the devs array into a linked list, and add a scsi_device_find > function to navigate the children list instead. This lets the SCSI > bus use more complex addressing. > > scsi_device_find may return another LUN on the same target if none is > found that matches exactly. > > Signed-off-by: Paolo Bonzini > --- > hw/esp.c | 5 +++-- > hw/lsi53c895a.c | 22 +++++++--------------- > hw/qdev.h | 2 +- > hw/scsi-bus.c | 53 ++++++++++++++++++++++++++++++----------------------- > hw/scsi.h | 3 +-- > hw/spapr_vscsi.c | 14 ++++++-------- > 6 files changed, 48 insertions(+), 51 deletions(-) > > diff --git a/hw/esp.c b/hw/esp.c > index d3fb1c6..8e17005 100644 > --- a/hw/esp.c > +++ b/hw/esp.c > @@ -217,7 +217,8 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf) > s->async_len = 0; > } > > - if (target >= ESP_MAX_DEVS || !s->bus.devs[target]) { > + s->current_dev = scsi_device_find(&s->bus, target, 0); > + if (!s->current_dev) { > // No such drive > s->rregs[ESP_RSTAT] = 0; > s->rregs[ESP_RINTR] = INTR_DC; > @@ -225,7 +226,6 @@ static uint32_t get_cmd(ESPState *s, uint8_t *buf) > esp_raise_irq(s); > return 0; > } > - s->current_dev = s->bus.devs[target]; > return dmalen; > } > > @@ -236,6 +236,7 @@ static void do_busid_cmd(ESPState *s, uint8_t *buf, uint8_t busid) > > trace_esp_do_busid_cmd(busid); > lun = busid & 7; > + s->current_dev = scsi_device_find(&s->bus, s->current_dev->id, lun); This is new, and I can't see an explanation in the commit log. Kevin