@@ -114,7 +114,7 @@ struct p9_client {
int wfd;
} fd;
struct {
- u16 port;
+ char *port;
bool privport;
} tcp;
@@ -31,7 +31,7 @@
#include <linux/syscalls.h> /* killme */
-#define P9_PORT 564
+#define P9_PORT "564"
#define MAX_SOCK_BUF (1024*1024)
#define MAXPOLLWADDR 2
@@ -49,7 +49,7 @@ static struct p9_trans_module p9_fd_trans;
struct p9_fd_opts {
int rfd;
int wfd;
- u16 port;
+ char *port;
bool privport;
};
@@ -746,8 +746,8 @@ static int p9_fd_cancelled(struct p9_client *client, struct p9_req_t *req)
static int p9_fd_show_options(struct seq_file *m, struct p9_client *clnt)
{
if (clnt->trans_mod == &p9_tcp_trans) {
- if (clnt->trans_opts.tcp.port != P9_PORT)
- seq_printf(m, ",port=%u", clnt->trans_opts.tcp.port);
+ if (!strcmp(clnt->trans_opts.tcp.port, P9_PORT))
+ seq_printf(m, ",port=%s", clnt->trans_opts.tcp.port);
} else if (clnt->trans_mod == &p9_fd_trans) {
if (clnt->trans_opts.fd.rfd != ~0)
seq_printf(m, ",rfd=%u", clnt->trans_opts.fd.rfd);
@@ -804,7 +804,7 @@ static int parse_opts(char *params, struct p9_fd_opts *opts)
}
switch (token) {
case Opt_port:
- opts->port = option;
+ opts->port = args[0].from;
break;
case Opt_rfdno:
opts->rfd = option;
@@ -981,7 +981,6 @@ static int
p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
{
int err;
- char port_str[6];
struct socket *csocket;
struct sockaddr_storage stor = { 0 };
struct p9_fd_opts opts;
@@ -993,9 +992,8 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args)
if (!addr)
return -EINVAL;
- sprintf(port_str, "%u", opts.port);
err = inet_pton_with_scope(current->nsproxy->net_ns, AF_UNSPEC, addr,
- port_str, &stor);
+ opts.port, &stor);
if (err < 0)
return err;
The port variable in the option structs is changed to char * to remove the conversions from u16 to char *. Signed-off-by: Joshua Murphy <joshuamurphy@posteo.net> --- include/net/9p/client.h | 2 +- net/9p/trans_fd.c | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-)