From nobody Sat Nov 8 08:02:14 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=virtuozzo.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1549536053221168.9072029967316; Thu, 7 Feb 2019 02:40:53 -0800 (PST) Received: from localhost ([127.0.0.1]:37544 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grh6w-0006WN-A4 for importer@patchew.org; Thu, 07 Feb 2019 05:40:50 -0500 Received: from eggs.gnu.org ([209.51.188.92]:37044) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1grgru-0002z8-PW for qemu-devel@nongnu.org; Thu, 07 Feb 2019 05:25:19 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1grgrt-00025t-Sq for qemu-devel@nongnu.org; Thu, 07 Feb 2019 05:25:18 -0500 Received: from relay.sw.ru ([185.231.240.75]:43012) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1grgrt-0001dV-KY; Thu, 07 Feb 2019 05:25:17 -0500 Received: from [10.28.8.145] (helo=kvm.sw.ru) by relay.sw.ru with esmtp (Exim 4.91) (envelope-from ) id 1grgrP-0005bY-SG; Thu, 07 Feb 2019 13:24:47 +0300 From: Vladimir Sementsov-Ogievskiy To: qemu-devel@nongnu.org, qemu-block@nongnu.org Date: Thu, 7 Feb 2019 13:24:42 +0300 Message-Id: <20190207102445.71998-15-vsementsov@virtuozzo.com> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20190207102445.71998-1-vsementsov@virtuozzo.com> References: <20190207102445.71998-1-vsementsov@virtuozzo.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 185.231.240.75 Subject: [Qemu-devel] [PATCH v3 14/17] tests/test-bdrv-drain: use QEMU_IOVEC_INIT_BUF 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@euphon.net, kwolf@redhat.com, vsementsov@virtuozzo.com, quintela@redhat.com, jcody@redhat.com, dgilbert@redhat.com, mreitz@redhat.com, stefanha@redhat.com, den@openvz.org, jsnow@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Use new QEMU_IOVEC_INIT_BUF() instead of qemu_iovec_init_external( ... , 1), which simplifies the code. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake --- tests/test-bdrv-drain.c | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/tests/test-bdrv-drain.c b/tests/test-bdrv-drain.c index ee1740ff06..821be405f0 100644 --- a/tests/test-bdrv-drain.c +++ b/tests/test-bdrv-drain.c @@ -204,12 +204,7 @@ static void test_drv_cb_common(enum drain_type drain_t= ype, bool recursive) BlockAIOCB *acb; int aio_ret; =20 - QEMUIOVector qiov; - struct iovec iov =3D { - .iov_base =3D NULL, - .iov_len =3D 0, - }; - qemu_iovec_init_external(&qiov, &iov, 1); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, NULL, 0); =20 blk =3D blk_new(BLK_PERM_ALL, BLK_PERM_ALL); bs =3D bdrv_new_open_driver(&bdrv_test, "test-node", BDRV_O_RDWR, @@ -670,12 +665,7 @@ static void test_iothread_common(enum drain_type drain= _type, int drain_thread) AioContext *ctx_a =3D iothread_get_aio_context(a); AioContext *ctx_b =3D iothread_get_aio_context(b); =20 - QEMUIOVector qiov; - struct iovec iov =3D { - .iov_base =3D NULL, - .iov_len =3D 0, - }; - qemu_iovec_init_external(&qiov, &iov, 1); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, NULL, 0); =20 /* bdrv_drain_all() may only be called from the main loop thread */ if (drain_type =3D=3D BDRV_DRAIN_ALL && drain_thread !=3D 0) { @@ -1148,13 +1138,7 @@ static void coroutine_fn test_co_delete_by_drain(voi= d *opaque) BlockDriverState *bs =3D blk_bs(blk); BDRVTestTopState *tts =3D bs->opaque; void *buffer =3D g_malloc(65536); - QEMUIOVector qiov; - struct iovec iov =3D { - .iov_base =3D buffer, - .iov_len =3D 65536, - }; - - qemu_iovec_init_external(&qiov, &iov, 1); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, buffer, 65536); =20 /* Pretend some internal write operation from parent to child. * Important: We have to read from the child, not from the parent! @@ -1365,12 +1349,7 @@ static void test_detach_indirect(bool by_parent_cb) BdrvChild *child_a, *child_b; BlockAIOCB *acb; =20 - QEMUIOVector qiov; - struct iovec iov =3D { - .iov_base =3D NULL, - .iov_len =3D 0, - }; - qemu_iovec_init_external(&qiov, &iov, 1); + QEMUIOVector qiov =3D QEMU_IOVEC_INIT_BUF(qiov, NULL, 0); =20 if (!by_parent_cb) { detach_by_driver_cb_role =3D child_file; --=20 2.18.0