From patchwork Thu Jan 14 13:44:13 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 42884 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 919CBB7CD1 for ; Fri, 15 Jan 2010 00:50:21 +1100 (EST) Received: from localhost ([127.0.0.1]:56632 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVQ4D-0002AO-BX for incoming@patchwork.ozlabs.org; Thu, 14 Jan 2010 08:48:53 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVPzr-0000um-Po for qemu-devel@nongnu.org; Thu, 14 Jan 2010 08:44:23 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVPzn-0000q6-Aw for qemu-devel@nongnu.org; Thu, 14 Jan 2010 08:44:23 -0500 Received: from [199.232.76.173] (port=35876 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVPzn-0000pz-0Z for qemu-devel@nongnu.org; Thu, 14 Jan 2010 08:44:19 -0500 Received: from mx1.redhat.com ([209.132.183.28]:17803) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NVPzm-0000NM-D8 for qemu-devel@nongnu.org; Thu, 14 Jan 2010 08:44:18 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0EDiH2B001253 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 14 Jan 2010 08:44:17 -0500 Received: from zweiblum.home.kraxel.org (vpn1-7-208.ams2.redhat.com [10.36.7.208]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0EDiGis022079; Thu, 14 Jan 2010 08:44:16 -0500 Received: by zweiblum.home.kraxel.org (Postfix, from userid 500) id BE5297010C; Thu, 14 Jan 2010 14:44:14 +0100 (CET) From: Gerd Hoffmann To: qemu-devel@nongnu.org Date: Thu, 14 Jan 2010 14:44:13 +0100 Message-Id: <1263476654-7222-3-git-send-email-kraxel@redhat.com> In-Reply-To: <1263476654-7222-1-git-send-email-kraxel@redhat.com> References: <1263476654-7222-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: Gerd Hoffmann Subject: [Qemu-devel] [PATCH 2/3] scsi: device version property 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 This patch adds a new property named 'ver' to scsi-disk which allows to specify the version which the virtual disk/cdrom should report to the guest. By default this is the qemu version (i.e. 0.12). usage: -drive if=none,id=disk,file=... -device lsi -device scsi-disk,drive=disk,bus=scsi.0,unit=0,ver=42 You can also switch the version for all scsi drives using: -global scsi-disk.ver=42 Signed-off-by: Gerd Hoffmann --- hw/scsi-disk.c | 5 ++++- 1 files changed, 4 insertions(+), 1 deletions(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index eb5b5a8..e3924de 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -65,6 +65,7 @@ struct SCSIDiskState int cluster_size; uint64_t max_lba; QEMUBH *bh; + char *version; }; static SCSIDiskReq *scsi_new_request(SCSIDevice *d, uint32_t tag, uint32_t lun) @@ -315,6 +316,7 @@ static uint8_t *scsi_get_buf(SCSIDevice *d, uint32_t tag) static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) { BlockDriverState *bdrv = req->dev->dinfo->bdrv; + SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, req->dev); int buflen = 0; if (req->cmd.buf[1] & 0x2) { @@ -432,7 +434,7 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) memcpy(&outbuf[16], "QEMU HARDDISK ", 16); } memcpy(&outbuf[8], "QEMU ", 8); - memcpy(&outbuf[32], QEMU_VERSION, 4); + memcpy(&outbuf[32], s->version ? s->version : QEMU_VERSION, 4); /* Identify device as SCSI-3 rev 1. Some later commands are also implemented. */ outbuf[2] = 3; @@ -1029,6 +1031,7 @@ static SCSIDeviceInfo scsi_disk_info = { .get_buf = scsi_get_buf, .qdev.props = (Property[]) { DEFINE_PROP_DRIVE("drive", SCSIDiskState, qdev.dinfo), + DEFINE_PROP_STRING("ver", SCSIDiskState, version), DEFINE_PROP_END_OF_LIST(), }, };