From nobody Wed Feb 11 08:38:08 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (208.118.235.17 [208.118.235.17]) by mx.zohomail.com with SMTPS id 1517334258142321.78025584993793; Tue, 30 Jan 2018 09:44:18 -0800 (PST) Received: from localhost ([::1]:51155 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egZxB-00038I-8L for importer@patchew.org; Tue, 30 Jan 2018 12:44:17 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52528) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1egZt8-0008NQ-5N for qemu-devel@nongnu.org; Tue, 30 Jan 2018 12:40:11 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1egZt1-0004QI-TR for qemu-devel@nongnu.org; Tue, 30 Jan 2018 12:40:06 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:41698) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1egZt1-0004DY-IL for qemu-devel@nongnu.org; Tue, 30 Jan 2018 12:39:59 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w0UHdeWZ110627 for ; Tue, 30 Jan 2018 12:39:50 -0500 Received: from e06smtp10.uk.ibm.com (e06smtp10.uk.ibm.com [195.75.94.106]) by mx0a-001b2d01.pphosted.com with ESMTP id 2ftsgmc5f5-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Tue, 30 Jan 2018 12:39:47 -0500 Received: from localhost by e06smtp10.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 30 Jan 2018 17:39:43 -0000 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp10.uk.ibm.com (192.168.101.140) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Tue, 30 Jan 2018 17:39:41 -0000 Received: from d06av23.portsmouth.uk.ibm.com (d06av23.portsmouth.uk.ibm.com [9.149.105.59]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w0UHdej847972396; Tue, 30 Jan 2018 17:39:40 GMT Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D90ACA4057; Tue, 30 Jan 2018 17:33:13 +0000 (GMT) Received: from d06av23.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id C7856A4053; Tue, 30 Jan 2018 17:33:13 +0000 (GMT) Received: from smtp.lab.toulouse-stg.fr.ibm.com (unknown [9.101.4.1]) by d06av23.portsmouth.uk.ibm.com (Postfix) with ESMTP; Tue, 30 Jan 2018 17:33:13 +0000 (GMT) Received: from bahia.lab.toulouse-stg.fr.ibm.com (bahia.lab.toulouse-stg.fr.ibm.com [9.101.4.41]) by smtp.lab.toulouse-stg.fr.ibm.com (Postfix) with ESMTP id 7F2D2220499; Tue, 30 Jan 2018 18:39:40 +0100 (CET) From: Greg Kurz To: qemu-devel@nongnu.org Date: Tue, 30 Jan 2018 18:39:28 +0100 X-Mailer: git-send-email 2.13.6 In-Reply-To: <20180130173935.5172-1-groug@kaod.org> References: <20180130173935.5172-1-groug@kaod.org> X-TM-AS-GCONF: 00 x-cbid: 18013017-0040-0000-0000-0000040A8478 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18013017-0041-0000-0000-0000260E1D55 Message-Id: <20180130173935.5172-4-groug@kaod.org> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2018-01-30_07:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1034 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1801300218 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic] [fuzzy] X-Received-From: 148.163.156.1 Subject: [Qemu-devel] [PULL 03/10] tests: virtio-9p: move request tag to the test functions X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It doesn't really makes sense to hide the request tag from the test functions. It prevents to test the 9p server behavior when passed a wrong tag (ie, still in use or different from P9_NOTAG for a version request). Also the spec says that a tag is reusable as soon as the corresponding request was replied or flushed: no need to always increment tags like we do now. And finaly, an upcoming test of the flush command will need to manipulate tags explicitely. This simply changes all request functions to have a tag argument. Except for the version request which needs P9_NOTAG, all other tests can pass 0 since they wait for the reply before sending another request. Signed-off-by: Greg Kurz Reviewed-by: Stefan Hajnoczi --- tests/virtio-9p-test.c | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/virtio-9p-test.c b/tests/virtio-9p-test.c index 00f00f7246e9..5ada2839b9ae 100644 --- a/tests/virtio-9p-test.c +++ b/tests/virtio-9p-test.c @@ -27,7 +27,6 @@ typedef struct { QOSState *qs; QVirtQueue *vq; char *test_share; - uint16_t p9_req_tag; } QVirtIO9P; =20 static QVirtIO9P *qvirtio_9p_start(const char *driver) @@ -294,10 +293,11 @@ static void v9fs_rlerror(P9Req *req, uint32_t *err) } =20 /* size[4] Tversion tag[2] msize[4] version[s] */ -static P9Req *v9fs_tversion(QVirtIO9P *v9p, uint32_t msize, const char *ve= rsion) +static P9Req *v9fs_tversion(QVirtIO9P *v9p, uint32_t msize, const char *ve= rsion, + uint16_t tag) { P9Req *req =3D v9fs_req_init(v9p, 4 + v9fs_string_size(version), P9_TV= ERSION, - P9_NOTAG); + tag); =20 v9fs_uint32_write(req, msize); v9fs_string_write(req, version); @@ -323,12 +323,12 @@ static void v9fs_rversion(P9Req *req, uint16_t *len, = char **version) } =20 /* size[4] Tattach tag[2] fid[4] afid[4] uname[s] aname[s] n_uname[4] */ -static P9Req *v9fs_tattach(QVirtIO9P *v9p, uint32_t fid, uint32_t n_uname) +static P9Req *v9fs_tattach(QVirtIO9P *v9p, uint32_t fid, uint32_t n_uname, + uint16_t tag) { const char *uname =3D ""; /* ignored by QEMU */ const char *aname =3D ""; /* ignored by QEMU */ - P9Req *req =3D v9fs_req_init(v9p, 4 + 4 + 2 + 2 + 4, P9_TATTACH, - ++(v9p->p9_req_tag)); + P9Req *req =3D v9fs_req_init(v9p, 4 + 4 + 2 + 2 + 4, P9_TATTACH, tag); =20 v9fs_uint32_write(req, fid); v9fs_uint32_write(req, P9_NOFID); @@ -353,7 +353,7 @@ static void v9fs_rattach(P9Req *req, v9fs_qid *qid) =20 /* size[4] Twalk tag[2] fid[4] newfid[4] nwname[2] nwname*(wname[s]) */ static P9Req *v9fs_twalk(QVirtIO9P *v9p, uint32_t fid, uint32_t newfid, - uint16_t nwname, char *const wnames[]) + uint16_t nwname, char *const wnames[], uint16_t t= ag) { P9Req *req; int i; @@ -362,7 +362,7 @@ static P9Req *v9fs_twalk(QVirtIO9P *v9p, uint32_t fid, = uint32_t newfid, for (i =3D 0; i < nwname; i++) { size +=3D v9fs_string_size(wnames[i]); } - req =3D v9fs_req_init(v9p, size, P9_TWALK, ++(v9p->p9_req_tag)); + req =3D v9fs_req_init(v9p, size, P9_TWALK, tag); v9fs_uint32_write(req, fid); v9fs_uint32_write(req, newfid); v9fs_uint16_write(req, nwname); @@ -397,7 +397,7 @@ static void fs_version(QVirtIO9P *v9p) char *server_version; P9Req *req; =20 - req =3D v9fs_tversion(v9p, P9_MAX_SIZE, version); + req =3D v9fs_tversion(v9p, P9_MAX_SIZE, version, P9_NOTAG); v9fs_rversion(req, &server_len, &server_version); =20 g_assert_cmpmem(server_version, server_len, version, strlen(version)); @@ -410,7 +410,7 @@ static void fs_attach(QVirtIO9P *v9p) P9Req *req; =20 fs_version(v9p); - req =3D v9fs_tattach(v9p, 0, getuid()); + req =3D v9fs_tattach(v9p, 0, getuid(), 0); v9fs_rattach(req, NULL); } =20 @@ -430,7 +430,7 @@ static void fs_walk(QVirtIO9P *v9p) } =20 fs_attach(v9p); - req =3D v9fs_twalk(v9p, 0, 1, P9_MAXWELEM, wnames); + req =3D v9fs_twalk(v9p, 0, 1, P9_MAXWELEM, wnames, 0); v9fs_rwalk(req, &nwqid, &wqid); =20 g_assert_cmpint(nwqid, =3D=3D, P9_MAXWELEM); @@ -451,7 +451,7 @@ static void fs_walk_no_slash(QVirtIO9P *v9p) uint32_t err; =20 fs_attach(v9p); - req =3D v9fs_twalk(v9p, 0, 1, 1, wnames); + req =3D v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_rlerror(req, &err); =20 g_assert_cmpint(err, =3D=3D, ENOENT); @@ -466,10 +466,10 @@ static void fs_walk_dotdot(QVirtIO9P *v9p) P9Req *req; =20 fs_version(v9p); - req =3D v9fs_tattach(v9p, 0, getuid()); + req =3D v9fs_tattach(v9p, 0, getuid(), 0); v9fs_rattach(req, &root_qid); =20 - req =3D v9fs_twalk(v9p, 0, 1, 1, wnames); + req =3D v9fs_twalk(v9p, 0, 1, 1, wnames, 0); v9fs_rwalk(req, NULL, &wqid); /* We now we'll get one qid */ =20 g_assert_cmpmem(&root_qid, 13, wqid[0], 13); --=20 2.13.6