From nobody Mon Feb 9 09:35:36 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=1666610280; cv=none; d=zohomail.com; s=zohoarc; b=VoC7rvIjKBZQvF86x/jA7FG13Nk+f2QYfq89oczJLjUdkWNoOg4AvQmfkI7fJUr6EtwhW14Slh9DA0NU3YD2P8c/71k5Rb260H6cuS+95425IMD5OCgR3OLDuVnpWSb49ZIyxc7+0bM5LJ0LDegYWGRbZTMMY4c5wJjRWKSomG0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1666610280; 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=CeHtuR5SWe3A/AmP2z5ZDNoepvaxVnrEVDW+XfndFNI=; b=LvhpARP0qCq+Ijq5At2lUscwh/BFFdCEqrBHpwFOCwv4H//4mnbiCv0OmUd8716HObaw1Ub0OdO92Sl1x9Wt1zj4abIGn8+Vvg71fG3tbVpNoKrIN4Pb87hUHAb1m8DUTFtMEk/HbUdfzSPQSbeRBaShYLGf4D0yRN6aNPvqAw8= 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 1666610279995747.7497076012736; Mon, 24 Oct 2022 04:17:59 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1omvN4-0000ro-BD; Mon, 24 Oct 2022 07:11:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <0e4c4ff02aecaa3cea3e583d07509378b7783307@lizzy.crudebyte.com>) id 1omvMt-0000o0-PN for qemu-devel@nongnu.org; Mon, 24 Oct 2022 07:11:46 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <0e4c4ff02aecaa3cea3e583d07509378b7783307@lizzy.crudebyte.com>) id 1omvMf-0007Fm-1v for qemu-devel@nongnu.org; Mon, 24 Oct 2022 07:11:40 -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=CeHtuR5SWe3A/AmP2z5ZDNoepvaxVnrEVDW+XfndFNI=; b=NHHuV MxjLbC5bQ3DQOKkhY2Fe5JkZHLrQA3K113n2hhA3MChrvEqztG7GQfEEVxOxPc4UoKkq+osqBTdyc 7zPCixXziR4magqZibb4KhEuYUI2je9bIfthheo0hNMWEndX0unvCNG+HuxPD5KTCpzUf6XNZ8sXR jeKukLziVvCe9G6FPgZeYT6bToz1O3oorQbkAn6GjoXd96XcJf3v3hiQXEngp0jTc9vzz8r91bYhM Xb4H6ZSZIaRoWdpQ1Ug1X4iPjUKd3RjPkNDcG6SdN/JKFA/m18frg0WkdE3pg7RLpmO6cCwNs13sb z4xARZrBUXorAU4Yr+/o1vYyD+XvA==; Message-Id: <0e4c4ff02aecaa3cea3e583d07509378b7783307.1666608862.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Mon, 24 Oct 2022 12:54:23 +0200 Subject: [PULL 14/23] tests/9p: simplify callers of tlopen() To: qemu-devel@nongnu.org, Stefan Hajnoczi 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=0e4c4ff02aecaa3cea3e583d07509378b7783307@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: , Sender: "Qemu-devel" Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @crudebyte.com) X-ZM-MESSAGEID: 1666610281838100001 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 Message-Id: --- 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