diff mbox series

[v2,2/4] 9p/trans_fd: split into dedicated module

Message ID 20211103193823.111007-3-linux@weissschuh.net (mailing list archive)
State Not Applicable
Delegated to: Netdev Maintainers
Headers show
Series net/9p: optimize transport module loading | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Series has a cover letter
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 4 this patch: 4
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 4 this patch: 4
netdev/checkpatch warning WARNING: please write a paragraph that describes the config symbol fully
netdev/kdoc success Errors and warnings before: 27 this patch: 27
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Thomas Weißschuh Nov. 3, 2021, 7:38 p.m. UTC
This allows these transports only to be used when needed.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
---
 include/net/9p/9p.h |  2 --
 net/9p/Kconfig      |  7 +++++++
 net/9p/Makefile     |  5 ++++-
 net/9p/mod.c        |  2 --
 net/9p/trans_fd.c   | 14 ++++++++++++--
 5 files changed, 23 insertions(+), 7 deletions(-)

Comments

Dominique Martinet Jan. 10, 2022, 12:57 a.m. UTC | #1
Hi Thomas,

it's been a while but I had a second look as I intend on submitting this
next week, just a small fixup on the Kconfig entry

Thomas Weißschuh wrote on Wed, Nov 03, 2021 at 08:38:21PM +0100:
> diff --git a/net/9p/Kconfig b/net/9p/Kconfig
> index 64468c49791f..af601129f1bb 100644
> --- a/net/9p/Kconfig
> +++ b/net/9p/Kconfig
> @@ -15,6 +15,13 @@ menuconfig NET_9P
>  
>  if NET_9P
>  
> +config NET_9P_FD
> +	depends on VIRTIO

I think that's just a copypaste leftover from NET_9P_VIRTIO ?
Since it used to be code within NET_9P and it's within a if NET_9P it
shouldn't depend on anything.

Also for compatibility I'd suggest we keep it on by default at this
point, e.g. add 'default NET_9P' to this block:


diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index af601129f1bb..deabbd376cb1 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -16,7 +16,7 @@ menuconfig NET_9P
 if NET_9P
 
 config NET_9P_FD
-       depends on VIRTIO
+       default NET_9P
        tristate "9P FD Transport"
        help
          This builds support for transports over TCP, Unix sockets and


I'll just fixup the commit with a word in the message unless you have a
problem with it, please let me know! :)
Thomas Weißschuh Jan. 10, 2022, 6:42 a.m. UTC | #2
Hi Dominique,

On 2022-01-10 09:57+0900, Dominique Martinet wrote:
> Hi Thomas,
> 
> it's been a while but I had a second look as I intend on submitting this
> next week, just a small fixup on the Kconfig entry
> 
> Thomas Weißschuh wrote on Wed, Nov 03, 2021 at 08:38:21PM +0100:
> > diff --git a/net/9p/Kconfig b/net/9p/Kconfig
> > index 64468c49791f..af601129f1bb 100644
> > --- a/net/9p/Kconfig
> > +++ b/net/9p/Kconfig
> > @@ -15,6 +15,13 @@ menuconfig NET_9P
> >  
> >  if NET_9P
> >  
> > +config NET_9P_FD
> > +	depends on VIRTIO
> 
> I think that's just a copypaste leftover from NET_9P_VIRTIO ?
> Since it used to be code within NET_9P and it's within a if NET_9P it
> shouldn't depend on anything.
> 
> Also for compatibility I'd suggest we keep it on by default at this
> point, e.g. add 'default NET_9P' to this block:

Yes, you are correct on both points.

> diff --git a/net/9p/Kconfig b/net/9p/Kconfig
> index af601129f1bb..deabbd376cb1 100644
> --- a/net/9p/Kconfig
> +++ b/net/9p/Kconfig
> @@ -16,7 +16,7 @@ menuconfig NET_9P
>  if NET_9P
>  
>  config NET_9P_FD
> -       depends on VIRTIO
> +       default NET_9P
>         tristate "9P FD Transport"
>         help
>           This builds support for transports over TCP, Unix sockets and
> 
> 
> I'll just fixup the commit with a word in the message unless you have a
> problem with it, please let me know! :)

Looks good, thanks!

Thomas
diff mbox series

Patch

diff --git a/include/net/9p/9p.h b/include/net/9p/9p.h
index 03614de86942..f420f8cb378d 100644
--- a/include/net/9p/9p.h
+++ b/include/net/9p/9p.h
@@ -553,6 +553,4 @@  struct p9_fcall {
 int p9_errstr2errno(char *errstr, int len);
 
 int p9_error_init(void);
-int p9_trans_fd_init(void);
-void p9_trans_fd_exit(void);
 #endif /* NET_9P_H */
diff --git a/net/9p/Kconfig b/net/9p/Kconfig
index 64468c49791f..af601129f1bb 100644
--- a/net/9p/Kconfig
+++ b/net/9p/Kconfig
@@ -15,6 +15,13 @@  menuconfig NET_9P
 
 if NET_9P
 
+config NET_9P_FD
+	depends on VIRTIO
+	tristate "9P FD Transport"
+	help
+	  This builds support for transports over TCP, Unix sockets and
+	  filedescriptors.
+
 config NET_9P_VIRTIO
 	depends on VIRTIO
 	tristate "9P Virtio Transport"
diff --git a/net/9p/Makefile b/net/9p/Makefile
index aa0a5641e5d0..1df9b344c30b 100644
--- a/net/9p/Makefile
+++ b/net/9p/Makefile
@@ -1,5 +1,6 @@ 
 # SPDX-License-Identifier: GPL-2.0
 obj-$(CONFIG_NET_9P) := 9pnet.o
+obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
 obj-$(CONFIG_NET_9P_XEN) += 9pnet_xen.o
 obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
 obj-$(CONFIG_NET_9P_RDMA) += 9pnet_rdma.o
@@ -9,9 +10,11 @@  obj-$(CONFIG_NET_9P_RDMA) += 9pnet_rdma.o
 	client.o \
 	error.o \
 	protocol.o \
-	trans_fd.o \
 	trans_common.o \
 
+9pnet_fd-objs := \
+	trans_fd.o \
+
 9pnet_virtio-objs := \
 	trans_virtio.o \
 
diff --git a/net/9p/mod.c b/net/9p/mod.c
index c95416c1d1a2..8f1d067b272e 100644
--- a/net/9p/mod.c
+++ b/net/9p/mod.c
@@ -182,7 +182,6 @@  static int __init init_p9(void)
 
 	p9_error_init();
 	pr_info("Installing 9P2000 support\n");
-	p9_trans_fd_init();
 
 	return ret;
 }
@@ -196,7 +195,6 @@  static void __exit exit_p9(void)
 {
 	pr_info("Unloading 9P2000 support\n");
 
-	p9_trans_fd_exit();
 	p9_client_exit();
 }
 
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index 007bbcc68010..e3f4a7a5c845 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -1092,6 +1092,7 @@  static struct p9_trans_module p9_tcp_trans = {
 	.show_options = p9_fd_show_options,
 	.owner = THIS_MODULE,
 };
+MODULE_ALIAS_9P("tcp");
 
 static struct p9_trans_module p9_unix_trans = {
 	.name = "unix",
@@ -1105,6 +1106,7 @@  static struct p9_trans_module p9_unix_trans = {
 	.show_options = p9_fd_show_options,
 	.owner = THIS_MODULE,
 };
+MODULE_ALIAS_9P("unix");
 
 static struct p9_trans_module p9_fd_trans = {
 	.name = "fd",
@@ -1118,6 +1120,7 @@  static struct p9_trans_module p9_fd_trans = {
 	.show_options = p9_fd_show_options,
 	.owner = THIS_MODULE,
 };
+MODULE_ALIAS_9P("fd");
 
 /**
  * p9_poll_workfn - poll worker thread
@@ -1151,7 +1154,7 @@  static void p9_poll_workfn(struct work_struct *work)
 	p9_debug(P9_DEBUG_TRANS, "finish\n");
 }
 
-int p9_trans_fd_init(void)
+static int __init p9_trans_fd_init(void)
 {
 	v9fs_register_trans(&p9_tcp_trans);
 	v9fs_register_trans(&p9_unix_trans);
@@ -1160,10 +1163,17 @@  int p9_trans_fd_init(void)
 	return 0;
 }
 
-void p9_trans_fd_exit(void)
+static void __exit p9_trans_fd_exit(void)
 {
 	flush_work(&p9_poll_work);
 	v9fs_unregister_trans(&p9_tcp_trans);
 	v9fs_unregister_trans(&p9_unix_trans);
 	v9fs_unregister_trans(&p9_fd_trans);
 }
+
+module_init(p9_trans_fd_init);
+module_exit(p9_trans_fd_exit);
+
+MODULE_AUTHOR("Eric Van Hensbergen <ericvh@gmail.com>");
+MODULE_DESCRIPTION("Filedescriptor Transport for 9P");
+MODULE_LICENSE("GPL");