All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Thomas Weißschuh" <linux@weissschuh.net>
To: v9fs-developer@lists.sourceforge.net, netdev@vger.kernel.org
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Dominique Martinet" <asmadeus@codewreck.org>,
	"Eric Van Hensbergen" <ericvh@gmail.com>,
	"Latchesar Ionkov" <lucho@ionkov.net>,
	"David S. Miller" <davem@davemloft.net>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Stefano Stabellini" <stefano@aporeto.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH v2 4/4] net/p9: load default transports
Date: Wed,  3 Nov 2021 20:38:23 +0100	[thread overview]
Message-ID: <20211103193823.111007-5-linux@weissschuh.net> (raw)
In-Reply-To: <20211103193823.111007-1-linux@weissschuh.net>

Now that all transports are split into modules it may happen that no
transports are registered when v9fs_get_default_trans() is called.
When that is the case try to load more transports from modules.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 net/9p/mod.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/net/9p/mod.c b/net/9p/mod.c
index 8f1d067b272e..7bb875cd279f 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -128,6 +128,10 @@ struct p9_trans_module *v9fs_get_trans_by_name(const char *s)
 }
 EXPORT_SYMBOL(v9fs_get_trans_by_name);
 
+static const char * const v9fs_default_transports[] = {
+	"virtio", "tcp", "fd", "unix", "xen", "rdma",
+};
+
 /**
  * v9fs_get_default_trans - get the default transport
  *
@@ -136,6 +140,7 @@ EXPORT_SYMBOL(v9fs_get_trans_by_name);
 struct p9_trans_module *v9fs_get_default_trans(void)
 {
 	struct p9_trans_module *t, *found = NULL;
+	int i;
 
 	spin_lock(&v9fs_trans_lock);
 
@@ -153,6 +158,10 @@ struct p9_trans_module *v9fs_get_default_trans(void)
 			}
 
 	spin_unlock(&v9fs_trans_lock);
+
+	for (i = 0; !found && i < ARRAY_SIZE(v9fs_default_transports); i++)
+		found = v9fs_get_trans_by_name(v9fs_default_transports[i]);
+
 	return found;
 }
 EXPORT_SYMBOL(v9fs_get_default_trans);
-- 
2.33.1


  parent reply	other threads:[~2021-11-03 19:38 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-03 19:38 [PATCH v2 0/4] net/9p: optimize transport module loading Thomas Weißschuh
2021-11-03 19:38 ` [PATCH v2 1/4] net/9p: autoload transport modules Thomas Weißschuh
2021-11-03 19:38 ` [PATCH v2 2/4] 9p/trans_fd: split into dedicated module Thomas Weißschuh
2022-01-10  0:57   ` Dominique Martinet
2022-01-10  6:42     ` Thomas Weißschuh
2021-11-03 19:38 ` [PATCH v2 3/4] 9p/xen: autoload when xenbus service is available Thomas Weißschuh
2021-11-03 19:38 ` Thomas Weißschuh [this message]
2021-11-08 18:50   ` [PATCH v2 4/4] net/p9: load default transports Thomas Weißschuh
2021-11-08 22:31     ` Dominique Martinet

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=20211103193823.111007-5-linux@weissschuh.net \
    --to=linux@weissschuh.net \
    --cc=asmadeus@codewreck.org \
    --cc=davem@davemloft.net \
    --cc=ericvh@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=netdev@vger.kernel.org \
    --cc=stefano@aporeto.com \
    --cc=v9fs-developer@lists.sourceforge.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.