From nobody Sun May 5 08:52:43 2024 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) 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=temperror (zoho.com: Error in retrieving data from DNS) 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 1513799060444628.1255872056988; Wed, 20 Dec 2017 11:44:20 -0800 (PST) Received: from localhost ([::1]:38223 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRkHW-0000ol-6i for importer@patchew.org; Wed, 20 Dec 2017 14:43:58 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:52473) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eRkGc-0000TQ-VU for qemu-devel@nongnu.org; Wed, 20 Dec 2017 14:43:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eRkGY-00077h-WD for qemu-devel@nongnu.org; Wed, 20 Dec 2017 14:43:03 -0500 Received: from 5.mo1.mail-out.ovh.net ([178.33.45.107]:43748) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1eRkGY-00076s-Pq for qemu-devel@nongnu.org; Wed, 20 Dec 2017 14:42:58 -0500 Received: from player795.ha.ovh.net (gw6.ovh.net [213.251.189.206]) by mo1.mail-out.ovh.net (Postfix) with ESMTP id A893FB595B for ; Wed, 20 Dec 2017 20:42:56 +0100 (CET) Received: from [192.168.0.243] (lns-bzn-46-82-253-208-248.adsl.proxad.net [82.253.208.248]) (Authenticated sender: groug@kaod.org) by player795.ha.ovh.net (Postfix) with ESMTPA id 39B82120092; Wed, 20 Dec 2017 20:42:54 +0100 (CET) From: Greg Kurz To: qemu-devel@nongnu.org Date: Wed, 20 Dec 2017 20:42:54 +0100 Message-ID: <151379897394.31252.4783267371691256574.stgit@bahia> User-Agent: StGit/0.17.1-46-g6855-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Ovh-Tracer-Id: 13636899672687417777 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtuddrgeeggddufeduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuqfggjfdpvefjgfevmfevgfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddm X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 178.33.45.107 Subject: [Qemu-devel] [PATCH] 9pfs: drop v9fs_register_transport() 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: Stefano Stabellini , Greg Kurz Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RSF_6 Z_629925259 SPT_0 No good reasons to do this outside of v9fs_device_realize_common(). Signed-off-by: Greg Kurz Reviewed-by: Stefano Stabellini --- hw/9pfs/9p.c | 6 +++++- hw/9pfs/9p.h | 10 ++-------- hw/9pfs/virtio-9p-device.c | 8 ++------ hw/9pfs/xen-9p-backend.c | 3 +-- 4 files changed, 10 insertions(+), 17 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index ccbc75265a52..2f836a59deac 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -3502,7 +3502,8 @@ void pdu_submit(V9fsPDU *pdu, P9MsgHeader *hdr) } =20 /* Returns 0 on success, 1 on failure. */ -int v9fs_device_realize_common(V9fsState *s, Error **errp) +int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t, + Error **errp) { int i, len; struct stat stat; @@ -3510,6 +3511,9 @@ int v9fs_device_realize_common(V9fsState *s, Error **= errp) V9fsPath path; int rc =3D 1; =20 + assert(!s->transport); + s->transport =3D t; + /* initialize pdu allocator */ QLIST_INIT(&s->free_list); QLIST_INIT(&s->active_list); diff --git a/hw/9pfs/9p.h b/hw/9pfs/9p.h index ea7657837784..e2aa64577fe1 100644 --- a/hw/9pfs/9p.h +++ b/hw/9pfs/9p.h @@ -346,7 +346,8 @@ void v9fs_path_sprintf(V9fsPath *path, const char *fmt,= ...); void v9fs_path_copy(V9fsPath *lhs, V9fsPath *rhs); int v9fs_name_to_path(V9fsState *s, V9fsPath *dirpath, const char *name, V9fsPath *path); -int v9fs_device_realize_common(V9fsState *s, Error **errp); +int v9fs_device_realize_common(V9fsState *s, const V9fsTransport *t, + Error **errp); void v9fs_device_unrealize_common(V9fsState *s, Error **errp); =20 V9fsPDU *pdu_alloc(V9fsState *s); @@ -366,11 +367,4 @@ struct V9fsTransport { void (*pdu_complete)(V9fsPDU *pdu, bool discard); }; =20 -static inline int v9fs_register_transport(V9fsState *s, const V9fsTranspor= t *t) -{ - assert(!s->transport); - s->transport =3D t; - return 0; -} - #endif diff --git a/hw/9pfs/virtio-9p-device.c b/hw/9pfs/virtio-9p-device.c index d874f48467ba..806e7573276c 100644 --- a/hw/9pfs/virtio-9p-device.c +++ b/hw/9pfs/virtio-9p-device.c @@ -201,17 +201,13 @@ static void virtio_9p_device_realize(DeviceState *dev= , Error **errp) V9fsVirtioState *v =3D VIRTIO_9P(dev); V9fsState *s =3D &v->state; =20 - if (v9fs_device_realize_common(s, errp)) { - goto out; + if (v9fs_device_realize_common(s, &virtio_9p_transport, errp)) { + return; } =20 v->config_size =3D sizeof(struct virtio_9p_config) + strlen(s->fsconf.= tag); virtio_init(vdev, "virtio-9p", VIRTIO_ID_9P, v->config_size); v->vq =3D virtio_add_queue(vdev, MAX_REQ, handle_9p_output); - v9fs_register_transport(s, &virtio_9p_transport); - -out: - return; } =20 static void virtio_9p_device_unrealize(DeviceState *dev, Error **errp) diff --git a/hw/9pfs/xen-9p-backend.c b/hw/9pfs/xen-9p-backend.c index dc1e6c88885d..e2ae1ac148eb 100644 --- a/hw/9pfs/xen-9p-backend.c +++ b/hw/9pfs/xen-9p-backend.c @@ -448,7 +448,6 @@ static int xen_9pfs_connect(struct XenDevice *xendev) xen_9pdev->id =3D s->fsconf.fsdev_id =3D g_strdup_printf("xen9p%d", xendev->dev); xen_9pdev->tag =3D s->fsconf.tag =3D xenstore_read_fe_str(xendev, "tag= "); - v9fs_register_transport(s, &xen_9p_transport); fsdev =3D qemu_opts_create(qemu_find_opts("fsdev"), s->fsconf.tag, 1, NULL); @@ -457,7 +456,7 @@ static int xen_9pfs_connect(struct XenDevice *xendev) qemu_opt_set(fsdev, "security_model", xen_9pdev->security_model, NULL); qemu_opts_set_id(fsdev, s->fsconf.fsdev_id); qemu_fsdev_add(fsdev); - v9fs_device_realize_common(s, NULL); + v9fs_device_realize_common(s, &xen_9p_transport, NULL); =20 return 0; =20