From a9a53769318503c4d8884e642e00603ea6885cb1 Mon Sep 17 00:00:00 2001 From: Christian Schoenebeck Date: Tue, 4 Oct 2022 22:53:49 +0200 Subject: [PATCH] tests/9p: simplify callers of treaddir() Now as treaddir() is using a declarative approach, simplify the code of callers of this function. Signed-off-by: Christian Schoenebeck Message-Id: <7cec6f2c7011a481806c34908893b7282702a7a6.1664917004.git.qemu_oss@crudebyte.com> --- tests/qtest/virtio-9p-test.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/tests/qtest/virtio-9p-test.c b/tests/qtest/virtio-9p-test.c index e5c174c218..99e24fce0b 100644 --- a/tests/qtest/virtio-9p-test.c +++ b/tests/qtest/virtio-9p-test.c @@ -120,12 +120,12 @@ static void fs_readdir(void *obj, void *data, QGuestAllocator *t_alloc) /* * submit count = msize - 11, because 11 is the header size of Rreaddir */ - req = treaddir({ + treaddir({ .client = v9p, .fid = 1, .offset = 0, .count = P9_MAX_SIZE - 11, - .requestOnly = true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rreaddir(req, &count, &nentries, &entries); + .rreaddir = { + .count = &count, .nentries = &nentries, .entries = &entries + } + }); /* * Assuming msize (P9_MAX_SIZE) is large enough so we can retrieve all @@ -190,12 +190,13 @@ static void do_readdir_split(QVirtio9P *v9p, uint32_t count) npartialentries = 0; partialentries = NULL; - req = treaddir({ + treaddir({ .client = v9p, .fid = fid, .offset = offset, .count = count, - .requestOnly = true - }).req; - v9fs_req_wait_for_reply(req, NULL); - v9fs_rreaddir(req, &count, &npartialentries, &partialentries); + .rreaddir = { + .count = &count, .nentries = &npartialentries, + .entries = &partialentries + } + }); if (npartialentries > 0 && partialentries) { if (!entries) { entries = partialentries;