aboutsummaryrefslogtreecommitdiffstats
path: root/net/sunrpc/svc_xprt.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2010-01-26 14:04:04 -0500
committerJ. Bruce Fields <bfields@citi.umich.edu>2010-01-26 17:56:43 -0500
commitd6783b2b6c4050df0ba0a84c6842cf5bc2212ef9 (patch)
treed5c5d2ca1be2a53bb6e948da76c2ecd0f74ee27c /net/sunrpc/svc_xprt.c
parent205ba42308729f4f41f21d314a4435e7de5c9a2e (diff)
SUNRPC: Bury "#ifdef IPV6" in svc_create_xprt()
Clean up: Bruce observed we have more or less common logic in each of svc_create_xprt()'s callers: the check to create an IPv6 RPC listener socket only if CONFIG_IPV6 is set. I'm about to add another case that does just the same. If we move the ifdefs into __svc_xpo_create(), then svc_create_xprt() call sites can get rid of the "#ifdef" ugliness, and can use the same logic with or without IPv6 support available in the kernel. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'net/sunrpc/svc_xprt.c')
-rw-r--r--net/sunrpc/svc_xprt.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/net/sunrpc/svc_xprt.c b/net/sunrpc/svc_xprt.c
index 7d1f9e928f69..f886ff367c80 100644
--- a/net/sunrpc/svc_xprt.c
+++ b/net/sunrpc/svc_xprt.c
@@ -173,11 +173,13 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
173 .sin_addr.s_addr = htonl(INADDR_ANY), 173 .sin_addr.s_addr = htonl(INADDR_ANY),
174 .sin_port = htons(port), 174 .sin_port = htons(port),
175 }; 175 };
176#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
176 struct sockaddr_in6 sin6 = { 177 struct sockaddr_in6 sin6 = {
177 .sin6_family = AF_INET6, 178 .sin6_family = AF_INET6,
178 .sin6_addr = IN6ADDR_ANY_INIT, 179 .sin6_addr = IN6ADDR_ANY_INIT,
179 .sin6_port = htons(port), 180 .sin6_port = htons(port),
180 }; 181 };
182#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
181 struct sockaddr *sap; 183 struct sockaddr *sap;
182 size_t len; 184 size_t len;
183 185
@@ -186,10 +188,12 @@ static struct svc_xprt *__svc_xpo_create(struct svc_xprt_class *xcl,
186 sap = (struct sockaddr *)&sin; 188 sap = (struct sockaddr *)&sin;
187 len = sizeof(sin); 189 len = sizeof(sin);
188 break; 190 break;
191#if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
189 case PF_INET6: 192 case PF_INET6:
190 sap = (struct sockaddr *)&sin6; 193 sap = (struct sockaddr *)&sin6;
191 len = sizeof(sin6); 194 len = sizeof(sin6);
192 break; 195 break;
196#endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */
193 default: 197 default:
194 return ERR_PTR(-EAFNOSUPPORT); 198 return ERR_PTR(-EAFNOSUPPORT);
195 } 199 }