From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:43337) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeUBO-00039A-Nc for qemu-devel@nongnu.org; Tue, 12 Jun 2012 12:43:13 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SeUBG-0006CX-GB for qemu-devel@nongnu.org; Tue, 12 Jun 2012 12:43:06 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:57794) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SeUBG-0006A5-8D for qemu-devel@nongnu.org; Tue, 12 Jun 2012 12:42:58 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so1095823pbb.4 for ; Tue, 12 Jun 2012 09:42:57 -0700 (PDT) Sender: Paolo Bonzini From: Paolo Bonzini Date: Tue, 12 Jun 2012 18:42:34 +0200 Message-Id: <1339519362-18852-3-git-send-email-pbonzini@redhat.com> In-Reply-To: <1339519362-18852-1-git-send-email-pbonzini@redhat.com> References: <1339519362-18852-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 02/10] scsi: add a qdev property for the disk's WWN List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Signed-off-by: Paolo Bonzini --- hw/scsi-disk.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c index 2bd8907..8882f69 100644 --- a/hw/scsi-disk.c +++ b/hw/scsi-disk.c @@ -68,6 +68,7 @@ struct SCSIDiskState bool media_changed; bool media_event; bool eject_request; + uint64_t wwn; QEMUBH *bh; char *version; char *serial; @@ -576,9 +577,17 @@ static int scsi_disk_emulate_inquiry(SCSIRequest *req, uint8_t *outbuf) outbuf[buflen++] = 0; // not officially assigned outbuf[buflen++] = 0; // reserved outbuf[buflen++] = id_len; // length of data following - memcpy(outbuf+buflen, str, id_len); buflen += id_len; + + if (s->wwn) { + outbuf[buflen++] = 0x1; // Binary + outbuf[buflen++] = 0x3; // NAA + outbuf[buflen++] = 0; // reserved + outbuf[buflen++] = 8; + stq_be_p(&outbuf[buflen], s->wwn); + buflen += 8; + } break; } case 0xb0: /* block limits */ @@ -1913,6 +1922,7 @@ static Property scsi_hd_properties[] = { SCSI_DISK_F_REMOVABLE, false), DEFINE_PROP_BIT("dpofua", SCSIDiskState, features, SCSI_DISK_F_DPOFUA, false), + DEFINE_PROP_HEX64("wwn", SCSIDiskState, wwn, 0), DEFINE_PROP_END_OF_LIST(), }; @@ -1957,6 +1967,7 @@ static TypeInfo scsi_hd_info = { static Property scsi_cd_properties[] = { DEFINE_SCSI_DISK_PROPERTIES(), + DEFINE_PROP_HEX64("wwn", SCSIDiskState, wwn, 0), DEFINE_PROP_END_OF_LIST(), }; @@ -2018,6 +2029,7 @@ static Property scsi_disk_properties[] = { SCSI_DISK_F_REMOVABLE, false), DEFINE_PROP_BIT("dpofua", SCSIDiskState, features, SCSI_DISK_F_DPOFUA, false), + DEFINE_PROP_HEX64("wwn", SCSIDiskState, wwn, 0), DEFINE_PROP_END_OF_LIST(), }; -- 1.7.10.2