From patchwork Fri Jun 4 15:13:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Schoenebeck X-Patchwork-Id: 12300331 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6790C4743F for ; Fri, 4 Jun 2021 17:25:07 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 7860261420 for ; Fri, 4 Jun 2021 17:25:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7860261420 Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=crudebyte.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Received: from localhost ([::1]:38386 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lpDZC-00045z-KR for qemu-devel@archiver.kernel.org; Fri, 04 Jun 2021 13:25:06 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35930) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpCoj-0001Pv-0B for qemu-devel@nongnu.org; Fri, 04 Jun 2021 12:37:06 -0400 Received: from lizzy.crudebyte.com ([91.194.90.13]:46441) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lpCoc-0003ci-Sj for qemu-devel@nongnu.org; Fri, 04 Jun 2021 12:37:04 -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=PazLJKZiQEVaGIIPZt1TFDxdCexiLb9bZg3fN3Mxfng=; b=Qhg0c 9kvDbb+PQ7ANf42FN1CNIFpriwXxqrd55k5OvF5I9BCyQRbdt5o72zxY5cBCY5FoPTjr0KNBvph5s GR2GCNcCyby4uRvwqlkLzK+pV4Gp1/erXuKuJdX0RnMzCs4v086nrSMtyXQoSZScUX9jqucZCBtqd R85a0L0Udj6Guh+7d9oJ0n0eBf4dsQ9I63/CWc639AK3uXpb4NmnI267R6qfGWM9NKG4qINes5GiQ jz+kfwVydeRlUe79wp52mWAmsfMTl+V3T1+xUUjO/Qcxv7agZfctyUQAsHIBGfXRjad3UeFkD+8bc 0pIRrRB1f8qpPHrBFP+aH0QpaJ/dg==; Message-Id: In-Reply-To: References: From: Christian Schoenebeck Date: Fri, 4 Jun 2021 17:13:17 +0200 Subject: [PATCH v2 4/7] 9pfs: drop fid_to_qid() To: qemu-devel@nongnu.org Cc: Greg Kurz Received-SPF: none client-ip=91.194.90.13; envelope-from=e9a4c9c7a0792ed4db6578d105a0823ea05bc324@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.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" There is only one user of fid_to_qid() which is v9fs_walk(). Let's open-code fid_to_qid() directly within v9fs_walk(), because fid_to_qid() hides the POSIX stat buffer which we are going to need in the subsequent patch. Signed-off-by: Christian Schoenebeck --- hw/9pfs/9p.c | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index eb15ec2082..0e3857798d 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -971,23 +971,6 @@ static int stat_to_qid(V9fsPDU *pdu, const struct stat *stbuf, V9fsQID *qidp) return 0; } -static int coroutine_fn fid_to_qid(V9fsPDU *pdu, V9fsFidState *fidp, - V9fsQID *qidp) -{ - struct stat stbuf; - int err; - - err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); - if (err < 0) { - return err; - } - err = stat_to_qid(pdu, &stbuf, qidp); - if (err < 0) { - return err; - } - return 0; -} - V9fsPDU *pdu_alloc(V9fsState *s) { V9fsPDU *pdu = NULL; @@ -1772,7 +1755,11 @@ static void coroutine_fn v9fs_walk(void *opaque) v9fs_path_init(&dpath); v9fs_path_init(&path); - err = fid_to_qid(pdu, fidp, &qid); + err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); + if (err < 0) { + goto out; + } + err = stat_to_qid(pdu, &stbuf, &qid); if (err < 0) { goto out; }