From nobody Mon Feb 9 12:04:21 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=1604311618; cv=none; d=zohomail.com; s=zohoarc; b=M0MXvRlPyNFoHJG6XD+V7FOKQtY4cBe+xNjnnt7BRgAaEqSV8a/C+Nn1OZiriV1edza5O7I6nrJUmGnvo9p8URYNBrFb7UoOD1axeCyCInyEEBuY5bY+NNqwwgilLV69wJECTzku1YKjInucHIdF7jLJvQdT9gljpSfYn2OsmvY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1604311618; 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=o2+jeSzz7qQD6sWpHqHX3A+P88gUlYGMB32yoKShenw=; b=QDw2ddp1CDVoQPgad9qO38Od1N9s5HfVnXX55HbsymHCLhh6gB6OQfecMmkV7hl/dMz3A4suLOY4RAXRo30QpbsMlcNeomD4ymAOlk+scmNMVy6DcqNxbDLLlapPjeBbh9CoxuJlp0wNv3KDmb6WGQLu4qSr9bbNc2pZdOThDhc= 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) header.from= Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1604311618298862.0351976901527; Mon, 2 Nov 2020 02:06:58 -0800 (PST) Received: from localhost ([::1]:53902 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kZWjp-00076x-4K for importer@patchew.org; Mon, 02 Nov 2020 05:06:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:49566) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <20018805224c69c78ac25d6b361eded8c8095c75@lizzy.crudebyte.com>) id 1kZWUP-0002lp-6X for qemu-devel@nongnu.org; Mon, 02 Nov 2020 04:51:01 -0500 Received: from lizzy.crudebyte.com ([91.194.90.13]:38551) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <20018805224c69c78ac25d6b361eded8c8095c75@lizzy.crudebyte.com>) id 1kZWUN-00071h-KW for qemu-devel@nongnu.org; Mon, 02 Nov 2020 04:51:00 -0500 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=o2+jeSzz7qQD6sWpHqHX3A+P88gUlYGMB32yoKShenw=; b=ISpLr 5V+AdE7twrx79js5KBvcxJ/QOay9vEl68KL694ujS2wBYvecjRNJJFOdRzrwx1lMNdXFNXXWcAWLi /dXB42dV/WHDVtKNyxAWYavDD/JDzJi5lLWHKSEiIaISY+lEKOxSQAkFDW8Y+aAq1qT67aDzgy5G9 GuOl8H/dlLrUIpljc0SN7YfeGrf54BtWsD07YtjKyAG276W9Co9vQj8zgm1pgwHqEnJ6JYnoHeNB8 rqAjq+O+4IEI5Ps7iZVMRi+4p7y7niLSCM/MYbuRpgAopilNg9jUw4VJgUXtSermJl74FXI6djplR PX53WMTk2QIXh8CNoaLcHC3Yod/rQ==; Message-Id: <20018805224c69c78ac25d6b361eded8c8095c75.1604309512.git.qemu_oss@crudebyte.com> In-Reply-To: References: From: Christian Schoenebeck Date: Wed, 21 Oct 2020 14:06:53 +0200 Subject: [PULL v3 10/17] tests/9pfs: simplify do_mkdir() To: qemu-devel@nongnu.org, Peter Maydell 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=20018805224c69c78ac25d6b361eded8c8095c75@lizzy.crudebyte.com; helo=lizzy.crudebyte.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/02 04:48:35 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: 13 X-Spam_score: 1.3 X-Spam_bar: + X-Spam_report: (1.3 / 5.0 requ) BAYES_00=-1.9, DATE_IN_PAST_96_XX=3.405, 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=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 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) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Split out walking a directory path to a separate new utility function do_walk() and use that function in do_mkdir(). The code difference saved this way is not much, but we'll use that new do_walk() function in the upcoming patches, so it will avoid quite some code duplication after all. Signed-off-by: Christian Schoenebeck Reviewed-by: Greg Kurz Message-Id: <4d7275b2363f122438a443ce079cbb355285e9d6.1603285620.git.qemu_o= ss@crudebyte.com> Signed-off-by: Christian Schoenebeck --- tests/qtest/virtio-9p-test.c | 27 +++++++++++++++++++-------- 1 file changed, 19 insertions(+), 8 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index 6f8c46a645..db37e31b32 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -583,6 +583,23 @@ static void do_version(QVirtio9P *v9p) g_free(server_version); } =20 +/* utility function: walk to requested dir and return fid for that dir */ +static uint32_t do_walk(QVirtio9P *v9p, const char *path) +{ + char **wnames; + P9Req *req; + const uint32_t fid =3D genfid(); + + int nwnames =3D split(path, "/", &wnames); + + req =3D v9fs_twalk(v9p, 0, fid, nwnames, wnames, 0); + v9fs_req_wait_for_reply(req, NULL); + v9fs_rwalk(req, NULL, NULL); + + split_free(&wnames); + return fid; +} + static void fs_version(void *obj, void *data, QGuestAllocator *t_alloc) { alloc =3D t_alloc; @@ -974,23 +991,17 @@ static void fs_flush_ignored(void *obj, void *data, Q= GuestAllocator *t_alloc) =20 static void do_mkdir(QVirtio9P *v9p, const char *path, const char *cname) { - char **wnames; char *const name =3D g_strdup(cname); + uint32_t fid; P9Req *req; - const uint32_t fid =3D genfid(); =20 - int nwnames =3D split(path, "/", &wnames); - - req =3D v9fs_twalk(v9p, 0, fid, nwnames, wnames, 0); - v9fs_req_wait_for_reply(req, NULL); - v9fs_rwalk(req, NULL, NULL); + fid =3D do_walk(v9p, path); =20 req =3D v9fs_tmkdir(v9p, fid, name, 0750, 0, 0); v9fs_req_wait_for_reply(req, NULL); v9fs_rmkdir(req, NULL); =20 g_free(name); - split_free(&wnames); } =20 static void fs_readdir_split_128(void *obj, void *data, --=20 2.20.1