From nobody Tue Oct 28 02:08:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516113172615159.51864079199765; Tue, 16 Jan 2018 06:32:52 -0800 (PST) Received: from localhost ([::1]:39168 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebSIF-0006bH-KK for importer@patchew.org; Tue, 16 Jan 2018 09:32:51 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50058) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebS3e-0002Z9-QR for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:17:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebS3Z-0004Ph-5h for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:17:46 -0500 Received: from mail-wm0-x243.google.com ([2a00:1450:400c:c09::243]:39446) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebS3Y-0004PR-VA for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:17:41 -0500 Received: by mail-wm0-x243.google.com with SMTP id i11so8890441wmf.4 for ; Tue, 16 Jan 2018 06:17:40 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id u10sm1537758wrg.6.2018.01.16.06.17.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 06:17:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=cfZ041KDoK43zcz57ci9uOlH/7EpQw1DEpFOjhZ5ag0=; b=SoUanQ+knN3IrChR3DVJgSa+6hVa6BZWaG/WPjiGI/D5Xsptd6JT5r9zShWcgzk3vG gnu9rIqpAupoE5HaA2KObEeLwQqWNNF4QWYce3QHwzxpQFUPYEnPhbosvAtEhPBXVLqL aOYRuYTODCioqGDzC2wd0eFM9h+vkaEsJglYx0P8b+vHCYaYkpfTqRDp2M0HcduTQO4m gnFGud6mQ8rqb67qRgXM6It6PvqD841kVwasDvXy+WLemRotOVTzGhHDPIX+XbOLCxPD Bb4OzoeJLwohJCEa/ZQxU5AVS2uU1onGlVC00AvChXCosOeamNk3ZMwUqqtr92xhGHRu Ekdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references; bh=cfZ041KDoK43zcz57ci9uOlH/7EpQw1DEpFOjhZ5ag0=; b=h5YZfZx5aRrhi41uoRj4ElL5nc7tlgr1z+by+T8t+KcxcbHmN+kTKBiQwR+ZNbrs70 RGpyXDV5fxFnnqBxi9JhSWcMY/M9b16E3vwsMH3V/Cat3GCXeC4ZFBNORLVDYOwKt9M6 l8D7lkTisOFk/YG2sJ6NE1dWsPIvZeMoPgFaPqR8XnoS4hj/4L1I0Ra8JZDIys0zoyCL 04a/Lgckdjtea2+2XIKDIgkKereDSCtEKE9OL+pcwHtwpki7dOdHQ/VjeIA4VP9QhL4c InwNcN7wMUEQEw4P+YrH8QEtVf6q91pXNsQnueCtLqcpHrHRR5Lb2IFs5g3wtZkCtcfU qh1w== X-Gm-Message-State: AKwxytfV16KwmS12RAy11w6Rgv00TZllqQK19Du8F16/++5Cq3oIteHH tQ6fkc9YkVpnviyn1TCD28GHpcQ/ X-Google-Smtp-Source: ACJfBoty7bv6y88zwArFwwoM/SDHVYrgrBSvX34Tm2EP7DX4UQrvwUsYQBSXhp/v92UeBJ8+CNdNrg== X-Received: by 10.28.69.212 with SMTP id l81mr13594604wmi.65.1516112259441; Tue, 16 Jan 2018 06:17:39 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 15:16:43 +0100 Message-Id: <1516112253-14480-2-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> References: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::243 Subject: [Qemu-devel] [PULL 01/51] scsi-generic: Add share-rw option X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Fam Zheng Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Fam Zheng Add the property to the device model, then parse it by calling blkconf_apply_backend_options(). In addition to blk_set_perm(), the called function also handles error options and wce. For error options we've already checked that the default values are used, for wce we don't have the option either so it is always the default (true). In other words there is no change of behavior in these regards. Signed-off-by: Fam Zheng Message-Id: <20171205151553.7834-1-famz@redhat.com> Signed-off-by: Paolo Bonzini --- hw/scsi/scsi-generic.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/hw/scsi/scsi-generic.c b/hw/scsi/scsi-generic.c index bd0d9ff..ba70c0d 100644 --- a/hw/scsi/scsi-generic.c +++ b/hw/scsi/scsi-generic.c @@ -482,6 +482,7 @@ static void scsi_generic_realize(SCSIDevice *s, Error *= *errp) int rc; int sg_version; struct sg_scsi_id scsiid; + Error *local_err =3D NULL; =20 if (!s->conf.blk) { error_setg(errp, "drive property not set"); @@ -515,6 +516,13 @@ static void scsi_generic_realize(SCSIDevice *s, Error = **errp) error_setg(errp, "SG_GET_SCSI_ID ioctl failed"); return; } + blkconf_apply_backend_options(&s->conf, + blk_is_read_only(s->conf.blk), + true, &local_err); + if (local_err) { + error_propagate(errp, local_err); + return; + } =20 /* define device state */ s->type =3D scsiid.scsi_type; @@ -565,6 +573,7 @@ static SCSIRequest *scsi_new_request(SCSIDevice *d, uin= t32_t tag, uint32_t lun, =20 static Property scsi_generic_properties[] =3D { DEFINE_PROP_DRIVE("drive", SCSIDevice, conf.blk), + DEFINE_PROP_BOOL("share-rw", SCSIDevice, conf.share_rw, false), DEFINE_PROP_END_OF_LIST(), }; =20 --=20 1.8.3.1