Skip to content

Commit 1c582c6

Browse files
t-8chmartinetd
authored andcommitted
9p/trans_fd: split into dedicated module
This allows these transports only to be used when needed. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Thomas Weißschuh <[email protected]> [Dominique: Kconfig NET_9P_FD: -depends VIRTIO, +default NET_9P] Signed-off-by: Dominique Martinet <[email protected]>
1 parent 90d6cf3 commit 1c582c6

File tree

5 files changed

+23
-7
lines changed

5 files changed

+23
-7
lines changed

include/net/9p/9p.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,4 @@ struct p9_fcall {
551551
int p9_errstr2errno(char *errstr, int len);
552552

553553
int p9_error_init(void);
554-
int p9_trans_fd_init(void);
555-
void p9_trans_fd_exit(void);
556554
#endif /* NET_9P_H */

net/9p/Kconfig

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ menuconfig NET_9P
1515

1616
if NET_9P
1717

18+
config NET_9P_FD
19+
default NET_9P
20+
tristate "9P FD Transport"
21+
help
22+
This builds support for transports over TCP, Unix sockets and
23+
filedescriptors.
24+
1825
config NET_9P_VIRTIO
1926
depends on VIRTIO
2027
tristate "9P Virtio Transport"

net/9p/Makefile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# SPDX-License-Identifier: GPL-2.0
22
obj-$(CONFIG_NET_9P) := 9pnet.o
3+
obj-$(CONFIG_NET_9P_FD) += 9pnet_fd.o
34
obj-$(CONFIG_NET_9P_XEN) += 9pnet_xen.o
45
obj-$(CONFIG_NET_9P_VIRTIO) += 9pnet_virtio.o
56
obj-$(CONFIG_NET_9P_RDMA) += 9pnet_rdma.o
@@ -9,9 +10,11 @@ obj-$(CONFIG_NET_9P_RDMA) += 9pnet_rdma.o
910
client.o \
1011
error.o \
1112
protocol.o \
12-
trans_fd.o \
1313
trans_common.o \
1414

15+
9pnet_fd-objs := \
16+
trans_fd.o \
17+
1518
9pnet_virtio-objs := \
1619
trans_virtio.o \
1720

net/9p/mod.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ static int __init init_p9(void)
177177

178178
p9_error_init();
179179
pr_info("Installing 9P2000 support\n");
180-
p9_trans_fd_init();
181180

182181
return ret;
183182
}
@@ -191,7 +190,6 @@ static void __exit exit_p9(void)
191190
{
192191
pr_info("Unloading 9P2000 support\n");
193192

194-
p9_trans_fd_exit();
195193
p9_client_exit();
196194
}
197195

net/9p/trans_fd.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,7 @@ static struct p9_trans_module p9_tcp_trans = {
10901090
.show_options = p9_fd_show_options,
10911091
.owner = THIS_MODULE,
10921092
};
1093+
MODULE_ALIAS_9P("tcp");
10931094

10941095
static struct p9_trans_module p9_unix_trans = {
10951096
.name = "unix",
@@ -1103,6 +1104,7 @@ static struct p9_trans_module p9_unix_trans = {
11031104
.show_options = p9_fd_show_options,
11041105
.owner = THIS_MODULE,
11051106
};
1107+
MODULE_ALIAS_9P("unix");
11061108

11071109
static struct p9_trans_module p9_fd_trans = {
11081110
.name = "fd",
@@ -1116,6 +1118,7 @@ static struct p9_trans_module p9_fd_trans = {
11161118
.show_options = p9_fd_show_options,
11171119
.owner = THIS_MODULE,
11181120
};
1121+
MODULE_ALIAS_9P("fd");
11191122

11201123
/**
11211124
* p9_poll_workfn - poll worker thread
@@ -1149,7 +1152,7 @@ static void p9_poll_workfn(struct work_struct *work)
11491152
p9_debug(P9_DEBUG_TRANS, "finish\n");
11501153
}
11511154

1152-
int p9_trans_fd_init(void)
1155+
static int __init p9_trans_fd_init(void)
11531156
{
11541157
v9fs_register_trans(&p9_tcp_trans);
11551158
v9fs_register_trans(&p9_unix_trans);
@@ -1158,10 +1161,17 @@ int p9_trans_fd_init(void)
11581161
return 0;
11591162
}
11601163

1161-
void p9_trans_fd_exit(void)
1164+
static void __exit p9_trans_fd_exit(void)
11621165
{
11631166
flush_work(&p9_poll_work);
11641167
v9fs_unregister_trans(&p9_tcp_trans);
11651168
v9fs_unregister_trans(&p9_unix_trans);
11661169
v9fs_unregister_trans(&p9_fd_trans);
11671170
}
1171+
1172+
module_init(p9_trans_fd_init);
1173+
module_exit(p9_trans_fd_exit);
1174+
1175+
MODULE_AUTHOR("Eric Van Hensbergen <[email protected]>");
1176+
MODULE_DESCRIPTION("Filedescriptor Transport for 9P");
1177+
MODULE_LICENSE("GPL");

0 commit comments

Comments
 (0)