From: Christian Schoenebeck <qemu_oss@crudebyte.com>
To: qemu-devel@nongnu.org, Peter Maydell <peter.maydell@linaro.org>
Cc: Greg Kurz <groug@kaod.org>
Subject: [PULL 5/8] 9pfs: drop fid_to_qid()
Date: Mon, 05 Jul 2021 13:13:51 +0200 [thread overview]
Message-ID: <1d0fc0d0eef057dc02055f531907188d19a83cb2.1625483630.git.qemu_oss@crudebyte.com> (raw)
In-Reply-To: <cover.1625483630.git.qemu_oss@crudebyte.com>
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 <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Message-Id: <e9a4c9c7a0792ed4db6578d105a0823ea05bc324.1622821729.git.qemu_oss@crudebyte.com>
---
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;
}
--
2.20.1
next prev parent reply other threads:[~2021-07-05 11:55 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-05 11:13 [PULL 0/8] 9p queue 2021-07-05 Christian Schoenebeck
2021-07-05 11:13 ` Christian Schoenebeck [this message]
2021-07-05 11:13 ` [PULL 3/8] 9pfs: fix not_same_qid() Christian Schoenebeck
2021-07-05 11:13 ` [PULL 7/8] 9pfs: drop root_qid Christian Schoenebeck
2021-07-05 11:13 ` [PULL 1/8] 9pfs: add link to 9p developer docs Christian Schoenebeck
2021-07-05 11:13 ` [PULL 2/8] 9pfs: simplify v9fs_walk() Christian Schoenebeck
2021-07-05 11:13 ` [PULL 6/8] 9pfs: replace not_same_qid() by same_stat_id() Christian Schoenebeck
2021-07-05 11:13 ` [PULL 8/8] 9pfs: reduce latency of Twalk Christian Schoenebeck
2021-07-05 11:13 ` [PULL 4/8] 9pfs: capture root stat Christian Schoenebeck
2021-07-05 13:57 ` [PULL 0/8] 9p queue 2021-07-05 Peter Maydell
2021-07-05 15:34 ` Christian Schoenebeck
2021-07-05 19:03 ` Peter Maydell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d0fc0d0eef057dc02055f531907188d19a83cb2.1625483630.git.qemu_oss@crudebyte.com \
--to=qemu_oss@crudebyte.com \
--cc=groug@kaod.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).