diff options
author | Eric W. Biederman <ebiederm@xmission.com> | 2015-03-12 00:06:44 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2015-03-12 14:39:40 -0400 |
commit | 0c5c9fb55106333e773de8c9dd321fa8240caeb3 (patch) | |
tree | da550b771a52ba583eb97c1ad00fffbf3ae17f73 /net/9p | |
parent | efd7ef1c1929d7a0329d4349252863c04d6f1729 (diff) |
net: Introduce possible_net_t
Having to say
> #ifdef CONFIG_NET_NS
> struct net *net;
> #endif
in structures is a little bit wordy and a little bit error prone.
Instead it is possible to say:
> typedef struct {
> #ifdef CONFIG_NET_NS
> struct net *net;
> #endif
> } possible_net_t;
And then in a header say:
> possible_net_t net;
Which is cleaner and easier to use and easier to test, as the
possible_net_t is always there no matter what the compile options.
Further this allows read_pnet and write_pnet to be functions in all
cases which is better at catching typos.
This change adds possible_net_t, updates the definitions of read_pnet
and write_pnet, updates optional struct net * variables that
write_pnet uses on to have the type possible_net_t, and finally fixes
up the b0rked users of read_pnet and write_pnet.
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/9p')
-rw-r--r-- | net/9p/trans_fd.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/9p/trans_fd.c b/net/9p/trans_fd.c index 80d08f6664cb..3e3d82d8ff70 100644 --- a/net/9p/trans_fd.c +++ b/net/9p/trans_fd.c | |||
@@ -940,7 +940,7 @@ p9_fd_create_tcp(struct p9_client *client, const char *addr, char *args) | |||
940 | sin_server.sin_family = AF_INET; | 940 | sin_server.sin_family = AF_INET; |
941 | sin_server.sin_addr.s_addr = in_aton(addr); | 941 | sin_server.sin_addr.s_addr = in_aton(addr); |
942 | sin_server.sin_port = htons(opts.port); | 942 | sin_server.sin_port = htons(opts.port); |
943 | err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_INET, | 943 | err = __sock_create(current->nsproxy->net_ns, PF_INET, |
944 | SOCK_STREAM, IPPROTO_TCP, &csocket, 1); | 944 | SOCK_STREAM, IPPROTO_TCP, &csocket, 1); |
945 | if (err) { | 945 | if (err) { |
946 | pr_err("%s (%d): problem creating socket\n", | 946 | pr_err("%s (%d): problem creating socket\n", |
@@ -988,7 +988,7 @@ p9_fd_create_unix(struct p9_client *client, const char *addr, char *args) | |||
988 | 988 | ||
989 | sun_server.sun_family = PF_UNIX; | 989 | sun_server.sun_family = PF_UNIX; |
990 | strcpy(sun_server.sun_path, addr); | 990 | strcpy(sun_server.sun_path, addr); |
991 | err = __sock_create(read_pnet(¤t->nsproxy->net_ns), PF_UNIX, | 991 | err = __sock_create(current->nsproxy->net_ns, PF_UNIX, |
992 | SOCK_STREAM, 0, &csocket, 1); | 992 | SOCK_STREAM, 0, &csocket, 1); |
993 | if (err < 0) { | 993 | if (err < 0) { |
994 | pr_err("%s (%d): problem creating socket\n", | 994 | pr_err("%s (%d): problem creating socket\n", |