From nobody Mon Feb 9 07:05:50 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) client-ip=170.10.129.124; envelope-from=philmd@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1637770555; cv=none; d=zohomail.com; s=zohoarc; b=PNNaHiKNYoKgcDEWZKF2gJEZGz5zdcXy6/r1ZInob47/h/gweKw2rrpbM1mFK8hNmowImtWV3xp7VLFlLs3dm2CCWuzyc1lQCigpX60gX58FryeP54m0/rOLpUp13ZHHXPpRwpaNhlgmIxNg/5rIXBxIJ2OpFM1YNIo51uZ1yF0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1637770555; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=pAJvjWL7+9OjZK8lvdVpeV3G6cYC7dwmwUMy7U51Sis=; b=bUUSpeNKam6N/rGSj/lC25A+5lflQt2/+XGsYSyw93t//S5hiaY53orP9YoCG87Mv8OcUYtAKk4CTQzWYqjGj95g+8TJXo5vShCI35UilxTYIpIHX2AZvVkdpiREDzFq3e0H0dhwMYBFYB+HDPoLXYCAqDLhmoPWfgTBZNIwDFs= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=philmd@redhat.com; dmarc=pass header.from= (p=none dis=none) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.zohomail.com with SMTPS id 1637770555339131.64090414953205; Wed, 24 Nov 2021 08:15:55 -0800 (PST) Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-543-F3qWVlxQO92S2Xu1kgVSPw-1; Wed, 24 Nov 2021 11:15:47 -0500 Received: by mail-wr1-f71.google.com with SMTP id q17-20020adff791000000b00183e734ba48so620140wrp.8 for ; Wed, 24 Nov 2021 08:15:47 -0800 (PST) Return-Path: Return-Path: Received: from x1w.redhat.com (62.red-83-57-168.dynamicip.rima-tde.net. [83.57.168.62]) by smtp.gmail.com with ESMTPSA id g18sm238429wrv.42.2021.11.24.08.15.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Nov 2021 08:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637770554; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=pAJvjWL7+9OjZK8lvdVpeV3G6cYC7dwmwUMy7U51Sis=; b=eQQqNR/I3BqTj2JsrJUMLYGL2zYQWcwVXA7PqODZIUlevSsFvss09Uc5GYk2ENMuWwX9Us kKDx0swzW9NvFFMwFYIPqnSoxlw+kSuyEagNSX3pSIIlneC/3e+04dtdrlQ2gmBtpM8yyt sIJ2aiJV2z5vMEt+WTqPOE/ss2b5QJY= X-MC-Unique: F3qWVlxQO92S2Xu1kgVSPw-1 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=pAJvjWL7+9OjZK8lvdVpeV3G6cYC7dwmwUMy7U51Sis=; b=GRRTh3JV8vfMOOAw7cBc9xVLkRboYs9oPmLf+ozS8QroLgJyN4YuT9UtXCZjTaRP7l lDzcDLSRIkJc3lUI/e7YkvZlDu2g5lw6KSIADvmpnSQ0iQr45thpKUW3cUPSiOsNlyIk XuRYdLUxopAe/NzRE/WCeGHbDZNAQ5bUxU7+1LXZyZhjIED0Db5nXuhk22k+BLh6lEpX GKA1+RbitB2DgI0yovfnF+OrAuLBFzuvPGfo5Ku4BpVxOMjzGTZb7p8GtahPDvrlsLRw mqAHuOzsnQ3Sout7HggCZPhUOugSmBOs5nUu/LLRaAWJwZx8t0VGyzSSUZmi/Tkp05kf o1JQ== X-Gm-Message-State: AOAM532AXuA/0CDpON9F3la748aeAR87hVjYGdkXAMC9k8a6FcYYNL8f JecffKd6pd+x2h3DjmSMIEiyut/Ztw0Dil9AfpqefRY0NLucSe1fE/ID5yyYdehsJ51qBfIBqJj 3viEottF+xMrV4w== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr21038349wrr.143.1637770545115; Wed, 24 Nov 2021 08:15:45 -0800 (PST) X-Google-Smtp-Source: ABdhPJwD9RdGN6SPWCFFH8LFC0bXsyXZDyls+tWio3VN0u65oJD/MN0d2h89E97UsuseeuRigr54iw== X-Received: by 2002:a5d:44d1:: with SMTP id z17mr21037970wrr.143.1637770542794; Wed, 24 Nov 2021 08:15:42 -0800 (PST) From: =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= To: qemu-devel@nongnu.org Cc: Hanna Reitz , Thomas Huth , Laurent Vivier , John Snow , Kevin Wolf , Paolo Bonzini , qemu-block@nongnu.org, =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= Subject: [PATCH v4 1/3] hw/block/fdc: Extract blk_create_empty_drive() Date: Wed, 24 Nov 2021 17:15:34 +0100 Message-Id: <20211124161536.631563-2-philmd@redhat.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211124161536.631563-1-philmd@redhat.com> References: <20211124161536.631563-1-philmd@redhat.com> MIME-Version: 1.0 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=philmd@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1637770557708100001 We are going to re-use this code in the next commit, so extract it as a new blk_create_empty_drive() function. Inspired-by: Hanna Reitz Signed-off-by: Philippe Mathieu-Daud=C3=A9 Reviewed-by: Hanna Reitz --- hw/block/fdc.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/hw/block/fdc.c b/hw/block/fdc.c index fa933cd3263..1dbf3f6028f 100644 --- a/hw/block/fdc.c +++ b/hw/block/fdc.c @@ -61,6 +61,12 @@ } while (0) =20 =20 +/* Anonymous BlockBackend for empty drive */ +static BlockBackend *blk_create_empty_drive(void) +{ + return blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL); +} + /********************************************************/ /* qdev floppy bus */ =20 @@ -486,8 +492,7 @@ static void floppy_drive_realize(DeviceState *qdev, Err= or **errp) } =20 if (!dev->conf.blk) { - /* Anonymous BlockBackend for an empty drive */ - dev->conf.blk =3D blk_new(qemu_get_aio_context(), 0, BLK_PERM_ALL); + dev->conf.blk =3D blk_create_empty_drive(); ret =3D blk_attach_dev(dev->conf.blk, qdev); assert(ret =3D=3D 0); =20 --=20 2.33.1