aboutsummaryrefslogtreecommitdiffstats
path: root/net/9p
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-07-15 15:00:42 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-07-15 15:00:42 -0400
commit78dcf73421a879d22319d3889119945b85954a68 (patch)
tree26e76f3e9fdc6b40133f2158de23cfe74af9feac /net/9p
parent93ff81859733d9697a5a0cc4707e52fb17056abb (diff)
parentfdb254db21bb4aed44a0bc7fe993e58d3848c926 (diff)
Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull ->s_options removal from Al Viro: "Preparations for fsmount/fsopen stuff (coming next cycle). Everything gets moved to explicit ->show_options(), killing ->s_options off + some cosmetic bits around fs/namespace.c and friends. Basically, the stuff needed to work with fsmount series with minimum of conflicts with other work. It's not strictly required for this merge window, but it would reduce the PITA during the coming cycle, so it would be nice to have those bits and pieces out of the way" * 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: isofs: Fix isofs_show_options() VFS: Kill off s_options and helpers orangefs: Implement show_options 9p: Implement show_options isofs: Implement show_options afs: Implement show_options affs: Implement show_options befs: Implement show_options spufs: Implement show_options bpf: Implement show_options ramfs: Implement show_options pstore: Implement show_options omfs: Implement show_options hugetlbfs: Implement show_options VFS: Don't use save/replace_mount_options if not using generic_show_options VFS: Provide empty name qstr VFS: Make get_filesystem() return the affected filesystem VFS: Clean up whitespace in fs/namespace.c and fs/super.c Provide a function to create a NUL-terminated string from unterminated data
Diffstat (limited to 'net/9p')
-rw-r--r--net/9p/client.c25
-rw-r--r--net/9p/trans_fd.c31
-rw-r--r--net/9p/trans_rdma.c31
3 files changed, 81 insertions, 6 deletions
diff --git a/net/9p/client.c b/net/9p/client.c
index 1218fb3b52da..4674235b0d9b 100644
--- a/net/9p/client.c
+++ b/net/9p/client.c
@@ -37,6 +37,7 @@
37#include <linux/uio.h> 37#include <linux/uio.h>
38#include <net/9p/9p.h> 38#include <net/9p/9p.h>
39#include <linux/parser.h> 39#include <linux/parser.h>
40#include <linux/seq_file.h>
40#include <net/9p/client.h> 41#include <net/9p/client.h>
41#include <net/9p/transport.h> 42#include <net/9p/transport.h>
42#include "protocol.h" 43#include "protocol.h"
@@ -77,6 +78,30 @@ inline int p9_is_proto_dotu(struct p9_client *clnt)
77} 78}
78EXPORT_SYMBOL(p9_is_proto_dotu); 79EXPORT_SYMBOL(p9_is_proto_dotu);
79 80
81int p9_show_client_options(struct seq_file *m, struct p9_client *clnt)
82{
83 if (clnt->msize != 8192)
84 seq_printf(m, ",msize=%u", clnt->msize);
85 seq_printf(m, "trans=%s", clnt->trans_mod->name);
86
87 switch (clnt->proto_version) {
88 case p9_proto_legacy:
89 seq_puts(m, ",noextend");
90 break;
91 case p9_proto_2000u:
92 seq_puts(m, ",version=9p2000.u");
93 break;
94 case p9_proto_2000L:
95 /* Default */
96 break;
97 }
98
99 if (clnt->trans_mod->show_options)
100 return clnt->trans_mod->show_options(m, clnt);
101 return 0;
102}
103EXPORT_SYMBOL(p9_show_client_options);
104
80/* 105/*
81 * Some error codes are taken directly from the server replies, 106 * Some error codes are taken directly from the server replies,
82 * make sure they are valid. 107 * make sure they are valid.
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c
index dca3cdd1a014..ddfa86648f95 100644
--- a/net/9p/trans_fd.c
+++ b/net/9p/trans_fd.c
@@ -41,6 +41,7 @@
41#include <linux/file.h> 41#include <linux/file.h>
42#include <linux/parser.h> 42#include <linux/parser.h>
43#include <linux/slab.h> 43#include <linux/slab.h>
44#include <linux/seq_file.h>
44#include <net/9p/9p.h> 45#include <net/9p/9p.h>
45#include <net/9p/client.h> 46#include <net/9p/client.h>
46#include <net/9p/transport.h> 47#include <net/9p/transport.h>
@@ -51,6 +52,9 @@
51#define MAX_SOCK_BUF (64*1024) 52#define MAX_SOCK_BUF (64*1024)
52#define MAXPOLLWADDR 2 53#define MAXPOLLWADDR 2
53 54
55static struct p9_trans_module p9_tcp_trans;
56static struct p9_trans_module p9_fd_trans;
57
54/** 58/**
55 * struct p9_fd_opts - per-transport options 59 * struct p9_fd_opts - per-transport options
56 * @rfd: file descriptor for reading (trans=fd) 60 * @rfd: file descriptor for reading (trans=fd)
@@ -63,7 +67,7 @@ struct p9_fd_opts {
63 int rfd; 67 int rfd;
64 int wfd; 68 int wfd;
65 u16 port; 69 u16 port;
66 int privport; 70 bool privport;
67}; 71};
68 72
69/* 73/*
@@ -720,6 +724,20 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
720 return 0; 724 return 0;
721} 725}
722 726
727static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt)
728{
729 if (clnt->trans_mod == &p9_tcp_trans) {
730 if (clnt->trans_opts.tcp.port != P9_PORT)
731 seq_printf(m, "port=%u", clnt->trans_opts.tcp.port);
732 } else if (clnt->trans_mod == &p9_fd_trans) {
733 if (clnt->trans_opts.fd.rfd != ~0)
734 seq_printf(m, "rfd=%u", clnt->trans_opts.fd.rfd);
735 if (clnt->trans_opts.fd.wfd != ~0)
736 seq_printf(m, "wfd=%u", clnt->trans_opts.fd.wfd);
737 }
738 return 0;
739}
740
723/** 741/**
724 * parse_opts - parse mount options into p9_fd_opts structure 742 * parse_opts - parse mount options into p9_fd_opts structure
725 * @params: options string passed from mount 743 * @params: options string passed from mount
@@ -738,7 +756,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
738 opts->port = P9_PORT; 756 opts->port = P9_PORT;
739 opts->rfd = ~0; 757 opts->rfd = ~0;
740 opts->wfd = ~0; 758 opts->wfd = ~0;
741 opts->privport = 0; 759 opts->privport = false;
742 760
743 if (!params) 761 if (!params)
744 return 0; 762 return 0;
@@ -776,7 +794,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
776 opts->wfd = option; 794 opts->wfd = option;
777 break; 795 break;
778 case Opt_privport: 796 case Opt_privport:
779 opts->privport = 1; 797 opts->privport = true;
780 break; 798 break;
781 default: 799 default:
782 continue; 800 continue;
@@ -942,6 +960,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
942 960
943 csocket = NULL; 961 csocket = NULL;
944 962
963 client->trans_opts.tcp.port = opts.port;
964 client->trans_opts.tcp.privport = opts.privport;
945 sin_server.sin_family = AF_INET; 965 sin_server.sin_family = AF_INET;
946 sin_server.sin_addr.s_addr = in_aton(addr); 966 sin_server.sin_addr.s_addr = in_aton(addr);
947 sin_server.sin_port = htons(opts.port); 967 sin_server.sin_port = htons(opts.port);
@@ -1020,6 +1040,8 @@ p9_fd_create(struct p9_client *client, const char *addr, char *args)
1020 struct p9_fd_opts opts; 1040 struct p9_fd_opts opts;
1021 1041
1022 parse_opts(args, &opts); 1042 parse_opts(args, &opts);
1043 client->trans_opts.fd.rfd = opts.rfd;
1044 client->trans_opts.fd.wfd = opts.wfd;
1023 1045
1024 if (opts.rfd == ~0 || opts.wfd == ~0) { 1046 if (opts.rfd == ~0 || opts.wfd == ~0) {
1025 pr_err("Insufficient options for proto=fd\n"); 1047 pr_err("Insufficient options for proto=fd\n");
@@ -1044,6 +1066,7 @@ static struct p9_trans_module p9_tcp_trans = {
1044 .request = p9_fd_request, 1066 .request = p9_fd_request,
1045 .cancel = p9_fd_cancel, 1067 .cancel = p9_fd_cancel,
1046 .cancelled = p9_fd_cancelled, 1068 .cancelled = p9_fd_cancelled,
1069 .show_options = p9_fd_show_options,
1047 .owner = THIS_MODULE, 1070 .owner = THIS_MODULE,
1048}; 1071};
1049 1072
@@ -1056,6 +1079,7 @@ static struct p9_trans_module p9_unix_trans = {
1056 .request = p9_fd_request, 1079 .request = p9_fd_request,
1057 .cancel = p9_fd_cancel, 1080 .cancel = p9_fd_cancel,
1058 .cancelled = p9_fd_cancelled, 1081 .cancelled = p9_fd_cancelled,
1082 .show_options = p9_fd_show_options,
1059 .owner = THIS_MODULE, 1083 .owner = THIS_MODULE,
1060}; 1084};
1061 1085
@@ -1068,6 +1092,7 @@ static struct p9_trans_module p9_fd_trans = {
1068 .request = p9_fd_request, 1092 .request = p9_fd_request,
1069 .cancel = p9_fd_cancel, 1093 .cancel = p9_fd_cancel,
1070 .cancelled = p9_fd_cancelled, 1094 .cancelled = p9_fd_cancelled,
1095 .show_options = p9_fd_show_options,
1071 .owner = THIS_MODULE, 1096 .owner = THIS_MODULE,
1072}; 1097};
1073 1098
diff --git a/net/9p/trans_rdma.c b/net/9p/trans_rdma.c
index 553ed4ecb6a0..6d8e3031978f 100644
--- a/net/9p/trans_rdma.c
+++ b/net/9p/trans_rdma.c
@@ -43,6 +43,7 @@
43#include <linux/parser.h> 43#include <linux/parser.h>
44#include <linux/semaphore.h> 44#include <linux/semaphore.h>
45#include <linux/slab.h> 45#include <linux/slab.h>
46#include <linux/seq_file.h>
46#include <net/9p/9p.h> 47#include <net/9p/9p.h>
47#include <net/9p/client.h> 48#include <net/9p/client.h>
48#include <net/9p/transport.h> 49#include <net/9p/transport.h>
@@ -70,6 +71,8 @@
70 * @dm_mr: DMA Memory Region pointer 71 * @dm_mr: DMA Memory Region pointer
71 * @lkey: The local access only memory region key 72 * @lkey: The local access only memory region key
72 * @timeout: Number of uSecs to wait for connection management events 73 * @timeout: Number of uSecs to wait for connection management events
74 * @privport: Whether a privileged port may be used
75 * @port: The port to use
73 * @sq_depth: The depth of the Send Queue 76 * @sq_depth: The depth of the Send Queue
74 * @sq_sem: Semaphore for the SQ 77 * @sq_sem: Semaphore for the SQ
75 * @rq_depth: The depth of the Receive Queue. 78 * @rq_depth: The depth of the Receive Queue.
@@ -95,6 +98,8 @@ struct p9_trans_rdma {
95 struct ib_qp *qp; 98 struct ib_qp *qp;
96 struct ib_cq *cq; 99 struct ib_cq *cq;
97 long timeout; 100 long timeout;
101 bool privport;
102 u16 port;
98 int sq_depth; 103 int sq_depth;
99 struct semaphore sq_sem; 104 struct semaphore sq_sem;
100 int rq_depth; 105 int rq_depth;
@@ -133,10 +138,10 @@ struct p9_rdma_context {
133 */ 138 */
134struct p9_rdma_opts { 139struct p9_rdma_opts {
135 short port; 140 short port;
141 bool privport;
136 int sq_depth; 142 int sq_depth;
137 int rq_depth; 143 int rq_depth;
138 long timeout; 144 long timeout;
139 int privport;
140}; 145};
141 146
142/* 147/*
@@ -159,6 +164,23 @@ static match_table_t tokens = {
159 {Opt_err, NULL}, 164 {Opt_err, NULL},
160}; 165};
161 166
167static int p9_rdma_show_options(struct seq_file *m, struct p9_client *clnt)
168{
169 struct p9_trans_rdma *rdma = clnt->trans;
170
171 if (rdma->port != P9_PORT)
172 seq_printf(m, ",port=%u", rdma->port);
173 if (rdma->sq_depth != P9_RDMA_SQ_DEPTH)
174 seq_printf(m, ",sq=%u", rdma->sq_depth);
175 if (rdma->rq_depth != P9_RDMA_RQ_DEPTH)
176 seq_printf(m, ",rq=%u", rdma->rq_depth);
177 if (rdma->timeout != P9_RDMA_TIMEOUT)
178 seq_printf(m, ",timeout=%lu", rdma->timeout);
179 if (rdma->privport)
180 seq_puts(m, ",privport");
181 return 0;
182}
183
162/** 184/**
163 * parse_opts - parse mount options into rdma options structure 185 * parse_opts - parse mount options into rdma options structure
164 * @params: options string passed from mount 186 * @params: options string passed from mount
@@ -177,7 +199,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
177 opts->sq_depth = P9_RDMA_SQ_DEPTH; 199 opts->sq_depth = P9_RDMA_SQ_DEPTH;
178 opts->rq_depth = P9_RDMA_RQ_DEPTH; 200 opts->rq_depth = P9_RDMA_RQ_DEPTH;
179 opts->timeout = P9_RDMA_TIMEOUT; 201 opts->timeout = P9_RDMA_TIMEOUT;
180 opts->privport = 0; 202 opts->privport = false;
181 203
182 if (!params) 204 if (!params)
183 return 0; 205 return 0;
@@ -218,7 +240,7 @@ static int parse_opts(char *params, struct p9_rdma_opts *opts)
218 opts->timeout = option; 240 opts->timeout = option;
219 break; 241 break;
220 case Opt_privport: 242 case Opt_privport:
221 opts->privport = 1; 243 opts->privport = true;
222 break; 244 break;
223 default: 245 default:
224 continue; 246 continue;
@@ -560,6 +582,8 @@ static struct p9_trans_rdma *alloc_rdma(struct p9_rdma_opts *opts)
560 if (!rdma) 582 if (!rdma)
561 return NULL; 583 return NULL;
562 584
585 rdma->port = opts->port;
586 rdma->privport = opts->privport;
563 rdma->sq_depth = opts->sq_depth; 587 rdma->sq_depth = opts->sq_depth;
564 rdma->rq_depth = opts->rq_depth; 588 rdma->rq_depth = opts->rq_depth;
565 rdma->timeout = opts->timeout; 589 rdma->timeout = opts->timeout;
@@ -733,6 +757,7 @@ static struct p9_trans_module p9_rdma_trans = {
733 .request = rdma_request, 757 .request = rdma_request,
734 .cancel = rdma_cancel, 758 .cancel = rdma_cancel,
735 .cancelled = rdma_cancelled, 759 .cancelled = rdma_cancelled,
760 .show_options = p9_rdma_show_options,
736}; 761};
737 762
738/** 763/**