From nobody Mon Feb 9 16:21:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=quarantine dis=none) header.from=crudebyte.com ARC-Seal: i=1; a=rsa-sha256; t=1664919212; cv=none; d=zohomail.com; s=zohoarc; b=imLGFi4mDqSfFKBe2aYSjZX3mF2FN4Cm9L2eFUzsHvG0eesFa0OeCs9h7irQOrXvihOZJuS28zfCS5uvBZPJmaPP4eLX6Y/OzuGqKkpU1AXfmWvoqFOPD/Mzc0f3qbof+iRENfEAC3dhOW4amimHUaF6ZUbbIIqY1ZMFf5g5K+o= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1664919212; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=js3NqUShX2HmMP302fS7mpsznxWt2G6ATCcJIiVI388=; b=Zkx6uKywd7lrbTalff62P8xIxFPPGPKGe5ZmFjU29bWTtBTcAO8BckiT94UefLDURxlF6kPOJRoJ1OeHdUJWBwJ+kOfF14+gDW/HmuZmnDXaleEt+XkQzGE3WEg7OzgAL16eiAbCgvur5ES81jsaLKouyYJys86krbV7kYEwK4k= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 166491921254332.476472880881374; Tue, 4 Oct 2022 14:33:32 -0700 (PDT) Received: from localhost ([::1]:46264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ofpXc-0005US-JE for importer@patchew.org; Tue, 04 Oct 2022 17:33:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:33726) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofpLu-0006SZ-9M for qemu-devel@nongnu.org; Tue, 04 Oct 2022 17:21:22 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:39817) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ofpLr-0002ZY-ND for qemu-devel@nongnu.org; Tue, 04 Oct 2022 17:21:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=crudebyte.com; s=lizzy; h=Cc:To:Subject:Date:From:References:In-Reply-To: Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Content-ID: Content-Description; bh=js3NqUShX2HmMP302fS7mpsznxWt2G6ATCcJIiVI388=; b=YYpNE dua/mKkXQC5Wcla2XUM/HbPLJ9/ZdwjrCpCHqfTJT3DUipyGxBLxGhS+nKtG9AEwh/4F63YwU9Rb9 d2dgP/R0nEjuwizgdkB9I428T8g7l2Pdefsnsr53D3SsX7U0OHiAOrrEOddHnMPwkAUnHJ2fcgoM/ 0+6jv2N4ClE4lJdswmpaKR3rO4pCQsldwffyjJaSMFAAHVG5u4ShUDzN/SfIhkkCVySyR1hDetdNW 7R8dJvv/ABo2P/L+mN79tiUwbn2F/pVUs5DrtVEIdcPw8Jpe3qjr8ex5cfznmPNg2+QfCsALUAVQA A9Ahma5gAYeLR7ZgTjTpkvfO3FaLg==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Tue, 4 Oct 2022 22:53:55 +0200 Subject: [PATCH 11/20] tests/9p: simplify callers of tlopen() To: qemu-devel@nongnu.org Cc: Greg Kurz Received-SPF: pass (zohomail.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; Received-SPF: none client-ip=91.194.90.13; envelope-from=f74b6153e079fc7a340e5cb575ee32e0fe1e0ae6@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1664919214355100001 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Now as tlopen() is using a declarative approach, simplify the code of callers of this function. Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 43 +++++++++--------------------------- 1 file changed, 10 insertions(+), 33 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 0455c3a094..60a030b877 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -105,7 +105,6 @@ static void fs_readdir(void *obj, void *data, QGuestAll= ocator *t_alloc) v9fs_qid qid; uint32_t count, nentries; struct V9fsDirent *entries =3D NULL; - P9Req *req; =20 tattach({ .client =3D v9p }); twalk({ @@ -114,11 +113,9 @@ static void fs_readdir(void *obj, void *data, QGuestAl= locator *t_alloc) }); g_assert_cmpint(nqid, =3D=3D, 1); =20 - req =3D tlopen({ - .client =3D v9p, .fid =3D 1, .flags =3D O_DIRECTORY, .requestOnly = =3D true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rlopen(req, &qid, NULL); + tlopen({ + .client =3D v9p, .fid =3D 1, .flags =3D O_DIRECTORY, .rlopen.qid = =3D &qid + }); =20 /* * submit count =3D msize - 11, because 11 is the header size of Rread= dir @@ -163,7 +160,6 @@ static void do_readdir_split(QVirtio9P *v9p, uint32_t c= ount) v9fs_qid qid; uint32_t nentries, npartialentries; struct V9fsDirent *entries, *tail, *partialentries; - P9Req *req; int fid; uint64_t offset; =20 @@ -181,11 +177,9 @@ static void do_readdir_split(QVirtio9P *v9p, uint32_t = count) }); g_assert_cmpint(nqid, =3D=3D, 1); =20 - req =3D tlopen({ - .client =3D v9p, .fid =3D fid, .flags =3D O_DIRECTORY, .requestOnl= y =3D true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rlopen(req, &qid, NULL); + tlopen({ + .client =3D v9p, .fid =3D fid, .flags =3D O_DIRECTORY, .rlopen.qid= =3D &qid + }); =20 /* * send as many Treaddir requests as required to get all directory @@ -363,18 +357,13 @@ static void fs_lopen(void *obj, void *data, QGuestAll= ocator *t_alloc) QVirtio9P *v9p =3D obj; v9fs_set_allocator(t_alloc); char *wnames[] =3D { g_strdup(QTEST_V9FS_SYNTH_LOPEN_FILE) }; - P9Req *req; =20 tattach({ .client =3D v9p }); twalk({ .client =3D v9p, .fid =3D 0, .newfid =3D 1, .nwname =3D 1, .wnames= =3D wnames }); =20 - req =3D tlopen({ - .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY, .requestOnly =3D= true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rlopen(req, NULL, NULL); + tlopen({ .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY }); =20 g_free(wnames[0]); } @@ -394,11 +383,7 @@ static void fs_write(void *obj, void *data, QGuestAllo= cator *t_alloc) .client =3D v9p, .fid =3D 0, .newfid =3D 1, .nwname =3D 1, .wnames= =3D wnames }); =20 - req =3D tlopen({ - .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY, .requestOnly =3D= true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rlopen(req, NULL, NULL); + tlopen({ .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY }); =20 req =3D v9fs_twrite(v9p, 1, 0, write_count, buf, 0); v9fs_req_wait_for_reply(req, NULL); @@ -422,11 +407,7 @@ static void fs_flush_success(void *obj, void *data, QG= uestAllocator *t_alloc) .client =3D v9p, .fid =3D 0, .newfid =3D 1, .nwname =3D 1, .wnames= =3D wnames }); =20 - req =3D tlopen({ - .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY, .requestOnly =3D= true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rlopen(req, NULL, NULL); + tlopen({ .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY }); =20 /* This will cause the 9p server to try to write data to the backend, * until the write request gets cancelled. @@ -461,11 +442,7 @@ static void fs_flush_ignored(void *obj, void *data, QG= uestAllocator *t_alloc) .client =3D v9p, .fid =3D 0, .newfid =3D 1, .nwname =3D 1, .wnames= =3D wnames }); =20 - req =3D tlopen({ - .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY, .requestOnly =3D= true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rlopen(req, NULL, NULL); + tlopen({ .client =3D v9p, .fid =3D 1, .flags =3D O_WRONLY }); =20 /* This will cause the write request to complete right away, before it * could be actually cancelled. --=20 2.30.2